Browse Source

故障工单统计

seimin 1 month ago
parent
commit
4e9f34bb00

+ 3 - 1
src/app/views/new-statistics/components/custom-tabs/custom-tabs.component.ts

@@ -31,7 +31,9 @@ export class CustomTabsComponent implements OnInit {
31
     // console.log('params:', params)
31
     // console.log('params:', params)
32
     // console.log('routePath:', routePath)
32
     // console.log('routePath:', routePath)
33
     this.selectTabEmit.emit(routePath.split('/').reverse()[0])
33
     this.selectTabEmit.emit(routePath.split('/').reverse()[0])
34
-    this.router.navigate([routePath], params).catch(err => {
34
+    this.router.navigate([routePath], {
35
+      replaceUrl: true
36
+    }).catch(err => {
35
       console.error('导航失败:', err);
37
       console.error('导航失败:', err);
36
       // 处理无效页签
38
       // 处理无效页签
37
       this.tabService.closeTab(path);
39
       this.tabService.closeTab(path);

+ 36 - 8
src/app/views/new-statistics/components/query-range/query-range.component.html

@@ -1,15 +1,43 @@
1
-<div class="save add display_flex align-items_center justify-content_flex-center" *ngIf="queryRangeFlag">
1
+<div class="save add display_flex align-items_center justify-content_flex-center">
2
   <div class="modalBody">
2
   <div class="modalBody">
3
     <div class="title">查询范围<i class="icon_transport transport-guanbi" (click)="hideModal()"></i>
3
     <div class="title">查询范围<i class="icon_transport transport-guanbi" (click)="hideModal()"></i>
4
     </div>
4
     </div>
5
     <div class="content">
5
     <div class="content">
6
       <form nz-form [formGroup]="validateForm" class="addForm">
6
       <form nz-form [formGroup]="validateForm" class="addForm">
7
-        <nz-form-item>
8
-          <nz-form-label [nzSm]="6" [nzXs]="24" nzRequired nzFor="affiliatedHospital">所属院区</nz-form-label>
9
-          <nz-form-control nzErrorTip="请选择所属院区!">
10
-            <nz-select [nzDropdownMatchSelectWidth]="false" type="affiliatedHospital" nzShowSearch
11
-              formControlName="affiliatedHospital" nzPlaceHolder="请选择所属院区">
12
-              <nz-option nzLabel="{{data['hosName']}}" nzValue="{{data['id']}}" *ngFor="let data of allHospital">
7
+        <nz-form-item class="mb0">
8
+          <nz-form-label [nzSpan]="4" nzRequired nzFor="queryType">查询范围</nz-form-label>
9
+          <nz-form-control [nzSpan]="20" nzErrorTip="请选择查询范围!">
10
+            <nz-radio-group formControlName="queryType" (ngModelChange)="changeQueryType($event)">
11
+              <label nz-radio [nzValue]="1">全院查询</label>
12
+              <label nz-radio [nzValue]="2">院区查询</label>
13
+              <label nz-radio [nzValue]="3">部门查询</label>
14
+              <label nz-radio [nzValue]="4">垂直部门查询</label>
15
+            </nz-radio-group>
16
+          </nz-form-control>
17
+        </nz-form-item>
18
+        <nz-form-item [hidden]="!(validateForm.value.queryType == 2 || validateForm.value.queryType == 3)">
19
+          <nz-form-label [nzSpan]="4" nzRequired nzFor="hospital">院<span style="visibility: hidden;">囧囧</span>区</nz-form-label>
20
+          <nz-form-control [nzSpan]="20" nzErrorTip="请选择院区!">
21
+            <nz-select [nzDropdownMatchSelectWidth]="false" formControlName="hospital" nzPlaceHolder="请选择院区" (ngModelChange)="changeHospital($event)">
22
+              <nz-option [nzLabel]="data.hosName" [nzValue]="data.id" *ngFor="let data of hospitalList">
23
+              </nz-option>
24
+            </nz-select>
25
+          </nz-form-control>
26
+        </nz-form-item>
27
+        <nz-form-item [hidden]="validateForm.value.queryType != 3">
28
+          <nz-form-label [nzSpan]="4" nzRequired nzFor="duty">责任部门</nz-form-label>
29
+          <nz-form-control [nzSpan]="20" nzErrorTip="请选择责任部门!">
30
+            <nz-select [nzDropdownMatchSelectWidth]="false" formControlName="duty" nzPlaceHolder="请选择责任部门">
31
+              <nz-option [nzLabel]="data.hosName" [nzValue]="data.id" *ngFor="let data of dutyList">
32
+              </nz-option>
33
+            </nz-select>
34
+          </nz-form-control>
35
+        </nz-form-item>
36
+        <nz-form-item [hidden]="validateForm.value.queryType != 4">
37
+          <nz-form-label [nzSpan]="6" nzRequired nzFor="dutyOne">一级责任部门</nz-form-label>
38
+          <nz-form-control [nzSpan]="18" nzErrorTip="请选择一级责任部门!">
39
+            <nz-select [nzDropdownMatchSelectWidth]="false" formControlName="dutyOne" nzPlaceHolder="请选择一级责任部门">
40
+              <nz-option [nzLabel]="data.hosName" [nzValue]="data.id" *ngFor="let data of dutyOneList">
13
               </nz-option>
41
               </nz-option>
14
             </nz-select>
42
             </nz-select>
15
           </nz-form-control>
43
           </nz-form-control>
@@ -17,8 +45,8 @@
17
       </form>
45
       </form>
18
     </div>
46
     </div>
19
     <div class="display_flex justify-content_flex-center">
47
     <div class="display_flex justify-content_flex-center">
48
+      <button nz-button nzType="default" (click)="hideModal()">取消</button>
20
       <button nzType="primary" nz-button (click)="submitForm()">确认</button>
49
       <button nzType="primary" nz-button (click)="submitForm()">确认</button>
21
-      <button class="btn cancel" nz-button nzType="default" (click)="hideModal()">取消</button>
22
     </div>
50
     </div>
23
   </div>
51
   </div>
24
 </div>
52
 </div>

+ 14 - 23
src/app/views/new-statistics/components/query-range/query-range.component.less

@@ -17,17 +17,18 @@
17
     .title {
17
     .title {
18
       width: 100%;
18
       width: 100%;
19
       text-align: center;
19
       text-align: center;
20
-      font-size: 18px;
20
+      font-size: 16px;
21
       position: relative;
21
       position: relative;
22
+      padding: 16px 0;
22
 
23
 
23
       i {
24
       i {
24
         position: absolute;
25
         position: absolute;
25
         right: 0;
26
         right: 0;
26
-        top: 0;
27
+        top: 50%;
27
         font-size: 20px;
28
         font-size: 20px;
28
         color: #666;
29
         color: #666;
29
         cursor: pointer;
30
         cursor: pointer;
30
-        padding: 0 5px;
31
+        transform: translateY(-50%);
31
       }
32
       }
32
     }
33
     }
33
 
34
 
@@ -38,7 +39,6 @@
38
       border: 1px solid #e5e9ed;
39
       border: 1px solid #e5e9ed;
39
       border-radius: 5px;
40
       border-radius: 5px;
40
       overflow: hidden;
41
       overflow: hidden;
41
-      margin-top: 12px;
42
 
42
 
43
       div {
43
       div {
44
         text-align: center;
44
         text-align: center;
@@ -75,10 +75,7 @@
75
 
75
 
76
     button {
76
     button {
77
       margin-top: 10px;
77
       margin-top: 10px;
78
-
79
-      &.btn {
80
-        margin-left: 8px;
81
-      }
78
+      margin-bottom: 10px;
82
     }
79
     }
83
   }
80
   }
84
 
81
 
@@ -86,39 +83,33 @@
86
   &.add {
83
   &.add {
87
     .modalBody {
84
     .modalBody {
88
       width: 578px;
85
       width: 578px;
89
-      height: 286px;
86
+      padding: 0 24px;
90
 
87
 
91
       .content {
88
       .content {
92
         width: 100%;
89
         width: 100%;
90
+        min-height: 166px;
91
+        padding: 10px 24px 0;
93
         height: auto;
92
         height: auto;
94
-        padding: 19px 14px 0 14px;
95
-        max-height: 500px;
96
         overflow-y: auto;
93
         overflow-y: auto;
97
 
94
 
98
         .addForm {
95
         .addForm {
99
           .ant-form-item {
96
           .ant-form-item {
100
             margin-bottom: 14px;
97
             margin-bottom: 14px;
101
-
102
             .ant-form-item-label {
98
             .ant-form-item-label {
103
-              line-height: 14px;
104
               text-align: left;
99
               text-align: left;
105
             }
100
             }
106
-          }
107
-        }
108
-
109
-        .editForm {
110
-          .ant-form-item {
111
-            margin-bottom: 14px;
112
-
113
-            .ant-form-item-label {
114
-              line-height: 0;
101
+            &.mb0{
102
+              margin-bottom: 6px;
103
+            }
104
+            .ant-radio-wrapper{
105
+              margin-right: 0;
115
             }
106
             }
116
           }
107
           }
117
         }
108
         }
118
       }
109
       }
119
 
110
 
120
       button:nth-child(1) {
111
       button:nth-child(1) {
121
-        margin-right: 20px;
112
+        margin-right: 8px;
122
       }
113
       }
123
     }
114
     }
124
   }
115
   }

+ 143 - 11
src/app/views/new-statistics/components/query-range/query-range.component.ts

@@ -2,6 +2,7 @@ import { ToolService } from './../../../../services/tool.service';
2
 import { Component, OnInit, Output, Input } from '@angular/core';
2
 import { Component, OnInit, Output, Input } from '@angular/core';
3
 import { FormGroup, FormBuilder, Validators } from '@angular/forms';
3
 import { FormGroup, FormBuilder, Validators } from '@angular/forms';
4
 import { EventEmitter } from '@angular/core';
4
 import { EventEmitter } from '@angular/core';
5
+import { MainService } from 'src/app/services/main.service';
5
 
6
 
6
 @Component({
7
 @Component({
7
   selector: 'app-query-range',
8
   selector: 'app-query-range',
@@ -11,25 +12,33 @@ import { EventEmitter } from '@angular/core';
11
 export class QueryRangeComponent implements OnInit {
12
 export class QueryRangeComponent implements OnInit {
12
   @Output() submitQueryRange = new EventEmitter();
13
   @Output() submitQueryRange = new EventEmitter();
13
   @Output() cancelQueryRange = new EventEmitter();
14
   @Output() cancelQueryRange = new EventEmitter();
14
-  @Input() queryRangeFlag: boolean = false;//模态框
15
+  @Input() queryType: number;
16
+  @Input() hospital: any;
17
+  @Input() duty: any;
15
   validateForm: FormGroup;//表单
18
   validateForm: FormGroup;//表单
16
-  allHospital: any;//所有院区
17
-  hosLoading: boolean = false;//确定按钮的loading
18
-  constructor(private fb: FormBuilder, private tool: ToolService) { }
19
+  constructor(
20
+    private fb: FormBuilder,
21
+    private tool: ToolService,
22
+    private mainService: MainService,
23
+  ) { }
19
 
24
 
20
   ngOnInit() {
25
   ngOnInit() {
21
-    this.allHospital = this.tool.getHospitalList();
22
-    this.initForm()
26
+    this.getHospitalList();
27
+    this.queryType == 3 && this.getDutyList(this.hospital.id);
28
+    this.getDutyOneList();
29
+    this.initForm();
23
   }
30
   }
24
   // 隐藏模态框
31
   // 隐藏模态框
25
   hideModal() {
32
   hideModal() {
26
     this.cancelQueryRange.emit()
33
     this.cancelQueryRange.emit()
27
-    this.initForm()
28
   }
34
   }
29
   // 初始化新增form表单
35
   // 初始化新增form表单
30
   initForm() {
36
   initForm() {
31
     this.validateForm = this.fb.group({
37
     this.validateForm = this.fb.group({
32
-      affiliatedHospital: [this.tool.getCurrentHospital().id + '', [Validators.required]]
38
+      queryType: [this.queryType, [Validators.required]],
39
+      hospital: [(this.hospital && (this.queryType == 2 || this.queryType == 3)) ? this.hospital.id : null],
40
+      duty: [(this.duty && this.queryType == 3) ? this.duty.id : null],
41
+      dutyOne: [(this.duty && this.queryType == 4) ? this.duty.id : null],
33
     });
42
     });
34
   }
43
   }
35
   // 表单提交
44
   // 表单提交
@@ -39,9 +48,132 @@ export class QueryRangeComponent implements OnInit {
39
       this.validateForm.controls[i].updateValueAndValidity();
48
       this.validateForm.controls[i].updateValueAndValidity();
40
     }
49
     }
41
     if (this.validateForm.invalid) return;
50
     if (this.validateForm.invalid) return;
42
-    let id = this.validateForm.value.affiliatedHospital;
43
-    this.hosLoading = true;
44
-    this.submitQueryRange.emit(id);
51
+    let queryType = this.validateForm.value.queryType;
52
+    let hospital;
53
+    let duty;
54
+    switch (queryType) {
55
+      case 1:
56
+        break;
57
+      case 2:
58
+        hospital = this.hospitalList.find(v => v.id == this.validateForm.value.hospital);
59
+        break;
60
+      case 3:
61
+        hospital = this.hospitalList.find(v => v.id == this.validateForm.value.hospital);
62
+        duty = this.dutyList.find(v => v.id == this.validateForm.value.duty);
63
+        break;
64
+      case 4:
65
+        hospital = this.dutyOneList.find(v => v.id == this.validateForm.value.dutyOne).parent;
66
+        duty = this.dutyOneList.find(v => v.id == this.validateForm.value.dutyOne);
67
+        break;
68
+    }
69
+    this.submitQueryRange.emit({queryType, hospital, duty});
45
     this.hideModal();
70
     this.hideModal();
46
   }
71
   }
72
+
73
+  // 选择查询范围
74
+  changeQueryType(queryType){
75
+    this.validateForm.controls.hospital.setValue(null);
76
+    this.validateForm.controls.duty.setValue(null);
77
+    this.validateForm.controls.dutyOne.setValue(null);
78
+    this.dutyList = [];
79
+    switch (queryType) {
80
+      case 1:
81
+        this.requiredChange(false, 'hospital');
82
+        this.requiredChange(false, 'duty');
83
+        this.requiredChange(false, 'dutyOne');
84
+        break;
85
+      case 2:
86
+        this.requiredChange(true, 'hospital');
87
+        this.requiredChange(false, 'duty');
88
+        this.requiredChange(false, 'dutyOne');
89
+        break;
90
+      case 3:
91
+        this.requiredChange(true, 'hospital');
92
+        this.requiredChange(true, 'duty');
93
+        this.requiredChange(false, 'dutyOne');
94
+        break;
95
+      case 4:
96
+        this.requiredChange(false, 'hospital');
97
+        this.requiredChange(false, 'duty');
98
+        this.requiredChange(true, 'dutyOne');
99
+        break;
100
+    }
101
+  }
102
+
103
+  // 选择院区
104
+  changeHospital(hosId){
105
+    if(this.validateForm.value.queryType == 3){
106
+      this.getDutyList(hosId);
107
+    }
108
+  }
109
+
110
+  requiredChange(required: boolean, field: string): void {
111
+    if (!required) {
112
+      this.validateForm.get(field)!.clearValidators();
113
+      this.validateForm.get(field)!.markAsPristine();
114
+    } else {
115
+      this.validateForm.get(field)!.setValidators(Validators.required);
116
+      this.validateForm.get(field)!.markAsDirty();
117
+    }
118
+    this.validateForm.get(field)!.updateValueAndValidity();
119
+  }
120
+
121
+  // 获取所有的院区
122
+  hospitalList:any[] = [];
123
+  getHospitalList(){
124
+    let postData: any = {
125
+      idx: 0,
126
+      sum: 99999,
127
+      hospital: {
128
+        selectType: "level1",
129
+      },
130
+    };
131
+    this.mainService.getFetchDataList("data", "hospital", postData).subscribe(result => {
132
+      if(result.status == 200){
133
+        this.hospitalList = result.list || [];
134
+      }else{
135
+        this.hospitalList = [];
136
+      }
137
+    });
138
+  }
139
+
140
+  // 获取所有的责任部门
141
+  dutyList:any[] = [];
142
+  getDutyList(parentId){
143
+    let postData: any = {
144
+      idx: 0,
145
+      sum: 99999,
146
+      hospital: {
147
+        parent: { id: parentId },
148
+        selectType: "branch",
149
+      },
150
+    };
151
+    this.mainService.getFetchDataList("data", "hospital", postData).subscribe(result => {
152
+      if(result.status == 200){
153
+        this.dutyList = result.list || [];
154
+      }else{
155
+        this.dutyList = [];
156
+      }
157
+    });
158
+  }
159
+
160
+  // 获取所有的一级责任部门
161
+  dutyOneList:any[] = [];
162
+  getDutyOneList(){
163
+    let postData: any = {
164
+      idx: 0,
165
+      sum: 99999,
166
+      hospital: {
167
+        selectType: "verticalBranch",
168
+      },
169
+    };
170
+    this.mainService.getFetchDataList("data", "hospital", postData).subscribe(result => {
171
+      if(result.status == 200){
172
+        this.dutyOneList = result.list || [];
173
+      }else{
174
+        this.dutyOneList = [];
175
+      }
176
+    });
177
+  }
178
+
47
 }
179
 }

+ 49 - 1
src/app/views/new-statistics/maintenance-statistics/incident-statistics/incident-statistics.component.html

@@ -1 +1,49 @@
1
-故障工单统计<input type="text">
1
+<div class="searchDataWrap">
2
+  <div class="searchData">
3
+    <div class="searchDataItem">
4
+      <span class="label">建单时间</span>:
5
+      <nz-range-picker [(ngModel)]="dateRange" [nzAllowClear]="false" (ngModelChange)="changeDate($event)" (nzOnCalendarChange)="onCalendarChangeDate($event)">
6
+      </nz-range-picker>
7
+    </div>
8
+  </div>
9
+  <div class="operation">
10
+    <button nz-button class="btn default" (click)="search(1)">搜索</button>
11
+    <button nz-button class="btn default ml8" (click)="excelExport()">导出</button>
12
+    <button nz-button class="btn default ml8" (click)="reset()">重置</button>
13
+  </div>
14
+</div>
15
+<nz-table [nzData]="listOfData" nzSize="middle" [nzShowPagination]="false" [nzLoading]="loading1">
16
+  <thead (nzSortChange)="sort($event)" nzSingleSort>
17
+    <tr>
18
+      <th nzWidth="10%">时间</th>
19
+      <th nzWidth="9%">工单总数</th>
20
+      <th nzWidth="9%" nzShowSort nzSortKey="byOrderNum" [(nzSort)]="sortCurrent.byOrderNum">平均响应时间</th>
21
+      <th nzWidth="9%">平均解决时间</th>
22
+      <th nzWidth="9%">超时单数</th>
23
+      <th nzWidth="9%" nzShowSort nzSortKey="completionRate" [(nzSort)]="sortCurrent.completionRate">挂起单数</th>
24
+      <th nzWidth="9%">耗材费用(元)</th>
25
+      <th nzWidth="9%">工时费用(元)</th>
26
+      <th nzWidth="9%">总费用(元)</th>
27
+      <th nzWidth="9%" nzShowSort nzSortKey="byIntegral" [(nzSort)]="sortCurrent.byIntegral">差评单数</th>
28
+      <th nzWidth="9%">好评率</th>
29
+    </tr>
30
+  </thead>
31
+  <tbody>
32
+    <tr *ngFor="let data of listOfData; let index = index">
33
+      <td>{{ index + (pageIndex - 1) * 10 + 1 }}</td>
34
+      <td>{{ data.name }}</td>
35
+      <td>{{ data.total || 0 }}</td>
36
+      <td>{{ data.total || 0 }}</td>
37
+      <td>{{ data.total || 0 }}</td>
38
+      <td>{{ data.fiveTimeNum || 0 }}<br>{{ data.specialCloseNum }}</td>
39
+      <td>{{ data.arriveTime }}<br>{{ data.completeTime }}</td>
40
+      <td>{{ data.avePer + "%" }}</td>
41
+      <td>{{ data.buildingGrade }}<br>{{ data.inspectModeGrade }}</td>
42
+      <td>{{ data.order || 0 }}</td>
43
+      <td>{{ data.order || 0 }}</td>
44
+    </tr>
45
+  </tbody>
46
+</nz-table>
47
+<div>
48
+  <nz-pagination [(nzPageIndex)]="pageIndex" [(nzTotal)]="listLength" nzShowSizeChanger [(nzPageSize)]="pageSize" (nzPageIndexChange)="getList(pageIndex, sortCurrentKey, sortCurrentValue)" (nzPageSizeChange)="getList(pageIndex, sortCurrentKey, sortCurrentValue)"></nz-pagination>
49
+</div>

+ 13 - 0
src/app/views/new-statistics/maintenance-statistics/incident-statistics/incident-statistics.component.less

@@ -5,4 +5,17 @@
5
   right: 0;
5
   right: 0;
6
   bottom: 0;
6
   bottom: 0;
7
   left: 0;
7
   left: 0;
8
+  .searchDataWrap{
9
+    display: flex;
10
+    align-items: center;
11
+    justify-content: space-between;
12
+    .searchData{
13
+      padding: 16px;
14
+      .searchDataItem{
15
+        .label{
16
+          font-size: 16px;
17
+        }
18
+      }
19
+    }
20
+  }
8
 }
21
 }

+ 123 - 2
src/app/views/new-statistics/maintenance-statistics/incident-statistics/incident-statistics.component.ts

@@ -1,13 +1,134 @@
1
+import { format, addMonths, startOfMonth, endOfMonth } from 'date-fns';
1
 import { Component, OnInit } from "@angular/core";
2
 import { Component, OnInit } from "@angular/core";
3
+import { MainService } from 'src/app/services/main.service';
2
 @Component({
4
 @Component({
3
   selector: "app-incident-statistics",
5
   selector: "app-incident-statistics",
4
   templateUrl: "./incident-statistics.component.html",
6
   templateUrl: "./incident-statistics.component.html",
5
   styleUrls: ["./incident-statistics.component.less"],
7
   styleUrls: ["./incident-statistics.component.less"],
6
 })
8
 })
7
 export class IncidentStatisticsComponent implements OnInit {
9
 export class IncidentStatisticsComponent implements OnInit {
8
-  constructor() {}
10
+  constructor(
11
+    private mainService: MainService,
12
+  ) {}
13
+
14
+  listOfData: any[] = []; //表格数据
15
+  pageIndex: number = 1; //表格当前页码
16
+  pageSize: number = 10; //表格每页展示条数
17
+  listLength: number = 10; //表格总数据量
9
 
18
 
10
   ngOnInit() {
19
   ngOnInit() {
11
-    console.log('初始化')
20
+    this.initSessionData();
21
+    this.search();
22
+  }
23
+
24
+  // 初始化缓存数据
25
+  queryType:any;
26
+  hosId:any;
27
+  dutyId:any;
28
+  parentDutyId:any;
29
+  initSessionData(){
30
+    let queryType:any = sessionStorage.getItem('maintenance_statistics_queryType');
31
+    let hosId:any = sessionStorage.getItem('maintenance_statistics_hospitalId');
32
+    let dutyId:any = sessionStorage.getItem('maintenance_statistics_dutyId');
33
+
34
+    queryType = queryType ? +queryType : undefined;
35
+    hosId = hosId ? +hosId : undefined;
36
+    dutyId = dutyId ? +dutyId : undefined;
37
+
38
+    this.queryType = queryType;
39
+    if(queryType == 1){
40
+      this.hosId = undefined;
41
+      this.dutyId = undefined;
42
+      this.parentDutyId = undefined;
43
+    }else if(queryType == 2){
44
+      this.hosId = hosId;
45
+      this.dutyId = undefined;
46
+      this.parentDutyId = undefined;
47
+    }else if(queryType == 3){
48
+      this.hosId = undefined;
49
+      this.dutyId = dutyId;
50
+      this.parentDutyId = undefined;
51
+    }else if(queryType == 4){
52
+      this.hosId = undefined;
53
+      this.dutyId = undefined;
54
+      this.parentDutyId = dutyId;
55
+    }
56
+  }
57
+
58
+  // 表格数据
59
+  loading1 = false;
60
+  getList(num?: number, field?: string, sort?: string) {
61
+    if (num !== undefined) {
62
+      this.pageIndex = num;
63
+    }
64
+    let postData:any = {
65
+      idx: this.pageIndex - 1,
66
+      sum: this.pageSize,
67
+      startDate: this.dateRange[0],
68
+      endDate: this.dateRange[1],
69
+      hosId: this.hosId,
70
+      dutyId: this.dutyId,
71
+      parentDutyId: this.parentDutyId,
72
+    };
73
+    if (field && sort) {
74
+      postData[field] = sort === "ascend" ? `asc` : `desc`;
75
+    }
76
+    this.loading1 = true;
77
+    this.mainService
78
+      .postCustom("itsm/report", "incidentWorkOrder", postData)
79
+      .subscribe((result) => {
80
+        this.loading1 = false;
81
+        this.listOfData = result.dataList || [];
82
+        this.listLength = result.totalCount;
83
+      });
84
+  }
85
+
86
+  // 列表排序
87
+  sortCurrent = {
88
+    byOrderNum: null,
89
+    byIntegral: null,
90
+		completionRate: null,
91
+  };
92
+  sortCurrentKey: string = "";
93
+  sortCurrentValue: string | null = "";
94
+  sort(e) {
95
+    const { key, value } = e;
96
+    this.sortCurrentKey = key;
97
+    this.sortCurrentValue = value;
98
+    this.getList(this.pageIndex, this.sortCurrentKey, this.sortCurrentValue);
99
+  }
100
+
101
+  // 搜索
102
+  search(num?: number) {
103
+    if (num !== undefined) {
104
+      this.getList(num, this.sortCurrentKey, this.sortCurrentValue);
105
+    } else {
106
+      this.getList(this.pageIndex, this.sortCurrentKey, this.sortCurrentValue);
107
+    }
108
+  }
109
+
110
+  // 日期选择 日
111
+  dateRange: any = [format(startOfMonth(addMonths(new Date(), -2)), 'yyyy-MM-dd HH:mm:ss'), format(endOfMonth(addMonths(new Date(), -1)), 'yyyy-MM-dd HH:mm:ss')]; //发起时间区间 天
112
+  changeDate(result?): void {
113
+    console.log(this.dateRange);
114
+    console.log(result);
115
+    result[0] = format(result[0], 'yyyy-MM-dd HH:mm:ss');
116
+    result[1] = format(result[1], 'yyyy-MM-dd HH:mm:ss');
117
+    this.dateRange = result;
118
+    this.search();
119
+  }
120
+
121
+  onCalendarChangeDate(dateArr){
122
+    console.log(dateArr)
123
+    if(dateArr.length == 2){
124
+      let dateStart = new Date(dateArr[0]);
125
+      let dateEnd = new Date(dateArr[1]);
126
+      dateStart.setHours(0,0,0);
127
+      dateEnd.setHours(23,59,59);
128
+      this.dateRange = [dateStart,dateEnd];
129
+    }
12
   }
130
   }
131
+
132
+  excelExport(){}
133
+  reset(){}
13
 }
134
 }

+ 2 - 2
src/app/views/new-statistics/maintenance-statistics/maintenance-statistics.component.html

@@ -12,7 +12,7 @@
12
 <!-- content -->
12
 <!-- content -->
13
 <div class="content">
13
 <div class="content">
14
   <virtual-scroller #osComponentRef1 [items]="secondMenuList" class="secondMenu">
14
   <virtual-scroller #osComponentRef1 [items]="secondMenuList" class="secondMenu">
15
-    <div class="secondMenuItem ellipsis-oneline" [ngClass]="{ active: activeSecondMenuLink == data.link }" title="故障工单统计" *ngFor="let data of osComponentRef1.viewPortItems" (click)="clickSecondMenu(data)">{{data.title}}</div>
15
+    <div class="secondMenuItem ellipsis-oneline" [ngClass]="{ active: activeSecondMenuLink == data.link }" [title]="data.title" *ngFor="let data of osComponentRef1.viewPortItems" (click)="clickSecondMenu(data)">{{data.title}}</div>
16
   </virtual-scroller>
16
   </virtual-scroller>
17
   <div class="main">
17
   <div class="main">
18
     <app-custom-tabs (selectTabEmit)="selectTabEmit($event)"></app-custom-tabs>
18
     <app-custom-tabs (selectTabEmit)="selectTabEmit($event)"></app-custom-tabs>
@@ -21,4 +21,4 @@
21
 </div>
21
 </div>
22
 
22
 
23
 <!-- 查询范围 -->
23
 <!-- 查询范围 -->
24
-<app-query-range (cancelQueryRange)="cancelQueryRange()" (submitQueryRange)="submitQueryRange($event)" [queryRangeFlag]="queryRangeFlag"></app-query-range>
24
+<app-query-range [hospital]="hospital" [duty]="duty" [queryType]="queryType" (cancelQueryRange)="cancelQueryRange()" (submitQueryRange)="submitQueryRange($event)" *ngIf="queryRangeFlag"></app-query-range>

+ 6 - 0
src/app/views/new-statistics/maintenance-statistics/maintenance-statistics.component.less

@@ -15,6 +15,12 @@
15
   ::ng-deep .ant-tabs.ant-tabs-card .ant-tabs-card-bar .ant-tabs-nav-container{
15
   ::ng-deep .ant-tabs.ant-tabs-card .ant-tabs-card-bar .ant-tabs-nav-container{
16
     height: 36px!important;
16
     height: 36px!important;
17
   }
17
   }
18
+  ::ng-deep .ant-tabs.ant-tabs-card .ant-tabs-card-bar .ant-tabs-tab{
19
+    background: #E9EAEC;
20
+  }
21
+  ::ng-deep .ant-tabs.ant-tabs-card .ant-tabs-card-bar .ant-tabs-tab-active{
22
+    background: #fff;
23
+  }
18
   .header{
24
   .header{
19
     height: 48px;
25
     height: 48px;
20
     background-color: #fff;
26
     background-color: #fff;

+ 34 - 4
src/app/views/new-statistics/maintenance-statistics/maintenance-statistics.component.ts

@@ -1,12 +1,12 @@
1
 import { ActivatedRoute, Router } from '@angular/router';
1
 import { ActivatedRoute, Router } from '@angular/router';
2
-import { Component, OnInit } from "@angular/core";
2
+import { Component, OnInit, OnDestroy } from "@angular/core";
3
 import { ToolService } from 'src/app/services/tool.service';
3
 import { ToolService } from 'src/app/services/tool.service';
4
 @Component({
4
 @Component({
5
   selector: "app-maintenance-statistics",
5
   selector: "app-maintenance-statistics",
6
   templateUrl: "./maintenance-statistics.component.html",
6
   templateUrl: "./maintenance-statistics.component.html",
7
   styleUrls: ["./maintenance-statistics.component.less"],
7
   styleUrls: ["./maintenance-statistics.component.less"],
8
 })
8
 })
9
-export class MaintenanceStatisticsComponent implements OnInit {
9
+export class MaintenanceStatisticsComponent implements OnInit, OnDestroy {
10
   constructor(
10
   constructor(
11
     public tool: ToolService,
11
     public tool: ToolService,
12
     public route: ActivatedRoute,
12
     public route: ActivatedRoute,
@@ -22,6 +22,10 @@ export class MaintenanceStatisticsComponent implements OnInit {
22
     console.log('this.menuList:', this.menuList)
22
     console.log('this.menuList:', this.menuList)
23
   }
23
   }
24
 
24
 
25
+  ngOnDestroy(){
26
+    this.sessionRemove();
27
+  }
28
+
25
   getMenuList(){
29
   getMenuList(){
26
     this.menuList = this.tool.getMenuAutoType(this.route);
30
     this.menuList = this.tool.getMenuAutoType(this.route);
27
     this.menuList.length && this.clickMenu(this.menuList[0]);
31
     this.menuList.length && this.clickMenu(this.menuList[0]);
@@ -39,7 +43,8 @@ export class MaintenanceStatisticsComponent implements OnInit {
39
   activeSecondMenuLink:string;
43
   activeSecondMenuLink:string;
40
   clickSecondMenu(data){
44
   clickSecondMenu(data){
41
     this.activeSecondMenuLink = data.link;
45
     this.activeSecondMenuLink = data.link;
42
-    this.router.navigateByUrl(`newStatistics/${this.route.parent.snapshot.routeConfig.path}/${data.link}`).finally();
46
+    // this.router.navigateByUrl(`newStatistics/${this.route.parent.snapshot.routeConfig.path}/${this.activeSecondMenuLink}`).finally();
47
+    this.router.navigate([`newStatistics/${this.route.parent.snapshot.routeConfig.path}/${this.activeSecondMenuLink}`], { replaceUrl: true });
43
   }
48
   }
44
 
49
 
45
   // 回显二级菜单
50
   // 回显二级菜单
@@ -85,6 +90,22 @@ export class MaintenanceStatisticsComponent implements OnInit {
85
     }else{
90
     }else{
86
       this.queryType = 1;
91
       this.queryType = 1;
87
     }
92
     }
93
+
94
+    this.sessionSave();
95
+  }
96
+
97
+  // 缓存数据
98
+  sessionSave(){
99
+    sessionStorage.setItem('maintenance_statistics_queryType', this.queryType);
100
+    sessionStorage.setItem('maintenance_statistics_hospitalId', this.hospital ? this.hospital.id : '');
101
+    sessionStorage.setItem('maintenance_statistics_dutyId', this.duty ? this.duty.id : '');
102
+  }
103
+
104
+  // 清除缓存数据
105
+  sessionRemove(){
106
+    sessionStorage.removeItem('maintenance_statistics_queryType');
107
+    sessionStorage.removeItem('maintenance_statistics_hospitalId');
108
+    sessionStorage.removeItem('maintenance_statistics_dutyId');
88
   }
109
   }
89
 
110
 
90
   // 查询范围
111
   // 查询范围
@@ -92,8 +113,17 @@ export class MaintenanceStatisticsComponent implements OnInit {
92
   queryRangeClick(){
113
   queryRangeClick(){
93
     this.queryRangeFlag = true;
114
     this.queryRangeFlag = true;
94
   }
115
   }
95
-  submitQueryRange(id) {
116
+  submitQueryRange({queryType, hospital, duty}) {
117
+    console.log('queryType:', queryType)
118
+    console.log('hospital:', hospital)
119
+    console.log('duty:', duty)
120
+    this.queryType = queryType;
121
+    this.hospital = hospital;
122
+    this.duty = duty;
96
     this.queryRangeFlag = false;
123
     this.queryRangeFlag = false;
124
+
125
+    this.sessionSave();
126
+    this.router.navigate([`newStatistics/${this.route.parent.snapshot.routeConfig.path}/${this.activeSecondMenuLink}`], { replaceUrl: true });
97
   }
127
   }
98
   cancelQueryRange() {
128
   cancelQueryRange() {
99
     this.queryRangeFlag = false;
129
     this.queryRangeFlag = false;

+ 4 - 2
src/app/views/new-statistics/services/tab.service.ts

@@ -18,7 +18,7 @@ export class TabService {
18
     this.router.events
18
     this.router.events
19
       .pipe(filter(event => event instanceof NavigationEnd))
19
       .pipe(filter(event => event instanceof NavigationEnd))
20
       .subscribe((event: NavigationEnd) => {
20
       .subscribe((event: NavigationEnd) => {
21
-        this.updateTabs(event.urlAfterRedirects);
21
+        event.urlAfterRedirects.startsWith('/newStatistics/') && this.updateTabs(event.urlAfterRedirects);
22
       });
22
       });
23
   }
23
   }
24
 
24
 
@@ -85,7 +85,9 @@ export class TabService {
85
     if (newActiveTab) {
85
     if (newActiveTab) {
86
       this.currentTab = newActiveTab;
86
       this.currentTab = newActiveTab;
87
       this.tabs.forEach(t => t.active = t.path === newActiveTab!.path);
87
       this.tabs.forEach(t => t.active = t.path === newActiveTab!.path);
88
-      this.router.navigate([newActiveTab.path]);
88
+      this.router.navigate([newActiveTab.path], {
89
+        replaceUrl: true
90
+      });
89
     }
91
     }
90
   }
92
   }
91
 
93