Browse Source

一堆统计

seimin 1 month ago
parent
commit
feb73b29b5
30 changed files with 1286 additions and 582 deletions
  1. 4 18
      src/app/views/new-statistics/maintenance-statistics/building-statistics/building-statistics.component.html
  2. 18 74
      src/app/views/new-statistics/maintenance-statistics/building-statistics/building-statistics.component.ts
  3. 2 2
      src/app/views/new-statistics/maintenance-statistics/category-one-statistics/category-one-statistics.component.ts
  4. 11 45
      src/app/views/new-statistics/maintenance-statistics/category-source-statistics/category-source-statistics.component.html
  5. 26 75
      src/app/views/new-statistics/maintenance-statistics/category-source-statistics/category-source-statistics.component.ts
  6. 2 2
      src/app/views/new-statistics/maintenance-statistics/category-three-statistics/category-three-statistics.component.ts
  7. 2 2
      src/app/views/new-statistics/maintenance-statistics/category-two-statistics/category-two-statistics.component.ts
  8. 14 0
      src/app/views/new-statistics/maintenance-statistics/consumable-statistics/consumable-statistics-routing.module.ts
  9. 70 0
      src/app/views/new-statistics/maintenance-statistics/consumable-statistics/consumable-statistics.component.html
  10. 71 0
      src/app/views/new-statistics/maintenance-statistics/consumable-statistics/consumable-statistics.component.less
  11. 273 0
      src/app/views/new-statistics/maintenance-statistics/consumable-statistics/consumable-statistics.component.ts
  12. 21 0
      src/app/views/new-statistics/maintenance-statistics/consumable-statistics/consumable-statistics.module.ts
  13. 41 43
      src/app/views/new-statistics/maintenance-statistics/department-evaluate-statistics/department-evaluate-statistics.component.html
  14. 37 65
      src/app/views/new-statistics/maintenance-statistics/department-evaluate-statistics/department-evaluate-statistics.component.ts
  15. 15 14
      src/app/views/new-statistics/maintenance-statistics/department-incident-statistics/department-incident-statistics.component.html
  16. 37 65
      src/app/views/new-statistics/maintenance-statistics/department-incident-statistics/department-incident-statistics.component.ts
  17. 29 43
      src/app/views/new-statistics/maintenance-statistics/department-source-statistics/department-source-statistics.component.html
  18. 37 65
      src/app/views/new-statistics/maintenance-statistics/department-source-statistics/department-source-statistics.component.ts
  19. 13 16
      src/app/views/new-statistics/maintenance-statistics/floor-statistics/floor-statistics.component.html
  20. 32 47
      src/app/views/new-statistics/maintenance-statistics/floor-statistics/floor-statistics.component.ts
  21. 1 1
      src/app/views/new-statistics/maintenance-statistics/group-statistics/group-statistics.component.ts
  22. 18 0
      src/app/views/new-statistics/maintenance-statistics/maintenance-statistics-routing.module.ts
  23. 14 3
      src/app/views/new-statistics/maintenance-statistics/tripartite-company-statistics/tripartite-company-statistics.component.html
  24. 48 1
      src/app/views/new-statistics/maintenance-statistics/tripartite-company-statistics/tripartite-company-statistics.component.ts
  25. 1 1
      src/app/views/new-statistics/maintenance-statistics/user-statistics/user-statistics.component.html
  26. 14 0
      src/app/views/new-statistics/maintenance-statistics/work-hour-statistics/work-hour-statistics-routing.module.ts
  27. 70 0
      src/app/views/new-statistics/maintenance-statistics/work-hour-statistics/work-hour-statistics.component.html
  28. 71 0
      src/app/views/new-statistics/maintenance-statistics/work-hour-statistics/work-hour-statistics.component.less
  29. 273 0
      src/app/views/new-statistics/maintenance-statistics/work-hour-statistics/work-hour-statistics.component.ts
  30. 21 0
      src/app/views/new-statistics/maintenance-statistics/work-hour-statistics/work-hour-statistics.module.ts

+ 4 - 18
src/app/views/new-statistics/maintenance-statistics/building-statistics/building-statistics.component.html

@@ -5,17 +5,6 @@
5 5
       <nz-range-picker [(ngModel)]="dateRange" [nzAllowClear]="false" (ngModelChange)="changeDate($event)" (nzOnCalendarChange)="onCalendarChangeDate($event)">
6 6
       </nz-range-picker>
7 7
     </div>
8
-    <div class="searchDataItem">
9
-      <span class="label">报修科室</span>:
10
-      <nz-select class="selectItem" [nzDropdownMatchSelectWidth]="false" nzServerSearch nzShowSearch (nzOnSearch)="changeRepairDeptInp($event)" nzAllowClear nzPlaceHolder="请选择报修科室" [(ngModel)]="repairDeptId" (nzOpenChange)="openChangeRepairDept($event)">
11
-      <ng-container *ngFor="let option of repairDeptList">
12
-        <nz-option *ngIf="!isLoading" [nzLabel]="option.dept" [nzValue]="option.id"></nz-option>
13
-      </ng-container>
14
-      <nz-option *ngIf="isLoading" nzDisabled nzCustomContent>
15
-        <i nz-icon nzType="loading" class="loading-icon"></i> 搜索中...
16
-      </nz-option>
17
-    </nz-select>
18
-    </div>
19 8
   </div>
20 9
   <div class="operation">
21 10
     <i class="icon_transport transport-gengduo" (click)="showMore()"></i>
@@ -24,18 +13,15 @@
24 13
     <button nz-button class="btn default ml8" (click)="excelExport()" [nzLoading]="excelExportLoading">导出</button>
25 14
   </div>
26 15
 </div>
27
-<div class="moreFilter" *ngIf="fieldConfig.fields.groupDTO || fieldConfig.fields.userDTO || fieldConfig.fields.category1DTO || fieldConfig.fields.category2DTO || fieldConfig.fields.category3DTO || fieldConfig.fields.sourceDTO">
28
-  <span>{{fieldConfig.fields.groupDTO?.groupName}}</span>
29
-  <span>{{fieldConfig.fields.userDTO?.name}}</span>
16
+<div class="moreFilter" *ngIf="fieldConfig.fields.category1DTO || fieldConfig.fields.category2DTO || fieldConfig.fields.category3DTO">
30 17
   <span>{{fieldConfig.fields.category1DTO?.category}}</span>
31 18
   <span>{{fieldConfig.fields.category2DTO?.category}}</span>
32 19
   <span>{{fieldConfig.fields.category3DTO?.category}}</span>
33
-  <span>{{fieldConfig.fields.sourceDTO?.name}}</span>
34 20
 </div>
35 21
 <nz-table class="table" [nzData]="listOfData" nzSize="middle" [nzShowPagination]="false" [nzLoading]="loading1" [nzScroll]="{ y: tableHeight + 'px' }" [nzFooter]="footerTpl">
36 22
   <thead (nzSortChange)="sort($event)" nzSingleSort>
37 23
     <tr>
38
-      <th nzWidth="10%" nzShowSort nzSortKey="startDate" [(nzSort)]="sortCurrent.startDate">时间</th>
24
+      <th nzWidth="10%">楼栋名称</th>
39 25
       <th nzWidth="9%" nzShowSort nzSortKey="sum" [(nzSort)]="sortCurrent.sum">工单总数</th>
40 26
       <th nzWidth="9%" nzShowSort nzSortKey="avgResponseTime" [(nzSort)]="sortCurrent.avgResponseTime">平均响应时间</th>
41 27
       <th nzWidth="9%" nzShowSort nzSortKey="avgResolvedTime" [(nzSort)]="sortCurrent.avgResolvedTime">平均解决时间</th>
@@ -50,7 +36,7 @@
50 36
   </thead>
51 37
   <tbody>
52 38
     <tr *ngFor="let data of listOfData">
53
-      <td>{{ data.startDate }}</td>
39
+      <td>{{ data.name }}</td>
54 40
       <td>{{ data.sum }}</td>
55 41
       <td>{{ data.avgResponseTime }}</td>
56 42
       <td>{{ data.avgResolvedTime }}</td>
@@ -66,7 +52,7 @@
66 52
   <ng-template #footerTpl>
67 53
     <table class="footTable">
68 54
       <tr *ngFor="let data of listOfDataEnd">
69
-        <td style="width: 10%">{{ data.startDate }}</td>
55
+        <td style="width: 10%">{{ data.name }}</td>
70 56
         <td style="width: 9%">{{ data.sum }}</td>
71 57
         <td style="width: 9%">{{ data.avgResponseTime }}</td>
72 58
         <td style="width: 9%">{{ data.avgResolvedTime }}</td>

+ 18 - 74
src/app/views/new-statistics/maintenance-statistics/building-statistics/building-statistics.component.ts

@@ -1,5 +1,3 @@
1
-import { debounceTime } from 'rxjs/operators';
2
-import { Subject } from 'rxjs';
3 1
 import { NzMessageService } from 'ng-zorro-antd/message';
4 2
 import { format, addMonths, startOfMonth, endOfMonth, startOfDay, endOfDay } from 'date-fns';
5 3
 import { Component, OnInit, HostListener, AfterViewInit } from "@angular/core";
@@ -23,15 +21,7 @@ export class BuildingStatisticsComponent implements OnInit, AfterViewInit {
23 21
   pageSize: number = 30; //表格每页展示条数
24 22
   listLength: number = 0; //表格总数据量
25 23
 
26
-  repairDeptId;//报修科室id
27
-
28
-  searchTimerSubject = new Subject();
29
-
30 24
   ngOnInit() {
31
-    this.searchTimerSubject.pipe(debounceTime(500)).subscribe((v) => {
32
-      let fun = v[0];
33
-      fun.call(this, v[1]);
34
-    });
35 25
     this.initSessionData();
36 26
     this.search();
37 27
   }
@@ -50,7 +40,7 @@ export class BuildingStatisticsComponent implements OnInit, AfterViewInit {
50 40
   }
51 41
 
52 42
   get getMoreFilter(){
53
-    let flag = this.fieldConfig.fields.groupDTO || this.fieldConfig.fields.userDTO || this.fieldConfig.fields.category1DTO || this.fieldConfig.fields.category2DTO || this.fieldConfig.fields.category3DTO || this.fieldConfig.fields.sourceDTO;
43
+    let flag = this.fieldConfig.fields.category1DTO || this.fieldConfig.fields.category2DTO || this.fieldConfig.fields.category3DTO;
54 44
     return flag ? 21 : 0;
55 45
   }
56 46
 
@@ -102,24 +92,19 @@ export class BuildingStatisticsComponent implements OnInit, AfterViewInit {
102 92
     let postData:any = {
103 93
       idx: this.pageIndex - 1,
104 94
       sum: this.pageSize,
105
-      startDate: this.dateRange[0],
106
-      endDate: this.dateRange[1],
107
-      hosId: this.hosId,
108
-      dutyId: this.dutyId,
109
-      parentDutyId: this.parentDutyId,
110
-      repairDeptId: this.repairDeptId,
111
-      groupId: this.fieldConfig.fields.groupId,
112
-      userId: this.fieldConfig.fields.userId,
113
-      categoryId: this.fieldConfig.fields.categoryId,
114
-      sourceId: this.fieldConfig.fields.sourceId,
115
-      hierarchy: this.fieldConfig.fields.hierarchy,
95
+      startDate: this.dateRange[0] || undefined,
96
+      endDate: this.dateRange[1] || undefined,
97
+      hosId: this.hosId || undefined,
98
+      dutyId: this.dutyId || undefined,
99
+      parentDutyId: this.parentDutyId || undefined,
100
+      categoryId: this.fieldConfig.fields.categoryId || undefined,
116 101
     };
117 102
     if (field && sort) {
118 103
       postData.sort = `${field} ${sort === "ascend" ? `asc` : `desc`}`
119 104
     }
120 105
     this.loading1 = true;
121 106
     this.mainService
122
-      .postCustom("itsm/report", "incidentWorkOrder", postData)
107
+      .postCustom("itsm/report", "buildingIncident", postData)
123 108
       .subscribe((result) => {
124 109
         this.loading1 = false;
125 110
         this.listOfData = result.dataList.filter((v, i) => { return i != result.dataList.length - 1 });
@@ -166,23 +151,18 @@ export class BuildingStatisticsComponent implements OnInit, AfterViewInit {
166 151
       nzDuration: 0,
167 152
     }).messageId;
168 153
     let postData:any = {
169
-      startDate: this.dateRange[0],
170
-      endDate: this.dateRange[1],
171
-      hosId: this.hosId,
172
-      dutyId: this.dutyId,
173
-      parentDutyId: this.parentDutyId,
174
-      repairDeptId: this.repairDeptId,
175
-      groupId: this.fieldConfig.fields.groupId,
176
-      userId: this.fieldConfig.fields.userId,
177
-      categoryId: this.fieldConfig.fields.categoryId,
178
-      sourceId: this.fieldConfig.fields.sourceId,
179
-      hierarchy: this.fieldConfig.fields.hierarchy,
154
+      startDate: this.dateRange[0] || undefined,
155
+      endDate: this.dateRange[1] || undefined,
156
+      hosId: this.hosId || undefined,
157
+      dutyId: this.dutyId || undefined,
158
+      parentDutyId: this.parentDutyId || undefined,
159
+      categoryId: this.fieldConfig.fields.categoryId || undefined,
180 160
     };
181 161
     if (this.sortCurrentKey && this.sortCurrentValue) {
182 162
       postData.sort = `${this.sortCurrentKey} ${this.sortCurrentValue === "ascend" ? `asc` : `desc`}`
183 163
     }
184 164
     this.mainService
185
-      .postExportCustom("itsm/export", "incidentWorkOrder", postData)
165
+      .postExportCustom("itsm/export", "buildingIncident", postData)
186 166
       .subscribe((data) => {
187 167
         this.message.remove(this.excelExportLoading);
188 168
         this.excelExportLoading = false;
@@ -210,52 +190,17 @@ export class BuildingStatisticsComponent implements OnInit, AfterViewInit {
210 190
 		this.sortCurrentValue = "";
211 191
 		this.sortCurrent = {};
212 192
     this.dateRange = [format(startOfMonth(addMonths(new Date(), -1)), 'yyyy-MM-dd HH:mm:ss'), format(endOfMonth(addMonths(new Date(), -1)), 'yyyy-MM-dd HH:mm:ss')]
213
-    this.repairDeptId = undefined;
214
-    this.fieldConfig.fields = {groupId: undefined, userId: undefined, categoryId: undefined, sourceId: undefined, hierarchy: undefined};
193
+    this.fieldConfig.fields = {category123: true};
215 194
     this.search();
216 195
   }
217 196
 
218
-  // 科室搜索
219
-  changeRepairDeptInp(e) {
220
-    this.searchTimer(this.getRepairDeptList, e);
221
-  }
222
-
223 197
   // 防抖
224 198
   isLoading = false;
225
-  searchTimer(fun, e) {
226
-    this.isLoading = true;
227
-    this.searchTimerSubject.next([fun, e]);
228
-  }
229
-
230
-  openChangeRepairDept(flag){
231
-    flag && this.getRepairDeptList();
232
-  }
233
-
234
-  // 获取报修科室列表
235
-  repairDeptList:any[] = [];
236
-  getRepairDeptList(keyword?) {
237
-    let data = {
238
-      department: {
239
-        cascadeHosId: this.getHosId,
240
-        dept: keyword,
241
-        searchType: 1,
242
-      },
243
-      idx: 0,
244
-      sum: 20,
245
-    };
246
-    this.isLoading = true;
247
-    this.mainService
248
-      .getFetchDataList("data", "department", data)
249
-      .subscribe((data) => {
250
-        this.isLoading = false;
251
-        this.repairDeptList = data.list;
252
-      });
253
-  }
254 199
 
255 200
   // 详细搜索
256 201
   fieldConfig:any = {
257
-    fields: {groupId: undefined, userId: undefined, categoryId: undefined, sourceId: undefined, hierarchy: undefined},
258
-    config: {groupAndUser: true, category123: true, source: true},
202
+    fields: {categoryId: undefined},
203
+    config: {category123: true},
259 204
   }
260 205
   showSearchMore:boolean = false;
261 206
   showMore(){
@@ -274,4 +219,3 @@ export class BuildingStatisticsComponent implements OnInit, AfterViewInit {
274 219
     this.onResize();
275 220
   }
276 221
 }
277
-

+ 2 - 2
src/app/views/new-statistics/maintenance-statistics/category-one-statistics/category-one-statistics.component.ts

@@ -101,7 +101,7 @@ export class CategoryOneStatisticsComponent implements OnInit, AfterViewInit {
101 101
       userId: this.fieldConfig.fields.userId || undefined,
102 102
       buildingId: this.fieldConfig.fields.buildingId || undefined,
103 103
       placeId: this.fieldConfig.fields.floorId || undefined,
104
-      compantId: this.fieldConfig.fields.compantId || undefined,
104
+      companyId: this.fieldConfig.fields.companyId || undefined,
105 105
       repairDeptId: this.fieldConfig.fields.repairDeptId || undefined,
106 106
       categoryLevel: 1,
107 107
     };
@@ -166,7 +166,7 @@ export class CategoryOneStatisticsComponent implements OnInit, AfterViewInit {
166 166
       userId: this.fieldConfig.fields.userId || undefined,
167 167
       buildingId: this.fieldConfig.fields.buildingId || undefined,
168 168
       placeId: this.fieldConfig.fields.floorId || undefined,
169
-      compantId: this.fieldConfig.fields.compantId || undefined,
169
+      companyId: this.fieldConfig.fields.companyId || undefined,
170 170
       repairDeptId: this.fieldConfig.fields.repairDeptId || undefined,
171 171
       categoryLevel: 1,
172 172
     };

+ 11 - 45
src/app/views/new-statistics/maintenance-statistics/category-source-statistics/category-source-statistics.component.html

@@ -5,17 +5,6 @@
5 5
       <nz-range-picker [(ngModel)]="dateRange" [nzAllowClear]="false" (ngModelChange)="changeDate($event)" (nzOnCalendarChange)="onCalendarChangeDate($event)">
6 6
       </nz-range-picker>
7 7
     </div>
8
-    <div class="searchDataItem">
9
-      <span class="label">报修科室</span>:
10
-      <nz-select class="selectItem" [nzDropdownMatchSelectWidth]="false" nzServerSearch nzShowSearch (nzOnSearch)="changeRepairDeptInp($event)" nzAllowClear nzPlaceHolder="请选择报修科室" [(ngModel)]="repairDeptId" (nzOpenChange)="openChangeRepairDept($event)">
11
-      <ng-container *ngFor="let option of repairDeptList">
12
-        <nz-option *ngIf="!isLoading" [nzLabel]="option.dept" [nzValue]="option.id"></nz-option>
13
-      </ng-container>
14
-      <nz-option *ngIf="isLoading" nzDisabled nzCustomContent>
15
-        <i nz-icon nzType="loading" class="loading-icon"></i> 搜索中...
16
-      </nz-option>
17
-    </nz-select>
18
-    </div>
19 8
   </div>
20 9
   <div class="operation">
21 10
     <i class="icon_transport transport-gengduo" (click)="showMore()"></i>
@@ -24,59 +13,36 @@
24 13
     <button nz-button class="btn default ml8" (click)="excelExport()" [nzLoading]="excelExportLoading">导出</button>
25 14
   </div>
26 15
 </div>
27
-<div class="moreFilter" *ngIf="fieldConfig.fields.groupDTO || fieldConfig.fields.userDTO || fieldConfig.fields.category1DTO || fieldConfig.fields.category2DTO || fieldConfig.fields.category3DTO || fieldConfig.fields.sourceDTO">
16
+<div class="moreFilter" *ngIf="fieldConfig.fields.groupDTO || fieldConfig.fields.userDTO || fieldConfig.fields.category1DTO || fieldConfig.fields.category2DTO || fieldConfig.fields.category3DTO || fieldConfig.fields.buildingDTO || fieldConfig.fields.floorDTO">
28 17
   <span>{{fieldConfig.fields.groupDTO?.groupName}}</span>
29 18
   <span>{{fieldConfig.fields.userDTO?.name}}</span>
30 19
   <span>{{fieldConfig.fields.category1DTO?.category}}</span>
31 20
   <span>{{fieldConfig.fields.category2DTO?.category}}</span>
32 21
   <span>{{fieldConfig.fields.category3DTO?.category}}</span>
33
-  <span>{{fieldConfig.fields.sourceDTO?.name}}</span>
22
+  <span>{{fieldConfig.fields.buildingDTO?.buildingName}}</span>
23
+  <span>{{fieldConfig.fields.floorDTO?.floorName}}</span>
34 24
 </div>
35 25
 <nz-table class="table" [nzData]="listOfData" nzSize="middle" [nzShowPagination]="false" [nzLoading]="loading1" [nzScroll]="{ y: tableHeight + 'px' }" [nzFooter]="footerTpl">
36 26
   <thead (nzSortChange)="sort($event)" nzSingleSort>
37 27
     <tr>
38
-      <th nzWidth="10%" nzShowSort nzSortKey="startDate" [(nzSort)]="sortCurrent.startDate">时间</th>
39
-      <th nzWidth="9%" nzShowSort nzSortKey="sum" [(nzSort)]="sortCurrent.sum">工单总数</th>
40
-      <th nzWidth="9%" nzShowSort nzSortKey="avgResponseTime" [(nzSort)]="sortCurrent.avgResponseTime">平均响应时间</th>
41
-      <th nzWidth="9%" nzShowSort nzSortKey="avgResolvedTime" [(nzSort)]="sortCurrent.avgResolvedTime">平均解决时间</th>
42
-      <th nzWidth="9%" nzShowSort nzSortKey="resolvedOverNum" [(nzSort)]="sortCurrent.resolvedOverNum">超时单数</th>
43
-      <th nzWidth="9%" nzShowSort nzSortKey="overTimeNum" [(nzSort)]="sortCurrent.overTimeNum">挂起单数</th>
44
-      <th nzWidth="9%" nzShowSort nzSortKey="consumablePrice" [(nzSort)]="sortCurrent.consumablePrice">耗材费用(元)</th>
45
-      <th nzWidth="9%" nzShowSort nzSortKey="workHourPrice" [(nzSort)]="sortCurrent.workHourPrice">工时费用(元)</th>
46
-      <th nzWidth="9%" nzShowSort nzSortKey="totalPrice" [(nzSort)]="sortCurrent.totalPrice">总费用(元)</th>
47
-      <th nzWidth="9%" nzShowSort nzSortKey="negativeNum" [(nzSort)]="sortCurrent.negativeNum">差评单数</th>
48
-      <th nzWidth="9%" nzShowSort nzSortKey="favorableRate" [(nzSort)]="sortCurrent.favorableRate">好评率</th>
28
+      <th nzWidth="34%">来源名称</th>
29
+      <th nzWidth="33%" nzShowSort nzSortKey="sum" [(nzSort)]="sortCurrent.sum">工单总数</th>
30
+      <th nzWidth="33%" nzShowSort nzSortKey="rate" [(nzSort)]="sortCurrent.rate">占比</th>
49 31
     </tr>
50 32
   </thead>
51 33
   <tbody>
52 34
     <tr *ngFor="let data of listOfData">
53
-      <td>{{ data.startDate }}</td>
35
+      <td>{{ data.sourceName }}</td>
54 36
       <td>{{ data.sum }}</td>
55
-      <td>{{ data.avgResponseTime }}</td>
56
-      <td>{{ data.avgResolvedTime }}</td>
57
-      <td>{{ data.resolvedOverNum }}</td>
58
-      <td>{{ data.overTimeNum }}</td>
59
-      <td>{{ data.consumablePrice }}</td>
60
-      <td>{{ data.workHourPrice }}</td>
61
-      <td>{{ data.totalPrice }}</td>
62
-      <td>{{ data.negativeNum }}</td>
63
-      <td>{{ data.favorableRate }}</td>
37
+      <td>{{ data.rate }}</td>
64 38
     </tr>
65 39
   </tbody>
66 40
   <ng-template #footerTpl>
67 41
     <table class="footTable">
68 42
       <tr *ngFor="let data of listOfDataEnd">
69
-        <td style="width: 10%">{{ data.startDate }}</td>
70
-        <td style="width: 9%">{{ data.sum }}</td>
71
-        <td style="width: 9%">{{ data.avgResponseTime }}</td>
72
-        <td style="width: 9%">{{ data.avgResolvedTime }}</td>
73
-        <td style="width: 9%">{{ data.resolvedOverNum }}</td>
74
-        <td style="width: 9%">{{ data.overTimeNum }}</td>
75
-        <td style="width: 9%">{{ data.consumablePrice }}</td>
76
-        <td style="width: 9%">{{ data.workHourPrice }}</td>
77
-        <td style="width: 9%">{{ data.totalPrice }}</td>
78
-        <td style="width: 9%">{{ data.negativeNum }}</td>
79
-        <td style="width: 9%">{{ data.favorableRate }}</td>
43
+        <td style="width: 34%">{{ data.sourceName }}</td>
44
+        <td style="width: 33%">{{ data.sum }}</td>
45
+        <td style="width: 33%">{{ data.rate }}</td>
80 46
       </tr>
81 47
     </table>
82 48
   </ng-template>

+ 26 - 75
src/app/views/new-statistics/maintenance-statistics/category-source-statistics/category-source-statistics.component.ts

@@ -1,5 +1,3 @@
1
-import { debounceTime } from 'rxjs/operators';
2
-import { Subject } from 'rxjs';
3 1
 import { NzMessageService } from 'ng-zorro-antd/message';
4 2
 import { format, addMonths, startOfMonth, endOfMonth, startOfDay, endOfDay } from 'date-fns';
5 3
 import { Component, OnInit, HostListener, AfterViewInit } from "@angular/core";
@@ -23,15 +21,7 @@ export class CategorySourceStatisticsComponent implements OnInit, AfterViewInit
23 21
   pageSize: number = 30; //表格每页展示条数
24 22
   listLength: number = 0; //表格总数据量
25 23
 
26
-  repairDeptId;//报修科室id
27
-
28
-  searchTimerSubject = new Subject();
29
-
30 24
   ngOnInit() {
31
-    this.searchTimerSubject.pipe(debounceTime(500)).subscribe((v) => {
32
-      let fun = v[0];
33
-      fun.call(this, v[1]);
34
-    });
35 25
     this.initSessionData();
36 26
     this.search();
37 27
   }
@@ -50,7 +40,7 @@ export class CategorySourceStatisticsComponent implements OnInit, AfterViewInit
50 40
   }
51 41
 
52 42
   get getMoreFilter(){
53
-    let flag = this.fieldConfig.fields.groupDTO || this.fieldConfig.fields.userDTO || this.fieldConfig.fields.category1DTO || this.fieldConfig.fields.category2DTO || this.fieldConfig.fields.category3DTO || this.fieldConfig.fields.sourceDTO;
43
+    let flag = this.fieldConfig.fields.groupDTO || this.fieldConfig.fields.userDTO || this.fieldConfig.fields.category1DTO || this.fieldConfig.fields.category2DTO || this.fieldConfig.fields.category3DTO || this.fieldConfig.fields.buildingDTO || this.fieldConfig.fields.floorDTO;
54 44
     return flag ? 21 : 0;
55 45
   }
56 46
 
@@ -102,24 +92,23 @@ export class CategorySourceStatisticsComponent implements OnInit, AfterViewInit
102 92
     let postData:any = {
103 93
       idx: this.pageIndex - 1,
104 94
       sum: this.pageSize,
105
-      startDate: this.dateRange[0],
106
-      endDate: this.dateRange[1],
107
-      hosId: this.hosId,
108
-      dutyId: this.dutyId,
109
-      parentDutyId: this.parentDutyId,
110
-      repairDeptId: this.repairDeptId,
111
-      groupId: this.fieldConfig.fields.groupId,
112
-      userId: this.fieldConfig.fields.userId,
113
-      categoryId: this.fieldConfig.fields.categoryId,
114
-      sourceId: this.fieldConfig.fields.sourceId,
115
-      hierarchy: this.fieldConfig.fields.hierarchy,
95
+      startDate: this.dateRange[0] || undefined,
96
+      endDate: this.dateRange[1] || undefined,
97
+      hosId: this.hosId || undefined,
98
+      dutyId: this.dutyId || undefined,
99
+      parentDutyId: this.parentDutyId || undefined,
100
+      groupId: this.fieldConfig.fields.groupId || undefined,
101
+      userId: this.fieldConfig.fields.userId || undefined,
102
+      categoryId: this.fieldConfig.fields.categoryId || undefined,
103
+      buildingId: this.fieldConfig.fields.buildingId || undefined,
104
+      placeId: this.fieldConfig.fields.floorId || undefined,
116 105
     };
117 106
     if (field && sort) {
118 107
       postData.sort = `${field} ${sort === "ascend" ? `asc` : `desc`}`
119 108
     }
120 109
     this.loading1 = true;
121 110
     this.mainService
122
-      .postCustom("itsm/report", "incidentWorkOrder", postData)
111
+      .postCustom("itsm/report", "incidentSource", postData)
123 112
       .subscribe((result) => {
124 113
         this.loading1 = false;
125 114
         this.listOfData = result.dataList.filter((v, i) => { return i != result.dataList.length - 1 });
@@ -166,23 +155,22 @@ export class CategorySourceStatisticsComponent implements OnInit, AfterViewInit
166 155
       nzDuration: 0,
167 156
     }).messageId;
168 157
     let postData:any = {
169
-      startDate: this.dateRange[0],
170
-      endDate: this.dateRange[1],
171
-      hosId: this.hosId,
172
-      dutyId: this.dutyId,
173
-      parentDutyId: this.parentDutyId,
174
-      repairDeptId: this.repairDeptId,
175
-      groupId: this.fieldConfig.fields.groupId,
176
-      userId: this.fieldConfig.fields.userId,
177
-      categoryId: this.fieldConfig.fields.categoryId,
178
-      sourceId: this.fieldConfig.fields.sourceId,
179
-      hierarchy: this.fieldConfig.fields.hierarchy,
158
+      startDate: this.dateRange[0] || undefined,
159
+      endDate: this.dateRange[1] || undefined,
160
+      hosId: this.hosId || undefined,
161
+      dutyId: this.dutyId || undefined,
162
+      parentDutyId: this.parentDutyId || undefined,
163
+      groupId: this.fieldConfig.fields.groupId || undefined,
164
+      userId: this.fieldConfig.fields.userId || undefined,
165
+      categoryId: this.fieldConfig.fields.categoryId || undefined,
166
+      buildingId: this.fieldConfig.fields.buildingId || undefined,
167
+      placeId: this.fieldConfig.fields.floorId || undefined,
180 168
     };
181 169
     if (this.sortCurrentKey && this.sortCurrentValue) {
182 170
       postData.sort = `${this.sortCurrentKey} ${this.sortCurrentValue === "ascend" ? `asc` : `desc`}`
183 171
     }
184 172
     this.mainService
185
-      .postExportCustom("itsm/export", "incidentWorkOrder", postData)
173
+      .postExportCustom("itsm/export", "incidentSource", postData)
186 174
       .subscribe((data) => {
187 175
         this.message.remove(this.excelExportLoading);
188 176
         this.excelExportLoading = false;
@@ -210,52 +198,17 @@ export class CategorySourceStatisticsComponent implements OnInit, AfterViewInit
210 198
 		this.sortCurrentValue = "";
211 199
 		this.sortCurrent = {};
212 200
     this.dateRange = [format(startOfMonth(addMonths(new Date(), -1)), 'yyyy-MM-dd HH:mm:ss'), format(endOfMonth(addMonths(new Date(), -1)), 'yyyy-MM-dd HH:mm:ss')]
213
-    this.repairDeptId = undefined;
214
-    this.fieldConfig.fields = {groupId: undefined, userId: undefined, categoryId: undefined, sourceId: undefined, hierarchy: undefined};
201
+    this.fieldConfig.fields = {groupId: undefined, userId: undefined, categoryId: undefined, buildingId: undefined, floorId: undefined};
215 202
     this.search();
216 203
   }
217 204
 
218
-  // 科室搜索
219
-  changeRepairDeptInp(e) {
220
-    this.searchTimer(this.getRepairDeptList, e);
221
-  }
222
-
223 205
   // 防抖
224 206
   isLoading = false;
225
-  searchTimer(fun, e) {
226
-    this.isLoading = true;
227
-    this.searchTimerSubject.next([fun, e]);
228
-  }
229
-
230
-  openChangeRepairDept(flag){
231
-    flag && this.getRepairDeptList();
232
-  }
233
-
234
-  // 获取报修科室列表
235
-  repairDeptList:any[] = [];
236
-  getRepairDeptList(keyword?) {
237
-    let data = {
238
-      department: {
239
-        cascadeHosId: this.getHosId,
240
-        dept: keyword,
241
-        searchType: 1,
242
-      },
243
-      idx: 0,
244
-      sum: 20,
245
-    };
246
-    this.isLoading = true;
247
-    this.mainService
248
-      .getFetchDataList("data", "department", data)
249
-      .subscribe((data) => {
250
-        this.isLoading = false;
251
-        this.repairDeptList = data.list;
252
-      });
253
-  }
254 207
 
255 208
   // 详细搜索
256 209
   fieldConfig:any = {
257
-    fields: {groupId: undefined, userId: undefined, categoryId: undefined, sourceId: undefined, hierarchy: undefined},
258
-    config: {groupAndUser: true, category123: true, source: true},
210
+    fields: {groupId: undefined, userId: undefined, categoryId: undefined, buildingId: undefined, floorId: undefined},
211
+    config: {groupAndUser: true, category123: true, buildingAndFloor: true},
259 212
   }
260 213
   showSearchMore:boolean = false;
261 214
   showMore(){
@@ -274,5 +227,3 @@ export class CategorySourceStatisticsComponent implements OnInit, AfterViewInit
274 227
     this.onResize();
275 228
   }
276 229
 }
277
-
278
-

+ 2 - 2
src/app/views/new-statistics/maintenance-statistics/category-three-statistics/category-three-statistics.component.ts

@@ -113,7 +113,7 @@ export class CategoryThreeStatisticsComponent implements OnInit, AfterViewInit {
113 113
       userId: this.fieldConfig.fields.userId || undefined,
114 114
       buildingId: this.fieldConfig.fields.buildingId || undefined,
115 115
       placeId: this.fieldConfig.fields.floorId || undefined,
116
-      compantId: this.fieldConfig.fields.compantId || undefined,
116
+      companyId: this.fieldConfig.fields.companyId || undefined,
117 117
       repairDeptId: this.fieldConfig.fields.repairDeptId || undefined,
118 118
       categoryLevel: 3,
119 119
     };
@@ -179,7 +179,7 @@ export class CategoryThreeStatisticsComponent implements OnInit, AfterViewInit {
179 179
       userId: this.fieldConfig.fields.userId || undefined,
180 180
       buildingId: this.fieldConfig.fields.buildingId || undefined,
181 181
       placeId: this.fieldConfig.fields.floorId || undefined,
182
-      compantId: this.fieldConfig.fields.compantId || undefined,
182
+      companyId: this.fieldConfig.fields.companyId || undefined,
183 183
       repairDeptId: this.fieldConfig.fields.repairDeptId || undefined,
184 184
       categoryLevel: 3,
185 185
     };

+ 2 - 2
src/app/views/new-statistics/maintenance-statistics/category-two-statistics/category-two-statistics.component.ts

@@ -112,7 +112,7 @@ export class CategoryTwoStatisticsComponent implements OnInit, AfterViewInit {
112 112
       userId: this.fieldConfig.fields.userId || undefined,
113 113
       buildingId: this.fieldConfig.fields.buildingId || undefined,
114 114
       placeId: this.fieldConfig.fields.floorId || undefined,
115
-      compantId: this.fieldConfig.fields.compantId || undefined,
115
+      companyId: this.fieldConfig.fields.companyId || undefined,
116 116
       repairDeptId: this.fieldConfig.fields.repairDeptId || undefined,
117 117
       categoryLevel: 2,
118 118
     };
@@ -178,7 +178,7 @@ export class CategoryTwoStatisticsComponent implements OnInit, AfterViewInit {
178 178
       userId: this.fieldConfig.fields.userId || undefined,
179 179
       buildingId: this.fieldConfig.fields.buildingId || undefined,
180 180
       placeId: this.fieldConfig.fields.floorId || undefined,
181
-      compantId: this.fieldConfig.fields.compantId || undefined,
181
+      companyId: this.fieldConfig.fields.companyId || undefined,
182 182
       repairDeptId: this.fieldConfig.fields.repairDeptId || undefined,
183 183
       categoryLevel: 2,
184 184
     };

+ 14 - 0
src/app/views/new-statistics/maintenance-statistics/consumable-statistics/consumable-statistics-routing.module.ts

@@ -0,0 +1,14 @@
1
+import { NgModule } from '@angular/core';
2
+import { Routes, RouterModule } from '@angular/router';
3
+import { ConsumableStatisticsComponent } from './consumable-statistics.component';
4
+
5
+
6
+const routes: Routes = [
7
+  { path: '', component: ConsumableStatisticsComponent }
8
+];
9
+
10
+@NgModule({
11
+  imports: [RouterModule.forChild(routes)],
12
+  exports: [RouterModule]
13
+})
14
+export class ConsumableStatisticsRoutingModule { }

+ 70 - 0
src/app/views/new-statistics/maintenance-statistics/consumable-statistics/consumable-statistics.component.html

@@ -0,0 +1,70 @@
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 class="searchDataItem">
9
+      <span class="label">报修科室</span>:
10
+      <nz-select class="selectItem" [nzDropdownMatchSelectWidth]="false" nzServerSearch nzShowSearch (nzOnSearch)="changeRepairDeptInp($event)" nzAllowClear nzPlaceHolder="请选择报修科室" [(ngModel)]="repairDeptId" (nzOpenChange)="openChangeRepairDept($event)">
11
+        <ng-container *ngFor="let option of repairDeptList">
12
+          <nz-option *ngIf="!isLoading" [nzLabel]="option.dept" [nzValue]="option.id"></nz-option>
13
+        </ng-container>
14
+        <nz-option *ngIf="isLoading" nzDisabled nzCustomContent>
15
+          <i nz-icon nzType="loading" class="loading-icon"></i> 搜索中...
16
+        </nz-option>
17
+      </nz-select>
18
+    </div>
19
+  </div>
20
+  <div class="operation">
21
+    <i class="icon_transport transport-gengduo" (click)="showMore()"></i>
22
+    <button nz-button class="btn default" (click)="search()">查询</button>
23
+    <button nz-button class="btn default ml8" (click)="reset()">重置</button>
24
+    <button nz-button class="btn default ml8" (click)="excelExport()" [nzLoading]="excelExportLoading">导出</button>
25
+  </div>
26
+</div>
27
+<div class="moreFilter" *ngIf="fieldConfig.fields.groupDTO || fieldConfig.fields.userDTO || fieldConfig.fields.category1DTO || fieldConfig.fields.category2DTO || fieldConfig.fields.category3DTO || fieldConfig.fields.buildingDTO || fieldConfig.fields.floorDTO || fieldConfig.fields.companyDTO">
28
+  <span>{{fieldConfig.fields.groupDTO?.groupName}}</span>
29
+  <span>{{fieldConfig.fields.userDTO?.name}}</span>
30
+  <span>{{fieldConfig.fields.category1DTO?.category}}</span>
31
+  <span>{{fieldConfig.fields.category2DTO?.category}}</span>
32
+  <span>{{fieldConfig.fields.category3DTO?.category}}</span>
33
+  <span>{{fieldConfig.fields.buildingDTO?.buildingName}}</span>
34
+  <span>{{fieldConfig.fields.floorDTO?.floorName}}</span>
35
+  <span>{{fieldConfig.fields.companyDTO?.name}}</span>
36
+</div>
37
+<nz-table class="table" [nzData]="listOfData" nzSize="middle" [nzShowPagination]="false" [nzLoading]="loading1" [nzScroll]="{ y: tableHeight + 'px' }" [nzFooter]="footerTpl">
38
+  <thead (nzSortChange)="sort($event)" nzSingleSort>
39
+    <tr>
40
+      <th nzWidth="25%">耗材名称(耗材编号)</th>
41
+      <th nzWidth="25%" nzShowSort nzSortKey="sum" [(nzSort)]="sortCurrent.sum">工单总数</th>
42
+      <th nzWidth="25%" nzShowSort nzSortKey="consumableNum" [(nzSort)]="sortCurrent.consumableNum">使用数量</th>
43
+      <th nzWidth="25%" nzShowSort nzSortKey="consumablePrice" [(nzSort)]="sortCurrent.consumablePrice">总费用(元)</th>
44
+    </tr>
45
+  </thead>
46
+  <tbody>
47
+    <tr *ngFor="let data of listOfData">
48
+      <td>{{ data.consumableName }}({{ data.consumableCode }})</td>
49
+      <td>{{ data.sum }}</td>
50
+      <td>{{ data.consumableNum }}</td>
51
+      <td>{{ data.consumablePrice }}</td>
52
+    </tr>
53
+  </tbody>
54
+  <ng-template #footerTpl>
55
+    <table class="footTable">
56
+      <tr *ngFor="let data of listOfDataEnd">
57
+        <td style="width: 25%">{{ data.consumableName }}</td>
58
+        <td style="width: 25%">{{ data.sum }}</td>
59
+        <td style="width: 25%">{{ data.consumableNum }}</td>
60
+        <td style="width: 25%">{{ data.consumablePrice }}</td>
61
+      </tr>
62
+    </table>
63
+  </ng-template>
64
+</nz-table>
65
+<div class="pagination">
66
+  <nz-pagination [(nzPageIndex)]="pageIndex" [(nzTotal)]="listLength" [(nzPageSize)]="pageSize" (nzPageIndexChange)="getList(pageIndex, sortCurrentKey, sortCurrentValue)" (nzPageSizeChange)="getList(pageIndex, sortCurrentKey, sortCurrentValue)"></nz-pagination>
67
+</div>
68
+
69
+<!-- 详细搜索 -->
70
+<app-search-more [fieldConfig]="fieldConfig" *ngIf="showSearchMore" [hosId]="hosId" [queryType]="queryType"  [dutyId]="dutyId"  [parentDutyId]="parentDutyId" (cancelEvent)="cancelEvent()" (submitEvent)="submitEvent($event)"></app-search-more>

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

@@ -0,0 +1,71 @@
1
+@import "../../../../../../src/theme.less";
2
+:host{
3
+  position: absolute;
4
+  top: 0;
5
+  right: 0;
6
+  bottom: 0;
7
+  left: 0;
8
+  ::ng-deep .ant-table-footer{
9
+    padding: 16px 0;
10
+    width: calc(100% - 16px);
11
+    font-weight: bold;
12
+  }
13
+  tr, th{
14
+    text-align: center;
15
+  }
16
+  .searchDataWrap{
17
+    display: flex;
18
+    align-items: center;
19
+    justify-content: space-between;
20
+    .searchData{
21
+      padding: 16px;
22
+      display: flex;
23
+      align-items: center;
24
+      .searchDataItem{
25
+        margin-right: 24px;
26
+        .label{
27
+          font-size: 16px;
28
+        }
29
+        .selectItem{
30
+          width: 224px;
31
+        }
32
+      }
33
+    }
34
+    .operation{
35
+      margin-right: 16px;
36
+      display: flex;
37
+      align-items: center;
38
+      cursor: pointer;
39
+      .icon_transport{
40
+        margin-right: 16px;
41
+        font-size: 24px;
42
+      }
43
+      .btn{
44
+        &.default{
45
+          height: 32px;
46
+          line-height: 32px;
47
+          min-width: 70px;
48
+        }
49
+      }
50
+    }
51
+  }
52
+
53
+  .table{
54
+    margin: 0 8px;
55
+  }
56
+
57
+  .moreFilter{
58
+    margin-bottom: 16px;
59
+    span{
60
+      margin-left: 16px;
61
+      color: @primary-color;
62
+    }
63
+  }
64
+
65
+  .pagination{
66
+    padding: 16px;
67
+    display: flex;
68
+    justify-content: flex-end;
69
+    align-items: center;
70
+  }
71
+}

+ 273 - 0
src/app/views/new-statistics/maintenance-statistics/consumable-statistics/consumable-statistics.component.ts

@@ -0,0 +1,273 @@
1
+import { debounceTime } from 'rxjs/operators';
2
+import { Subject } from 'rxjs';
3
+import { NzMessageService } from 'ng-zorro-antd/message';
4
+import { format, addMonths, startOfMonth, endOfMonth, startOfDay, endOfDay } from 'date-fns';
5
+import { Component, OnInit, HostListener, AfterViewInit } from "@angular/core";
6
+import { MainService } from 'src/app/services/main.service';
7
+import { ActivatedRoute } from '@angular/router';
8
+@Component({
9
+  selector: "app-consumable-statistics",
10
+  templateUrl: "./consumable-statistics.component.html",
11
+  styleUrls: ["./consumable-statistics.component.less"],
12
+})
13
+export class ConsumableStatisticsComponent implements OnInit, AfterViewInit {
14
+  constructor(
15
+    private mainService: MainService,
16
+    private message: NzMessageService,
17
+    private route: ActivatedRoute,
18
+  ) {}
19
+
20
+  listOfData: any[] = []; //表格数据
21
+  listOfDataEnd: any[] = []; //表格合计
22
+  pageIndex: number = 1; //表格当前页码
23
+  pageSize: number = 30; //表格每页展示条数
24
+  listLength: number = 0; //表格总数据量
25
+
26
+  repairDeptId;//报修科室id
27
+
28
+  searchTimerSubject = new Subject();
29
+
30
+  ngOnInit() {
31
+    this.searchTimerSubject.pipe(debounceTime(500)).subscribe((v) => {
32
+      let fun = v[0];
33
+      fun.call(this, v[1]);
34
+    });
35
+    this.initSessionData();
36
+    this.search();
37
+  }
38
+
39
+  ngAfterViewInit(){
40
+    this.onResize();
41
+  }
42
+
43
+  tableHeight:number = 0;
44
+  @HostListener('window:resize')
45
+  onResize(): void {
46
+    setTimeout(() => {
47
+      this.tableHeight = window.innerHeight - 64 - 64 - 36 - 48 - 8 - 45 - 54 - this.getMoreFilter;
48
+      console.log('this.tableHeight:', this.tableHeight)
49
+    }, 0)
50
+  }
51
+
52
+  get getMoreFilter(){
53
+    let flag = this.fieldConfig.fields.groupDTO || this.fieldConfig.fields.userDTO || this.fieldConfig.fields.category1DTO || this.fieldConfig.fields.category2DTO || this.fieldConfig.fields.category3DTO || this.fieldConfig.fields.buildingDTO || this.fieldConfig.fields.floorDTO || this.fieldConfig.fields.companyDTO;
54
+    return flag ? 21 : 0;
55
+  }
56
+
57
+  // 初始化缓存数据
58
+  queryType:any;
59
+  hosId:any;
60
+  dutyId:any;
61
+  parentDutyId:any;
62
+  initSessionData(){
63
+    let maintenanceStatistics = JSON.parse(sessionStorage.getItem('maintenanceStatistics'));
64
+    let queryType:any = maintenanceStatistics.queryType;
65
+    let hosId:any = maintenanceStatistics.hospitalId;
66
+    let dutyId:any = maintenanceStatistics.dutyId;
67
+
68
+    queryType = queryType ? +queryType : undefined;
69
+    hosId = hosId ? +hosId : undefined;
70
+    dutyId = dutyId ? +dutyId : undefined;
71
+
72
+    this.queryType = queryType;
73
+    if(queryType == 1){
74
+      this.hosId = undefined;
75
+      this.dutyId = undefined;
76
+      this.parentDutyId = undefined;
77
+    }else if(queryType == 2){
78
+      this.hosId = hosId;
79
+      this.dutyId = undefined;
80
+      this.parentDutyId = undefined;
81
+    }else if(queryType == 3){
82
+      this.hosId = undefined;
83
+      this.dutyId = dutyId;
84
+      this.parentDutyId = undefined;
85
+    }else if(queryType == 4){
86
+      this.hosId = undefined;
87
+      this.dutyId = undefined;
88
+      this.parentDutyId = dutyId;
89
+    }
90
+  }
91
+
92
+  get getHosId(){
93
+    return this.parentDutyId || this.dutyId || this.hosId;
94
+  }
95
+
96
+  // 表格数据
97
+  loading1 = false;
98
+  getList(num?: number, field?: string, sort?: string) {
99
+    if (num !== undefined) {
100
+      this.pageIndex = num;
101
+    }
102
+    let postData:any = {
103
+      idx: this.pageIndex - 1,
104
+      sum: this.pageSize,
105
+      startDate: this.dateRange[0] || undefined,
106
+      endDate: this.dateRange[1] || undefined,
107
+      hosId: this.hosId || undefined,
108
+      dutyId: this.dutyId || undefined,
109
+      parentDutyId: this.parentDutyId || undefined,
110
+      repairDeptId: this.repairDeptId || undefined,
111
+      groupId: this.fieldConfig.fields.groupId || undefined,
112
+      userId: this.fieldConfig.fields.userId || undefined,
113
+      categoryId: this.fieldConfig.fields.categoryId || undefined,
114
+      buildingId: this.fieldConfig.fields.buildingId || undefined,
115
+      placeId: this.fieldConfig.fields.floorId || undefined,
116
+      companyId: this.fieldConfig.fields.companyId || undefined,
117
+    };
118
+    if (field && sort) {
119
+      postData.sort = `${field} ${sort === "ascend" ? `asc` : `desc`}`
120
+    }
121
+    this.loading1 = true;
122
+    this.mainService
123
+      .postCustom("itsm/report", "consumableIncident", postData)
124
+      .subscribe((result) => {
125
+        this.loading1 = false;
126
+        this.listOfData = result.dataList.filter((v, i) => { return i != result.dataList.length - 1 });
127
+        this.listOfDataEnd = result.dataList.filter((v, i) => { return i == result.dataList.length - 1 });
128
+        this.listLength = result.totalCount;
129
+      });
130
+  }
131
+
132
+  // 列表排序
133
+  sortCurrent:any = {};
134
+  sortCurrentKey: string = "";
135
+  sortCurrentValue: string | null = "";
136
+  sort(e) {
137
+    const { key, value } = e;
138
+    this.sortCurrentKey = key;
139
+    this.sortCurrentValue = value;
140
+    this.getList(this.pageIndex, this.sortCurrentKey, this.sortCurrentValue);
141
+  }
142
+
143
+  // 搜索
144
+  search() {
145
+    this.getList(1, this.sortCurrentKey, this.sortCurrentValue);
146
+  }
147
+
148
+  // 日期选择
149
+  dateRange: any = [format(startOfMonth(addMonths(new Date(), -1)), 'yyyy-MM-dd HH:mm:ss'), format(endOfMonth(addMonths(new Date(), -1)), 'yyyy-MM-dd HH:mm:ss')];
150
+  changeDate(result?): void {
151
+    result[0] = format(startOfDay(result[0]), 'yyyy-MM-dd HH:mm:ss');
152
+    result[1] = format(endOfDay(result[1]), 'yyyy-MM-dd HH:mm:ss');
153
+    this.dateRange = result;
154
+  }
155
+
156
+  onCalendarChangeDate(dateArr){
157
+    console.log(dateArr)
158
+    if(dateArr.length == 2){
159
+      this.dateRange = [format(startOfDay(dateArr[0]), 'yyyy-MM-dd HH:mm:ss'), format(endOfDay(dateArr[1]), 'yyyy-MM-dd HH:mm:ss')];
160
+    }
161
+  }
162
+
163
+  // 导出
164
+  excelExportLoading:any = false;
165
+  excelExport(){
166
+    this.excelExportLoading = this.message.loading("导出中..", {
167
+      nzDuration: 0,
168
+    }).messageId;
169
+    let postData:any = {
170
+      startDate: this.dateRange[0] || undefined,
171
+      endDate: this.dateRange[1] || undefined,
172
+      hosId: this.hosId || undefined,
173
+      dutyId: this.dutyId || undefined,
174
+      parentDutyId: this.parentDutyId || undefined,
175
+      repairDeptId: this.repairDeptId || undefined,
176
+      groupId: this.fieldConfig.fields.groupId || undefined,
177
+      userId: this.fieldConfig.fields.userId || undefined,
178
+      categoryId: this.fieldConfig.fields.categoryId || undefined,
179
+      buildingId: this.fieldConfig.fields.buildingId || undefined,
180
+      placeId: this.fieldConfig.fields.floorId || undefined,
181
+      companyId: this.fieldConfig.fields.companyId || undefined,
182
+    };
183
+    if (this.sortCurrentKey && this.sortCurrentValue) {
184
+      postData.sort = `${this.sortCurrentKey} ${this.sortCurrentValue === "ascend" ? `asc` : `desc`}`
185
+    }
186
+    this.mainService
187
+      .postExportCustom("itsm/export", "consumableIncident", postData)
188
+      .subscribe((data) => {
189
+        this.message.remove(this.excelExportLoading);
190
+        this.excelExportLoading = false;
191
+        this.message.success('导出成功');
192
+        var file = new Blob([data], {
193
+          type: "application/vnd.ms-excel",
194
+        });
195
+        //trick to download store a file having its URL
196
+        var fileURL = URL.createObjectURL(file);
197
+        var a = document.createElement("a");
198
+        a.href = fileURL;
199
+        a.target = "_blank";
200
+        a.download = `${this.route.parent.routeConfig.data.title}.xls`;
201
+        document.body.appendChild(a);
202
+        a.click();
203
+      },(err) => {
204
+        this.message.remove(this.excelExportLoading);
205
+        this.excelExportLoading = false;
206
+        this.message.error('导出失败');
207
+      });
208
+  }
209
+  // 重置
210
+  reset(){
211
+    this.sortCurrentKey = "";
212
+		this.sortCurrentValue = "";
213
+		this.sortCurrent = {};
214
+    this.dateRange = [format(startOfMonth(addMonths(new Date(), -1)), 'yyyy-MM-dd HH:mm:ss'), format(endOfMonth(addMonths(new Date(), -1)), 'yyyy-MM-dd HH:mm:ss')]
215
+    this.repairDeptId = undefined;
216
+    this.fieldConfig.fields = {groupId: undefined, userId: undefined, categoryId: undefined, buildingId: undefined, floorId: undefined, companyId: undefined};
217
+    this.search();
218
+  }
219
+
220
+  // 防抖
221
+  isLoading = false;
222
+  searchTimer(fun, e) {
223
+    this.isLoading = true;
224
+    this.searchTimerSubject.next([fun, e]);
225
+  }
226
+
227
+  openChangeRepairDept(flag){
228
+    flag && this.getRepairDeptList();
229
+  }
230
+
231
+  // 获取报修科室列表
232
+  repairDeptList:any[] = [];
233
+  getRepairDeptList(keyword?) {
234
+    let data = {
235
+      department: {
236
+        cascadeHosId: this.getHosId,
237
+        dept: keyword,
238
+        searchType: 1,
239
+      },
240
+      idx: 0,
241
+      sum: 20,
242
+    };
243
+    this.isLoading = true;
244
+    this.mainService
245
+      .getFetchDataList("data", "department", data)
246
+      .subscribe((data) => {
247
+        this.isLoading = false;
248
+        this.repairDeptList = data.list;
249
+      });
250
+  }
251
+
252
+  // 详细搜索
253
+  fieldConfig:any = {
254
+    fields: {groupId: undefined, userId: undefined, categoryId: undefined, buildingId: undefined, floorId: undefined, companyId: undefined},
255
+    config: {groupAndUser: true, category123: true, buildingAndFloor: true, company: true},
256
+  }
257
+  showSearchMore:boolean = false;
258
+  showMore(){
259
+    this.showSearchMore = true;
260
+  }
261
+
262
+  cancelEvent(){
263
+    this.showSearchMore = false;
264
+  }
265
+
266
+  submitEvent(fields){
267
+    this.showSearchMore = false;
268
+    this.fieldConfig.fields = fields;
269
+    console.log('this.fieldConfig.fields:', this.fieldConfig.fields)
270
+    this.search();
271
+    this.onResize();
272
+  }
273
+}

+ 21 - 0
src/app/views/new-statistics/maintenance-statistics/consumable-statistics/consumable-statistics.module.ts

@@ -0,0 +1,21 @@
1
+import { ConsumableStatisticsComponent } from './consumable-statistics.component';
2
+import { NgModule } from '@angular/core';
3
+import { CommonModule } from '@angular/common';
4
+
5
+import { ConsumableStatisticsRoutingModule } from './consumable-statistics-routing.module';
6
+import { ShareModule } from 'src/app/share/share.module';
7
+import { SearchMoreModule } from '../../components/search-more/search-more.module';
8
+
9
+
10
+@NgModule({
11
+  declarations: [
12
+    ConsumableStatisticsComponent,
13
+  ],
14
+  imports: [
15
+    CommonModule,
16
+    ConsumableStatisticsRoutingModule,
17
+    ShareModule,
18
+    SearchMoreModule,
19
+  ]
20
+})
21
+export class ConsumableStatisticsModule { }

+ 41 - 43
src/app/views/new-statistics/maintenance-statistics/department-evaluate-statistics/department-evaluate-statistics.component.html

@@ -6,15 +6,15 @@
6 6
       </nz-range-picker>
7 7
     </div>
8 8
     <div class="searchDataItem">
9
-      <span class="label">报修科室</span>:
10
-      <nz-select class="selectItem" [nzDropdownMatchSelectWidth]="false" nzServerSearch nzShowSearch (nzOnSearch)="changeRepairDeptInp($event)" nzAllowClear nzPlaceHolder="请选择报修科室" [(ngModel)]="repairDeptId" (nzOpenChange)="openChangeRepairDept($event)">
11
-      <ng-container *ngFor="let option of repairDeptList">
12
-        <nz-option *ngIf="!isLoading" [nzLabel]="option.dept" [nzValue]="option.id"></nz-option>
13
-      </ng-container>
14
-      <nz-option *ngIf="isLoading" nzDisabled nzCustomContent>
15
-        <i nz-icon nzType="loading" class="loading-icon"></i> 搜索中...
16
-      </nz-option>
17
-    </nz-select>
9
+      <span class="label">科室类型</span>:
10
+      <nz-select class="selectItem" [nzDropdownMatchSelectWidth]="false" nzAllowClear nzPlaceHolder="请选择科室类型" [(ngModel)]="deptTypeId" (nzOpenChange)="openChangeDeptType($event)">
11
+        <ng-container *ngFor="let option of deptTypeList">
12
+          <nz-option *ngIf="!isLoading" [nzLabel]="option.name" [nzValue]="option.id"></nz-option>
13
+        </ng-container>
14
+        <nz-option *ngIf="isLoading" nzDisabled nzCustomContent>
15
+          <i nz-icon nzType="loading" class="loading-icon"></i> 搜索中...
16
+        </nz-option>
17
+      </nz-select>
18 18
     </div>
19 19
   </div>
20 20
   <div class="operation">
@@ -24,59 +24,57 @@
24 24
     <button nz-button class="btn default ml8" (click)="excelExport()" [nzLoading]="excelExportLoading">导出</button>
25 25
   </div>
26 26
 </div>
27
-<div class="moreFilter" *ngIf="fieldConfig.fields.groupDTO || fieldConfig.fields.userDTO || fieldConfig.fields.category1DTO || fieldConfig.fields.category2DTO || fieldConfig.fields.category3DTO || fieldConfig.fields.sourceDTO">
27
+<div class="moreFilter" *ngIf="fieldConfig.fields.groupDTO || fieldConfig.fields.userDTO || fieldConfig.fields.category1DTO || fieldConfig.fields.category2DTO || fieldConfig.fields.category3DTO || fieldConfig.fields.buildingDTO || fieldConfig.fields.floorDTO">
28 28
   <span>{{fieldConfig.fields.groupDTO?.groupName}}</span>
29 29
   <span>{{fieldConfig.fields.userDTO?.name}}</span>
30 30
   <span>{{fieldConfig.fields.category1DTO?.category}}</span>
31 31
   <span>{{fieldConfig.fields.category2DTO?.category}}</span>
32 32
   <span>{{fieldConfig.fields.category3DTO?.category}}</span>
33
-  <span>{{fieldConfig.fields.sourceDTO?.name}}</span>
33
+  <span>{{fieldConfig.fields.buildingDTO?.buildingName}}</span>
34
+  <span>{{fieldConfig.fields.floorDTO?.floorName}}</span>
34 35
 </div>
35 36
 <nz-table class="table" [nzData]="listOfData" nzSize="middle" [nzShowPagination]="false" [nzLoading]="loading1" [nzScroll]="{ y: tableHeight + 'px' }" [nzFooter]="footerTpl">
36 37
   <thead (nzSortChange)="sort($event)" nzSingleSort>
37 38
     <tr>
38
-      <th nzWidth="10%" nzShowSort nzSortKey="startDate" [(nzSort)]="sortCurrent.startDate">时间</th>
39
-      <th nzWidth="9%" nzShowSort nzSortKey="sum" [(nzSort)]="sortCurrent.sum">工单总数</th>
40
-      <th nzWidth="9%" nzShowSort nzSortKey="avgResponseTime" [(nzSort)]="sortCurrent.avgResponseTime">平均响应时间</th>
41
-      <th nzWidth="9%" nzShowSort nzSortKey="avgResolvedTime" [(nzSort)]="sortCurrent.avgResolvedTime">平均解决时间</th>
42
-      <th nzWidth="9%" nzShowSort nzSortKey="resolvedOverNum" [(nzSort)]="sortCurrent.resolvedOverNum">超时单数</th>
43
-      <th nzWidth="9%" nzShowSort nzSortKey="overTimeNum" [(nzSort)]="sortCurrent.overTimeNum">挂起单数</th>
44
-      <th nzWidth="9%" nzShowSort nzSortKey="consumablePrice" [(nzSort)]="sortCurrent.consumablePrice">耗材费用(元)</th>
45
-      <th nzWidth="9%" nzShowSort nzSortKey="workHourPrice" [(nzSort)]="sortCurrent.workHourPrice">工时费用(元)</th>
46
-      <th nzWidth="9%" nzShowSort nzSortKey="totalPrice" [(nzSort)]="sortCurrent.totalPrice">总费用(元)</th>
47
-      <th nzWidth="9%" nzShowSort nzSortKey="negativeNum" [(nzSort)]="sortCurrent.negativeNum">差评单数</th>
48
-      <th nzWidth="9%" nzShowSort nzSortKey="favorableRate" [(nzSort)]="sortCurrent.favorableRate">好评率</th>
39
+      <th nzWidth="10%">科室名称(编码)</th>
40
+      <th nzWidth="10%" nzShowSort nzSortKey="sum" [(nzSort)]="sortCurrent.sum">工单总数</th>
41
+      <th nzWidth="10%" nzShowSort nzSortKey="degreeCount" [(nzSort)]="sortCurrent.degreeCount">评价工单数</th>
42
+      <th nzWidth="10%" nzShowSort nzSortKey="oneStar" [(nzSort)]="sortCurrent.oneStar">一星</th>
43
+      <th nzWidth="10%" nzShowSort nzSortKey="twoStar" [(nzSort)]="sortCurrent.twoStar">二星</th>
44
+      <th nzWidth="10%" nzShowSort nzSortKey="threeStar" [(nzSort)]="sortCurrent.threeStar">三星</th>
45
+      <th nzWidth="10%" nzShowSort nzSortKey="fourStar" [(nzSort)]="sortCurrent.fourStar">四星</th>
46
+      <th nzWidth="10%" nzShowSort nzSortKey="fiveStar" [(nzSort)]="sortCurrent.fiveStar">五星</th>
47
+      <th nzWidth="10%" nzShowSort nzSortKey="totalStar" [(nzSort)]="sortCurrent.totalStar">评价总星数</th>
48
+      <th nzWidth="10%" nzShowSort nzSortKey="avgStar" [(nzSort)]="sortCurrent.avgStar">平均总星数</th>
49 49
     </tr>
50 50
   </thead>
51 51
   <tbody>
52 52
     <tr *ngFor="let data of listOfData">
53
-      <td>{{ data.startDate }}</td>
53
+      <td>{{ data.deptName }}({{ data.deptCode }})</td>
54 54
       <td>{{ data.sum }}</td>
55
-      <td>{{ data.avgResponseTime }}</td>
56
-      <td>{{ data.avgResolvedTime }}</td>
57
-      <td>{{ data.resolvedOverNum }}</td>
58
-      <td>{{ data.overTimeNum }}</td>
59
-      <td>{{ data.consumablePrice }}</td>
60
-      <td>{{ data.workHourPrice }}</td>
61
-      <td>{{ data.totalPrice }}</td>
62
-      <td>{{ data.negativeNum }}</td>
63
-      <td>{{ data.favorableRate }}</td>
55
+      <td>{{ data.degreeCount }}</td>
56
+      <td>{{ data.oneStar }}</td>
57
+      <td>{{ data.twoStar }}</td>
58
+      <td>{{ data.threeStar }}</td>
59
+      <td>{{ data.fourStar }}</td>
60
+      <td>{{ data.fiveStar }}</td>
61
+      <td>{{ data.totalStar }}</td>
62
+      <td>{{ data.avgStar }}</td>
64 63
     </tr>
65 64
   </tbody>
66 65
   <ng-template #footerTpl>
67 66
     <table class="footTable">
68 67
       <tr *ngFor="let data of listOfDataEnd">
69
-        <td style="width: 10%">{{ data.startDate }}</td>
70
-        <td style="width: 9%">{{ data.sum }}</td>
71
-        <td style="width: 9%">{{ data.avgResponseTime }}</td>
72
-        <td style="width: 9%">{{ data.avgResolvedTime }}</td>
73
-        <td style="width: 9%">{{ data.resolvedOverNum }}</td>
74
-        <td style="width: 9%">{{ data.overTimeNum }}</td>
75
-        <td style="width: 9%">{{ data.consumablePrice }}</td>
76
-        <td style="width: 9%">{{ data.workHourPrice }}</td>
77
-        <td style="width: 9%">{{ data.totalPrice }}</td>
78
-        <td style="width: 9%">{{ data.negativeNum }}</td>
79
-        <td style="width: 9%">{{ data.favorableRate }}</td>
68
+        <td style="width: 10%">{{ data.deptCode }}</td>
69
+        <td style="width: 10%">{{ data.sum }}</td>
70
+        <td style="width: 10%">{{ data.degreeCount }}</td>
71
+        <td style="width: 10%">{{ data.oneStar }}</td>
72
+        <td style="width: 10%">{{ data.twoStar }}</td>
73
+        <td style="width: 10%">{{ data.threeStar }}</td>
74
+        <td style="width: 10%">{{ data.fourStar }}</td>
75
+        <td style="width: 10%">{{ data.fiveStar }}</td>
76
+        <td style="width: 10%">{{ data.totalStar }}</td>
77
+        <td style="width: 10%">{{ data.avgStar }}</td>
80 78
       </tr>
81 79
     </table>
82 80
   </ng-template>

+ 37 - 65
src/app/views/new-statistics/maintenance-statistics/department-evaluate-statistics/department-evaluate-statistics.component.ts

@@ -1,5 +1,3 @@
1
-import { debounceTime } from 'rxjs/operators';
2
-import { Subject } from 'rxjs';
3 1
 import { NzMessageService } from 'ng-zorro-antd/message';
4 2
 import { format, addMonths, startOfMonth, endOfMonth, startOfDay, endOfDay } from 'date-fns';
5 3
 import { Component, OnInit, HostListener, AfterViewInit } from "@angular/core";
@@ -23,15 +21,9 @@ export class DepartmentEvaluateStatisticsComponent implements OnInit, AfterViewI
23 21
   pageSize: number = 30; //表格每页展示条数
24 22
   listLength: number = 0; //表格总数据量
25 23
 
26
-  repairDeptId;//报修科室id
27
-
28
-  searchTimerSubject = new Subject();
24
+  deptTypeId;//科室类型id
29 25
 
30 26
   ngOnInit() {
31
-    this.searchTimerSubject.pipe(debounceTime(500)).subscribe((v) => {
32
-      let fun = v[0];
33
-      fun.call(this, v[1]);
34
-    });
35 27
     this.initSessionData();
36 28
     this.search();
37 29
   }
@@ -50,7 +42,7 @@ export class DepartmentEvaluateStatisticsComponent implements OnInit, AfterViewI
50 42
   }
51 43
 
52 44
   get getMoreFilter(){
53
-    let flag = this.fieldConfig.fields.groupDTO || this.fieldConfig.fields.userDTO || this.fieldConfig.fields.category1DTO || this.fieldConfig.fields.category2DTO || this.fieldConfig.fields.category3DTO || this.fieldConfig.fields.sourceDTO;
45
+    let flag = this.fieldConfig.fields.groupDTO || this.fieldConfig.fields.userDTO || this.fieldConfig.fields.category1DTO || this.fieldConfig.fields.category2DTO || this.fieldConfig.fields.category3DTO || this.fieldConfig.fields.buildingDTO || this.fieldConfig.fields.floorDTO;
54 46
     return flag ? 21 : 0;
55 47
   }
56 48
 
@@ -102,24 +94,24 @@ export class DepartmentEvaluateStatisticsComponent implements OnInit, AfterViewI
102 94
     let postData:any = {
103 95
       idx: this.pageIndex - 1,
104 96
       sum: this.pageSize,
105
-      startDate: this.dateRange[0],
106
-      endDate: this.dateRange[1],
107
-      hosId: this.hosId,
108
-      dutyId: this.dutyId,
109
-      parentDutyId: this.parentDutyId,
110
-      repairDeptId: this.repairDeptId,
111
-      groupId: this.fieldConfig.fields.groupId,
112
-      userId: this.fieldConfig.fields.userId,
113
-      categoryId: this.fieldConfig.fields.categoryId,
114
-      sourceId: this.fieldConfig.fields.sourceId,
115
-      hierarchy: this.fieldConfig.fields.hierarchy,
97
+      startDate: this.dateRange[0] || undefined,
98
+      endDate: this.dateRange[1] || undefined,
99
+      hosId: this.hosId || undefined,
100
+      dutyId: this.dutyId || undefined,
101
+      parentDutyId: this.parentDutyId || undefined,
102
+      deptTypeId: this.deptTypeId || undefined,
103
+      groupId: this.fieldConfig.fields.groupId || undefined,
104
+      userId: this.fieldConfig.fields.userId || undefined,
105
+      categoryId: this.fieldConfig.fields.categoryId || undefined,
106
+      buildingId: this.fieldConfig.fields.buildingId || undefined,
107
+      placeId: this.fieldConfig.fields.floorId || undefined,
116 108
     };
117 109
     if (field && sort) {
118 110
       postData.sort = `${field} ${sort === "ascend" ? `asc` : `desc`}`
119 111
     }
120 112
     this.loading1 = true;
121 113
     this.mainService
122
-      .postCustom("itsm/report", "incidentWorkOrder", postData)
114
+      .postCustom("itsm/report", "deptEvaluate", postData)
123 115
       .subscribe((result) => {
124 116
         this.loading1 = false;
125 117
         this.listOfData = result.dataList.filter((v, i) => { return i != result.dataList.length - 1 });
@@ -166,23 +158,23 @@ export class DepartmentEvaluateStatisticsComponent implements OnInit, AfterViewI
166 158
       nzDuration: 0,
167 159
     }).messageId;
168 160
     let postData:any = {
169
-      startDate: this.dateRange[0],
170
-      endDate: this.dateRange[1],
171
-      hosId: this.hosId,
172
-      dutyId: this.dutyId,
173
-      parentDutyId: this.parentDutyId,
174
-      repairDeptId: this.repairDeptId,
175
-      groupId: this.fieldConfig.fields.groupId,
176
-      userId: this.fieldConfig.fields.userId,
177
-      categoryId: this.fieldConfig.fields.categoryId,
178
-      sourceId: this.fieldConfig.fields.sourceId,
179
-      hierarchy: this.fieldConfig.fields.hierarchy,
161
+      startDate: this.dateRange[0] || undefined,
162
+      endDate: this.dateRange[1] || undefined,
163
+      hosId: this.hosId || undefined,
164
+      dutyId: this.dutyId || undefined,
165
+      parentDutyId: this.parentDutyId || undefined,
166
+      deptTypeId: this.deptTypeId || undefined,
167
+      groupId: this.fieldConfig.fields.groupId || undefined,
168
+      userId: this.fieldConfig.fields.userId || undefined,
169
+      categoryId: this.fieldConfig.fields.categoryId || undefined,
170
+      buildingId: this.fieldConfig.fields.buildingId || undefined,
171
+      placeId: this.fieldConfig.fields.floorId || undefined,
180 172
     };
181 173
     if (this.sortCurrentKey && this.sortCurrentValue) {
182 174
       postData.sort = `${this.sortCurrentKey} ${this.sortCurrentValue === "ascend" ? `asc` : `desc`}`
183 175
     }
184 176
     this.mainService
185
-      .postExportCustom("itsm/export", "incidentWorkOrder", postData)
177
+      .postExportCustom("itsm/export", "deptEvaluate", postData)
186 178
       .subscribe((data) => {
187 179
         this.message.remove(this.excelExportLoading);
188 180
         this.excelExportLoading = false;
@@ -210,52 +202,34 @@ export class DepartmentEvaluateStatisticsComponent implements OnInit, AfterViewI
210 202
 		this.sortCurrentValue = "";
211 203
 		this.sortCurrent = {};
212 204
     this.dateRange = [format(startOfMonth(addMonths(new Date(), -1)), 'yyyy-MM-dd HH:mm:ss'), format(endOfMonth(addMonths(new Date(), -1)), 'yyyy-MM-dd HH:mm:ss')]
213
-    this.repairDeptId = undefined;
214
-    this.fieldConfig.fields = {groupId: undefined, userId: undefined, categoryId: undefined, sourceId: undefined, hierarchy: undefined};
205
+    this.deptTypeId = undefined;
206
+    this.fieldConfig.fields = {groupId: undefined, userId: undefined, categoryId: undefined, buildingId: undefined, floorId: undefined};
215 207
     this.search();
216 208
   }
217 209
 
218
-  // 科室搜索
219
-  changeRepairDeptInp(e) {
220
-    this.searchTimer(this.getRepairDeptList, e);
221
-  }
222
-
223 210
   // 防抖
224 211
   isLoading = false;
225
-  searchTimer(fun, e) {
226
-    this.isLoading = true;
227
-    this.searchTimerSubject.next([fun, e]);
228
-  }
229 212
 
230
-  openChangeRepairDept(flag){
231
-    flag && this.getRepairDeptList();
213
+  openChangeDeptType(flag){
214
+    flag && this.getDeptTypeList();
232 215
   }
233 216
 
234
-  // 获取报修科室列表
235
-  repairDeptList:any[] = [];
236
-  getRepairDeptList(keyword?) {
237
-    let data = {
238
-      department: {
239
-        cascadeHosId: this.getHosId,
240
-        dept: keyword,
241
-        searchType: 1,
242
-      },
243
-      idx: 0,
244
-      sum: 20,
245
-    };
217
+  // 获取科室类型列表
218
+  deptTypeList:any[] = [];
219
+  getDeptTypeList(keyword?) {
246 220
     this.isLoading = true;
247 221
     this.mainService
248
-      .getFetchDataList("data", "department", data)
222
+      .getDictionary("list", "dept_type")
249 223
       .subscribe((data) => {
250 224
         this.isLoading = false;
251
-        this.repairDeptList = data.list;
225
+        this.deptTypeList = data;
252 226
       });
253 227
   }
254 228
 
255 229
   // 详细搜索
256 230
   fieldConfig:any = {
257
-    fields: {groupId: undefined, userId: undefined, categoryId: undefined, sourceId: undefined, hierarchy: undefined},
258
-    config: {groupAndUser: true, category123: true, source: true},
231
+    fields: {groupId: undefined, userId: undefined, categoryId: undefined, buildingId: undefined, floorId: undefined},
232
+    config: {groupAndUser: true, category123: true, buildingAndFloor: true},
259 233
   }
260 234
   showSearchMore:boolean = false;
261 235
   showMore(){
@@ -274,5 +248,3 @@ export class DepartmentEvaluateStatisticsComponent implements OnInit, AfterViewI
274 248
     this.onResize();
275 249
   }
276 250
 }
277
-
278
-

+ 15 - 14
src/app/views/new-statistics/maintenance-statistics/department-incident-statistics/department-incident-statistics.component.html

@@ -6,15 +6,15 @@
6 6
       </nz-range-picker>
7 7
     </div>
8 8
     <div class="searchDataItem">
9
-      <span class="label">报修科室</span>:
10
-      <nz-select class="selectItem" [nzDropdownMatchSelectWidth]="false" nzServerSearch nzShowSearch (nzOnSearch)="changeRepairDeptInp($event)" nzAllowClear nzPlaceHolder="请选择报修科室" [(ngModel)]="repairDeptId" (nzOpenChange)="openChangeRepairDept($event)">
11
-      <ng-container *ngFor="let option of repairDeptList">
12
-        <nz-option *ngIf="!isLoading" [nzLabel]="option.dept" [nzValue]="option.id"></nz-option>
13
-      </ng-container>
14
-      <nz-option *ngIf="isLoading" nzDisabled nzCustomContent>
15
-        <i nz-icon nzType="loading" class="loading-icon"></i> 搜索中...
16
-      </nz-option>
17
-    </nz-select>
9
+      <span class="label">科室类型</span>:
10
+      <nz-select class="selectItem" [nzDropdownMatchSelectWidth]="false" nzAllowClear nzPlaceHolder="请选择科室类型" [(ngModel)]="deptTypeId" (nzOpenChange)="openChangeDeptType($event)">
11
+        <ng-container *ngFor="let option of deptTypeList">
12
+          <nz-option *ngIf="!isLoading" [nzLabel]="option.name" [nzValue]="option.id"></nz-option>
13
+        </ng-container>
14
+        <nz-option *ngIf="isLoading" nzDisabled nzCustomContent>
15
+          <i nz-icon nzType="loading" class="loading-icon"></i> 搜索中...
16
+        </nz-option>
17
+      </nz-select>
18 18
     </div>
19 19
   </div>
20 20
   <div class="operation">
@@ -24,18 +24,19 @@
24 24
     <button nz-button class="btn default ml8" (click)="excelExport()" [nzLoading]="excelExportLoading">导出</button>
25 25
   </div>
26 26
 </div>
27
-<div class="moreFilter" *ngIf="fieldConfig.fields.groupDTO || fieldConfig.fields.userDTO || fieldConfig.fields.category1DTO || fieldConfig.fields.category2DTO || fieldConfig.fields.category3DTO || fieldConfig.fields.sourceDTO">
27
+<div class="moreFilter" *ngIf="fieldConfig.fields.groupDTO || fieldConfig.fields.userDTO || fieldConfig.fields.category1DTO || fieldConfig.fields.category2DTO || fieldConfig.fields.category3DTO || fieldConfig.fields.buildingDTO || fieldConfig.fields.floorDTO">
28 28
   <span>{{fieldConfig.fields.groupDTO?.groupName}}</span>
29 29
   <span>{{fieldConfig.fields.userDTO?.name}}</span>
30 30
   <span>{{fieldConfig.fields.category1DTO?.category}}</span>
31 31
   <span>{{fieldConfig.fields.category2DTO?.category}}</span>
32 32
   <span>{{fieldConfig.fields.category3DTO?.category}}</span>
33
-  <span>{{fieldConfig.fields.sourceDTO?.name}}</span>
33
+  <span>{{fieldConfig.fields.buildingDTO?.buildingName}}</span>
34
+  <span>{{fieldConfig.fields.floorDTO?.floorName}}</span>
34 35
 </div>
35 36
 <nz-table class="table" [nzData]="listOfData" nzSize="middle" [nzShowPagination]="false" [nzLoading]="loading1" [nzScroll]="{ y: tableHeight + 'px' }" [nzFooter]="footerTpl">
36 37
   <thead (nzSortChange)="sort($event)" nzSingleSort>
37 38
     <tr>
38
-      <th nzWidth="10%" nzShowSort nzSortKey="startDate" [(nzSort)]="sortCurrent.startDate">时间</th>
39
+      <th nzWidth="10%">科室名称(编码)</th>
39 40
       <th nzWidth="9%" nzShowSort nzSortKey="sum" [(nzSort)]="sortCurrent.sum">工单总数</th>
40 41
       <th nzWidth="9%" nzShowSort nzSortKey="avgResponseTime" [(nzSort)]="sortCurrent.avgResponseTime">平均响应时间</th>
41 42
       <th nzWidth="9%" nzShowSort nzSortKey="avgResolvedTime" [(nzSort)]="sortCurrent.avgResolvedTime">平均解决时间</th>
@@ -50,7 +51,7 @@
50 51
   </thead>
51 52
   <tbody>
52 53
     <tr *ngFor="let data of listOfData">
53
-      <td>{{ data.startDate }}</td>
54
+      <td>{{ data.deptName }}({{ data.deptCode }})</td>
54 55
       <td>{{ data.sum }}</td>
55 56
       <td>{{ data.avgResponseTime }}</td>
56 57
       <td>{{ data.avgResolvedTime }}</td>
@@ -66,7 +67,7 @@
66 67
   <ng-template #footerTpl>
67 68
     <table class="footTable">
68 69
       <tr *ngFor="let data of listOfDataEnd">
69
-        <td style="width: 10%">{{ data.startDate }}</td>
70
+        <td style="width: 10%">{{ data.deptCode }}</td>
70 71
         <td style="width: 9%">{{ data.sum }}</td>
71 72
         <td style="width: 9%">{{ data.avgResponseTime }}</td>
72 73
         <td style="width: 9%">{{ data.avgResolvedTime }}</td>

+ 37 - 65
src/app/views/new-statistics/maintenance-statistics/department-incident-statistics/department-incident-statistics.component.ts

@@ -1,5 +1,3 @@
1
-import { debounceTime } from 'rxjs/operators';
2
-import { Subject } from 'rxjs';
3 1
 import { NzMessageService } from 'ng-zorro-antd/message';
4 2
 import { format, addMonths, startOfMonth, endOfMonth, startOfDay, endOfDay } from 'date-fns';
5 3
 import { Component, OnInit, HostListener, AfterViewInit } from "@angular/core";
@@ -23,15 +21,9 @@ export class DepartmentIncidentStatisticsComponent implements OnInit, AfterViewI
23 21
   pageSize: number = 30; //表格每页展示条数
24 22
   listLength: number = 0; //表格总数据量
25 23
 
26
-  repairDeptId;//报修科室id
27
-
28
-  searchTimerSubject = new Subject();
24
+  deptTypeId;//科室类型id
29 25
 
30 26
   ngOnInit() {
31
-    this.searchTimerSubject.pipe(debounceTime(500)).subscribe((v) => {
32
-      let fun = v[0];
33
-      fun.call(this, v[1]);
34
-    });
35 27
     this.initSessionData();
36 28
     this.search();
37 29
   }
@@ -50,7 +42,7 @@ export class DepartmentIncidentStatisticsComponent implements OnInit, AfterViewI
50 42
   }
51 43
 
52 44
   get getMoreFilter(){
53
-    let flag = this.fieldConfig.fields.groupDTO || this.fieldConfig.fields.userDTO || this.fieldConfig.fields.category1DTO || this.fieldConfig.fields.category2DTO || this.fieldConfig.fields.category3DTO || this.fieldConfig.fields.sourceDTO;
45
+    let flag = this.fieldConfig.fields.groupDTO || this.fieldConfig.fields.userDTO || this.fieldConfig.fields.category1DTO || this.fieldConfig.fields.category2DTO || this.fieldConfig.fields.category3DTO || this.fieldConfig.fields.buildingDTO || this.fieldConfig.fields.floorDTO;
54 46
     return flag ? 21 : 0;
55 47
   }
56 48
 
@@ -102,24 +94,24 @@ export class DepartmentIncidentStatisticsComponent implements OnInit, AfterViewI
102 94
     let postData:any = {
103 95
       idx: this.pageIndex - 1,
104 96
       sum: this.pageSize,
105
-      startDate: this.dateRange[0],
106
-      endDate: this.dateRange[1],
107
-      hosId: this.hosId,
108
-      dutyId: this.dutyId,
109
-      parentDutyId: this.parentDutyId,
110
-      repairDeptId: this.repairDeptId,
111
-      groupId: this.fieldConfig.fields.groupId,
112
-      userId: this.fieldConfig.fields.userId,
113
-      categoryId: this.fieldConfig.fields.categoryId,
114
-      sourceId: this.fieldConfig.fields.sourceId,
115
-      hierarchy: this.fieldConfig.fields.hierarchy,
97
+      startDate: this.dateRange[0] || undefined,
98
+      endDate: this.dateRange[1] || undefined,
99
+      hosId: this.hosId || undefined,
100
+      dutyId: this.dutyId || undefined,
101
+      parentDutyId: this.parentDutyId || undefined,
102
+      deptTypeId: this.deptTypeId || undefined,
103
+      groupId: this.fieldConfig.fields.groupId || undefined,
104
+      userId: this.fieldConfig.fields.userId || undefined,
105
+      categoryId: this.fieldConfig.fields.categoryId || undefined,
106
+      buildingId: this.fieldConfig.fields.buildingId || undefined,
107
+      placeId: this.fieldConfig.fields.floorId || undefined,
116 108
     };
117 109
     if (field && sort) {
118 110
       postData.sort = `${field} ${sort === "ascend" ? `asc` : `desc`}`
119 111
     }
120 112
     this.loading1 = true;
121 113
     this.mainService
122
-      .postCustom("itsm/report", "incidentWorkOrder", postData)
114
+      .postCustom("itsm/report", "repairDept", postData)
123 115
       .subscribe((result) => {
124 116
         this.loading1 = false;
125 117
         this.listOfData = result.dataList.filter((v, i) => { return i != result.dataList.length - 1 });
@@ -166,23 +158,23 @@ export class DepartmentIncidentStatisticsComponent implements OnInit, AfterViewI
166 158
       nzDuration: 0,
167 159
     }).messageId;
168 160
     let postData:any = {
169
-      startDate: this.dateRange[0],
170
-      endDate: this.dateRange[1],
171
-      hosId: this.hosId,
172
-      dutyId: this.dutyId,
173
-      parentDutyId: this.parentDutyId,
174
-      repairDeptId: this.repairDeptId,
175
-      groupId: this.fieldConfig.fields.groupId,
176
-      userId: this.fieldConfig.fields.userId,
177
-      categoryId: this.fieldConfig.fields.categoryId,
178
-      sourceId: this.fieldConfig.fields.sourceId,
179
-      hierarchy: this.fieldConfig.fields.hierarchy,
161
+      startDate: this.dateRange[0] || undefined,
162
+      endDate: this.dateRange[1] || undefined,
163
+      hosId: this.hosId || undefined,
164
+      dutyId: this.dutyId || undefined,
165
+      parentDutyId: this.parentDutyId || undefined,
166
+      deptTypeId: this.deptTypeId || undefined,
167
+      groupId: this.fieldConfig.fields.groupId || undefined,
168
+      userId: this.fieldConfig.fields.userId || undefined,
169
+      categoryId: this.fieldConfig.fields.categoryId || undefined,
170
+      buildingId: this.fieldConfig.fields.buildingId || undefined,
171
+      placeId: this.fieldConfig.fields.floorId || undefined,
180 172
     };
181 173
     if (this.sortCurrentKey && this.sortCurrentValue) {
182 174
       postData.sort = `${this.sortCurrentKey} ${this.sortCurrentValue === "ascend" ? `asc` : `desc`}`
183 175
     }
184 176
     this.mainService
185
-      .postExportCustom("itsm/export", "incidentWorkOrder", postData)
177
+      .postExportCustom("itsm/export", "repairDept", postData)
186 178
       .subscribe((data) => {
187 179
         this.message.remove(this.excelExportLoading);
188 180
         this.excelExportLoading = false;
@@ -210,52 +202,34 @@ export class DepartmentIncidentStatisticsComponent implements OnInit, AfterViewI
210 202
 		this.sortCurrentValue = "";
211 203
 		this.sortCurrent = {};
212 204
     this.dateRange = [format(startOfMonth(addMonths(new Date(), -1)), 'yyyy-MM-dd HH:mm:ss'), format(endOfMonth(addMonths(new Date(), -1)), 'yyyy-MM-dd HH:mm:ss')]
213
-    this.repairDeptId = undefined;
214
-    this.fieldConfig.fields = {groupId: undefined, userId: undefined, categoryId: undefined, sourceId: undefined, hierarchy: undefined};
205
+    this.deptTypeId = undefined;
206
+    this.fieldConfig.fields = {groupId: undefined, userId: undefined, categoryId: undefined, buildingId: undefined, floorId: undefined};
215 207
     this.search();
216 208
   }
217 209
 
218
-  // 科室搜索
219
-  changeRepairDeptInp(e) {
220
-    this.searchTimer(this.getRepairDeptList, e);
221
-  }
222
-
223 210
   // 防抖
224 211
   isLoading = false;
225
-  searchTimer(fun, e) {
226
-    this.isLoading = true;
227
-    this.searchTimerSubject.next([fun, e]);
228
-  }
229 212
 
230
-  openChangeRepairDept(flag){
231
-    flag && this.getRepairDeptList();
213
+  openChangeDeptType(flag){
214
+    flag && this.getDeptTypeList();
232 215
   }
233 216
 
234
-  // 获取报修科室列表
235
-  repairDeptList:any[] = [];
236
-  getRepairDeptList(keyword?) {
237
-    let data = {
238
-      department: {
239
-        cascadeHosId: this.getHosId,
240
-        dept: keyword,
241
-        searchType: 1,
242
-      },
243
-      idx: 0,
244
-      sum: 20,
245
-    };
217
+  // 获取科室类型列表
218
+  deptTypeList:any[] = [];
219
+  getDeptTypeList(keyword?) {
246 220
     this.isLoading = true;
247 221
     this.mainService
248
-      .getFetchDataList("data", "department", data)
222
+      .getDictionary("list", "dept_type")
249 223
       .subscribe((data) => {
250 224
         this.isLoading = false;
251
-        this.repairDeptList = data.list;
225
+        this.deptTypeList = data;
252 226
       });
253 227
   }
254 228
 
255 229
   // 详细搜索
256 230
   fieldConfig:any = {
257
-    fields: {groupId: undefined, userId: undefined, categoryId: undefined, sourceId: undefined, hierarchy: undefined},
258
-    config: {groupAndUser: true, category123: true, source: true},
231
+    fields: {groupId: undefined, userId: undefined, categoryId: undefined, buildingId: undefined, floorId: undefined},
232
+    config: {groupAndUser: true, category123: true, buildingAndFloor: true},
259 233
   }
260 234
   showSearchMore:boolean = false;
261 235
   showMore(){
@@ -274,5 +248,3 @@ export class DepartmentIncidentStatisticsComponent implements OnInit, AfterViewI
274 248
     this.onResize();
275 249
   }
276 250
 }
277
-
278
-

+ 29 - 43
src/app/views/new-statistics/maintenance-statistics/department-source-statistics/department-source-statistics.component.html

@@ -6,15 +6,15 @@
6 6
       </nz-range-picker>
7 7
     </div>
8 8
     <div class="searchDataItem">
9
-      <span class="label">报修科室</span>:
10
-      <nz-select class="selectItem" [nzDropdownMatchSelectWidth]="false" nzServerSearch nzShowSearch (nzOnSearch)="changeRepairDeptInp($event)" nzAllowClear nzPlaceHolder="请选择报修科室" [(ngModel)]="repairDeptId" (nzOpenChange)="openChangeRepairDept($event)">
11
-      <ng-container *ngFor="let option of repairDeptList">
12
-        <nz-option *ngIf="!isLoading" [nzLabel]="option.dept" [nzValue]="option.id"></nz-option>
13
-      </ng-container>
14
-      <nz-option *ngIf="isLoading" nzDisabled nzCustomContent>
15
-        <i nz-icon nzType="loading" class="loading-icon"></i> 搜索中...
16
-      </nz-option>
17
-    </nz-select>
9
+      <span class="label">科室类型</span>:
10
+      <nz-select class="selectItem" [nzDropdownMatchSelectWidth]="false" nzAllowClear nzPlaceHolder="请选择科室类型" [(ngModel)]="deptTypeId" (nzOpenChange)="openChangeDeptType($event)">
11
+        <ng-container *ngFor="let option of deptTypeList">
12
+          <nz-option *ngIf="!isLoading" [nzLabel]="option.name" [nzValue]="option.id"></nz-option>
13
+        </ng-container>
14
+        <nz-option *ngIf="isLoading" nzDisabled nzCustomContent>
15
+          <i nz-icon nzType="loading" class="loading-icon"></i> 搜索中...
16
+        </nz-option>
17
+      </nz-select>
18 18
     </div>
19 19
   </div>
20 20
   <div class="operation">
@@ -24,59 +24,45 @@
24 24
     <button nz-button class="btn default ml8" (click)="excelExport()" [nzLoading]="excelExportLoading">导出</button>
25 25
   </div>
26 26
 </div>
27
-<div class="moreFilter" *ngIf="fieldConfig.fields.groupDTO || fieldConfig.fields.userDTO || fieldConfig.fields.category1DTO || fieldConfig.fields.category2DTO || fieldConfig.fields.category3DTO || fieldConfig.fields.sourceDTO">
27
+<div class="moreFilter" *ngIf="fieldConfig.fields.groupDTO || fieldConfig.fields.userDTO || fieldConfig.fields.category1DTO || fieldConfig.fields.category2DTO || fieldConfig.fields.category3DTO || fieldConfig.fields.buildingDTO || fieldConfig.fields.floorDTO">
28 28
   <span>{{fieldConfig.fields.groupDTO?.groupName}}</span>
29 29
   <span>{{fieldConfig.fields.userDTO?.name}}</span>
30 30
   <span>{{fieldConfig.fields.category1DTO?.category}}</span>
31 31
   <span>{{fieldConfig.fields.category2DTO?.category}}</span>
32 32
   <span>{{fieldConfig.fields.category3DTO?.category}}</span>
33
-  <span>{{fieldConfig.fields.sourceDTO?.name}}</span>
33
+  <span>{{fieldConfig.fields.buildingDTO?.buildingName}}</span>
34
+  <span>{{fieldConfig.fields.floorDTO?.floorName}}</span>
34 35
 </div>
35 36
 <nz-table class="table" [nzData]="listOfData" nzSize="middle" [nzShowPagination]="false" [nzLoading]="loading1" [nzScroll]="{ y: tableHeight + 'px' }" [nzFooter]="footerTpl">
36 37
   <thead (nzSortChange)="sort($event)" nzSingleSort>
37 38
     <tr>
38
-      <th nzWidth="10%" nzShowSort nzSortKey="startDate" [(nzSort)]="sortCurrent.startDate">时间</th>
39
-      <th nzWidth="9%" nzShowSort nzSortKey="sum" [(nzSort)]="sortCurrent.sum">工单总数</th>
40
-      <th nzWidth="9%" nzShowSort nzSortKey="avgResponseTime" [(nzSort)]="sortCurrent.avgResponseTime">平均响应时间</th>
41
-      <th nzWidth="9%" nzShowSort nzSortKey="avgResolvedTime" [(nzSort)]="sortCurrent.avgResolvedTime">平均解决时间</th>
42
-      <th nzWidth="9%" nzShowSort nzSortKey="resolvedOverNum" [(nzSort)]="sortCurrent.resolvedOverNum">超时单数</th>
43
-      <th nzWidth="9%" nzShowSort nzSortKey="overTimeNum" [(nzSort)]="sortCurrent.overTimeNum">挂起单数</th>
44
-      <th nzWidth="9%" nzShowSort nzSortKey="consumablePrice" [(nzSort)]="sortCurrent.consumablePrice">耗材费用(元)</th>
45
-      <th nzWidth="9%" nzShowSort nzSortKey="workHourPrice" [(nzSort)]="sortCurrent.workHourPrice">工时费用(元)</th>
46
-      <th nzWidth="9%" nzShowSort nzSortKey="totalPrice" [(nzSort)]="sortCurrent.totalPrice">总费用(元)</th>
47
-      <th nzWidth="9%" nzShowSort nzSortKey="negativeNum" [(nzSort)]="sortCurrent.negativeNum">差评单数</th>
48
-      <th nzWidth="9%" nzShowSort nzSortKey="favorableRate" [(nzSort)]="sortCurrent.favorableRate">好评率</th>
39
+      <th nzWidth="20%">科室名称(编码)</th>
40
+      <th nzWidth="16%" nzShowSort nzSortKey="sum" [(nzSort)]="sortCurrent.sum">工单总数</th>
41
+      <th nzWidth="16%" nzShowSort nzSortKey="phoneCount" [(nzSort)]="sortCurrent.phoneCount">电话报修数</th>
42
+      <th nzWidth="16%" nzShowSort nzSortKey="wechatCount" [(nzSort)]="sortCurrent.wechatCount">微信报修数</th>
43
+      <th nzWidth="16%" nzShowSort nzSortKey="webCount" [(nzSort)]="sortCurrent.webCount">web报修数</th>
44
+      <th nzWidth="16%" nzShowSort nzSortKey="otherCount" [(nzSort)]="sortCurrent.otherCount">其他</th>
49 45
     </tr>
50 46
   </thead>
51 47
   <tbody>
52 48
     <tr *ngFor="let data of listOfData">
53
-      <td>{{ data.startDate }}</td>
49
+      <td>{{ data.deptName }}({{ data.deptCode }})</td>
54 50
       <td>{{ data.sum }}</td>
55
-      <td>{{ data.avgResponseTime }}</td>
56
-      <td>{{ data.avgResolvedTime }}</td>
57
-      <td>{{ data.resolvedOverNum }}</td>
58
-      <td>{{ data.overTimeNum }}</td>
59
-      <td>{{ data.consumablePrice }}</td>
60
-      <td>{{ data.workHourPrice }}</td>
61
-      <td>{{ data.totalPrice }}</td>
62
-      <td>{{ data.negativeNum }}</td>
63
-      <td>{{ data.favorableRate }}</td>
51
+      <td>{{ data.phoneCount }}</td>
52
+      <td>{{ data.wechatCount }}</td>
53
+      <td>{{ data.webCount }}</td>
54
+      <td>{{ data.otherCount }}</td>
64 55
     </tr>
65 56
   </tbody>
66 57
   <ng-template #footerTpl>
67 58
     <table class="footTable">
68 59
       <tr *ngFor="let data of listOfDataEnd">
69
-        <td style="width: 10%">{{ data.startDate }}</td>
70
-        <td style="width: 9%">{{ data.sum }}</td>
71
-        <td style="width: 9%">{{ data.avgResponseTime }}</td>
72
-        <td style="width: 9%">{{ data.avgResolvedTime }}</td>
73
-        <td style="width: 9%">{{ data.resolvedOverNum }}</td>
74
-        <td style="width: 9%">{{ data.overTimeNum }}</td>
75
-        <td style="width: 9%">{{ data.consumablePrice }}</td>
76
-        <td style="width: 9%">{{ data.workHourPrice }}</td>
77
-        <td style="width: 9%">{{ data.totalPrice }}</td>
78
-        <td style="width: 9%">{{ data.negativeNum }}</td>
79
-        <td style="width: 9%">{{ data.favorableRate }}</td>
60
+        <td style="width: 20%">{{ data.deptCode }}</td>
61
+        <td style="width: 16%">{{ data.sum }}</td>
62
+        <td style="width: 16%">{{ data.phoneCount }}</td>
63
+        <td style="width: 16%">{{ data.wechatCount }}</td>
64
+        <td style="width: 16%">{{ data.webCount }}</td>
65
+        <td style="width: 16%">{{ data.otherCount }}</td>
80 66
       </tr>
81 67
     </table>
82 68
   </ng-template>

+ 37 - 65
src/app/views/new-statistics/maintenance-statistics/department-source-statistics/department-source-statistics.component.ts

@@ -1,5 +1,3 @@
1
-import { debounceTime } from 'rxjs/operators';
2
-import { Subject } from 'rxjs';
3 1
 import { NzMessageService } from 'ng-zorro-antd/message';
4 2
 import { format, addMonths, startOfMonth, endOfMonth, startOfDay, endOfDay } from 'date-fns';
5 3
 import { Component, OnInit, HostListener, AfterViewInit } from "@angular/core";
@@ -23,15 +21,9 @@ export class DepartmentSourceStatisticsComponent implements OnInit, AfterViewIni
23 21
   pageSize: number = 30; //表格每页展示条数
24 22
   listLength: number = 0; //表格总数据量
25 23
 
26
-  repairDeptId;//报修科室id
27
-
28
-  searchTimerSubject = new Subject();
24
+  deptTypeId;//科室类型id
29 25
 
30 26
   ngOnInit() {
31
-    this.searchTimerSubject.pipe(debounceTime(500)).subscribe((v) => {
32
-      let fun = v[0];
33
-      fun.call(this, v[1]);
34
-    });
35 27
     this.initSessionData();
36 28
     this.search();
37 29
   }
@@ -50,7 +42,7 @@ export class DepartmentSourceStatisticsComponent implements OnInit, AfterViewIni
50 42
   }
51 43
 
52 44
   get getMoreFilter(){
53
-    let flag = this.fieldConfig.fields.groupDTO || this.fieldConfig.fields.userDTO || this.fieldConfig.fields.category1DTO || this.fieldConfig.fields.category2DTO || this.fieldConfig.fields.category3DTO || this.fieldConfig.fields.sourceDTO;
45
+    let flag = this.fieldConfig.fields.groupDTO || this.fieldConfig.fields.userDTO || this.fieldConfig.fields.category1DTO || this.fieldConfig.fields.category2DTO || this.fieldConfig.fields.category3DTO || this.fieldConfig.fields.buildingDTO || this.fieldConfig.fields.floorDTO;
54 46
     return flag ? 21 : 0;
55 47
   }
56 48
 
@@ -102,24 +94,24 @@ export class DepartmentSourceStatisticsComponent implements OnInit, AfterViewIni
102 94
     let postData:any = {
103 95
       idx: this.pageIndex - 1,
104 96
       sum: this.pageSize,
105
-      startDate: this.dateRange[0],
106
-      endDate: this.dateRange[1],
107
-      hosId: this.hosId,
108
-      dutyId: this.dutyId,
109
-      parentDutyId: this.parentDutyId,
110
-      repairDeptId: this.repairDeptId,
111
-      groupId: this.fieldConfig.fields.groupId,
112
-      userId: this.fieldConfig.fields.userId,
113
-      categoryId: this.fieldConfig.fields.categoryId,
114
-      sourceId: this.fieldConfig.fields.sourceId,
115
-      hierarchy: this.fieldConfig.fields.hierarchy,
97
+      startDate: this.dateRange[0] || undefined,
98
+      endDate: this.dateRange[1] || undefined,
99
+      hosId: this.hosId || undefined,
100
+      dutyId: this.dutyId || undefined,
101
+      parentDutyId: this.parentDutyId || undefined,
102
+      deptTypeId: this.deptTypeId || undefined,
103
+      groupId: this.fieldConfig.fields.groupId || undefined,
104
+      userId: this.fieldConfig.fields.userId || undefined,
105
+      categoryId: this.fieldConfig.fields.categoryId || undefined,
106
+      buildingId: this.fieldConfig.fields.buildingId || undefined,
107
+      placeId: this.fieldConfig.fields.floorId || undefined,
116 108
     };
117 109
     if (field && sort) {
118 110
       postData.sort = `${field} ${sort === "ascend" ? `asc` : `desc`}`
119 111
     }
120 112
     this.loading1 = true;
121 113
     this.mainService
122
-      .postCustom("itsm/report", "incidentWorkOrder", postData)
114
+      .postCustom("itsm/report", "deptSource", postData)
123 115
       .subscribe((result) => {
124 116
         this.loading1 = false;
125 117
         this.listOfData = result.dataList.filter((v, i) => { return i != result.dataList.length - 1 });
@@ -166,23 +158,23 @@ export class DepartmentSourceStatisticsComponent implements OnInit, AfterViewIni
166 158
       nzDuration: 0,
167 159
     }).messageId;
168 160
     let postData:any = {
169
-      startDate: this.dateRange[0],
170
-      endDate: this.dateRange[1],
171
-      hosId: this.hosId,
172
-      dutyId: this.dutyId,
173
-      parentDutyId: this.parentDutyId,
174
-      repairDeptId: this.repairDeptId,
175
-      groupId: this.fieldConfig.fields.groupId,
176
-      userId: this.fieldConfig.fields.userId,
177
-      categoryId: this.fieldConfig.fields.categoryId,
178
-      sourceId: this.fieldConfig.fields.sourceId,
179
-      hierarchy: this.fieldConfig.fields.hierarchy,
161
+      startDate: this.dateRange[0] || undefined,
162
+      endDate: this.dateRange[1] || undefined,
163
+      hosId: this.hosId || undefined,
164
+      dutyId: this.dutyId || undefined,
165
+      parentDutyId: this.parentDutyId || undefined,
166
+      deptTypeId: this.deptTypeId || undefined,
167
+      groupId: this.fieldConfig.fields.groupId || undefined,
168
+      userId: this.fieldConfig.fields.userId || undefined,
169
+      categoryId: this.fieldConfig.fields.categoryId || undefined,
170
+      buildingId: this.fieldConfig.fields.buildingId || undefined,
171
+      placeId: this.fieldConfig.fields.floorId || undefined,
180 172
     };
181 173
     if (this.sortCurrentKey && this.sortCurrentValue) {
182 174
       postData.sort = `${this.sortCurrentKey} ${this.sortCurrentValue === "ascend" ? `asc` : `desc`}`
183 175
     }
184 176
     this.mainService
185
-      .postExportCustom("itsm/export", "incidentWorkOrder", postData)
177
+      .postExportCustom("itsm/export", "deptSource", postData)
186 178
       .subscribe((data) => {
187 179
         this.message.remove(this.excelExportLoading);
188 180
         this.excelExportLoading = false;
@@ -210,52 +202,34 @@ export class DepartmentSourceStatisticsComponent implements OnInit, AfterViewIni
210 202
 		this.sortCurrentValue = "";
211 203
 		this.sortCurrent = {};
212 204
     this.dateRange = [format(startOfMonth(addMonths(new Date(), -1)), 'yyyy-MM-dd HH:mm:ss'), format(endOfMonth(addMonths(new Date(), -1)), 'yyyy-MM-dd HH:mm:ss')]
213
-    this.repairDeptId = undefined;
214
-    this.fieldConfig.fields = {groupId: undefined, userId: undefined, categoryId: undefined, sourceId: undefined, hierarchy: undefined};
205
+    this.deptTypeId = undefined;
206
+    this.fieldConfig.fields = {groupId: undefined, userId: undefined, categoryId: undefined, buildingId: undefined, floorId: undefined};
215 207
     this.search();
216 208
   }
217 209
 
218
-  // 科室搜索
219
-  changeRepairDeptInp(e) {
220
-    this.searchTimer(this.getRepairDeptList, e);
221
-  }
222
-
223 210
   // 防抖
224 211
   isLoading = false;
225
-  searchTimer(fun, e) {
226
-    this.isLoading = true;
227
-    this.searchTimerSubject.next([fun, e]);
228
-  }
229 212
 
230
-  openChangeRepairDept(flag){
231
-    flag && this.getRepairDeptList();
213
+  openChangeDeptType(flag){
214
+    flag && this.getDeptTypeList();
232 215
   }
233 216
 
234
-  // 获取报修科室列表
235
-  repairDeptList:any[] = [];
236
-  getRepairDeptList(keyword?) {
237
-    let data = {
238
-      department: {
239
-        cascadeHosId: this.getHosId,
240
-        dept: keyword,
241
-        searchType: 1,
242
-      },
243
-      idx: 0,
244
-      sum: 20,
245
-    };
217
+  // 获取科室类型列表
218
+  deptTypeList:any[] = [];
219
+  getDeptTypeList(keyword?) {
246 220
     this.isLoading = true;
247 221
     this.mainService
248
-      .getFetchDataList("data", "department", data)
222
+      .getDictionary("list", "dept_type")
249 223
       .subscribe((data) => {
250 224
         this.isLoading = false;
251
-        this.repairDeptList = data.list;
225
+        this.deptTypeList = data;
252 226
       });
253 227
   }
254 228
 
255 229
   // 详细搜索
256 230
   fieldConfig:any = {
257
-    fields: {groupId: undefined, userId: undefined, categoryId: undefined, sourceId: undefined, hierarchy: undefined},
258
-    config: {groupAndUser: true, category123: true, source: true},
231
+    fields: {groupId: undefined, userId: undefined, categoryId: undefined, buildingId: undefined, floorId: undefined},
232
+    config: {groupAndUser: true, category123: true, buildingAndFloor: true},
259 233
   }
260 234
   showSearchMore:boolean = false;
261 235
   showMore(){
@@ -274,5 +248,3 @@ export class DepartmentSourceStatisticsComponent implements OnInit, AfterViewIni
274 248
     this.onResize();
275 249
   }
276 250
 }
277
-
278
-

+ 13 - 16
src/app/views/new-statistics/maintenance-statistics/floor-statistics/floor-statistics.component.html

@@ -6,15 +6,15 @@
6 6
       </nz-range-picker>
7 7
     </div>
8 8
     <div class="searchDataItem">
9
-      <span class="label">报修科室</span>:
10
-      <nz-select class="selectItem" [nzDropdownMatchSelectWidth]="false" nzServerSearch nzShowSearch (nzOnSearch)="changeRepairDeptInp($event)" nzAllowClear nzPlaceHolder="请选择报修科室" [(ngModel)]="repairDeptId" (nzOpenChange)="openChangeRepairDept($event)">
11
-      <ng-container *ngFor="let option of repairDeptList">
12
-        <nz-option *ngIf="!isLoading" [nzLabel]="option.dept" [nzValue]="option.id"></nz-option>
13
-      </ng-container>
14
-      <nz-option *ngIf="isLoading" nzDisabled nzCustomContent>
15
-        <i nz-icon nzType="loading" class="loading-icon"></i> 搜索中...
16
-      </nz-option>
17
-    </nz-select>
9
+      <span class="label">楼栋</span>:
10
+      <nz-select class="selectItem" [nzDropdownMatchSelectWidth]="false" nzServerSearch nzShowSearch (nzOnSearch)="changeBuildingInp($event)" nzAllowClear nzPlaceHolder="请选择楼栋" [(ngModel)]="buildingId" (nzOpenChange)="openChangeBuilding($event)">
11
+        <ng-container *ngFor="let option of buildingList">
12
+          <nz-option *ngIf="!isLoading" [nzLabel]="option.buildingName" [nzValue]="option.id"></nz-option>
13
+        </ng-container>
14
+        <nz-option *ngIf="isLoading" nzDisabled nzCustomContent>
15
+          <i nz-icon nzType="loading" class="loading-icon"></i> 搜索中...
16
+        </nz-option>
17
+      </nz-select>
18 18
     </div>
19 19
   </div>
20 20
   <div class="operation">
@@ -24,18 +24,15 @@
24 24
     <button nz-button class="btn default ml8" (click)="excelExport()" [nzLoading]="excelExportLoading">导出</button>
25 25
   </div>
26 26
 </div>
27
-<div class="moreFilter" *ngIf="fieldConfig.fields.groupDTO || fieldConfig.fields.userDTO || fieldConfig.fields.category1DTO || fieldConfig.fields.category2DTO || fieldConfig.fields.category3DTO || fieldConfig.fields.sourceDTO">
28
-  <span>{{fieldConfig.fields.groupDTO?.groupName}}</span>
29
-  <span>{{fieldConfig.fields.userDTO?.name}}</span>
27
+<div class="moreFilter" *ngIf="fieldConfig.fields.category1DTO || fieldConfig.fields.category2DTO || fieldConfig.fields.category3DTO">
30 28
   <span>{{fieldConfig.fields.category1DTO?.category}}</span>
31 29
   <span>{{fieldConfig.fields.category2DTO?.category}}</span>
32 30
   <span>{{fieldConfig.fields.category3DTO?.category}}</span>
33
-  <span>{{fieldConfig.fields.sourceDTO?.name}}</span>
34 31
 </div>
35 32
 <nz-table class="table" [nzData]="listOfData" nzSize="middle" [nzShowPagination]="false" [nzLoading]="loading1" [nzScroll]="{ y: tableHeight + 'px' }" [nzFooter]="footerTpl">
36 33
   <thead (nzSortChange)="sort($event)" nzSingleSort>
37 34
     <tr>
38
-      <th nzWidth="10%" nzShowSort nzSortKey="startDate" [(nzSort)]="sortCurrent.startDate">时间</th>
35
+      <th nzWidth="10%">楼栋楼层名称</th>
39 36
       <th nzWidth="9%" nzShowSort nzSortKey="sum" [(nzSort)]="sortCurrent.sum">工单总数</th>
40 37
       <th nzWidth="9%" nzShowSort nzSortKey="avgResponseTime" [(nzSort)]="sortCurrent.avgResponseTime">平均响应时间</th>
41 38
       <th nzWidth="9%" nzShowSort nzSortKey="avgResolvedTime" [(nzSort)]="sortCurrent.avgResolvedTime">平均解决时间</th>
@@ -50,7 +47,7 @@
50 47
   </thead>
51 48
   <tbody>
52 49
     <tr *ngFor="let data of listOfData">
53
-      <td>{{ data.startDate }}</td>
50
+      <td>{{ data.name }}</td>
54 51
       <td>{{ data.sum }}</td>
55 52
       <td>{{ data.avgResponseTime }}</td>
56 53
       <td>{{ data.avgResolvedTime }}</td>
@@ -66,7 +63,7 @@
66 63
   <ng-template #footerTpl>
67 64
     <table class="footTable">
68 65
       <tr *ngFor="let data of listOfDataEnd">
69
-        <td style="width: 10%">{{ data.startDate }}</td>
66
+        <td style="width: 10%">{{ data.name }}</td>
70 67
         <td style="width: 9%">{{ data.sum }}</td>
71 68
         <td style="width: 9%">{{ data.avgResponseTime }}</td>
72 69
         <td style="width: 9%">{{ data.avgResolvedTime }}</td>

+ 32 - 47
src/app/views/new-statistics/maintenance-statistics/floor-statistics/floor-statistics.component.ts

@@ -23,7 +23,7 @@ export class FloorStatisticsComponent implements OnInit, AfterViewInit {
23 23
   pageSize: number = 30; //表格每页展示条数
24 24
   listLength: number = 0; //表格总数据量
25 25
 
26
-  repairDeptId;//报修科室id
26
+  buildingId;//楼栋id
27 27
 
28 28
   searchTimerSubject = new Subject();
29 29
 
@@ -50,7 +50,7 @@ export class FloorStatisticsComponent implements OnInit, AfterViewInit {
50 50
   }
51 51
 
52 52
   get getMoreFilter(){
53
-    let flag = this.fieldConfig.fields.groupDTO || this.fieldConfig.fields.userDTO || this.fieldConfig.fields.category1DTO || this.fieldConfig.fields.category2DTO || this.fieldConfig.fields.category3DTO || this.fieldConfig.fields.sourceDTO;
53
+    let flag = this.fieldConfig.fields.category1DTO || this.fieldConfig.fields.category2DTO || this.fieldConfig.fields.category3DTO;
54 54
     return flag ? 21 : 0;
55 55
   }
56 56
 
@@ -102,24 +102,20 @@ export class FloorStatisticsComponent implements OnInit, AfterViewInit {
102 102
     let postData:any = {
103 103
       idx: this.pageIndex - 1,
104 104
       sum: this.pageSize,
105
-      startDate: this.dateRange[0],
106
-      endDate: this.dateRange[1],
107
-      hosId: this.hosId,
108
-      dutyId: this.dutyId,
109
-      parentDutyId: this.parentDutyId,
110
-      repairDeptId: this.repairDeptId,
111
-      groupId: this.fieldConfig.fields.groupId,
112
-      userId: this.fieldConfig.fields.userId,
113
-      categoryId: this.fieldConfig.fields.categoryId,
114
-      sourceId: this.fieldConfig.fields.sourceId,
115
-      hierarchy: this.fieldConfig.fields.hierarchy,
105
+      startDate: this.dateRange[0] || undefined,
106
+      endDate: this.dateRange[1] || undefined,
107
+      hosId: this.hosId || undefined,
108
+      dutyId: this.dutyId || undefined,
109
+      parentDutyId: this.parentDutyId || undefined,
110
+      buildingId: this.buildingId || undefined,
111
+      categoryId: this.fieldConfig.fields.categoryId || undefined,
116 112
     };
117 113
     if (field && sort) {
118 114
       postData.sort = `${field} ${sort === "ascend" ? `asc` : `desc`}`
119 115
     }
120 116
     this.loading1 = true;
121 117
     this.mainService
122
-      .postCustom("itsm/report", "incidentWorkOrder", postData)
118
+      .postCustom("itsm/report", "floorIncident", postData)
123 119
       .subscribe((result) => {
124 120
         this.loading1 = false;
125 121
         this.listOfData = result.dataList.filter((v, i) => { return i != result.dataList.length - 1 });
@@ -166,23 +162,19 @@ export class FloorStatisticsComponent implements OnInit, AfterViewInit {
166 162
       nzDuration: 0,
167 163
     }).messageId;
168 164
     let postData:any = {
169
-      startDate: this.dateRange[0],
170
-      endDate: this.dateRange[1],
171
-      hosId: this.hosId,
172
-      dutyId: this.dutyId,
173
-      parentDutyId: this.parentDutyId,
174
-      repairDeptId: this.repairDeptId,
175
-      groupId: this.fieldConfig.fields.groupId,
176
-      userId: this.fieldConfig.fields.userId,
177
-      categoryId: this.fieldConfig.fields.categoryId,
178
-      sourceId: this.fieldConfig.fields.sourceId,
179
-      hierarchy: this.fieldConfig.fields.hierarchy,
165
+      startDate: this.dateRange[0] || undefined,
166
+      endDate: this.dateRange[1] || undefined,
167
+      hosId: this.hosId || undefined,
168
+      dutyId: this.dutyId || undefined,
169
+      parentDutyId: this.parentDutyId || undefined,
170
+      buildingId: this.buildingId || undefined,
171
+      categoryId: this.fieldConfig.fields.categoryId || undefined,
180 172
     };
181 173
     if (this.sortCurrentKey && this.sortCurrentValue) {
182 174
       postData.sort = `${this.sortCurrentKey} ${this.sortCurrentValue === "ascend" ? `asc` : `desc`}`
183 175
     }
184 176
     this.mainService
185
-      .postExportCustom("itsm/export", "incidentWorkOrder", postData)
177
+      .postExportCustom("itsm/export", "floorIncident", postData)
186 178
       .subscribe((data) => {
187 179
         this.message.remove(this.excelExportLoading);
188 180
         this.excelExportLoading = false;
@@ -210,16 +202,11 @@ export class FloorStatisticsComponent implements OnInit, AfterViewInit {
210 202
 		this.sortCurrentValue = "";
211 203
 		this.sortCurrent = {};
212 204
     this.dateRange = [format(startOfMonth(addMonths(new Date(), -1)), 'yyyy-MM-dd HH:mm:ss'), format(endOfMonth(addMonths(new Date(), -1)), 'yyyy-MM-dd HH:mm:ss')]
213
-    this.repairDeptId = undefined;
214
-    this.fieldConfig.fields = {groupId: undefined, userId: undefined, categoryId: undefined, sourceId: undefined, hierarchy: undefined};
205
+    this.buildingId = undefined;
206
+    this.fieldConfig.fields = {category123: true};
215 207
     this.search();
216 208
   }
217 209
 
218
-  // 科室搜索
219
-  changeRepairDeptInp(e) {
220
-    this.searchTimer(this.getRepairDeptList, e);
221
-  }
222
-
223 210
   // 防抖
224 211
   isLoading = false;
225 212
   searchTimer(fun, e) {
@@ -227,35 +214,35 @@ export class FloorStatisticsComponent implements OnInit, AfterViewInit {
227 214
     this.searchTimerSubject.next([fun, e]);
228 215
   }
229 216
 
230
-  openChangeRepairDept(flag){
231
-    flag && this.getRepairDeptList();
217
+  openChangeBuilding(flag){
218
+    flag && this.getBuildingList();
232 219
   }
233 220
 
234 221
   // 获取报修科室列表
235
-  repairDeptList:any[] = [];
236
-  getRepairDeptList(keyword?) {
222
+  buildingList:any[] = [];
223
+  getBuildingList(keyword?) {
237 224
     let data = {
238
-      department: {
239
-        cascadeHosId: this.getHosId,
240
-        dept: keyword,
241
-        searchType: 1,
225
+      building: {
226
+        simpleQuery: true,
227
+        buildingName: keyword,
228
+        cascadeHosId:this.getHosId,
242 229
       },
243 230
       idx: 0,
244 231
       sum: 20,
245 232
     };
246 233
     this.isLoading = true;
247 234
     this.mainService
248
-      .getFetchDataList("data", "department", data)
235
+      .getFetchDataList("data", "building", data)
249 236
       .subscribe((data) => {
250 237
         this.isLoading = false;
251
-        this.repairDeptList = data.list;
238
+        this.buildingList = data.list;
252 239
       });
253 240
   }
254 241
 
255 242
   // 详细搜索
256 243
   fieldConfig:any = {
257
-    fields: {groupId: undefined, userId: undefined, categoryId: undefined, sourceId: undefined, hierarchy: undefined},
258
-    config: {groupAndUser: true, category123: true, source: true},
244
+    fields: {categoryId: undefined},
245
+    config: {category123: true},
259 246
   }
260 247
   showSearchMore:boolean = false;
261 248
   showMore(){
@@ -274,5 +261,3 @@ export class FloorStatisticsComponent implements OnInit, AfterViewInit {
274 261
     this.onResize();
275 262
   }
276 263
 }
277
-
278
-

+ 1 - 1
src/app/views/new-statistics/maintenance-statistics/group-statistics/group-statistics.component.ts

@@ -40,7 +40,7 @@ export class GroupStatisticsComponent implements OnInit, AfterViewInit {
40 40
   }
41 41
 
42 42
   get getMoreFilter(){
43
-    let flag = this.fieldConfig.fields.category1DTO || this.fieldConfig.fields.category2DTO || this.fieldConfig.fields.category3DTO;
43
+    let flag = this.fieldConfig.fields.category1DTO || this.fieldConfig.fields.category2DTO || this.fieldConfig.fields.category3DTO || this.fieldConfig.fields.buildingDTO || this.fieldConfig.fields.floorDTO;
44 44
     return flag ? 21 : 0;
45 45
   }
46 46
 

+ 18 - 0
src/app/views/new-statistics/maintenance-statistics/maintenance-statistics-routing.module.ts

@@ -134,6 +134,24 @@ const routes: Routes = [
134 134
           title: '故障来源统计'
135 135
         }
136 136
       },
137
+      {
138
+        // 耗材统计
139
+        path: 'consumableStatistics',
140
+        loadChildren: () => import('./consumable-statistics/consumable-statistics.module').then(m => m.ConsumableStatisticsModule),
141
+        data: {
142
+          reuse: true,
143
+          title: '耗材统计'
144
+        }
145
+      },
146
+      {
147
+        // 工时统计
148
+        path: 'workHourStatistics',
149
+        loadChildren: () => import('./work-hour-statistics/work-hour-statistics.module').then(m => m.WorkHourStatisticsModule),
150
+        data: {
151
+          reuse: true,
152
+          title: '工时统计'
153
+        }
154
+      },
137 155
     ]
138 156
   }
139 157
 ];

+ 14 - 3
src/app/views/new-statistics/maintenance-statistics/tripartite-company-statistics/tripartite-company-statistics.component.html

@@ -5,6 +5,17 @@
5 5
       <nz-range-picker [(ngModel)]="dateRange" [nzAllowClear]="false" (ngModelChange)="changeDate($event)" (nzOnCalendarChange)="onCalendarChangeDate($event)">
6 6
       </nz-range-picker>
7 7
     </div>
8
+    <div class="searchDataItem">
9
+      <span class="label">报修科室</span>:
10
+      <nz-select class="selectItem" [nzDropdownMatchSelectWidth]="false" nzServerSearch nzShowSearch (nzOnSearch)="changeRepairDeptInp($event)" nzAllowClear nzPlaceHolder="请选择报修科室" [(ngModel)]="repairDeptId" (nzOpenChange)="openChangeRepairDept($event)">
11
+        <ng-container *ngFor="let option of repairDeptList">
12
+          <nz-option *ngIf="!isLoading" [nzLabel]="option.dept" [nzValue]="option.id"></nz-option>
13
+        </ng-container>
14
+        <nz-option *ngIf="isLoading" nzDisabled nzCustomContent>
15
+          <i nz-icon nzType="loading" class="loading-icon"></i> 搜索中...
16
+        </nz-option>
17
+      </nz-select>
18
+    </div>
8 19
   </div>
9 20
   <div class="operation">
10 21
     <i class="icon_transport transport-gengduo" (click)="showMore()"></i>
@@ -23,7 +34,7 @@
23 34
 <nz-table class="table" [nzData]="listOfData" nzSize="middle" [nzShowPagination]="false" [nzLoading]="loading1" [nzScroll]="{ y: tableHeight + 'px' }" [nzFooter]="footerTpl">
24 35
   <thead (nzSortChange)="sort($event)" nzSingleSort>
25 36
     <tr>
26
-      <th nzWidth="10%">分组名称</th>
37
+      <th nzWidth="10%">公司名称</th>
27 38
       <th nzWidth="9%" nzShowSort nzSortKey="sum" [(nzSort)]="sortCurrent.sum">工单总数</th>
28 39
       <th nzWidth="9%" nzShowSort nzSortKey="avgResponseTime" [(nzSort)]="sortCurrent.avgResponseTime">平均响应时间</th>
29 40
       <th nzWidth="9%" nzShowSort nzSortKey="avgResolvedTime" [(nzSort)]="sortCurrent.avgResolvedTime">平均解决时间</th>
@@ -38,7 +49,7 @@
38 49
   </thead>
39 50
   <tbody>
40 51
     <tr *ngFor="let data of listOfData">
41
-      <td>{{ data.groupName }}</td>
52
+      <td>{{ data.companyName }}</td>
42 53
       <td>{{ data.sum }}</td>
43 54
       <td>{{ data.avgResponseTime }}</td>
44 55
       <td>{{ data.avgResolvedTime }}</td>
@@ -54,7 +65,7 @@
54 65
   <ng-template #footerTpl>
55 66
     <table class="footTable">
56 67
       <tr *ngFor="let data of listOfDataEnd">
57
-        <td style="width: 10%">{{ data.groupName }}</td>
68
+        <td style="width: 10%">{{ data.companyName }}</td>
58 69
         <td style="width: 9%">{{ data.sum }}</td>
59 70
         <td style="width: 9%">{{ data.avgResponseTime }}</td>
60 71
         <td style="width: 9%">{{ data.avgResolvedTime }}</td>

+ 48 - 1
src/app/views/new-statistics/maintenance-statistics/tripartite-company-statistics/tripartite-company-statistics.component.ts

@@ -1,3 +1,5 @@
1
+import { debounceTime } from 'rxjs/operators';
2
+import { Subject } from 'rxjs';
1 3
 import { NzMessageService } from 'ng-zorro-antd/message';
2 4
 import { format, addMonths, startOfMonth, endOfMonth, startOfDay, endOfDay } from 'date-fns';
3 5
 import { Component, OnInit, HostListener, AfterViewInit } from "@angular/core";
@@ -21,7 +23,15 @@ export class TripartiteCompanyStatisticsComponent implements OnInit, AfterViewIn
21 23
   pageSize: number = 30; //表格每页展示条数
22 24
   listLength: number = 0; //表格总数据量
23 25
 
26
+  repairDeptId;//报修科室id
27
+
28
+  searchTimerSubject = new Subject();
29
+
24 30
   ngOnInit() {
31
+    this.searchTimerSubject.pipe(debounceTime(500)).subscribe((v) => {
32
+      let fun = v[0];
33
+      fun.call(this, v[1]);
34
+    });
25 35
     this.initSessionData();
26 36
     this.search();
27 37
   }
@@ -40,7 +50,7 @@ export class TripartiteCompanyStatisticsComponent implements OnInit, AfterViewIn
40 50
   }
41 51
 
42 52
   get getMoreFilter(){
43
-    let flag = this.fieldConfig.fields.category1DTO || this.fieldConfig.fields.category2DTO || this.fieldConfig.fields.category3DTO;
53
+    let flag = this.fieldConfig.fields.category1DTO || this.fieldConfig.fields.category2DTO || this.fieldConfig.fields.category3DTO || this.fieldConfig.fields.buildingDTO || this.fieldConfig.fields.floorDTO;
44 54
     return flag ? 21 : 0;
45 55
   }
46 56
 
@@ -97,6 +107,7 @@ export class TripartiteCompanyStatisticsComponent implements OnInit, AfterViewIn
97 107
       hosId: this.hosId || undefined,
98 108
       dutyId: this.dutyId || undefined,
99 109
       parentDutyId: this.parentDutyId || undefined,
110
+      repairDeptId: this.repairDeptId || undefined,
100 111
       categoryId: this.fieldConfig.fields.categoryId || undefined,
101 112
       buildingId: this.fieldConfig.fields.buildingId || undefined,
102 113
       placeId: this.fieldConfig.fields.floorId || undefined,
@@ -158,6 +169,7 @@ export class TripartiteCompanyStatisticsComponent implements OnInit, AfterViewIn
158 169
       hosId: this.hosId || undefined,
159 170
       dutyId: this.dutyId || undefined,
160 171
       parentDutyId: this.parentDutyId || undefined,
172
+      repairDeptId: this.repairDeptId || undefined,
161 173
       categoryId: this.fieldConfig.fields.categoryId || undefined,
162 174
       buildingId: this.fieldConfig.fields.buildingId || undefined,
163 175
       placeId: this.fieldConfig.fields.floorId || undefined,
@@ -194,12 +206,47 @@ export class TripartiteCompanyStatisticsComponent implements OnInit, AfterViewIn
194 206
 		this.sortCurrentValue = "";
195 207
 		this.sortCurrent = {};
196 208
     this.dateRange = [format(startOfMonth(addMonths(new Date(), -1)), 'yyyy-MM-dd HH:mm:ss'), format(endOfMonth(addMonths(new Date(), -1)), 'yyyy-MM-dd HH:mm:ss')]
209
+    this.repairDeptId = undefined;
197 210
     this.fieldConfig.fields = {categoryId: undefined, buildingId: undefined, floorId: undefined};
198 211
     this.search();
199 212
   }
200 213
 
214
+  // 科室搜索
215
+  changeRepairDeptInp(e) {
216
+    this.searchTimer(this.getRepairDeptList, e);
217
+  }
218
+
201 219
   // 防抖
202 220
   isLoading = false;
221
+  searchTimer(fun, e) {
222
+    this.isLoading = true;
223
+    this.searchTimerSubject.next([fun, e]);
224
+  }
225
+
226
+  openChangeRepairDept(flag){
227
+    flag && this.getRepairDeptList();
228
+  }
229
+
230
+  // 获取报修科室列表
231
+  repairDeptList:any[] = [];
232
+  getRepairDeptList(keyword?) {
233
+    let data = {
234
+      department: {
235
+        cascadeHosId: this.getHosId,
236
+        dept: keyword,
237
+        searchType: 1,
238
+      },
239
+      idx: 0,
240
+      sum: 20,
241
+    };
242
+    this.isLoading = true;
243
+    this.mainService
244
+      .getFetchDataList("data", "department", data)
245
+      .subscribe((data) => {
246
+        this.isLoading = false;
247
+        this.repairDeptList = data.list;
248
+      });
249
+  }
203 250
 
204 251
   // 详细搜索
205 252
   fieldConfig:any = {

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

@@ -65,7 +65,7 @@
65 65
   <ng-template #footerTpl>
66 66
     <table class="footTable">
67 67
       <tr *ngFor="let data of listOfDataEnd">
68
-        <td style="width: 10%">{{ data.userName }}({{ data.userAccount }})</td>
68
+        <td style="width: 10%">{{ data.userName }}</td>
69 69
         <td style="width: 9%">{{ data.sum }}</td>
70 70
         <td style="width: 9%">{{ data.avgResponseTime }}</td>
71 71
         <td style="width: 9%">{{ data.avgResolvedTime }}</td>

+ 14 - 0
src/app/views/new-statistics/maintenance-statistics/work-hour-statistics/work-hour-statistics-routing.module.ts

@@ -0,0 +1,14 @@
1
+import { NgModule } from '@angular/core';
2
+import { Routes, RouterModule } from '@angular/router';
3
+import { WorkHourStatisticsComponent } from './work-hour-statistics.component';
4
+
5
+
6
+const routes: Routes = [
7
+  { path: '', component: WorkHourStatisticsComponent }
8
+];
9
+
10
+@NgModule({
11
+  imports: [RouterModule.forChild(routes)],
12
+  exports: [RouterModule]
13
+})
14
+export class WorkHourStatisticsRoutingModule { }

+ 70 - 0
src/app/views/new-statistics/maintenance-statistics/work-hour-statistics/work-hour-statistics.component.html

@@ -0,0 +1,70 @@
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 class="searchDataItem">
9
+      <span class="label">报修科室</span>:
10
+      <nz-select class="selectItem" [nzDropdownMatchSelectWidth]="false" nzServerSearch nzShowSearch (nzOnSearch)="changeRepairDeptInp($event)" nzAllowClear nzPlaceHolder="请选择报修科室" [(ngModel)]="repairDeptId" (nzOpenChange)="openChangeRepairDept($event)">
11
+        <ng-container *ngFor="let option of repairDeptList">
12
+          <nz-option *ngIf="!isLoading" [nzLabel]="option.dept" [nzValue]="option.id"></nz-option>
13
+        </ng-container>
14
+        <nz-option *ngIf="isLoading" nzDisabled nzCustomContent>
15
+          <i nz-icon nzType="loading" class="loading-icon"></i> 搜索中...
16
+        </nz-option>
17
+      </nz-select>
18
+    </div>
19
+  </div>
20
+  <div class="operation">
21
+    <i class="icon_transport transport-gengduo" (click)="showMore()"></i>
22
+    <button nz-button class="btn default" (click)="search()">查询</button>
23
+    <button nz-button class="btn default ml8" (click)="reset()">重置</button>
24
+    <button nz-button class="btn default ml8" (click)="excelExport()" [nzLoading]="excelExportLoading">导出</button>
25
+  </div>
26
+</div>
27
+<div class="moreFilter" *ngIf="fieldConfig.fields.groupDTO || fieldConfig.fields.userDTO || fieldConfig.fields.category1DTO || fieldConfig.fields.category2DTO || fieldConfig.fields.category3DTO || fieldConfig.fields.buildingDTO || fieldConfig.fields.floorDTO || fieldConfig.fields.companyDTO">
28
+  <span>{{fieldConfig.fields.groupDTO?.groupName}}</span>
29
+  <span>{{fieldConfig.fields.userDTO?.name}}</span>
30
+  <span>{{fieldConfig.fields.category1DTO?.category}}</span>
31
+  <span>{{fieldConfig.fields.category2DTO?.category}}</span>
32
+  <span>{{fieldConfig.fields.category3DTO?.category}}</span>
33
+  <span>{{fieldConfig.fields.buildingDTO?.buildingName}}</span>
34
+  <span>{{fieldConfig.fields.floorDTO?.floorName}}</span>
35
+  <span>{{fieldConfig.fields.companyDTO?.name}}</span>
36
+</div>
37
+<nz-table class="table" [nzData]="listOfData" nzSize="middle" [nzShowPagination]="false" [nzLoading]="loading1" [nzScroll]="{ y: tableHeight + 'px' }" [nzFooter]="footerTpl">
38
+  <thead (nzSortChange)="sort($event)" nzSingleSort>
39
+    <tr>
40
+      <th nzWidth="25%">工时名称</th>
41
+      <th nzWidth="25%" nzShowSort nzSortKey="sum" [(nzSort)]="sortCurrent.sum">工单总数</th>
42
+      <th nzWidth="25%" nzShowSort nzSortKey="workHourNum" [(nzSort)]="sortCurrent.workHourNum">使用数量</th>
43
+      <th nzWidth="25%" nzShowSort nzSortKey="workHourPrice" [(nzSort)]="sortCurrent.workHourPrice">总费用(元)</th>
44
+    </tr>
45
+  </thead>
46
+  <tbody>
47
+    <tr *ngFor="let data of listOfData">
48
+      <td>{{ data.workHourName }}</td>
49
+      <td>{{ data.sum }}</td>
50
+      <td>{{ data.workHourNum }}</td>
51
+      <td>{{ data.workHourPrice }}</td>
52
+    </tr>
53
+  </tbody>
54
+  <ng-template #footerTpl>
55
+    <table class="footTable">
56
+      <tr *ngFor="let data of listOfDataEnd">
57
+        <td style="width: 25%">{{ data.workHourName }}</td>
58
+        <td style="width: 25%">{{ data.sum }}</td>
59
+        <td style="width: 25%">{{ data.workHourNum }}</td>
60
+        <td style="width: 25%">{{ data.workHourPrice }}</td>
61
+      </tr>
62
+    </table>
63
+  </ng-template>
64
+</nz-table>
65
+<div class="pagination">
66
+  <nz-pagination [(nzPageIndex)]="pageIndex" [(nzTotal)]="listLength" [(nzPageSize)]="pageSize" (nzPageIndexChange)="getList(pageIndex, sortCurrentKey, sortCurrentValue)" (nzPageSizeChange)="getList(pageIndex, sortCurrentKey, sortCurrentValue)"></nz-pagination>
67
+</div>
68
+
69
+<!-- 详细搜索 -->
70
+<app-search-more [fieldConfig]="fieldConfig" *ngIf="showSearchMore" [hosId]="hosId" [queryType]="queryType"  [dutyId]="dutyId"  [parentDutyId]="parentDutyId" (cancelEvent)="cancelEvent()" (submitEvent)="submitEvent($event)"></app-search-more>

+ 71 - 0
src/app/views/new-statistics/maintenance-statistics/work-hour-statistics/work-hour-statistics.component.less

@@ -0,0 +1,71 @@
1
+@import "../../../../../../src/theme.less";
2
+:host{
3
+  position: absolute;
4
+  top: 0;
5
+  right: 0;
6
+  bottom: 0;
7
+  left: 0;
8
+  ::ng-deep .ant-table-footer{
9
+    padding: 16px 0;
10
+    width: calc(100% - 16px);
11
+    font-weight: bold;
12
+  }
13
+  tr, th{
14
+    text-align: center;
15
+  }
16
+  .searchDataWrap{
17
+    display: flex;
18
+    align-items: center;
19
+    justify-content: space-between;
20
+    .searchData{
21
+      padding: 16px;
22
+      display: flex;
23
+      align-items: center;
24
+      .searchDataItem{
25
+        margin-right: 24px;
26
+        .label{
27
+          font-size: 16px;
28
+        }
29
+        .selectItem{
30
+          width: 224px;
31
+        }
32
+      }
33
+    }
34
+    .operation{
35
+      margin-right: 16px;
36
+      display: flex;
37
+      align-items: center;
38
+      cursor: pointer;
39
+      .icon_transport{
40
+        margin-right: 16px;
41
+        font-size: 24px;
42
+      }
43
+      .btn{
44
+        &.default{
45
+          height: 32px;
46
+          line-height: 32px;
47
+          min-width: 70px;
48
+        }
49
+      }
50
+    }
51
+  }
52
+
53
+  .table{
54
+    margin: 0 8px;
55
+  }
56
+
57
+  .moreFilter{
58
+    margin-bottom: 16px;
59
+    span{
60
+      margin-left: 16px;
61
+      color: @primary-color;
62
+    }
63
+  }
64
+
65
+  .pagination{
66
+    padding: 16px;
67
+    display: flex;
68
+    justify-content: flex-end;
69
+    align-items: center;
70
+  }
71
+}

+ 273 - 0
src/app/views/new-statistics/maintenance-statistics/work-hour-statistics/work-hour-statistics.component.ts

@@ -0,0 +1,273 @@
1
+import { debounceTime } from 'rxjs/operators';
2
+import { Subject } from 'rxjs';
3
+import { NzMessageService } from 'ng-zorro-antd/message';
4
+import { format, addMonths, startOfMonth, endOfMonth, startOfDay, endOfDay } from 'date-fns';
5
+import { Component, OnInit, HostListener, AfterViewInit } from "@angular/core";
6
+import { MainService } from 'src/app/services/main.service';
7
+import { ActivatedRoute } from '@angular/router';
8
+@Component({
9
+  selector: "app-work-hour-statistics",
10
+  templateUrl: "./work-hour-statistics.component.html",
11
+  styleUrls: ["./work-hour-statistics.component.less"],
12
+})
13
+export class WorkHourStatisticsComponent implements OnInit, AfterViewInit {
14
+  constructor(
15
+    private mainService: MainService,
16
+    private message: NzMessageService,
17
+    private route: ActivatedRoute,
18
+  ) {}
19
+
20
+  listOfData: any[] = []; //表格数据
21
+  listOfDataEnd: any[] = []; //表格合计
22
+  pageIndex: number = 1; //表格当前页码
23
+  pageSize: number = 30; //表格每页展示条数
24
+  listLength: number = 0; //表格总数据量
25
+
26
+  repairDeptId;//报修科室id
27
+
28
+  searchTimerSubject = new Subject();
29
+
30
+  ngOnInit() {
31
+    this.searchTimerSubject.pipe(debounceTime(500)).subscribe((v) => {
32
+      let fun = v[0];
33
+      fun.call(this, v[1]);
34
+    });
35
+    this.initSessionData();
36
+    this.search();
37
+  }
38
+
39
+  ngAfterViewInit(){
40
+    this.onResize();
41
+  }
42
+
43
+  tableHeight:number = 0;
44
+  @HostListener('window:resize')
45
+  onResize(): void {
46
+    setTimeout(() => {
47
+      this.tableHeight = window.innerHeight - 64 - 64 - 36 - 48 - 8 - 45 - 54 - this.getMoreFilter;
48
+      console.log('this.tableHeight:', this.tableHeight)
49
+    }, 0)
50
+  }
51
+
52
+  get getMoreFilter(){
53
+    let flag = this.fieldConfig.fields.groupDTO || this.fieldConfig.fields.userDTO || this.fieldConfig.fields.category1DTO || this.fieldConfig.fields.category2DTO || this.fieldConfig.fields.category3DTO || this.fieldConfig.fields.buildingDTO || this.fieldConfig.fields.floorDTO || this.fieldConfig.fields.companyDTO;
54
+    return flag ? 21 : 0;
55
+  }
56
+
57
+  // 初始化缓存数据
58
+  queryType:any;
59
+  hosId:any;
60
+  dutyId:any;
61
+  parentDutyId:any;
62
+  initSessionData(){
63
+    let maintenanceStatistics = JSON.parse(sessionStorage.getItem('maintenanceStatistics'));
64
+    let queryType:any = maintenanceStatistics.queryType;
65
+    let hosId:any = maintenanceStatistics.hospitalId;
66
+    let dutyId:any = maintenanceStatistics.dutyId;
67
+
68
+    queryType = queryType ? +queryType : undefined;
69
+    hosId = hosId ? +hosId : undefined;
70
+    dutyId = dutyId ? +dutyId : undefined;
71
+
72
+    this.queryType = queryType;
73
+    if(queryType == 1){
74
+      this.hosId = undefined;
75
+      this.dutyId = undefined;
76
+      this.parentDutyId = undefined;
77
+    }else if(queryType == 2){
78
+      this.hosId = hosId;
79
+      this.dutyId = undefined;
80
+      this.parentDutyId = undefined;
81
+    }else if(queryType == 3){
82
+      this.hosId = undefined;
83
+      this.dutyId = dutyId;
84
+      this.parentDutyId = undefined;
85
+    }else if(queryType == 4){
86
+      this.hosId = undefined;
87
+      this.dutyId = undefined;
88
+      this.parentDutyId = dutyId;
89
+    }
90
+  }
91
+
92
+  get getHosId(){
93
+    return this.parentDutyId || this.dutyId || this.hosId;
94
+  }
95
+
96
+  // 表格数据
97
+  loading1 = false;
98
+  getList(num?: number, field?: string, sort?: string) {
99
+    if (num !== undefined) {
100
+      this.pageIndex = num;
101
+    }
102
+    let postData:any = {
103
+      idx: this.pageIndex - 1,
104
+      sum: this.pageSize,
105
+      startDate: this.dateRange[0] || undefined,
106
+      endDate: this.dateRange[1] || undefined,
107
+      hosId: this.hosId || undefined,
108
+      dutyId: this.dutyId || undefined,
109
+      parentDutyId: this.parentDutyId || undefined,
110
+      repairDeptId: this.repairDeptId || undefined,
111
+      groupId: this.fieldConfig.fields.groupId || undefined,
112
+      userId: this.fieldConfig.fields.userId || undefined,
113
+      categoryId: this.fieldConfig.fields.categoryId || undefined,
114
+      buildingId: this.fieldConfig.fields.buildingId || undefined,
115
+      placeId: this.fieldConfig.fields.floorId || undefined,
116
+      companyId: this.fieldConfig.fields.companyId || undefined,
117
+    };
118
+    if (field && sort) {
119
+      postData.sort = `${field} ${sort === "ascend" ? `asc` : `desc`}`
120
+    }
121
+    this.loading1 = true;
122
+    this.mainService
123
+      .postCustom("itsm/report", "workHourIncident", postData)
124
+      .subscribe((result) => {
125
+        this.loading1 = false;
126
+        this.listOfData = result.dataList.filter((v, i) => { return i != result.dataList.length - 1 });
127
+        this.listOfDataEnd = result.dataList.filter((v, i) => { return i == result.dataList.length - 1 });
128
+        this.listLength = result.totalCount;
129
+      });
130
+  }
131
+
132
+  // 列表排序
133
+  sortCurrent:any = {};
134
+  sortCurrentKey: string = "";
135
+  sortCurrentValue: string | null = "";
136
+  sort(e) {
137
+    const { key, value } = e;
138
+    this.sortCurrentKey = key;
139
+    this.sortCurrentValue = value;
140
+    this.getList(this.pageIndex, this.sortCurrentKey, this.sortCurrentValue);
141
+  }
142
+
143
+  // 搜索
144
+  search() {
145
+    this.getList(1, this.sortCurrentKey, this.sortCurrentValue);
146
+  }
147
+
148
+  // 日期选择
149
+  dateRange: any = [format(startOfMonth(addMonths(new Date(), -1)), 'yyyy-MM-dd HH:mm:ss'), format(endOfMonth(addMonths(new Date(), -1)), 'yyyy-MM-dd HH:mm:ss')];
150
+  changeDate(result?): void {
151
+    result[0] = format(startOfDay(result[0]), 'yyyy-MM-dd HH:mm:ss');
152
+    result[1] = format(endOfDay(result[1]), 'yyyy-MM-dd HH:mm:ss');
153
+    this.dateRange = result;
154
+  }
155
+
156
+  onCalendarChangeDate(dateArr){
157
+    console.log(dateArr)
158
+    if(dateArr.length == 2){
159
+      this.dateRange = [format(startOfDay(dateArr[0]), 'yyyy-MM-dd HH:mm:ss'), format(endOfDay(dateArr[1]), 'yyyy-MM-dd HH:mm:ss')];
160
+    }
161
+  }
162
+
163
+  // 导出
164
+  excelExportLoading:any = false;
165
+  excelExport(){
166
+    this.excelExportLoading = this.message.loading("导出中..", {
167
+      nzDuration: 0,
168
+    }).messageId;
169
+    let postData:any = {
170
+      startDate: this.dateRange[0] || undefined,
171
+      endDate: this.dateRange[1] || undefined,
172
+      hosId: this.hosId || undefined,
173
+      dutyId: this.dutyId || undefined,
174
+      parentDutyId: this.parentDutyId || undefined,
175
+      repairDeptId: this.repairDeptId || undefined,
176
+      groupId: this.fieldConfig.fields.groupId || undefined,
177
+      userId: this.fieldConfig.fields.userId || undefined,
178
+      categoryId: this.fieldConfig.fields.categoryId || undefined,
179
+      buildingId: this.fieldConfig.fields.buildingId || undefined,
180
+      placeId: this.fieldConfig.fields.floorId || undefined,
181
+      companyId: this.fieldConfig.fields.companyId || undefined,
182
+    };
183
+    if (this.sortCurrentKey && this.sortCurrentValue) {
184
+      postData.sort = `${this.sortCurrentKey} ${this.sortCurrentValue === "ascend" ? `asc` : `desc`}`
185
+    }
186
+    this.mainService
187
+      .postExportCustom("itsm/export", "workHourIncident", postData)
188
+      .subscribe((data) => {
189
+        this.message.remove(this.excelExportLoading);
190
+        this.excelExportLoading = false;
191
+        this.message.success('导出成功');
192
+        var file = new Blob([data], {
193
+          type: "application/vnd.ms-excel",
194
+        });
195
+        //trick to download store a file having its URL
196
+        var fileURL = URL.createObjectURL(file);
197
+        var a = document.createElement("a");
198
+        a.href = fileURL;
199
+        a.target = "_blank";
200
+        a.download = `${this.route.parent.routeConfig.data.title}.xls`;
201
+        document.body.appendChild(a);
202
+        a.click();
203
+      },(err) => {
204
+        this.message.remove(this.excelExportLoading);
205
+        this.excelExportLoading = false;
206
+        this.message.error('导出失败');
207
+      });
208
+  }
209
+  // 重置
210
+  reset(){
211
+    this.sortCurrentKey = "";
212
+		this.sortCurrentValue = "";
213
+		this.sortCurrent = {};
214
+    this.dateRange = [format(startOfMonth(addMonths(new Date(), -1)), 'yyyy-MM-dd HH:mm:ss'), format(endOfMonth(addMonths(new Date(), -1)), 'yyyy-MM-dd HH:mm:ss')]
215
+    this.repairDeptId = undefined;
216
+    this.fieldConfig.fields = {groupId: undefined, userId: undefined, categoryId: undefined, buildingId: undefined, floorId: undefined, companyId: undefined};
217
+    this.search();
218
+  }
219
+
220
+  // 防抖
221
+  isLoading = false;
222
+  searchTimer(fun, e) {
223
+    this.isLoading = true;
224
+    this.searchTimerSubject.next([fun, e]);
225
+  }
226
+
227
+  openChangeRepairDept(flag){
228
+    flag && this.getRepairDeptList();
229
+  }
230
+
231
+  // 获取报修科室列表
232
+  repairDeptList:any[] = [];
233
+  getRepairDeptList(keyword?) {
234
+    let data = {
235
+      department: {
236
+        cascadeHosId: this.getHosId,
237
+        dept: keyword,
238
+        searchType: 1,
239
+      },
240
+      idx: 0,
241
+      sum: 20,
242
+    };
243
+    this.isLoading = true;
244
+    this.mainService
245
+      .getFetchDataList("data", "department", data)
246
+      .subscribe((data) => {
247
+        this.isLoading = false;
248
+        this.repairDeptList = data.list;
249
+      });
250
+  }
251
+
252
+  // 详细搜索
253
+  fieldConfig:any = {
254
+    fields: {groupId: undefined, userId: undefined, categoryId: undefined, buildingId: undefined, floorId: undefined, companyId: undefined},
255
+    config: {groupAndUser: true, category123: true, buildingAndFloor: true, company: true},
256
+  }
257
+  showSearchMore:boolean = false;
258
+  showMore(){
259
+    this.showSearchMore = true;
260
+  }
261
+
262
+  cancelEvent(){
263
+    this.showSearchMore = false;
264
+  }
265
+
266
+  submitEvent(fields){
267
+    this.showSearchMore = false;
268
+    this.fieldConfig.fields = fields;
269
+    console.log('this.fieldConfig.fields:', this.fieldConfig.fields)
270
+    this.search();
271
+    this.onResize();
272
+  }
273
+}

+ 21 - 0
src/app/views/new-statistics/maintenance-statistics/work-hour-statistics/work-hour-statistics.module.ts

@@ -0,0 +1,21 @@
1
+import { WorkHourStatisticsComponent } from './work-hour-statistics.component';
2
+import { NgModule } from '@angular/core';
3
+import { CommonModule } from '@angular/common';
4
+
5
+import { WorkHourStatisticsRoutingModule } from './work-hour-statistics-routing.module';
6
+import { ShareModule } from 'src/app/share/share.module';
7
+import { SearchMoreModule } from '../../components/search-more/search-more.module';
8
+
9
+
10
+@NgModule({
11
+  declarations: [
12
+    WorkHourStatisticsComponent,
13
+  ],
14
+  imports: [
15
+    CommonModule,
16
+    WorkHourStatisticsRoutingModule,
17
+    ShareModule,
18
+    SearchMoreModule,
19
+  ]
20
+})
21
+export class WorkHourStatisticsModule { }