Просмотр исходного кода

Merge branch 'master' of http://git.dashitech.com/seimin/zy-pc

maotao месяцев назад: 3
Родитель
Сommit
0943ead9a8
48 измененных файлов с 1803 добавлено и 805 удалено
  1. 40 48
      src/app/SimpleReuseStrategy.ts
  2. 6 0
      src/app/app-routing.module.ts
  3. 12 12
      src/app/views/hushijiandan/hushijiandan.component.ts
  4. 3 1
      src/app/views/main/main.component.ts
  5. 7 7
      src/app/views/new-statistics/components/search-more/search-more.component.html
  6. 41 26
      src/app/views/new-statistics/components/search-more/search-more.component.ts
  7. 8 21
      src/app/views/new-statistics/maintenance-statistics/building-statistics/building-statistics.component.html
  8. 33 76
      src/app/views/new-statistics/maintenance-statistics/building-statistics/building-statistics.component.ts
  9. 4 3
      src/app/views/new-statistics/maintenance-statistics/category-one-statistics/category-one-statistics.component.html
  10. 17 6
      src/app/views/new-statistics/maintenance-statistics/category-one-statistics/category-one-statistics.component.ts
  11. 13 46
      src/app/views/new-statistics/maintenance-statistics/category-source-statistics/category-source-statistics.component.html
  12. 41 77
      src/app/views/new-statistics/maintenance-statistics/category-source-statistics/category-source-statistics.component.ts
  13. 4 3
      src/app/views/new-statistics/maintenance-statistics/category-three-statistics/category-three-statistics.component.html
  14. 25 13
      src/app/views/new-statistics/maintenance-statistics/category-three-statistics/category-three-statistics.component.ts
  15. 4 3
      src/app/views/new-statistics/maintenance-statistics/category-two-statistics/category-two-statistics.component.html
  16. 20 8
      src/app/views/new-statistics/maintenance-statistics/category-two-statistics/category-two-statistics.component.ts
  17. 14 0
      src/app/views/new-statistics/maintenance-statistics/consumable-statistics/consumable-statistics-routing.module.ts
  18. 71 0
      src/app/views/new-statistics/maintenance-statistics/consumable-statistics/consumable-statistics.component.html
  19. 71 0
      src/app/views/new-statistics/maintenance-statistics/consumable-statistics/consumable-statistics.component.less
  20. 291 0
      src/app/views/new-statistics/maintenance-statistics/consumable-statistics/consumable-statistics.component.ts
  21. 21 0
      src/app/views/new-statistics/maintenance-statistics/consumable-statistics/consumable-statistics.module.ts
  22. 43 44
      src/app/views/new-statistics/maintenance-statistics/department-evaluate-statistics/department-evaluate-statistics.component.html
  23. 52 67
      src/app/views/new-statistics/maintenance-statistics/department-evaluate-statistics/department-evaluate-statistics.component.ts
  24. 19 17
      src/app/views/new-statistics/maintenance-statistics/department-incident-statistics/department-incident-statistics.component.html
  25. 52 67
      src/app/views/new-statistics/maintenance-statistics/department-incident-statistics/department-incident-statistics.component.ts
  26. 31 44
      src/app/views/new-statistics/maintenance-statistics/department-source-statistics/department-source-statistics.component.html
  27. 52 67
      src/app/views/new-statistics/maintenance-statistics/department-source-statistics/department-source-statistics.component.ts
  28. 17 19
      src/app/views/new-statistics/maintenance-statistics/floor-statistics/floor-statistics.component.html
  29. 50 47
      src/app/views/new-statistics/maintenance-statistics/floor-statistics/floor-statistics.component.ts
  30. 4 3
      src/app/views/new-statistics/maintenance-statistics/group-statistics/group-statistics.component.html
  31. 16 3
      src/app/views/new-statistics/maintenance-statistics/group-statistics/group-statistics.component.ts
  32. 5 4
      src/app/views/new-statistics/maintenance-statistics/incident-statistics/incident-statistics.component.html
  33. 16 5
      src/app/views/new-statistics/maintenance-statistics/incident-statistics/incident-statistics.component.ts
  34. 22 4
      src/app/views/new-statistics/maintenance-statistics/maintenance-statistics-routing.module.ts
  35. 2 0
      src/app/views/new-statistics/maintenance-statistics/maintenance-statistics.component.less
  36. 30 14
      src/app/views/new-statistics/maintenance-statistics/maintenance-statistics.component.ts
  37. 8 8
      src/app/views/new-statistics/maintenance-statistics/synthesize-statistics/synthesize-statistics.component.html
  38. 30 17
      src/app/views/new-statistics/maintenance-statistics/synthesize-statistics/synthesize-statistics.component.ts
  39. 18 6
      src/app/views/new-statistics/maintenance-statistics/tripartite-company-statistics/tripartite-company-statistics.component.html
  40. 63 3
      src/app/views/new-statistics/maintenance-statistics/tripartite-company-statistics/tripartite-company-statistics.component.ts
  41. 5 4
      src/app/views/new-statistics/maintenance-statistics/user-statistics/user-statistics.component.html
  42. 18 5
      src/app/views/new-statistics/maintenance-statistics/user-statistics/user-statistics.component.ts
  43. 14 0
      src/app/views/new-statistics/maintenance-statistics/work-hour-statistics/work-hour-statistics-routing.module.ts
  44. 71 0
      src/app/views/new-statistics/maintenance-statistics/work-hour-statistics/work-hour-statistics.component.html
  45. 71 0
      src/app/views/new-statistics/maintenance-statistics/work-hour-statistics/work-hour-statistics.component.less
  46. 291 0
      src/app/views/new-statistics/maintenance-statistics/work-hour-statistics/work-hour-statistics.component.ts
  47. 21 0
      src/app/views/new-statistics/maintenance-statistics/work-hour-statistics/work-hour-statistics.module.ts
  48. 36 7
      src/app/views/new-statistics/services/tab.service.ts

+ 40 - 48
src/app/SimpleReuseStrategy.ts

@@ -1,66 +1,58 @@
1
-import { RouteReuseStrategy, ActivatedRouteSnapshot, DetachedRouteHandle, UrlSegment } from '@angular/router';
1
+import {RouteReuseStrategy, DefaultUrlSerializer, ActivatedRouteSnapshot, DetachedRouteHandle} from '@angular/router';
2 2
 
3
+/**
4
+ * 路由复用策略
5
+ */
3 6
 export class SimpleReuseStrategy implements RouteReuseStrategy {
4
-  static cacheRouters = new Map<string, DetachedRouteHandle>();
5 7
 
6
-  public static deleteRouteCache(url): void {
7
-    if (SimpleReuseStrategy.cacheRouters.has(url)) {
8
-      const handle: any = SimpleReuseStrategy.cacheRouters.get(url);
9
-      try {
10
-        handle.componentRef.destory();
11
-      } catch (e) { }
12
-      SimpleReuseStrategy.cacheRouters.delete(url);
13
-    }
8
+  public static handlers: { [key: string]: DetachedRouteHandle } = {};
9
+  private static waitDelete: string;
10
+
11
+  /** 表示对所有路由允许复用 如果你有路由不想利用可以在这加一些业务逻辑判断 */
12
+  public shouldDetach(route: ActivatedRouteSnapshot): boolean {
13
+    return route.routeConfig && route.routeConfig.data && route.routeConfig.data.reuse === true;
14 14
   }
15 15
 
16
-  public static deleteAllRouteCache(): void {
17
-    SimpleReuseStrategy.cacheRouters.forEach((handle: any, key) => {
18
-      SimpleReuseStrategy.deleteRouteCache(key);
19
-    });
16
+  /** 当路由离开时会触发。按path作为key存储路由快照&组件当前实例对象 */
17
+  public store(route: ActivatedRouteSnapshot, handle: DetachedRouteHandle): void {
18
+    if (SimpleReuseStrategy.waitDelete && SimpleReuseStrategy.waitDelete === this.getRouteUrl(route)) {
19
+      // 如果待删除是当前路由则不存储快照
20
+      SimpleReuseStrategy.waitDelete = null;
21
+      return;
22
+    }
23
+    SimpleReuseStrategy.handlers[this.getRouteUrl(route)] = handle;
20 24
   }
21 25
 
22
-  // one 进入路由触发,是否同一路由时复用路由
23
-  shouldReuseRoute(future: ActivatedRouteSnapshot, curr: ActivatedRouteSnapshot): boolean {
24
-    return future.routeConfig === curr.routeConfig &&
25
-      JSON.stringify(future.params) === JSON.stringify(curr.params);
26
+  /** 若 path 在缓存中有的都认为允许还原路由 */
27
+  public shouldAttach(route: ActivatedRouteSnapshot): boolean {
28
+    return !!SimpleReuseStrategy.handlers[this.getRouteUrl(route)];
26 29
   }
27 30
 
28
-  // 获取存储路由
29
-  retrieve(route: ActivatedRouteSnapshot): DetachedRouteHandle {
30
-    const url = this.getFullRouteURL(route);
31
-    if (route.data.reuse && SimpleReuseStrategy.cacheRouters.has(url)) {
32
-      return SimpleReuseStrategy.cacheRouters.get(url);
33
-    } else {
31
+  /** 从缓存中获取快照,若无则返回nul */
32
+  public retrieve(route: ActivatedRouteSnapshot): DetachedRouteHandle {
33
+    if (!route.routeConfig) {
34 34
       return null;
35 35
     }
36
-  }
37 36
 
38
-  // 是否允许复用路由
39
-  shouldDetach(route: ActivatedRouteSnapshot): boolean {
40
-    return Boolean(route.data.reuse);
41
-  }
42
-  // 当路由离开时会触发,存储路由
43
-  store(route: ActivatedRouteSnapshot, handle: DetachedRouteHandle): void {
44
-    const url = this.getFullRouteURL(route);
45
-    SimpleReuseStrategy.cacheRouters.set(url, handle);
46
-  }
47
-  //  是否允许还原路由
48
-  shouldAttach(route: ActivatedRouteSnapshot): boolean {
49
-    const url = this.getFullRouteURL(route);
50
-    return Boolean(route.data.reuse) && SimpleReuseStrategy.cacheRouters.has(url);
37
+    return SimpleReuseStrategy.handlers[this.getRouteUrl(route)];
51 38
   }
52 39
 
53
-  // 获取当前路由url
54
-  private getFullRouteURL(route: ActivatedRouteSnapshot): string {
55
-    const { pathFromRoot } = route;
56
-    let fullRouteUrlPath: string[] = [];
57
-    pathFromRoot.forEach((item: ActivatedRouteSnapshot) => {
58
-      fullRouteUrlPath = fullRouteUrlPath.concat(this.getRouteUrlPath(item));
59
-    });
60
-    return `/${fullRouteUrlPath.join('/')}`;
40
+  /** 进入路由触发,判断是否同一路由 */
41
+  public shouldReuseRoute(future: ActivatedRouteSnapshot, curr: ActivatedRouteSnapshot): boolean {
42
+    return future.routeConfig === curr.routeConfig &&
43
+      JSON.stringify(future.params) === JSON.stringify(curr.params);
44
+  }
61 45
 
46
+  private getRouteUrl(route: ActivatedRouteSnapshot) {
47
+    return route['_routerState'].url.replace(/\//g, '_');
62 48
   }
63
-  private getRouteUrlPath(route: ActivatedRouteSnapshot) {
64
-    return route.url.map(urlSegment => urlSegment.path);
49
+
50
+  public static deleteRouteSnapshot(url: string): void {
51
+    const key = url.replace(/\//g, '_');
52
+    if (SimpleReuseStrategy.handlers[key]) {
53
+      delete SimpleReuseStrategy.handlers[key];
54
+    } else {
55
+      SimpleReuseStrategy.waitDelete = key;
56
+    }
65 57
   }
66 58
 }

+ 6 - 0
src/app/app-routing.module.ts

@@ -185,6 +185,12 @@ const routes: Routes = [
185 185
     path: "newStatistics",
186 186
     loadChildren: () => import("./views/new-statistics/new-statistics.module").then((m) => m.NewStatisticsModule),
187 187
   },
188
+  // 临时路由
189
+  {
190
+    path: "redirect",
191
+    redirectTo: '/',
192
+    pathMatch: 'full'
193
+  },
188 194
   // 管理端首页
189 195
   {
190 196
     path: '**',

+ 12 - 12
src/app/views/hushijiandan/hushijiandan.component.ts

@@ -130,7 +130,7 @@ export class HushijiandanComponent implements OnInit {
130 130
     private webs: WebsocketNurseService,
131 131
     public tool: ToolService,
132 132
 		public http: HttpClient
133
-		
133
+
134 134
   ) {
135 135
     this.othersListOptions = {
136 136
       onUpdate: (event: any) => {
@@ -313,17 +313,17 @@ export class HushijiandanComponent implements OnInit {
313 313
     this.coopBtns = coopBtns;
314 314
     console.log(this.coopBtns);
315 315
   }
316
-	
316
+
317 317
 	// 关闭客服弹框
318 318
 	smartClose(e){
319 319
 		this.smartShow = false;
320 320
 	}
321
-	
321
+
322 322
 	// 打开客服弹框
323
-	smartOpen(e){
323
+	smartOpen(e?){
324 324
 		this.smartShow = true;
325 325
 	}
326
-	
326
+
327 327
 	// 预览图片
328 328
 	imgs = [];
329 329
 	isPreview = false;
@@ -338,7 +338,7 @@ export class HushijiandanComponent implements OnInit {
338 338
 	    this.isPreview = true;
339 339
 	  }, 0)
340 340
 	}
341
-	
341
+
342 342
 	// 图片相关
343 343
 	showUploadList = {
344 344
 	  showPreviewIcon: true,
@@ -361,7 +361,7 @@ export class HushijiandanComponent implements OnInit {
361 361
 	  this.previewImage = file.url || file.thumbUrl;
362 362
 	  this.previewVisible = true;
363 363
 	};
364
-	
364
+
365 365
 	beforeUpload = (file: UploadFile): boolean => {
366 366
 		console.log('file2:', file)
367 367
 	  this.fileList = [...this.fileList, file];
@@ -371,7 +371,7 @@ export class HushijiandanComponent implements OnInit {
371 371
 	  console.log('this.fileList:', this.fileList)
372 372
 	  return true;
373 373
 	};
374
-	
374
+
375 375
 	getBase64(file: any): Promise<any> {
376 376
 	  return new Promise((resolve, reject) => {
377 377
 	    const reader = new FileReader();
@@ -380,10 +380,10 @@ export class HushijiandanComponent implements OnInit {
380 380
 	    reader.onerror = error => reject(error);
381 381
 	  });
382 382
 	}
383
-	
383
+
384 384
 	// 临时上传图片
385 385
 	temporarilyUrl = this.mainService.returnUploadUrl('wechatRequesterIncident', 0);
386
-	
386
+
387 387
 	// 图片上传
388 388
 	uploadImages(file, id){
389 389
 	  const formData = new FormData();
@@ -394,7 +394,7 @@ export class HushijiandanComponent implements OnInit {
394 394
 	  });
395 395
 	  return this.http.request(req).pipe(filter(e => e instanceof HttpResponse)).toPromise();
396 396
 	}
397
-	
397
+
398 398
 	// 获取任务类型(病理标本)
399 399
 	taskTypeData:any;
400 400
 	getTaskTypesId() {
@@ -3169,7 +3169,7 @@ export class HushijiandanComponent implements OnInit {
3169 3169
         this.patientModal = true;
3170 3170
         that.checkedShowMsg = data;
3171 3171
 				if(data.end){
3172
-					if(data.end.end.departmentStrategy==202 || 
3172
+					if(data.end.end.departmentStrategy==202 ||
3173 3173
 					data.end.end.departmentStrategy==204 ||
3174 3174
 					data.end.end.departmentStrategy==205){
3175 3175
 						this.isEndFixedType = true

+ 3 - 1
src/app/views/main/main.component.ts

@@ -484,7 +484,9 @@ export class MainComponent implements OnInit {
484 484
   }
485 485
   // 统计
486 486
   toNewStatistics(): void {
487
-    this.router.navigateByUrl("newStatistics/maintenanceStatistics/incidentStatistics");
487
+    let menus = JSON.parse(localStorage.getItem("menu"));
488
+    let firstMenu = menus.find((item) => item.type == "newStatistics");
489
+    this.router.navigateByUrl(`newStatistics/${firstMenu.link}/${firstMenu.childrens[0].link}`);
488 490
   }
489 491
   // 大屏端或视图端
490 492
   screenType;

+ 7 - 7
src/app/views/new-statistics/components/search-more/search-more.component.html

@@ -21,7 +21,7 @@
21 21
         <nz-form-item [hidden]="!fieldConfig.config.groupAndUser">
22 22
           <nz-form-label [nzSpan]="6" nzFor="userId">维修人员</nz-form-label>
23 23
           <nz-form-control [nzSpan]="18" nzErrorTip="请选择维修人员!">
24
-            <nz-select [nzDropdownMatchSelectWidth]="false" nzAllowClear nzServerSearch nzShowSearch (nzOnSearch)="changeUserInp($event)" formControlName="userId" nzPlaceHolder="请选择维修人员" (nzOpenChange)="openChangeUser($event)">
24
+            <nz-select [nzDropdownMatchSelectWidth]="false" nzAllowClear nzServerSearch nzShowSearch (nzOnSearch)="changeUserInp($event)" formControlName="userId" nzPlaceHolder="请选择维修人员" (nzOpenChange)="openChangeUser($event)" (ngModelChange)="setIsSelecting()">
25 25
               <ng-container *ngFor="let option of userList">
26 26
                 <nz-option *ngIf="!isLoading" [nzLabel]="option.name" [nzValue]="option.id"></nz-option>
27 27
               </ng-container>
@@ -63,7 +63,7 @@
63 63
         <nz-form-item [hidden]="!fieldConfig.config.category123">
64 64
           <nz-form-label [nzSpan]="6" nzFor="category3Id">三级分类</nz-form-label>
65 65
           <nz-form-control [nzSpan]="18" nzErrorTip="请选择三级分类!">
66
-            <nz-select [nzDropdownMatchSelectWidth]="false" nzAllowClear nzServerSearch nzShowSearch (nzOnSearch)="changeCategory3Inp($event)" formControlName="category3Id" nzPlaceHolder="请选择三级分类" (nzOpenChange)="openChangeCategory3($event)">
66
+            <nz-select [nzDropdownMatchSelectWidth]="false" nzAllowClear nzServerSearch nzShowSearch (nzOnSearch)="changeCategory3Inp($event)" formControlName="category3Id" nzPlaceHolder="请选择三级分类" (nzOpenChange)="openChangeCategory3($event)" (ngModelChange)="setIsSelecting()">
67 67
               <ng-container *ngFor="let option of category3List">
68 68
                 <nz-option *ngIf="!isLoading" [nzLabel]="option.category" [nzValue]="option.id"></nz-option>
69 69
               </ng-container>
@@ -93,7 +93,7 @@
93 93
           <nz-form-control [nzSpan]="18" nzErrorTip="请选择楼栋!">
94 94
             <nz-select [nzDropdownMatchSelectWidth]="false" nzAllowClear nzServerSearch nzShowSearch (nzOnSearch)="changeBuildingInp($event)" formControlName="buildingId" nzPlaceHolder="请选择楼栋" (nzOpenChange)="openChangeBuilding($event)" (ngModelChange)="changeBuilding($event)">
95 95
               <ng-container *ngFor="let option of buildingList">
96
-                <nz-option *ngIf="!isLoading" [nzLabel]="option.buildingName" [nzValue]="option.id"></nz-option>
96
+                <nz-option *ngIf="!isLoading" [nzLabel]="option.hosName + '-' + option.buildingName" [nzValue]="option.id"></nz-option>
97 97
               </ng-container>
98 98
               <nz-option *ngIf="isLoading" nzDisabled nzCustomContent>
99 99
                 <i nz-icon nzType="loading" class="loading-icon"></i> 搜索中...
@@ -105,7 +105,7 @@
105 105
         <nz-form-item [hidden]="!fieldConfig.config.buildingAndFloor">
106 106
           <nz-form-label [nzSpan]="6" nzFor="floorId">楼<span style="visibility: hidden;">囧囧</span>层</nz-form-label>
107 107
           <nz-form-control [nzSpan]="18" nzErrorTip="请选择楼层!">
108
-            <nz-select [nzDropdownMatchSelectWidth]="false" nzAllowClear nzServerSearch nzShowSearch (nzOnSearch)="changeFloorInp($event)" formControlName="floorId" nzPlaceHolder="请选择楼层" (nzOpenChange)="openChangeFloor($event)">
108
+            <nz-select [nzDropdownMatchSelectWidth]="false" nzAllowClear nzServerSearch nzShowSearch (nzOnSearch)="changeFloorInp($event)" formControlName="floorId" nzPlaceHolder="请选择楼层" (nzOpenChange)="openChangeFloor($event)" (ngModelChange)="setIsSelecting()">
109 109
               <ng-container *ngFor="let option of floorList">
110 110
                 <nz-option *ngIf="!isLoading" [nzLabel]="option.floorName" [nzValue]="option.id"></nz-option>
111 111
               </ng-container>
@@ -119,7 +119,7 @@
119 119
         <nz-form-item [hidden]="!fieldConfig.config.company">
120 120
           <nz-form-label [nzSpan]="6" nzFor="companyId">三方公司</nz-form-label>
121 121
           <nz-form-control [nzSpan]="18" nzErrorTip="请选择三方公司!">
122
-            <nz-select [nzDropdownMatchSelectWidth]="false" nzAllowClear nzServerSearch nzShowSearch (nzOnSearch)="changeCompanyInp($event)" formControlName="companyId" nzPlaceHolder="请选择三方公司" (nzOpenChange)="openChangeCompany($event)">
122
+            <nz-select [nzDropdownMatchSelectWidth]="false" nzAllowClear nzServerSearch nzShowSearch (nzOnSearch)="changeCompanyInp($event)" formControlName="companyId" nzPlaceHolder="请选择三方公司" (nzOpenChange)="openChangeCompany($event)" (ngModelChange)="setIsSelecting()">
123 123
               <ng-container *ngFor="let option of companyList">
124 124
                 <nz-option *ngIf="!isLoading" [nzLabel]="option.name" [nzValue]="option.id"></nz-option>
125 125
               </ng-container>
@@ -133,9 +133,9 @@
133 133
         <nz-form-item [hidden]="!fieldConfig.config.repairDept">
134 134
           <nz-form-label [nzSpan]="6" nzFor="repairDeptId">报修科室</nz-form-label>
135 135
           <nz-form-control [nzSpan]="18" nzErrorTip="请选择报修科室!">
136
-            <nz-select [nzDropdownMatchSelectWidth]="false" nzAllowClear nzServerSearch nzShowSearch (nzOnSearch)="changeRepairDeptInp($event)" formControlName="repairDeptId" nzPlaceHolder="请选择报修科室" (nzOpenChange)="openChangeRepairDept($event)">
136
+            <nz-select [nzDropdownMatchSelectWidth]="false" nzAllowClear nzServerSearch nzShowSearch (nzOnSearch)="changeRepairDeptInp($event)" formControlName="repairDeptId" nzPlaceHolder="请选择报修科室" (nzOpenChange)="openChangeRepairDept($event)" (ngModelChange)="setIsSelecting()">
137 137
               <ng-container *ngFor="let option of repairDeptList">
138
-                <nz-option *ngIf="!isLoading" [nzLabel]="option.dept" [nzValue]="option.id"></nz-option>
138
+                <nz-option *ngIf="!isLoading" [nzLabel]="option.hospital.hosName + '-' + option.dept" [nzValue]="option.id"></nz-option>
139 139
               </ng-container>
140 140
               <nz-option *ngIf="isLoading" nzDisabled nzCustomContent>
141 141
                 <i nz-icon nzType="loading" class="loading-icon"></i> 搜索中...

+ 41 - 26
src/app/views/new-statistics/components/search-more/search-more.component.ts

@@ -109,9 +109,11 @@ export class SearchMoreComponent implements OnInit {
109 109
       fields.floorDTO = this.floorList.find(item => item.id == this.validateForm.value.floorId);
110 110
     }
111 111
     if(this.fieldConfig.config.company){
112
+      fields.companyId = this.validateForm.value.companyId;
112 113
       fields.companyDTO = this.companyList.find(item => item.id == this.validateForm.value.companyId);
113 114
     }
114 115
     if(this.fieldConfig.config.repairDept){
116
+      fields.repairDeptId = this.validateForm.value.repairDeptId;
115 117
       fields.repairDeptDTO = this.repairDeptList.find(item => item.id == this.validateForm.value.repairDeptId);
116 118
     }
117 119
     this.submitEvent.emit(fields);
@@ -124,11 +126,21 @@ export class SearchMoreComponent implements OnInit {
124 126
 
125 127
   // 防抖
126 128
   isLoading = false;
129
+  isSelecting:boolean = false; // 是否在选中状态
127 130
   searchTimer(fun, e) {
131
+    if (this.isSelecting) {
132
+      this.isSelecting = false; // 重置标志
133
+      return; // 跳过处理
134
+    }
128 135
     this.isLoading = true;
129 136
     this.searchTimerSubject.next([fun, e]);
130 137
   }
131 138
 
139
+  // 设置标志
140
+  setIsSelecting(){
141
+    this.isSelecting = true; // 设置标志
142
+  }
143
+
132 144
   // =================维修分组===================
133 145
 
134 146
   // 维修分组搜索
@@ -143,7 +155,7 @@ export class SearchMoreComponent implements OnInit {
143 155
       idx: 0,
144 156
       sum: 20,
145 157
       group2: {
146
-        hospitals: this.getHosId,
158
+        statisticalHosId: this.getHosId,
147 159
         groupName: keyword,
148 160
         type: 3,
149 161
       },
@@ -163,9 +175,10 @@ export class SearchMoreComponent implements OnInit {
163 175
   }
164 176
 
165 177
   changeGroup(id){
178
+    this.setIsSelecting();
166 179
     this.userList = [];
167 180
     this.validateForm.controls.userId.setValue(null);
168
-    this.getUserList('', id);
181
+    this.getUserList();
169 182
   }
170 183
 
171 184
   // =================维修人员===================
@@ -177,8 +190,8 @@ export class SearchMoreComponent implements OnInit {
177 190
 
178 191
   // 获取维修人员列表
179 192
   userList:any[] = [];
180
-  getUserList(keyword = '', groupId = ''){
181
-    if(!groupId){
193
+  getUserList(keyword = ''){
194
+    if(!this.validateForm.value.groupId){
182 195
       this.isLoading = false;
183 196
       this.userList = [];
184 197
       return;
@@ -189,7 +202,7 @@ export class SearchMoreComponent implements OnInit {
189 202
       user: {
190 203
         name: keyword,
191 204
         simpleQuery: true,
192
-        groupdata: { id: groupId },
205
+        groupdata: { id: this.validateForm.value.groupId },
193 206
         roleCodes: 'first-line support,second-line support,incident manager',
194 207
         engineer: 1,
195 208
       },
@@ -205,7 +218,7 @@ export class SearchMoreComponent implements OnInit {
205 218
     });
206 219
   }
207 220
   openChangeUser(flag){
208
-    flag && this.getUserList('', this.validateForm.value.groupId);
221
+    flag && this.getUserList();
209 222
   }
210 223
 
211 224
   // =================一级分类===================
@@ -222,8 +235,7 @@ export class SearchMoreComponent implements OnInit {
222 235
       category: {
223 236
         category: keyword,
224 237
         selectType: 'mutlQuery',
225
-        dutyIds: this.queryType == 3 ? this.dutyId : undefined,
226
-        parentDutyId: this.queryType == 3 ? this.parentDutyId : undefined,
238
+        statisticalHosId: this.getHosId,
227 239
         hierarchy: 1,
228 240
       },
229 241
     };
@@ -242,9 +254,10 @@ export class SearchMoreComponent implements OnInit {
242 254
   }
243 255
 
244 256
   changeCategory1(id){
257
+    this.setIsSelecting();
245 258
     this.category2List = [];
246 259
     this.validateForm.controls.category2Id.setValue(null);
247
-    this.getCategory2List('', id);
260
+    this.getCategory2List();
248 261
 
249 262
     this.category3List = [];
250 263
     this.validateForm.controls.category3Id.setValue(null);
@@ -259,8 +272,8 @@ export class SearchMoreComponent implements OnInit {
259 272
 
260 273
   // 获取二级分类列表
261 274
   category2List:any[] = [];
262
-  getCategory2List(keyword = '', parentId = ''){
263
-    if(!parentId){
275
+  getCategory2List(keyword = ''){
276
+    if(!this.validateForm.value.category1Id){
264 277
       this.isLoading = false;
265 278
       this.category2List = [];
266 279
       return;
@@ -269,7 +282,7 @@ export class SearchMoreComponent implements OnInit {
269 282
       category: {
270 283
         category: keyword,
271 284
         selectType: 'mutlQuery',
272
-        parent: { id: parentId },
285
+        parent: { id: this.validateForm.value.category1Id },
273 286
       },
274 287
     };
275 288
     this.isLoading = true;
@@ -283,13 +296,14 @@ export class SearchMoreComponent implements OnInit {
283 296
     });
284 297
   }
285 298
   openChangeCategory2(flag){
286
-    flag && this.getCategory2List('', this.validateForm.value.category1Id);
299
+    flag && this.getCategory2List();
287 300
   }
288 301
 
289 302
   changeCategory2(id){
303
+    this.setIsSelecting();
290 304
     this.category3List = [];
291 305
     this.validateForm.controls.category3Id.setValue(null);
292
-    this.getCategory3List('', id);
306
+    this.getCategory3List();
293 307
   }
294 308
 
295 309
   // =================三级分类===================
@@ -301,8 +315,8 @@ export class SearchMoreComponent implements OnInit {
301 315
 
302 316
   // 获取三级分类列表
303 317
   category3List:any[] = [];
304
-  getCategory3List(keyword = '', parentId = ''){
305
-    if(!parentId){
318
+  getCategory3List(keyword = ''){
319
+    if(!this.validateForm.value.category2Id){
306 320
       this.isLoading = false;
307 321
       this.category3List = [];
308 322
       return;
@@ -311,7 +325,7 @@ export class SearchMoreComponent implements OnInit {
311 325
       category: {
312 326
         category: keyword,
313 327
         selectType: 'mutlQuery',
314
-        parent: { id: parentId },
328
+        parent: { id: this.validateForm.value.category2Id },
315 329
       },
316 330
     };
317 331
     this.isLoading = true;
@@ -325,7 +339,7 @@ export class SearchMoreComponent implements OnInit {
325 339
     });
326 340
   }
327 341
   openChangeCategory3(flag){
328
-    flag && this.getCategory3List('', this.validateForm.value.category2Id);
342
+    flag && this.getCategory3List();
329 343
   }
330 344
 
331 345
   // =================故障来源===================
@@ -354,7 +368,7 @@ export class SearchMoreComponent implements OnInit {
354 368
       building: {
355 369
         simpleQuery: true,
356 370
         buildingName: keyword,
357
-        cascadeHosId:this.getHosId,
371
+        statisticalHosId:this.getHosId,
358 372
       },
359 373
     };
360 374
     this.isLoading = true;
@@ -372,9 +386,10 @@ export class SearchMoreComponent implements OnInit {
372 386
   }
373 387
 
374 388
   changeBuilding(id){
389
+    this.setIsSelecting();
375 390
     this.floorList = [];
376 391
     this.validateForm.controls.floorId.setValue(null);
377
-    this.getFloorList('', id);
392
+    this.getFloorList();
378 393
   }
379 394
 
380 395
   // =================楼层===================
@@ -386,8 +401,8 @@ export class SearchMoreComponent implements OnInit {
386 401
 
387 402
   // 获取楼层列表
388 403
   floorList:any[] = [];
389
-  getFloorList(keyword = '', buildingId = ''){
390
-    if(!buildingId){
404
+  getFloorList(keyword = ''){
405
+    if(!this.validateForm.value.buildingId){
391 406
       this.isLoading = false;
392 407
       this.floorList = [];
393 408
       return;
@@ -397,7 +412,7 @@ export class SearchMoreComponent implements OnInit {
397 412
       sum: 20,
398 413
       floor: {
399 414
         floorName: keyword,
400
-        buildId : buildingId,
415
+        buildId : this.validateForm.value.buildingId,
401 416
       },
402 417
     };
403 418
     this.isLoading = true;
@@ -411,7 +426,7 @@ export class SearchMoreComponent implements OnInit {
411 426
     });
412 427
   }
413 428
   openChangeFloor(flag){
414
-    flag && this.getFloorList('', this.validateForm.value.buildingId);
429
+    flag && this.getFloorList();
415 430
   }
416 431
 
417 432
   // =================三方公司===================
@@ -430,7 +445,7 @@ export class SearchMoreComponent implements OnInit {
430 445
       company: {
431 446
         busiType: { key: "company_busi_type", value: "2" },
432 447
         name: keyword,
433
-        hosId: this.getHosId,
448
+        statisticalHosId: this.getHosId,
434 449
       },
435 450
     };
436 451
     this.isLoading = true;
@@ -461,7 +476,7 @@ export class SearchMoreComponent implements OnInit {
461 476
       idx: 0,
462 477
       sum: 20,
463 478
       department: {
464
-        cascadeHosId: this.getHosId,
479
+        statisticalHosId: this.getHosId,
465 480
         dept: keyword,
466 481
         searchType: 1,
467 482
       },

+ 8 - 21
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,21 +13,18 @@
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
-      <th nzWidth="9%" nzShowSort nzSortKey="avgResponseTime" [(nzSort)]="sortCurrent.avgResponseTime">平均响应时间</th>
41
-      <th nzWidth="9%" nzShowSort nzSortKey="avgResolvedTime" [(nzSort)]="sortCurrent.avgResolvedTime">平均解决时</th>
26
+      <th nzWidth="9%" nzShowSort nzSortKey="avgResponseTime" [(nzSort)]="sortCurrent.avgResponseTime">平均接单时长</th>
27
+      <th nzWidth="9%" nzShowSort nzSortKey="avgResolvedTime" [(nzSort)]="sortCurrent.avgResolvedTime">平均解决时</th>
42 28
       <th nzWidth="9%" nzShowSort nzSortKey="resolvedOverNum" [(nzSort)]="sortCurrent.resolvedOverNum">超时单数</th>
43 29
       <th nzWidth="9%" nzShowSort nzSortKey="overTimeNum" [(nzSort)]="sortCurrent.overTimeNum">挂起单数</th>
44 30
       <th nzWidth="9%" nzShowSort nzSortKey="consumablePrice" [(nzSort)]="sortCurrent.consumablePrice">耗材费用(元)</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>
@@ -82,7 +68,8 @@
82 68
   </ng-template>
83 69
 </nz-table>
84 70
 <div class="pagination">
85
-  <nz-pagination [(nzPageIndex)]="pageIndex" [(nzTotal)]="listLength" [(nzPageSize)]="pageSize" (nzPageIndexChange)="getList(pageIndex, sortCurrentKey, sortCurrentValue)" (nzPageSizeChange)="getList(pageIndex, sortCurrentKey, sortCurrentValue)"></nz-pagination>
71
+  <ng-template #totalTemplate let-total> 共 {{ total }} 条 </ng-template>
72
+  <nz-pagination [(nzPageIndex)]="pageIndex" [(nzTotal)]="listLength" [(nzPageSize)]="pageSize" (nzPageIndexChange)="getList(pageIndex, sortCurrentKey, sortCurrentValue)" (nzPageSizeChange)="getList(pageIndex, sortCurrentKey, sortCurrentValue)" nzShowSizeChanger [nzPageSizeOptions]="[30,50,100,200]" [nzShowTotal]="totalTemplate"></nz-pagination>
86 73
 </div>
87 74
 
88 75
 <!-- 详细搜索 -->

+ 33 - 76
src/app/views/new-statistics/maintenance-statistics/building-statistics/building-statistics.component.ts

@@ -1,5 +1,4 @@
1
-import { debounceTime } from 'rxjs/operators';
2
-import { Subject } from 'rxjs';
1
+import { TabService } from './../../services/tab.service';
3 2
 import { NzMessageService } from 'ng-zorro-antd/message';
4 3
 import { format, addMonths, startOfMonth, endOfMonth, startOfDay, endOfDay } from 'date-fns';
5 4
 import { Component, OnInit, HostListener, AfterViewInit } from "@angular/core";
@@ -15,6 +14,7 @@ export class BuildingStatisticsComponent implements OnInit, AfterViewInit {
15 14
     private mainService: MainService,
16 15
     private message: NzMessageService,
17 16
     private route: ActivatedRoute,
17
+    private tabService: TabService,
18 18
   ) {}
19 19
 
20 20
   listOfData: any[] = []; //表格数据
@@ -23,16 +23,9 @@ export class BuildingStatisticsComponent implements OnInit, AfterViewInit {
23 23
   pageSize: number = 30; //表格每页展示条数
24 24
   listLength: number = 0; //表格总数据量
25 25
 
26
-  repairDeptId;//报修科室id
27
-
28
-  searchTimerSubject = new Subject();
29
-
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();
28
+    this.getQueryParams();
36 29
     this.search();
37 30
   }
38 31
 
@@ -44,13 +37,21 @@ export class BuildingStatisticsComponent implements OnInit, AfterViewInit {
44 37
   @HostListener('window:resize')
45 38
   onResize(): void {
46 39
     setTimeout(() => {
47
-      this.tableHeight = window.innerHeight - 64 - 64 - 36 - 48 - 8 - 45 - 54 - this.getMoreFilter;
48
-      console.log('this.tableHeight:', this.tableHeight)
40
+      this.tableHeight = window.innerHeight - document.querySelector('.searchDataWrap').clientHeight - 64 - 36 - 48 - 8 - document.querySelector('.ant-table-header').clientHeight - 55 - this.getMoreFilter - 2;
41
+
49 42
     }, 0)
50 43
   }
51 44
 
45
+  getQueryParams(){
46
+    let queryParams = this.tabService.getQueryParams();
47
+    this.tabService.clearQueryParams();
48
+    if(queryParams.dateRange){
49
+      this.dateRange = queryParams.dateRange;
50
+    }
51
+  }
52
+
52 53
   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;
54
+    let flag = this.fieldConfig.fields.category1DTO || this.fieldConfig.fields.category2DTO || this.fieldConfig.fields.category3DTO;
54 55
     return flag ? 21 : 0;
55 56
   }
56 57
 
@@ -102,24 +103,20 @@ export class BuildingStatisticsComponent implements OnInit, AfterViewInit {
102 103
     let postData:any = {
103 104
       idx: this.pageIndex - 1,
104 105
       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,
106
+      startDate: this.dateRange[0] || undefined,
107
+      endDate: this.dateRange[1] || undefined,
108
+      hosId: this.hosId || undefined,
109
+      dutyId: this.dutyId || undefined,
110
+      parentDutyId: this.parentDutyId || undefined,
111
+      categoryId: this.fieldConfig.fields.categoryId || undefined,
112
+      hierarchy: this.fieldConfig.fields.hierarchy || undefined,
116 113
     };
117 114
     if (field && sort) {
118 115
       postData.sort = `${field} ${sort === "ascend" ? `asc` : `desc`}`
119 116
     }
120 117
     this.loading1 = true;
121 118
     this.mainService
122
-      .postCustom("itsm/report", "incidentWorkOrder", postData)
119
+      .postCustom("itsm/report", "buildingIncident", postData)
123 120
       .subscribe((result) => {
124 121
         this.loading1 = false;
125 122
         this.listOfData = result.dataList.filter((v, i) => { return i != result.dataList.length - 1 });
@@ -166,23 +163,19 @@ export class BuildingStatisticsComponent implements OnInit, AfterViewInit {
166 163
       nzDuration: 0,
167 164
     }).messageId;
168 165
     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,
166
+      startDate: this.dateRange[0] || undefined,
167
+      endDate: this.dateRange[1] || undefined,
168
+      hosId: this.hosId || undefined,
169
+      dutyId: this.dutyId || undefined,
170
+      parentDutyId: this.parentDutyId || undefined,
171
+      categoryId: this.fieldConfig.fields.categoryId || undefined,
172
+      hierarchy: this.fieldConfig.fields.hierarchy || undefined,
180 173
     };
181 174
     if (this.sortCurrentKey && this.sortCurrentValue) {
182 175
       postData.sort = `${this.sortCurrentKey} ${this.sortCurrentValue === "ascend" ? `asc` : `desc`}`
183 176
     }
184 177
     this.mainService
185
-      .postExportCustom("itsm/export", "incidentWorkOrder", postData)
178
+      .postExportCustom("itsm/export", "buildingIncident", postData)
186 179
       .subscribe((data) => {
187 180
         this.message.remove(this.excelExportLoading);
188 181
         this.excelExportLoading = false;
@@ -210,52 +203,17 @@ export class BuildingStatisticsComponent implements OnInit, AfterViewInit {
210 203
 		this.sortCurrentValue = "";
211 204
 		this.sortCurrent = {};
212 205
     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};
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
-  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 212
 
255 213
   // 详细搜索
256 214
   fieldConfig:any = {
257
-    fields: {groupId: undefined, userId: undefined, categoryId: undefined, sourceId: undefined, hierarchy: undefined},
258
-    config: {groupAndUser: true, category123: true, source: true},
215
+    fields: {categoryId: undefined},
216
+    config: {category123: true},
259 217
   }
260 218
   showSearchMore:boolean = false;
261 219
   showMore(){
@@ -274,4 +232,3 @@ export class BuildingStatisticsComponent implements OnInit, AfterViewInit {
274 232
     this.onResize();
275 233
   }
276 234
 }
277
-

+ 4 - 3
src/app/views/new-statistics/maintenance-statistics/category-one-statistics/category-one-statistics.component.html

@@ -26,8 +26,8 @@
26 26
     <tr>
27 27
       <th nzWidth="10%">故障现象</th>
28 28
       <th nzWidth="9%" nzShowSort nzSortKey="sum" [(nzSort)]="sortCurrent.sum">工单总数</th>
29
-      <th nzWidth="9%" nzShowSort nzSortKey="avgResponseTime" [(nzSort)]="sortCurrent.avgResponseTime">平均响应时间</th>
30
-      <th nzWidth="9%" nzShowSort nzSortKey="avgResolvedTime" [(nzSort)]="sortCurrent.avgResolvedTime">平均解决时</th>
29
+      <th nzWidth="9%" nzShowSort nzSortKey="avgResponseTime" [(nzSort)]="sortCurrent.avgResponseTime">平均接单时长</th>
30
+      <th nzWidth="9%" nzShowSort nzSortKey="avgResolvedTime" [(nzSort)]="sortCurrent.avgResolvedTime">平均解决时</th>
31 31
       <th nzWidth="9%" nzShowSort nzSortKey="resolvedOverNum" [(nzSort)]="sortCurrent.resolvedOverNum">超时单数</th>
32 32
       <th nzWidth="9%" nzShowSort nzSortKey="overTimeNum" [(nzSort)]="sortCurrent.overTimeNum">挂起单数</th>
33 33
       <th nzWidth="9%" nzShowSort nzSortKey="consumablePrice" [(nzSort)]="sortCurrent.consumablePrice">耗材费用(元)</th>
@@ -71,7 +71,8 @@
71 71
   </ng-template>
72 72
 </nz-table>
73 73
 <div class="pagination">
74
-  <nz-pagination [(nzPageIndex)]="pageIndex" [(nzTotal)]="listLength" [(nzPageSize)]="pageSize" (nzPageIndexChange)="getList(pageIndex, sortCurrentKey, sortCurrentValue)" (nzPageSizeChange)="getList(pageIndex, sortCurrentKey, sortCurrentValue)"></nz-pagination>
74
+  <ng-template #totalTemplate let-total> 共 {{ total }} 条 </ng-template>
75
+  <nz-pagination [(nzPageIndex)]="pageIndex" [(nzTotal)]="listLength" [(nzPageSize)]="pageSize" (nzPageIndexChange)="getList(pageIndex, sortCurrentKey, sortCurrentValue)" (nzPageSizeChange)="getList(pageIndex, sortCurrentKey, sortCurrentValue)" nzShowSizeChanger [nzPageSizeOptions]="[30,50,100,200]" [nzShowTotal]="totalTemplate"></nz-pagination>
75 76
 </div>
76 77
 
77 78
 <!-- 详细搜索 -->

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

@@ -1,3 +1,4 @@
1
+import { TabService } from './../../services/tab.service';
1 2
 import { NzMessageService } from 'ng-zorro-antd/message';
2 3
 import { format, addMonths, startOfMonth, endOfMonth, startOfDay, endOfDay } from 'date-fns';
3 4
 import { Component, OnInit, HostListener, AfterViewInit } from "@angular/core";
@@ -13,6 +14,7 @@ export class CategoryOneStatisticsComponent implements OnInit, AfterViewInit {
13 14
     private mainService: MainService,
14 15
     private message: NzMessageService,
15 16
     private route: ActivatedRoute,
17
+    private tabService: TabService,
16 18
   ) {}
17 19
 
18 20
   listOfData: any[] = []; //表格数据
@@ -23,6 +25,7 @@ export class CategoryOneStatisticsComponent implements OnInit, AfterViewInit {
23 25
 
24 26
   ngOnInit() {
25 27
     this.initSessionData();
28
+    this.getQueryParams();
26 29
     this.search();
27 30
   }
28 31
 
@@ -34,11 +37,19 @@ export class CategoryOneStatisticsComponent implements OnInit, AfterViewInit {
34 37
   @HostListener('window:resize')
35 38
   onResize(): void {
36 39
     setTimeout(() => {
37
-      this.tableHeight = window.innerHeight - 64 - 64 - 36 - 48 - 8 - 45 - 54 - this.getMoreFilter;
38
-      console.log('this.tableHeight:', this.tableHeight)
40
+      this.tableHeight = window.innerHeight - document.querySelector('.searchDataWrap').clientHeight - 64 - 36 - 48 - 8 - document.querySelector('.ant-table-header').clientHeight - 55 - this.getMoreFilter - 2;
41
+
39 42
     }, 0)
40 43
   }
41 44
 
45
+  getQueryParams(){
46
+    let queryParams = this.tabService.getQueryParams();
47
+    this.tabService.clearQueryParams();
48
+    if(queryParams.dateRange){
49
+      this.dateRange = queryParams.dateRange;
50
+    }
51
+  }
52
+
42 53
   get getMoreFilter(){
43 54
     let flag = this.fieldConfig.fields.groupDTO || this.fieldConfig.fields.userDTO || this.fieldConfig.fields.buildingDTO || this.fieldConfig.fields.floorDTO || this.fieldConfig.fields.companyDTO || this.fieldConfig.fields.repairDeptDTO;
44 55
     return flag ? 21 : 0;
@@ -97,11 +108,11 @@ export class CategoryOneStatisticsComponent implements OnInit, AfterViewInit {
97 108
       hosId: this.hosId || undefined,
98 109
       dutyId: this.dutyId || undefined,
99 110
       parentDutyId: this.parentDutyId || undefined,
100
-      groupId: this.fieldConfig.fields.groupId || undefined,
111
+      groupId: this.fieldConfig.fields.userId ? undefined : (this.fieldConfig.fields.groupId || undefined),
101 112
       userId: this.fieldConfig.fields.userId || undefined,
102 113
       buildingId: this.fieldConfig.fields.buildingId || undefined,
103 114
       placeId: this.fieldConfig.fields.floorId || undefined,
104
-      compantId: this.fieldConfig.fields.compantId || undefined,
115
+      companyId: this.fieldConfig.fields.companyId || undefined,
105 116
       repairDeptId: this.fieldConfig.fields.repairDeptId || undefined,
106 117
       categoryLevel: 1,
107 118
     };
@@ -162,11 +173,11 @@ export class CategoryOneStatisticsComponent implements OnInit, AfterViewInit {
162 173
       hosId: this.hosId || undefined,
163 174
       dutyId: this.dutyId || undefined,
164 175
       parentDutyId: this.parentDutyId || undefined,
165
-      groupId: this.fieldConfig.fields.groupId || undefined,
176
+      groupId: this.fieldConfig.fields.userId ? undefined : (this.fieldConfig.fields.groupId || undefined),
166 177
       userId: this.fieldConfig.fields.userId || undefined,
167 178
       buildingId: this.fieldConfig.fields.buildingId || undefined,
168 179
       placeId: this.fieldConfig.fields.floorId || undefined,
169
-      compantId: this.fieldConfig.fields.compantId || undefined,
180
+      companyId: this.fieldConfig.fields.companyId || undefined,
170 181
       repairDeptId: this.fieldConfig.fields.repairDeptId || undefined,
171 182
       categoryLevel: 1,
172 183
     };

+ 13 - 46
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,65 +13,43 @@
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>
83 49
 </nz-table>
84 50
 <div class="pagination">
85
-  <nz-pagination [(nzPageIndex)]="pageIndex" [(nzTotal)]="listLength" [(nzPageSize)]="pageSize" (nzPageIndexChange)="getList(pageIndex, sortCurrentKey, sortCurrentValue)" (nzPageSizeChange)="getList(pageIndex, sortCurrentKey, sortCurrentValue)"></nz-pagination>
51
+  <ng-template #totalTemplate let-total> 共 {{ total }} 条 </ng-template>
52
+  <nz-pagination [(nzPageIndex)]="pageIndex" [(nzTotal)]="listLength" [(nzPageSize)]="pageSize" (nzPageIndexChange)="getList(pageIndex, sortCurrentKey, sortCurrentValue)" (nzPageSizeChange)="getList(pageIndex, sortCurrentKey, sortCurrentValue)" nzShowSizeChanger [nzPageSizeOptions]="[30,50,100,200]" [nzShowTotal]="totalTemplate"></nz-pagination>
86 53
 </div>
87 54
 
88 55
 <!-- 详细搜索 -->

+ 41 - 77
src/app/views/new-statistics/maintenance-statistics/category-source-statistics/category-source-statistics.component.ts

@@ -1,5 +1,4 @@
1
-import { debounceTime } from 'rxjs/operators';
2
-import { Subject } from 'rxjs';
1
+import { TabService } from './../../services/tab.service';
3 2
 import { NzMessageService } from 'ng-zorro-antd/message';
4 3
 import { format, addMonths, startOfMonth, endOfMonth, startOfDay, endOfDay } from 'date-fns';
5 4
 import { Component, OnInit, HostListener, AfterViewInit } from "@angular/core";
@@ -15,6 +14,7 @@ export class CategorySourceStatisticsComponent implements OnInit, AfterViewInit
15 14
     private mainService: MainService,
16 15
     private message: NzMessageService,
17 16
     private route: ActivatedRoute,
17
+    private tabService: TabService,
18 18
   ) {}
19 19
 
20 20
   listOfData: any[] = []; //表格数据
@@ -23,16 +23,9 @@ export class CategorySourceStatisticsComponent implements OnInit, AfterViewInit
23 23
   pageSize: number = 30; //表格每页展示条数
24 24
   listLength: number = 0; //表格总数据量
25 25
 
26
-  repairDeptId;//报修科室id
27
-
28
-  searchTimerSubject = new Subject();
29
-
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();
28
+    this.getQueryParams();
36 29
     this.search();
37 30
   }
38 31
 
@@ -44,13 +37,21 @@ export class CategorySourceStatisticsComponent implements OnInit, AfterViewInit
44 37
   @HostListener('window:resize')
45 38
   onResize(): void {
46 39
     setTimeout(() => {
47
-      this.tableHeight = window.innerHeight - 64 - 64 - 36 - 48 - 8 - 45 - 54 - this.getMoreFilter;
48
-      console.log('this.tableHeight:', this.tableHeight)
40
+      this.tableHeight = window.innerHeight - document.querySelector('.searchDataWrap').clientHeight - 64 - 36 - 48 - 8 - document.querySelector('.ant-table-header').clientHeight - 55 - this.getMoreFilter - 2;
41
+
49 42
     }, 0)
50 43
   }
51 44
 
45
+  getQueryParams(){
46
+    let queryParams = this.tabService.getQueryParams();
47
+    this.tabService.clearQueryParams();
48
+    if(queryParams.dateRange){
49
+      this.dateRange = queryParams.dateRange;
50
+    }
51
+  }
52
+
52 53
   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;
54
+    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 55
     return flag ? 21 : 0;
55 56
   }
56 57
 
@@ -102,24 +103,24 @@ export class CategorySourceStatisticsComponent implements OnInit, AfterViewInit
102 103
     let postData:any = {
103 104
       idx: this.pageIndex - 1,
104 105
       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,
106
+      startDate: this.dateRange[0] || undefined,
107
+      endDate: this.dateRange[1] || undefined,
108
+      hosId: this.hosId || undefined,
109
+      dutyId: this.dutyId || undefined,
110
+      parentDutyId: this.parentDutyId || undefined,
111
+      groupId: this.fieldConfig.fields.userId ? undefined : (this.fieldConfig.fields.groupId || undefined),
112
+      userId: this.fieldConfig.fields.userId || undefined,
113
+      categoryId: this.fieldConfig.fields.categoryId || undefined,
114
+      hierarchy: this.fieldConfig.fields.hierarchy || undefined,
115
+      buildingId: this.fieldConfig.fields.buildingId || undefined,
116
+      placeId: this.fieldConfig.fields.floorId || undefined,
116 117
     };
117 118
     if (field && sort) {
118 119
       postData.sort = `${field} ${sort === "ascend" ? `asc` : `desc`}`
119 120
     }
120 121
     this.loading1 = true;
121 122
     this.mainService
122
-      .postCustom("itsm/report", "incidentWorkOrder", postData)
123
+      .postCustom("itsm/report", "incidentSource", postData)
123 124
       .subscribe((result) => {
124 125
         this.loading1 = false;
125 126
         this.listOfData = result.dataList.filter((v, i) => { return i != result.dataList.length - 1 });
@@ -166,23 +167,23 @@ export class CategorySourceStatisticsComponent implements OnInit, AfterViewInit
166 167
       nzDuration: 0,
167 168
     }).messageId;
168 169
     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,
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
+      groupId: this.fieldConfig.fields.userId ? undefined : (this.fieldConfig.fields.groupId || undefined),
176
+      userId: this.fieldConfig.fields.userId || undefined,
177
+      categoryId: this.fieldConfig.fields.categoryId || undefined,
178
+      hierarchy: this.fieldConfig.fields.hierarchy || undefined,
179
+      buildingId: this.fieldConfig.fields.buildingId || undefined,
180
+      placeId: this.fieldConfig.fields.floorId || undefined,
180 181
     };
181 182
     if (this.sortCurrentKey && this.sortCurrentValue) {
182 183
       postData.sort = `${this.sortCurrentKey} ${this.sortCurrentValue === "ascend" ? `asc` : `desc`}`
183 184
     }
184 185
     this.mainService
185
-      .postExportCustom("itsm/export", "incidentWorkOrder", postData)
186
+      .postExportCustom("itsm/export", "incidentSource", postData)
186 187
       .subscribe((data) => {
187 188
         this.message.remove(this.excelExportLoading);
188 189
         this.excelExportLoading = false;
@@ -210,52 +211,17 @@ export class CategorySourceStatisticsComponent implements OnInit, AfterViewInit
210 211
 		this.sortCurrentValue = "";
211 212
 		this.sortCurrent = {};
212 213
     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};
214
+    this.fieldConfig.fields = {groupId: undefined, userId: undefined, categoryId: undefined, buildingId: undefined, floorId: undefined};
215 215
     this.search();
216 216
   }
217 217
 
218
-  // 科室搜索
219
-  changeRepairDeptInp(e) {
220
-    this.searchTimer(this.getRepairDeptList, e);
221
-  }
222
-
223 218
   // 防抖
224 219
   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 220
 
255 221
   // 详细搜索
256 222
   fieldConfig:any = {
257
-    fields: {groupId: undefined, userId: undefined, categoryId: undefined, sourceId: undefined, hierarchy: undefined},
258
-    config: {groupAndUser: true, category123: true, source: true},
223
+    fields: {groupId: undefined, userId: undefined, categoryId: undefined, buildingId: undefined, floorId: undefined},
224
+    config: {groupAndUser: true, category123: true, buildingAndFloor: true},
259 225
   }
260 226
   showSearchMore:boolean = false;
261 227
   showMore(){
@@ -274,5 +240,3 @@ export class CategorySourceStatisticsComponent implements OnInit, AfterViewInit
274 240
     this.onResize();
275 241
   }
276 242
 }
277
-
278
-

+ 4 - 3
src/app/views/new-statistics/maintenance-statistics/category-three-statistics/category-three-statistics.component.html

@@ -46,8 +46,8 @@
46 46
     <tr>
47 47
       <th nzWidth="10%">故障现象</th>
48 48
       <th nzWidth="9%" nzShowSort nzSortKey="sum" [(nzSort)]="sortCurrent.sum">工单总数</th>
49
-      <th nzWidth="9%" nzShowSort nzSortKey="avgResponseTime" [(nzSort)]="sortCurrent.avgResponseTime">平均响应时间</th>
50
-      <th nzWidth="9%" nzShowSort nzSortKey="avgResolvedTime" [(nzSort)]="sortCurrent.avgResolvedTime">平均解决时</th>
49
+      <th nzWidth="9%" nzShowSort nzSortKey="avgResponseTime" [(nzSort)]="sortCurrent.avgResponseTime">平均接单时长</th>
50
+      <th nzWidth="9%" nzShowSort nzSortKey="avgResolvedTime" [(nzSort)]="sortCurrent.avgResolvedTime">平均解决时</th>
51 51
       <th nzWidth="9%" nzShowSort nzSortKey="resolvedOverNum" [(nzSort)]="sortCurrent.resolvedOverNum">超时单数</th>
52 52
       <th nzWidth="9%" nzShowSort nzSortKey="overTimeNum" [(nzSort)]="sortCurrent.overTimeNum">挂起单数</th>
53 53
       <th nzWidth="9%" nzShowSort nzSortKey="consumablePrice" [(nzSort)]="sortCurrent.consumablePrice">耗材费用(元)</th>
@@ -91,7 +91,8 @@
91 91
   </ng-template>
92 92
 </nz-table>
93 93
 <div class="pagination">
94
-  <nz-pagination [(nzPageIndex)]="pageIndex" [(nzTotal)]="listLength" [(nzPageSize)]="pageSize" (nzPageIndexChange)="getList(pageIndex, sortCurrentKey, sortCurrentValue)" (nzPageSizeChange)="getList(pageIndex, sortCurrentKey, sortCurrentValue)"></nz-pagination>
94
+  <ng-template #totalTemplate let-total> 共 {{ total }} 条 </ng-template>
95
+  <nz-pagination [(nzPageIndex)]="pageIndex" [(nzTotal)]="listLength" [(nzPageSize)]="pageSize" (nzPageIndexChange)="getList(pageIndex, sortCurrentKey, sortCurrentValue)" (nzPageSizeChange)="getList(pageIndex, sortCurrentKey, sortCurrentValue)" nzShowSizeChanger [nzPageSizeOptions]="[30,50,100,200]" [nzShowTotal]="totalTemplate"></nz-pagination>
95 96
 </div>
96 97
 
97 98
 <!-- 详细搜索 -->

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

@@ -1,3 +1,4 @@
1
+import { TabService } from './../../services/tab.service';
1 2
 import { debounceTime } from 'rxjs/operators';
2 3
 import { Subject } from 'rxjs';
3 4
 import { NzMessageService } from 'ng-zorro-antd/message';
@@ -15,6 +16,7 @@ export class CategoryThreeStatisticsComponent implements OnInit, AfterViewInit {
15 16
     private mainService: MainService,
16 17
     private message: NzMessageService,
17 18
     private route: ActivatedRoute,
19
+    private tabService: TabService,
18 20
   ) {}
19 21
 
20 22
   listOfData: any[] = []; //表格数据
@@ -34,6 +36,7 @@ export class CategoryThreeStatisticsComponent implements OnInit, AfterViewInit {
34 36
       fun.call(this, v[1]);
35 37
     });
36 38
     this.initSessionData();
39
+    this.getQueryParams();
37 40
     this.search();
38 41
   }
39 42
 
@@ -45,11 +48,19 @@ export class CategoryThreeStatisticsComponent implements OnInit, AfterViewInit {
45 48
   @HostListener('window:resize')
46 49
   onResize(): void {
47 50
     setTimeout(() => {
48
-      this.tableHeight = window.innerHeight - 64 - 64 - 36 - 48 - 8 - 45 - 54 - this.getMoreFilter;
49
-      console.log('this.tableHeight:', this.tableHeight)
51
+      this.tableHeight = window.innerHeight - document.querySelector('.searchDataWrap').clientHeight - 64 - 36 - 48 - 8 - document.querySelector('.ant-table-header').clientHeight - 55 - this.getMoreFilter - 2;
52
+
50 53
     }, 0)
51 54
   }
52 55
 
56
+  getQueryParams(){
57
+    let queryParams = this.tabService.getQueryParams();
58
+    this.tabService.clearQueryParams();
59
+    if(queryParams.dateRange){
60
+      this.dateRange = queryParams.dateRange;
61
+    }
62
+  }
63
+
53 64
   get getMoreFilter(){
54 65
     let flag = this.fieldConfig.fields.groupDTO || this.fieldConfig.fields.userDTO || this.fieldConfig.fields.buildingDTO || this.fieldConfig.fields.floorDTO || this.fieldConfig.fields.companyDTO || this.fieldConfig.fields.repairDeptDTO;
55 66
     return flag ? 21 : 0;
@@ -109,11 +120,12 @@ export class CategoryThreeStatisticsComponent implements OnInit, AfterViewInit {
109 120
       dutyId: this.dutyId || undefined,
110 121
       parentDutyId: this.parentDutyId || undefined,
111 122
       categoryId: this.category2Id || this.category1Id || undefined,
112
-      groupId: this.fieldConfig.fields.groupId || undefined,
123
+      hierarchy: this.category2Id ? 2 : (this.category1Id ? 1 : undefined),
124
+      groupId: this.fieldConfig.fields.userId ? undefined : (this.fieldConfig.fields.groupId || undefined),
113 125
       userId: this.fieldConfig.fields.userId || undefined,
114 126
       buildingId: this.fieldConfig.fields.buildingId || undefined,
115 127
       placeId: this.fieldConfig.fields.floorId || undefined,
116
-      compantId: this.fieldConfig.fields.compantId || undefined,
128
+      companyId: this.fieldConfig.fields.companyId || undefined,
117 129
       repairDeptId: this.fieldConfig.fields.repairDeptId || undefined,
118 130
       categoryLevel: 3,
119 131
     };
@@ -175,11 +187,12 @@ export class CategoryThreeStatisticsComponent implements OnInit, AfterViewInit {
175 187
       dutyId: this.dutyId || undefined,
176 188
       parentDutyId: this.parentDutyId || undefined,
177 189
       categoryId: this.category2Id || this.category1Id || undefined,
178
-      groupId: this.fieldConfig.fields.groupId || undefined,
190
+      hierarchy: this.category2Id ? 2 : (this.category1Id ? 1 : undefined),
191
+      groupId: this.fieldConfig.fields.userId ? undefined : (this.fieldConfig.fields.groupId || undefined),
179 192
       userId: this.fieldConfig.fields.userId || undefined,
180 193
       buildingId: this.fieldConfig.fields.buildingId || undefined,
181 194
       placeId: this.fieldConfig.fields.floorId || undefined,
182
-      compantId: this.fieldConfig.fields.compantId || undefined,
195
+      companyId: this.fieldConfig.fields.companyId || undefined,
183 196
       repairDeptId: this.fieldConfig.fields.repairDeptId || undefined,
184 197
       categoryLevel: 3,
185 198
     };
@@ -242,7 +255,7 @@ export class CategoryThreeStatisticsComponent implements OnInit, AfterViewInit {
242 255
   changeCategory1(id){
243 256
     this.category2List = [];
244 257
     this.category2Id = null;
245
-    this.getCategory2List('', id);
258
+    this.getCategory2List();
246 259
   }
247 260
 
248 261
   // 获取一级分类列表
@@ -252,8 +265,7 @@ export class CategoryThreeStatisticsComponent implements OnInit, AfterViewInit {
252 265
       category: {
253 266
         category: keyword,
254 267
         selectType: 'mutlQuery',
255
-        dutyIds: this.queryType == 3 ? this.dutyId : undefined,
256
-        parentDutyId: this.queryType == 3 ? this.parentDutyId : undefined,
268
+        statisticalHosId: this.getHosId,
257 269
         hierarchy: 1,
258 270
       },
259 271
     };
@@ -274,13 +286,13 @@ export class CategoryThreeStatisticsComponent implements OnInit, AfterViewInit {
274 286
   }
275 287
 
276 288
   openChangeCategory2(flag){
277
-    flag && this.getCategory2List('', this.category1Id);
289
+    flag && this.getCategory2List();
278 290
   }
279 291
 
280 292
   // 获取二级分类列表
281 293
   category2List:any[] = [];
282
-  getCategory2List(keyword = '', parentId = '') {
283
-    if(!parentId){
294
+  getCategory2List(keyword = '') {
295
+    if(!this.category1Id){
284 296
       this.isLoading = false;
285 297
       this.category2List = [];
286 298
       return;
@@ -289,7 +301,7 @@ export class CategoryThreeStatisticsComponent implements OnInit, AfterViewInit {
289 301
       category: {
290 302
         category: keyword,
291 303
         selectType: 'mutlQuery',
292
-        parent: { id: parentId },
304
+        parent: { id: this.category1Id },
293 305
       },
294 306
     };
295 307
     this.isLoading = true;

+ 4 - 3
src/app/views/new-statistics/maintenance-statistics/category-two-statistics/category-two-statistics.component.html

@@ -36,8 +36,8 @@
36 36
     <tr>
37 37
       <th nzWidth="10%">故障现象</th>
38 38
       <th nzWidth="9%" nzShowSort nzSortKey="sum" [(nzSort)]="sortCurrent.sum">工单总数</th>
39
-      <th nzWidth="9%" nzShowSort nzSortKey="avgResponseTime" [(nzSort)]="sortCurrent.avgResponseTime">平均响应时间</th>
40
-      <th nzWidth="9%" nzShowSort nzSortKey="avgResolvedTime" [(nzSort)]="sortCurrent.avgResolvedTime">平均解决时</th>
39
+      <th nzWidth="9%" nzShowSort nzSortKey="avgResponseTime" [(nzSort)]="sortCurrent.avgResponseTime">平均接单时长</th>
40
+      <th nzWidth="9%" nzShowSort nzSortKey="avgResolvedTime" [(nzSort)]="sortCurrent.avgResolvedTime">平均解决时</th>
41 41
       <th nzWidth="9%" nzShowSort nzSortKey="resolvedOverNum" [(nzSort)]="sortCurrent.resolvedOverNum">超时单数</th>
42 42
       <th nzWidth="9%" nzShowSort nzSortKey="overTimeNum" [(nzSort)]="sortCurrent.overTimeNum">挂起单数</th>
43 43
       <th nzWidth="9%" nzShowSort nzSortKey="consumablePrice" [(nzSort)]="sortCurrent.consumablePrice">耗材费用(元)</th>
@@ -81,7 +81,8 @@
81 81
   </ng-template>
82 82
 </nz-table>
83 83
 <div class="pagination">
84
-  <nz-pagination [(nzPageIndex)]="pageIndex" [(nzTotal)]="listLength" [(nzPageSize)]="pageSize" (nzPageIndexChange)="getList(pageIndex, sortCurrentKey, sortCurrentValue)" (nzPageSizeChange)="getList(pageIndex, sortCurrentKey, sortCurrentValue)"></nz-pagination>
84
+  <ng-template #totalTemplate let-total> 共 {{ total }} 条 </ng-template>
85
+  <nz-pagination [(nzPageIndex)]="pageIndex" [(nzTotal)]="listLength" [(nzPageSize)]="pageSize" (nzPageIndexChange)="getList(pageIndex, sortCurrentKey, sortCurrentValue)" (nzPageSizeChange)="getList(pageIndex, sortCurrentKey, sortCurrentValue)" nzShowSizeChanger [nzPageSizeOptions]="[30,50,100,200]" [nzShowTotal]="totalTemplate"></nz-pagination>
85 86
 </div>
86 87
 
87 88
 <!-- 详细搜索 -->

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

@@ -1,3 +1,4 @@
1
+import { TabService } from './../../services/tab.service';
1 2
 import { debounceTime } from 'rxjs/operators';
2 3
 import { Subject } from 'rxjs';
3 4
 import { NzMessageService } from 'ng-zorro-antd/message';
@@ -15,6 +16,7 @@ export class CategoryTwoStatisticsComponent implements OnInit, AfterViewInit {
15 16
     private mainService: MainService,
16 17
     private message: NzMessageService,
17 18
     private route: ActivatedRoute,
19
+    private tabService: TabService,
18 20
   ) {}
19 21
 
20 22
   listOfData: any[] = []; //表格数据
@@ -33,6 +35,7 @@ export class CategoryTwoStatisticsComponent implements OnInit, AfterViewInit {
33 35
       fun.call(this, v[1]);
34 36
     });
35 37
     this.initSessionData();
38
+    this.getQueryParams();
36 39
     this.search();
37 40
   }
38 41
 
@@ -44,11 +47,19 @@ export class CategoryTwoStatisticsComponent implements OnInit, AfterViewInit {
44 47
   @HostListener('window:resize')
45 48
   onResize(): void {
46 49
     setTimeout(() => {
47
-      this.tableHeight = window.innerHeight - 64 - 64 - 36 - 48 - 8 - 45 - 54 - this.getMoreFilter;
48
-      console.log('this.tableHeight:', this.tableHeight)
50
+      this.tableHeight = window.innerHeight - document.querySelector('.searchDataWrap').clientHeight - 64 - 36 - 48 - 8 - document.querySelector('.ant-table-header').clientHeight - 55 - this.getMoreFilter - 2;
51
+
49 52
     }, 0)
50 53
   }
51 54
 
55
+  getQueryParams(){
56
+    let queryParams = this.tabService.getQueryParams();
57
+    this.tabService.clearQueryParams();
58
+    if(queryParams.dateRange){
59
+      this.dateRange = queryParams.dateRange;
60
+    }
61
+  }
62
+
52 63
   get getMoreFilter(){
53 64
     let flag = this.fieldConfig.fields.groupDTO || this.fieldConfig.fields.userDTO || this.fieldConfig.fields.buildingDTO || this.fieldConfig.fields.floorDTO || this.fieldConfig.fields.companyDTO || this.fieldConfig.fields.repairDeptDTO;
54 65
     return flag ? 21 : 0;
@@ -108,11 +119,12 @@ export class CategoryTwoStatisticsComponent implements OnInit, AfterViewInit {
108 119
       dutyId: this.dutyId || undefined,
109 120
       parentDutyId: this.parentDutyId || undefined,
110 121
       categoryId: this.category1Id || undefined,
111
-      groupId: this.fieldConfig.fields.groupId || undefined,
122
+      hierarchy: this.category1Id ? 1 : undefined,
123
+      groupId: this.fieldConfig.fields.userId ? undefined : (this.fieldConfig.fields.groupId || undefined),
112 124
       userId: this.fieldConfig.fields.userId || undefined,
113 125
       buildingId: this.fieldConfig.fields.buildingId || undefined,
114 126
       placeId: this.fieldConfig.fields.floorId || undefined,
115
-      compantId: this.fieldConfig.fields.compantId || undefined,
127
+      companyId: this.fieldConfig.fields.companyId || undefined,
116 128
       repairDeptId: this.fieldConfig.fields.repairDeptId || undefined,
117 129
       categoryLevel: 2,
118 130
     };
@@ -174,11 +186,12 @@ export class CategoryTwoStatisticsComponent implements OnInit, AfterViewInit {
174 186
       dutyId: this.dutyId || undefined,
175 187
       parentDutyId: this.parentDutyId || undefined,
176 188
       categoryId: this.category1Id || undefined,
177
-      groupId: this.fieldConfig.fields.groupId || undefined,
189
+      hierarchy: this.category1Id ? 1 : undefined,
190
+      groupId: this.fieldConfig.fields.userId ? undefined : (this.fieldConfig.fields.groupId || undefined),
178 191
       userId: this.fieldConfig.fields.userId || undefined,
179 192
       buildingId: this.fieldConfig.fields.buildingId || undefined,
180 193
       placeId: this.fieldConfig.fields.floorId || undefined,
181
-      compantId: this.fieldConfig.fields.compantId || undefined,
194
+      companyId: this.fieldConfig.fields.companyId || undefined,
182 195
       repairDeptId: this.fieldConfig.fields.repairDeptId || undefined,
183 196
       categoryLevel: 2,
184 197
     };
@@ -242,8 +255,7 @@ export class CategoryTwoStatisticsComponent implements OnInit, AfterViewInit {
242 255
       category: {
243 256
         category: keyword,
244 257
         selectType: 'mutlQuery',
245
-        dutyIds: this.queryType == 3 ? this.dutyId : undefined,
246
-        parentDutyId: this.queryType == 3 ? this.parentDutyId : undefined,
258
+        statisticalHosId: this.getHosId,
247 259
         hierarchy: 1,
248 260
       },
249 261
     };

+ 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 { }

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

@@ -0,0 +1,71 @@
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.hospital.hosName + '-' + 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
+  <ng-template #totalTemplate let-total> 共 {{ total }} 条 </ng-template>
67
+  <nz-pagination [(nzPageIndex)]="pageIndex" [(nzTotal)]="listLength" [(nzPageSize)]="pageSize" (nzPageIndexChange)="getList(pageIndex, sortCurrentKey, sortCurrentValue)" (nzPageSizeChange)="getList(pageIndex, sortCurrentKey, sortCurrentValue)" nzShowSizeChanger [nzPageSizeOptions]="[30,50,100,200]" [nzShowTotal]="totalTemplate"></nz-pagination>
68
+</div>
69
+
70
+<!-- 详细搜索 -->
71
+<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
+}

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

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

+ 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 { }

+ 43 - 44
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,65 +24,64 @@
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>
83 81
 </nz-table>
84 82
 <div class="pagination">
85
-  <nz-pagination [(nzPageIndex)]="pageIndex" [(nzTotal)]="listLength" [(nzPageSize)]="pageSize" (nzPageIndexChange)="getList(pageIndex, sortCurrentKey, sortCurrentValue)" (nzPageSizeChange)="getList(pageIndex, sortCurrentKey, sortCurrentValue)"></nz-pagination>
83
+  <ng-template #totalTemplate let-total> 共 {{ total }} 条 </ng-template>
84
+  <nz-pagination [(nzPageIndex)]="pageIndex" [(nzTotal)]="listLength" [(nzPageSize)]="pageSize" (nzPageIndexChange)="getList(pageIndex, sortCurrentKey, sortCurrentValue)" (nzPageSizeChange)="getList(pageIndex, sortCurrentKey, sortCurrentValue)" nzShowSizeChanger [nzPageSizeOptions]="[30,50,100,200]" [nzShowTotal]="totalTemplate"></nz-pagination>
86 85
 </div>
87 86
 
88 87
 <!-- 详细搜索 -->

+ 52 - 67
src/app/views/new-statistics/maintenance-statistics/department-evaluate-statistics/department-evaluate-statistics.component.ts

@@ -1,5 +1,4 @@
1
-import { debounceTime } from 'rxjs/operators';
2
-import { Subject } from 'rxjs';
1
+import { TabService } from './../../services/tab.service';
3 2
 import { NzMessageService } from 'ng-zorro-antd/message';
4 3
 import { format, addMonths, startOfMonth, endOfMonth, startOfDay, endOfDay } from 'date-fns';
5 4
 import { Component, OnInit, HostListener, AfterViewInit } from "@angular/core";
@@ -15,6 +14,7 @@ export class DepartmentEvaluateStatisticsComponent implements OnInit, AfterViewI
15 14
     private mainService: MainService,
16 15
     private message: NzMessageService,
17 16
     private route: ActivatedRoute,
17
+    private tabService: TabService,
18 18
   ) {}
19 19
 
20 20
   listOfData: any[] = []; //表格数据
@@ -23,16 +23,11 @@ export class DepartmentEvaluateStatisticsComponent implements OnInit, AfterViewI
23 23
   pageSize: number = 30; //表格每页展示条数
24 24
   listLength: number = 0; //表格总数据量
25 25
 
26
-  repairDeptId;//报修科室id
27
-
28
-  searchTimerSubject = new Subject();
26
+  deptTypeId;//科室类型id
29 27
 
30 28
   ngOnInit() {
31
-    this.searchTimerSubject.pipe(debounceTime(500)).subscribe((v) => {
32
-      let fun = v[0];
33
-      fun.call(this, v[1]);
34
-    });
35 29
     this.initSessionData();
30
+    this.getQueryParams();
36 31
     this.search();
37 32
   }
38 33
 
@@ -44,13 +39,21 @@ export class DepartmentEvaluateStatisticsComponent implements OnInit, AfterViewI
44 39
   @HostListener('window:resize')
45 40
   onResize(): void {
46 41
     setTimeout(() => {
47
-      this.tableHeight = window.innerHeight - 64 - 64 - 36 - 48 - 8 - 45 - 54 - this.getMoreFilter;
48
-      console.log('this.tableHeight:', this.tableHeight)
42
+      this.tableHeight = window.innerHeight - document.querySelector('.searchDataWrap').clientHeight - 64 - 36 - 48 - 8 - document.querySelector('.ant-table-header').clientHeight - 55 - this.getMoreFilter - 2;
43
+
49 44
     }, 0)
50 45
   }
51 46
 
47
+  getQueryParams(){
48
+    let queryParams = this.tabService.getQueryParams();
49
+    this.tabService.clearQueryParams();
50
+    if(queryParams.dateRange){
51
+      this.dateRange = queryParams.dateRange;
52
+    }
53
+  }
54
+
52 55
   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;
56
+    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 57
     return flag ? 21 : 0;
55 58
   }
56 59
 
@@ -102,24 +105,25 @@ export class DepartmentEvaluateStatisticsComponent implements OnInit, AfterViewI
102 105
     let postData:any = {
103 106
       idx: this.pageIndex - 1,
104 107
       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,
108
+      startDate: this.dateRange[0] || undefined,
109
+      endDate: this.dateRange[1] || undefined,
110
+      hosId: this.hosId || undefined,
111
+      dutyId: this.dutyId || undefined,
112
+      parentDutyId: this.parentDutyId || undefined,
113
+      deptTypeId: this.deptTypeId || undefined,
114
+      groupId: this.fieldConfig.fields.userId ? undefined : (this.fieldConfig.fields.groupId || undefined),
115
+      userId: this.fieldConfig.fields.userId || undefined,
116
+      categoryId: this.fieldConfig.fields.categoryId || undefined,
117
+      hierarchy: this.fieldConfig.fields.hierarchy || undefined,
118
+      buildingId: this.fieldConfig.fields.buildingId || undefined,
119
+      placeId: this.fieldConfig.fields.floorId || undefined,
116 120
     };
117 121
     if (field && sort) {
118 122
       postData.sort = `${field} ${sort === "ascend" ? `asc` : `desc`}`
119 123
     }
120 124
     this.loading1 = true;
121 125
     this.mainService
122
-      .postCustom("itsm/report", "incidentWorkOrder", postData)
126
+      .postCustom("itsm/report", "deptEvaluate", postData)
123 127
       .subscribe((result) => {
124 128
         this.loading1 = false;
125 129
         this.listOfData = result.dataList.filter((v, i) => { return i != result.dataList.length - 1 });
@@ -166,23 +170,24 @@ export class DepartmentEvaluateStatisticsComponent implements OnInit, AfterViewI
166 170
       nzDuration: 0,
167 171
     }).messageId;
168 172
     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,
173
+      startDate: this.dateRange[0] || undefined,
174
+      endDate: this.dateRange[1] || undefined,
175
+      hosId: this.hosId || undefined,
176
+      dutyId: this.dutyId || undefined,
177
+      parentDutyId: this.parentDutyId || undefined,
178
+      deptTypeId: this.deptTypeId || undefined,
179
+      groupId: this.fieldConfig.fields.userId ? undefined : (this.fieldConfig.fields.groupId || undefined),
180
+      userId: this.fieldConfig.fields.userId || undefined,
181
+      categoryId: this.fieldConfig.fields.categoryId || undefined,
182
+      hierarchy: this.fieldConfig.fields.hierarchy || undefined,
183
+      buildingId: this.fieldConfig.fields.buildingId || undefined,
184
+      placeId: this.fieldConfig.fields.floorId || undefined,
180 185
     };
181 186
     if (this.sortCurrentKey && this.sortCurrentValue) {
182 187
       postData.sort = `${this.sortCurrentKey} ${this.sortCurrentValue === "ascend" ? `asc` : `desc`}`
183 188
     }
184 189
     this.mainService
185
-      .postExportCustom("itsm/export", "incidentWorkOrder", postData)
190
+      .postExportCustom("itsm/export", "deptEvaluate", postData)
186 191
       .subscribe((data) => {
187 192
         this.message.remove(this.excelExportLoading);
188 193
         this.excelExportLoading = false;
@@ -210,52 +215,34 @@ export class DepartmentEvaluateStatisticsComponent implements OnInit, AfterViewI
210 215
 		this.sortCurrentValue = "";
211 216
 		this.sortCurrent = {};
212 217
     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};
218
+    this.deptTypeId = undefined;
219
+    this.fieldConfig.fields = {groupId: undefined, userId: undefined, categoryId: undefined, buildingId: undefined, floorId: undefined};
215 220
     this.search();
216 221
   }
217 222
 
218
-  // 科室搜索
219
-  changeRepairDeptInp(e) {
220
-    this.searchTimer(this.getRepairDeptList, e);
221
-  }
222
-
223 223
   // 防抖
224 224
   isLoading = false;
225
-  searchTimer(fun, e) {
226
-    this.isLoading = true;
227
-    this.searchTimerSubject.next([fun, e]);
228
-  }
229 225
 
230
-  openChangeRepairDept(flag){
231
-    flag && this.getRepairDeptList();
226
+  openChangeDeptType(flag){
227
+    flag && this.getDeptTypeList();
232 228
   }
233 229
 
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
-    };
230
+  // 获取科室类型列表
231
+  deptTypeList:any[] = [];
232
+  getDeptTypeList(keyword?) {
246 233
     this.isLoading = true;
247 234
     this.mainService
248
-      .getFetchDataList("data", "department", data)
235
+      .getDictionary("list", "dept_type")
249 236
       .subscribe((data) => {
250 237
         this.isLoading = false;
251
-        this.repairDeptList = data.list;
238
+        this.deptTypeList = data;
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: {groupId: undefined, userId: undefined, categoryId: undefined, buildingId: undefined, floorId: undefined},
245
+    config: {groupAndUser: true, category123: true, buildingAndFloor: true},
259 246
   }
260 247
   showSearchMore:boolean = false;
261 248
   showMore(){
@@ -274,5 +261,3 @@ export class DepartmentEvaluateStatisticsComponent implements OnInit, AfterViewI
274 261
     this.onResize();
275 262
   }
276 263
 }
277
-
278
-

+ 19 - 17
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,21 +24,22 @@
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
-      <th nzWidth="9%" nzShowSort nzSortKey="avgResponseTime" [(nzSort)]="sortCurrent.avgResponseTime">平均响应时间</th>
41
-      <th nzWidth="9%" nzShowSort nzSortKey="avgResolvedTime" [(nzSort)]="sortCurrent.avgResolvedTime">平均解决时</th>
41
+      <th nzWidth="9%" nzShowSort nzSortKey="avgResponseTime" [(nzSort)]="sortCurrent.avgResponseTime">平均接单时长</th>
42
+      <th nzWidth="9%" nzShowSort nzSortKey="avgResolvedTime" [(nzSort)]="sortCurrent.avgResolvedTime">平均解决时</th>
42 43
       <th nzWidth="9%" nzShowSort nzSortKey="resolvedOverNum" [(nzSort)]="sortCurrent.resolvedOverNum">超时单数</th>
43 44
       <th nzWidth="9%" nzShowSort nzSortKey="overTimeNum" [(nzSort)]="sortCurrent.overTimeNum">挂起单数</th>
44 45
       <th nzWidth="9%" nzShowSort nzSortKey="consumablePrice" [(nzSort)]="sortCurrent.consumablePrice">耗材费用(元)</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>
@@ -82,7 +83,8 @@
82 83
   </ng-template>
83 84
 </nz-table>
84 85
 <div class="pagination">
85
-  <nz-pagination [(nzPageIndex)]="pageIndex" [(nzTotal)]="listLength" [(nzPageSize)]="pageSize" (nzPageIndexChange)="getList(pageIndex, sortCurrentKey, sortCurrentValue)" (nzPageSizeChange)="getList(pageIndex, sortCurrentKey, sortCurrentValue)"></nz-pagination>
86
+  <ng-template #totalTemplate let-total> 共 {{ total }} 条 </ng-template>
87
+  <nz-pagination [(nzPageIndex)]="pageIndex" [(nzTotal)]="listLength" [(nzPageSize)]="pageSize" (nzPageIndexChange)="getList(pageIndex, sortCurrentKey, sortCurrentValue)" (nzPageSizeChange)="getList(pageIndex, sortCurrentKey, sortCurrentValue)" nzShowSizeChanger [nzPageSizeOptions]="[30,50,100,200]" [nzShowTotal]="totalTemplate"></nz-pagination>
86 88
 </div>
87 89
 
88 90
 <!-- 详细搜索 -->

+ 52 - 67
src/app/views/new-statistics/maintenance-statistics/department-incident-statistics/department-incident-statistics.component.ts

@@ -1,5 +1,4 @@
1
-import { debounceTime } from 'rxjs/operators';
2
-import { Subject } from 'rxjs';
1
+import { TabService } from './../../services/tab.service';
3 2
 import { NzMessageService } from 'ng-zorro-antd/message';
4 3
 import { format, addMonths, startOfMonth, endOfMonth, startOfDay, endOfDay } from 'date-fns';
5 4
 import { Component, OnInit, HostListener, AfterViewInit } from "@angular/core";
@@ -15,6 +14,7 @@ export class DepartmentIncidentStatisticsComponent implements OnInit, AfterViewI
15 14
     private mainService: MainService,
16 15
     private message: NzMessageService,
17 16
     private route: ActivatedRoute,
17
+    private tabService: TabService,
18 18
   ) {}
19 19
 
20 20
   listOfData: any[] = []; //表格数据
@@ -23,16 +23,11 @@ export class DepartmentIncidentStatisticsComponent implements OnInit, AfterViewI
23 23
   pageSize: number = 30; //表格每页展示条数
24 24
   listLength: number = 0; //表格总数据量
25 25
 
26
-  repairDeptId;//报修科室id
27
-
28
-  searchTimerSubject = new Subject();
26
+  deptTypeId;//科室类型id
29 27
 
30 28
   ngOnInit() {
31
-    this.searchTimerSubject.pipe(debounceTime(500)).subscribe((v) => {
32
-      let fun = v[0];
33
-      fun.call(this, v[1]);
34
-    });
35 29
     this.initSessionData();
30
+    this.getQueryParams();
36 31
     this.search();
37 32
   }
38 33
 
@@ -44,13 +39,21 @@ export class DepartmentIncidentStatisticsComponent implements OnInit, AfterViewI
44 39
   @HostListener('window:resize')
45 40
   onResize(): void {
46 41
     setTimeout(() => {
47
-      this.tableHeight = window.innerHeight - 64 - 64 - 36 - 48 - 8 - 45 - 54 - this.getMoreFilter;
48
-      console.log('this.tableHeight:', this.tableHeight)
42
+      this.tableHeight = window.innerHeight - document.querySelector('.searchDataWrap').clientHeight - 64 - 36 - 48 - 8 - document.querySelector('.ant-table-header').clientHeight - 55 - this.getMoreFilter - 2;
43
+
49 44
     }, 0)
50 45
   }
51 46
 
47
+  getQueryParams(){
48
+    let queryParams = this.tabService.getQueryParams();
49
+    this.tabService.clearQueryParams();
50
+    if(queryParams.dateRange){
51
+      this.dateRange = queryParams.dateRange;
52
+    }
53
+  }
54
+
52 55
   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;
56
+    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 57
     return flag ? 21 : 0;
55 58
   }
56 59
 
@@ -102,24 +105,25 @@ export class DepartmentIncidentStatisticsComponent implements OnInit, AfterViewI
102 105
     let postData:any = {
103 106
       idx: this.pageIndex - 1,
104 107
       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,
108
+      startDate: this.dateRange[0] || undefined,
109
+      endDate: this.dateRange[1] || undefined,
110
+      hosId: this.hosId || undefined,
111
+      dutyId: this.dutyId || undefined,
112
+      parentDutyId: this.parentDutyId || undefined,
113
+      deptTypeId: this.deptTypeId || undefined,
114
+      groupId: this.fieldConfig.fields.userId ? undefined : (this.fieldConfig.fields.groupId || undefined),
115
+      userId: this.fieldConfig.fields.userId || undefined,
116
+      categoryId: this.fieldConfig.fields.categoryId || undefined,
117
+      hierarchy: this.fieldConfig.fields.hierarchy || undefined,
118
+      buildingId: this.fieldConfig.fields.buildingId || undefined,
119
+      placeId: this.fieldConfig.fields.floorId || undefined,
116 120
     };
117 121
     if (field && sort) {
118 122
       postData.sort = `${field} ${sort === "ascend" ? `asc` : `desc`}`
119 123
     }
120 124
     this.loading1 = true;
121 125
     this.mainService
122
-      .postCustom("itsm/report", "incidentWorkOrder", postData)
126
+      .postCustom("itsm/report", "repairDept", postData)
123 127
       .subscribe((result) => {
124 128
         this.loading1 = false;
125 129
         this.listOfData = result.dataList.filter((v, i) => { return i != result.dataList.length - 1 });
@@ -166,23 +170,24 @@ export class DepartmentIncidentStatisticsComponent implements OnInit, AfterViewI
166 170
       nzDuration: 0,
167 171
     }).messageId;
168 172
     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,
173
+      startDate: this.dateRange[0] || undefined,
174
+      endDate: this.dateRange[1] || undefined,
175
+      hosId: this.hosId || undefined,
176
+      dutyId: this.dutyId || undefined,
177
+      parentDutyId: this.parentDutyId || undefined,
178
+      deptTypeId: this.deptTypeId || undefined,
179
+      groupId: this.fieldConfig.fields.userId ? undefined : (this.fieldConfig.fields.groupId || undefined),
180
+      userId: this.fieldConfig.fields.userId || undefined,
181
+      categoryId: this.fieldConfig.fields.categoryId || undefined,
182
+      hierarchy: this.fieldConfig.fields.hierarchy || undefined,
183
+      buildingId: this.fieldConfig.fields.buildingId || undefined,
184
+      placeId: this.fieldConfig.fields.floorId || undefined,
180 185
     };
181 186
     if (this.sortCurrentKey && this.sortCurrentValue) {
182 187
       postData.sort = `${this.sortCurrentKey} ${this.sortCurrentValue === "ascend" ? `asc` : `desc`}`
183 188
     }
184 189
     this.mainService
185
-      .postExportCustom("itsm/export", "incidentWorkOrder", postData)
190
+      .postExportCustom("itsm/export", "repairDept", postData)
186 191
       .subscribe((data) => {
187 192
         this.message.remove(this.excelExportLoading);
188 193
         this.excelExportLoading = false;
@@ -210,52 +215,34 @@ export class DepartmentIncidentStatisticsComponent implements OnInit, AfterViewI
210 215
 		this.sortCurrentValue = "";
211 216
 		this.sortCurrent = {};
212 217
     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};
218
+    this.deptTypeId = undefined;
219
+    this.fieldConfig.fields = {groupId: undefined, userId: undefined, categoryId: undefined, buildingId: undefined, floorId: undefined};
215 220
     this.search();
216 221
   }
217 222
 
218
-  // 科室搜索
219
-  changeRepairDeptInp(e) {
220
-    this.searchTimer(this.getRepairDeptList, e);
221
-  }
222
-
223 223
   // 防抖
224 224
   isLoading = false;
225
-  searchTimer(fun, e) {
226
-    this.isLoading = true;
227
-    this.searchTimerSubject.next([fun, e]);
228
-  }
229 225
 
230
-  openChangeRepairDept(flag){
231
-    flag && this.getRepairDeptList();
226
+  openChangeDeptType(flag){
227
+    flag && this.getDeptTypeList();
232 228
   }
233 229
 
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
-    };
230
+  // 获取科室类型列表
231
+  deptTypeList:any[] = [];
232
+  getDeptTypeList(keyword?) {
246 233
     this.isLoading = true;
247 234
     this.mainService
248
-      .getFetchDataList("data", "department", data)
235
+      .getDictionary("list", "dept_type")
249 236
       .subscribe((data) => {
250 237
         this.isLoading = false;
251
-        this.repairDeptList = data.list;
238
+        this.deptTypeList = data;
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: {groupId: undefined, userId: undefined, categoryId: undefined, buildingId: undefined, floorId: undefined},
245
+    config: {groupAndUser: true, category123: true, buildingAndFloor: true},
259 246
   }
260 247
   showSearchMore:boolean = false;
261 248
   showMore(){
@@ -274,5 +261,3 @@ export class DepartmentIncidentStatisticsComponent implements OnInit, AfterViewI
274 261
     this.onResize();
275 262
   }
276 263
 }
277
-
278
-

+ 31 - 44
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,65 +24,52 @@
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>
83 69
 </nz-table>
84 70
 <div class="pagination">
85
-  <nz-pagination [(nzPageIndex)]="pageIndex" [(nzTotal)]="listLength" [(nzPageSize)]="pageSize" (nzPageIndexChange)="getList(pageIndex, sortCurrentKey, sortCurrentValue)" (nzPageSizeChange)="getList(pageIndex, sortCurrentKey, sortCurrentValue)"></nz-pagination>
71
+  <ng-template #totalTemplate let-total> 共 {{ total }} 条 </ng-template>
72
+  <nz-pagination [(nzPageIndex)]="pageIndex" [(nzTotal)]="listLength" [(nzPageSize)]="pageSize" (nzPageIndexChange)="getList(pageIndex, sortCurrentKey, sortCurrentValue)" (nzPageSizeChange)="getList(pageIndex, sortCurrentKey, sortCurrentValue)" nzShowSizeChanger [nzPageSizeOptions]="[30,50,100,200]" [nzShowTotal]="totalTemplate"></nz-pagination>
86 73
 </div>
87 74
 
88 75
 <!-- 详细搜索 -->

+ 52 - 67
src/app/views/new-statistics/maintenance-statistics/department-source-statistics/department-source-statistics.component.ts

@@ -1,5 +1,4 @@
1
-import { debounceTime } from 'rxjs/operators';
2
-import { Subject } from 'rxjs';
1
+import { TabService } from './../../services/tab.service';
3 2
 import { NzMessageService } from 'ng-zorro-antd/message';
4 3
 import { format, addMonths, startOfMonth, endOfMonth, startOfDay, endOfDay } from 'date-fns';
5 4
 import { Component, OnInit, HostListener, AfterViewInit } from "@angular/core";
@@ -15,6 +14,7 @@ export class DepartmentSourceStatisticsComponent implements OnInit, AfterViewIni
15 14
     private mainService: MainService,
16 15
     private message: NzMessageService,
17 16
     private route: ActivatedRoute,
17
+    private tabService: TabService,
18 18
   ) {}
19 19
 
20 20
   listOfData: any[] = []; //表格数据
@@ -23,16 +23,11 @@ export class DepartmentSourceStatisticsComponent implements OnInit, AfterViewIni
23 23
   pageSize: number = 30; //表格每页展示条数
24 24
   listLength: number = 0; //表格总数据量
25 25
 
26
-  repairDeptId;//报修科室id
27
-
28
-  searchTimerSubject = new Subject();
26
+  deptTypeId;//科室类型id
29 27
 
30 28
   ngOnInit() {
31
-    this.searchTimerSubject.pipe(debounceTime(500)).subscribe((v) => {
32
-      let fun = v[0];
33
-      fun.call(this, v[1]);
34
-    });
35 29
     this.initSessionData();
30
+    this.getQueryParams();
36 31
     this.search();
37 32
   }
38 33
 
@@ -44,13 +39,21 @@ export class DepartmentSourceStatisticsComponent implements OnInit, AfterViewIni
44 39
   @HostListener('window:resize')
45 40
   onResize(): void {
46 41
     setTimeout(() => {
47
-      this.tableHeight = window.innerHeight - 64 - 64 - 36 - 48 - 8 - 45 - 54 - this.getMoreFilter;
48
-      console.log('this.tableHeight:', this.tableHeight)
42
+      this.tableHeight = window.innerHeight - document.querySelector('.searchDataWrap').clientHeight - 64 - 36 - 48 - 8 - document.querySelector('.ant-table-header').clientHeight - 55 - this.getMoreFilter - 2;
43
+
49 44
     }, 0)
50 45
   }
51 46
 
47
+  getQueryParams(){
48
+    let queryParams = this.tabService.getQueryParams();
49
+    this.tabService.clearQueryParams();
50
+    if(queryParams.dateRange){
51
+      this.dateRange = queryParams.dateRange;
52
+    }
53
+  }
54
+
52 55
   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;
56
+    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 57
     return flag ? 21 : 0;
55 58
   }
56 59
 
@@ -102,24 +105,25 @@ export class DepartmentSourceStatisticsComponent implements OnInit, AfterViewIni
102 105
     let postData:any = {
103 106
       idx: this.pageIndex - 1,
104 107
       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,
108
+      startDate: this.dateRange[0] || undefined,
109
+      endDate: this.dateRange[1] || undefined,
110
+      hosId: this.hosId || undefined,
111
+      dutyId: this.dutyId || undefined,
112
+      parentDutyId: this.parentDutyId || undefined,
113
+      deptTypeId: this.deptTypeId || undefined,
114
+      groupId: this.fieldConfig.fields.userId ? undefined : (this.fieldConfig.fields.groupId || undefined),
115
+      userId: this.fieldConfig.fields.userId || undefined,
116
+      categoryId: this.fieldConfig.fields.categoryId || undefined,
117
+      hierarchy: this.fieldConfig.fields.hierarchy || undefined,
118
+      buildingId: this.fieldConfig.fields.buildingId || undefined,
119
+      placeId: this.fieldConfig.fields.floorId || undefined,
116 120
     };
117 121
     if (field && sort) {
118 122
       postData.sort = `${field} ${sort === "ascend" ? `asc` : `desc`}`
119 123
     }
120 124
     this.loading1 = true;
121 125
     this.mainService
122
-      .postCustom("itsm/report", "incidentWorkOrder", postData)
126
+      .postCustom("itsm/report", "deptSource", postData)
123 127
       .subscribe((result) => {
124 128
         this.loading1 = false;
125 129
         this.listOfData = result.dataList.filter((v, i) => { return i != result.dataList.length - 1 });
@@ -166,23 +170,24 @@ export class DepartmentSourceStatisticsComponent implements OnInit, AfterViewIni
166 170
       nzDuration: 0,
167 171
     }).messageId;
168 172
     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,
173
+      startDate: this.dateRange[0] || undefined,
174
+      endDate: this.dateRange[1] || undefined,
175
+      hosId: this.hosId || undefined,
176
+      dutyId: this.dutyId || undefined,
177
+      parentDutyId: this.parentDutyId || undefined,
178
+      deptTypeId: this.deptTypeId || undefined,
179
+      groupId: this.fieldConfig.fields.userId ? undefined : (this.fieldConfig.fields.groupId || undefined),
180
+      userId: this.fieldConfig.fields.userId || undefined,
181
+      categoryId: this.fieldConfig.fields.categoryId || undefined,
182
+      hierarchy: this.fieldConfig.fields.hierarchy || undefined,
183
+      buildingId: this.fieldConfig.fields.buildingId || undefined,
184
+      placeId: this.fieldConfig.fields.floorId || undefined,
180 185
     };
181 186
     if (this.sortCurrentKey && this.sortCurrentValue) {
182 187
       postData.sort = `${this.sortCurrentKey} ${this.sortCurrentValue === "ascend" ? `asc` : `desc`}`
183 188
     }
184 189
     this.mainService
185
-      .postExportCustom("itsm/export", "incidentWorkOrder", postData)
190
+      .postExportCustom("itsm/export", "deptSource", postData)
186 191
       .subscribe((data) => {
187 192
         this.message.remove(this.excelExportLoading);
188 193
         this.excelExportLoading = false;
@@ -210,52 +215,34 @@ export class DepartmentSourceStatisticsComponent implements OnInit, AfterViewIni
210 215
 		this.sortCurrentValue = "";
211 216
 		this.sortCurrent = {};
212 217
     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};
218
+    this.deptTypeId = undefined;
219
+    this.fieldConfig.fields = {groupId: undefined, userId: undefined, categoryId: undefined, buildingId: undefined, floorId: undefined};
215 220
     this.search();
216 221
   }
217 222
 
218
-  // 科室搜索
219
-  changeRepairDeptInp(e) {
220
-    this.searchTimer(this.getRepairDeptList, e);
221
-  }
222
-
223 223
   // 防抖
224 224
   isLoading = false;
225
-  searchTimer(fun, e) {
226
-    this.isLoading = true;
227
-    this.searchTimerSubject.next([fun, e]);
228
-  }
229 225
 
230
-  openChangeRepairDept(flag){
231
-    flag && this.getRepairDeptList();
226
+  openChangeDeptType(flag){
227
+    flag && this.getDeptTypeList();
232 228
   }
233 229
 
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
-    };
230
+  // 获取科室类型列表
231
+  deptTypeList:any[] = [];
232
+  getDeptTypeList(keyword?) {
246 233
     this.isLoading = true;
247 234
     this.mainService
248
-      .getFetchDataList("data", "department", data)
235
+      .getDictionary("list", "dept_type")
249 236
       .subscribe((data) => {
250 237
         this.isLoading = false;
251
-        this.repairDeptList = data.list;
238
+        this.deptTypeList = data;
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: {groupId: undefined, userId: undefined, categoryId: undefined, buildingId: undefined, floorId: undefined},
245
+    config: {groupAndUser: true, category123: true, buildingAndFloor: true},
259 246
   }
260 247
   showSearchMore:boolean = false;
261 248
   showMore(){
@@ -274,5 +261,3 @@ export class DepartmentSourceStatisticsComponent implements OnInit, AfterViewIni
274 261
     this.onResize();
275 262
   }
276 263
 }
277
-
278
-

+ 17 - 19
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.hosName + '-' + 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,21 +24,18 @@
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
-      <th nzWidth="9%" nzShowSort nzSortKey="avgResponseTime" [(nzSort)]="sortCurrent.avgResponseTime">平均响应时间</th>
41
-      <th nzWidth="9%" nzShowSort nzSortKey="avgResolvedTime" [(nzSort)]="sortCurrent.avgResolvedTime">平均解决时</th>
37
+      <th nzWidth="9%" nzShowSort nzSortKey="avgResponseTime" [(nzSort)]="sortCurrent.avgResponseTime">平均接单时长</th>
38
+      <th nzWidth="9%" nzShowSort nzSortKey="avgResolvedTime" [(nzSort)]="sortCurrent.avgResolvedTime">平均解决时</th>
42 39
       <th nzWidth="9%" nzShowSort nzSortKey="resolvedOverNum" [(nzSort)]="sortCurrent.resolvedOverNum">超时单数</th>
43 40
       <th nzWidth="9%" nzShowSort nzSortKey="overTimeNum" [(nzSort)]="sortCurrent.overTimeNum">挂起单数</th>
44 41
       <th nzWidth="9%" nzShowSort nzSortKey="consumablePrice" [(nzSort)]="sortCurrent.consumablePrice">耗材费用(元)</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>
@@ -82,7 +79,8 @@
82 79
   </ng-template>
83 80
 </nz-table>
84 81
 <div class="pagination">
85
-  <nz-pagination [(nzPageIndex)]="pageIndex" [(nzTotal)]="listLength" [(nzPageSize)]="pageSize" (nzPageIndexChange)="getList(pageIndex, sortCurrentKey, sortCurrentValue)" (nzPageSizeChange)="getList(pageIndex, sortCurrentKey, sortCurrentValue)"></nz-pagination>
82
+  <ng-template #totalTemplate let-total> 共 {{ total }} 条 </ng-template>
83
+  <nz-pagination [(nzPageIndex)]="pageIndex" [(nzTotal)]="listLength" [(nzPageSize)]="pageSize" (nzPageIndexChange)="getList(pageIndex, sortCurrentKey, sortCurrentValue)" (nzPageSizeChange)="getList(pageIndex, sortCurrentKey, sortCurrentValue)" nzShowSizeChanger [nzPageSizeOptions]="[30,50,100,200]" [nzShowTotal]="totalTemplate"></nz-pagination>
86 84
 </div>
87 85
 
88 86
 <!-- 详细搜索 -->

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

@@ -1,3 +1,4 @@
1
+import { TabService } from './../../services/tab.service';
1 2
 import { debounceTime } from 'rxjs/operators';
2 3
 import { Subject } from 'rxjs';
3 4
 import { NzMessageService } from 'ng-zorro-antd/message';
@@ -15,6 +16,7 @@ export class FloorStatisticsComponent implements OnInit, AfterViewInit {
15 16
     private mainService: MainService,
16 17
     private message: NzMessageService,
17 18
     private route: ActivatedRoute,
19
+    private tabService: TabService,
18 20
   ) {}
19 21
 
20 22
   listOfData: any[] = []; //表格数据
@@ -23,7 +25,7 @@ export class FloorStatisticsComponent implements OnInit, AfterViewInit {
23 25
   pageSize: number = 30; //表格每页展示条数
24 26
   listLength: number = 0; //表格总数据量
25 27
 
26
-  repairDeptId;//报修科室id
28
+  buildingId;//楼栋id
27 29
 
28 30
   searchTimerSubject = new Subject();
29 31
 
@@ -33,6 +35,7 @@ export class FloorStatisticsComponent implements OnInit, AfterViewInit {
33 35
       fun.call(this, v[1]);
34 36
     });
35 37
     this.initSessionData();
38
+    this.getQueryParams();
36 39
     this.search();
37 40
   }
38 41
 
@@ -44,13 +47,21 @@ export class FloorStatisticsComponent implements OnInit, AfterViewInit {
44 47
   @HostListener('window:resize')
45 48
   onResize(): void {
46 49
     setTimeout(() => {
47
-      this.tableHeight = window.innerHeight - 64 - 64 - 36 - 48 - 8 - 45 - 54 - this.getMoreFilter;
48
-      console.log('this.tableHeight:', this.tableHeight)
50
+      this.tableHeight = window.innerHeight - document.querySelector('.searchDataWrap').clientHeight - 64 - 36 - 48 - 8 - document.querySelector('.ant-table-header').clientHeight - 55 - this.getMoreFilter - 2;
51
+
49 52
     }, 0)
50 53
   }
51 54
 
55
+  getQueryParams(){
56
+    let queryParams = this.tabService.getQueryParams();
57
+    this.tabService.clearQueryParams();
58
+    if(queryParams.dateRange){
59
+      this.dateRange = queryParams.dateRange;
60
+    }
61
+  }
62
+
52 63
   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;
64
+    let flag = this.fieldConfig.fields.category1DTO || this.fieldConfig.fields.category2DTO || this.fieldConfig.fields.category3DTO;
54 65
     return flag ? 21 : 0;
55 66
   }
56 67
 
@@ -102,24 +113,21 @@ export class FloorStatisticsComponent implements OnInit, AfterViewInit {
102 113
     let postData:any = {
103 114
       idx: this.pageIndex - 1,
104 115
       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,
116
+      startDate: this.dateRange[0] || undefined,
117
+      endDate: this.dateRange[1] || undefined,
118
+      hosId: this.hosId || undefined,
119
+      dutyId: this.dutyId || undefined,
120
+      parentDutyId: this.parentDutyId || undefined,
121
+      buildingId: this.buildingId || undefined,
122
+      categoryId: this.fieldConfig.fields.categoryId || undefined,
123
+      hierarchy: this.fieldConfig.fields.hierarchy || undefined,
116 124
     };
117 125
     if (field && sort) {
118 126
       postData.sort = `${field} ${sort === "ascend" ? `asc` : `desc`}`
119 127
     }
120 128
     this.loading1 = true;
121 129
     this.mainService
122
-      .postCustom("itsm/report", "incidentWorkOrder", postData)
130
+      .postCustom("itsm/report", "floorIncident", postData)
123 131
       .subscribe((result) => {
124 132
         this.loading1 = false;
125 133
         this.listOfData = result.dataList.filter((v, i) => { return i != result.dataList.length - 1 });
@@ -166,23 +174,20 @@ export class FloorStatisticsComponent implements OnInit, AfterViewInit {
166 174
       nzDuration: 0,
167 175
     }).messageId;
168 176
     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,
177
+      startDate: this.dateRange[0] || undefined,
178
+      endDate: this.dateRange[1] || undefined,
179
+      hosId: this.hosId || undefined,
180
+      dutyId: this.dutyId || undefined,
181
+      parentDutyId: this.parentDutyId || undefined,
182
+      buildingId: this.buildingId || undefined,
183
+      categoryId: this.fieldConfig.fields.categoryId || undefined,
184
+      hierarchy: this.fieldConfig.fields.hierarchy || undefined,
180 185
     };
181 186
     if (this.sortCurrentKey && this.sortCurrentValue) {
182 187
       postData.sort = `${this.sortCurrentKey} ${this.sortCurrentValue === "ascend" ? `asc` : `desc`}`
183 188
     }
184 189
     this.mainService
185
-      .postExportCustom("itsm/export", "incidentWorkOrder", postData)
190
+      .postExportCustom("itsm/export", "floorIncident", postData)
186 191
       .subscribe((data) => {
187 192
         this.message.remove(this.excelExportLoading);
188 193
         this.excelExportLoading = false;
@@ -210,14 +215,14 @@ export class FloorStatisticsComponent implements OnInit, AfterViewInit {
210 215
 		this.sortCurrentValue = "";
211 216
 		this.sortCurrent = {};
212 217
     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};
218
+    this.buildingId = undefined;
219
+    this.fieldConfig.fields = {categoryId: undefined};
215 220
     this.search();
216 221
   }
217 222
 
218
-  // 科室搜索
219
-  changeRepairDeptInp(e) {
220
-    this.searchTimer(this.getRepairDeptList, e);
223
+  // 楼栋搜索
224
+  changeBuildingInp(e) {
225
+    this.searchTimer(this.getBuildingList, e);
221 226
   }
222 227
 
223 228
   // 防抖
@@ -227,35 +232,35 @@ export class FloorStatisticsComponent implements OnInit, AfterViewInit {
227 232
     this.searchTimerSubject.next([fun, e]);
228 233
   }
229 234
 
230
-  openChangeRepairDept(flag){
231
-    flag && this.getRepairDeptList();
235
+  openChangeBuilding(flag){
236
+    flag && this.getBuildingList();
232 237
   }
233 238
 
234 239
   // 获取报修科室列表
235
-  repairDeptList:any[] = [];
236
-  getRepairDeptList(keyword?) {
240
+  buildingList:any[] = [];
241
+  getBuildingList(keyword?) {
237 242
     let data = {
238
-      department: {
239
-        cascadeHosId: this.getHosId,
240
-        dept: keyword,
241
-        searchType: 1,
243
+      building: {
244
+        simpleQuery: true,
245
+        buildingName: keyword,
246
+        statisticalHosId:this.getHosId,
242 247
       },
243 248
       idx: 0,
244 249
       sum: 20,
245 250
     };
246 251
     this.isLoading = true;
247 252
     this.mainService
248
-      .getFetchDataList("data", "department", data)
253
+      .getFetchDataList("data", "building", data)
249 254
       .subscribe((data) => {
250 255
         this.isLoading = false;
251
-        this.repairDeptList = data.list;
256
+        this.buildingList = data.list;
252 257
       });
253 258
   }
254 259
 
255 260
   // 详细搜索
256 261
   fieldConfig:any = {
257
-    fields: {groupId: undefined, userId: undefined, categoryId: undefined, sourceId: undefined, hierarchy: undefined},
258
-    config: {groupAndUser: true, category123: true, source: true},
262
+    fields: {categoryId: undefined},
263
+    config: {category123: true},
259 264
   }
260 265
   showSearchMore:boolean = false;
261 266
   showMore(){
@@ -274,5 +279,3 @@ export class FloorStatisticsComponent implements OnInit, AfterViewInit {
274 279
     this.onResize();
275 280
   }
276 281
 }
277
-
278
-

+ 4 - 3
src/app/views/new-statistics/maintenance-statistics/group-statistics/group-statistics.component.html

@@ -25,8 +25,8 @@
25 25
     <tr>
26 26
       <th nzWidth="10%">分组名称</th>
27 27
       <th nzWidth="9%" nzShowSort nzSortKey="sum" [(nzSort)]="sortCurrent.sum">工单总数</th>
28
-      <th nzWidth="9%" nzShowSort nzSortKey="avgResponseTime" [(nzSort)]="sortCurrent.avgResponseTime">平均响应时间</th>
29
-      <th nzWidth="9%" nzShowSort nzSortKey="avgResolvedTime" [(nzSort)]="sortCurrent.avgResolvedTime">平均解决时</th>
28
+      <th nzWidth="9%" nzShowSort nzSortKey="avgResponseTime" [(nzSort)]="sortCurrent.avgResponseTime">平均接单时长</th>
29
+      <th nzWidth="9%" nzShowSort nzSortKey="avgResolvedTime" [(nzSort)]="sortCurrent.avgResolvedTime">平均解决时</th>
30 30
       <th nzWidth="9%" nzShowSort nzSortKey="resolvedOverNum" [(nzSort)]="sortCurrent.resolvedOverNum">超时单数</th>
31 31
       <th nzWidth="9%" nzShowSort nzSortKey="overTimeNum" [(nzSort)]="sortCurrent.overTimeNum">挂起单数</th>
32 32
       <th nzWidth="9%" nzShowSort nzSortKey="consumablePrice" [(nzSort)]="sortCurrent.consumablePrice">耗材费用(元)</th>
@@ -70,7 +70,8 @@
70 70
   </ng-template>
71 71
 </nz-table>
72 72
 <div class="pagination">
73
-  <nz-pagination [(nzPageIndex)]="pageIndex" [(nzTotal)]="listLength" [(nzPageSize)]="pageSize" (nzPageIndexChange)="getList(pageIndex, sortCurrentKey, sortCurrentValue)" (nzPageSizeChange)="getList(pageIndex, sortCurrentKey, sortCurrentValue)"></nz-pagination>
73
+  <ng-template #totalTemplate let-total> 共 {{ total }} 条 </ng-template>
74
+  <nz-pagination [(nzPageIndex)]="pageIndex" [(nzTotal)]="listLength" [(nzPageSize)]="pageSize" (nzPageIndexChange)="getList(pageIndex, sortCurrentKey, sortCurrentValue)" (nzPageSizeChange)="getList(pageIndex, sortCurrentKey, sortCurrentValue)" nzShowSizeChanger [nzPageSizeOptions]="[30,50,100,200]" [nzShowTotal]="totalTemplate"></nz-pagination>
74 75
 </div>
75 76
 
76 77
 <!-- 详细搜索 -->

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

@@ -1,3 +1,4 @@
1
+import { TabService } from './../../services/tab.service';
1 2
 import { NzMessageService } from 'ng-zorro-antd/message';
2 3
 import { format, addMonths, startOfMonth, endOfMonth, startOfDay, endOfDay } from 'date-fns';
3 4
 import { Component, OnInit, HostListener, AfterViewInit } from "@angular/core";
@@ -13,6 +14,7 @@ export class GroupStatisticsComponent implements OnInit, AfterViewInit {
13 14
     private mainService: MainService,
14 15
     private message: NzMessageService,
15 16
     private route: ActivatedRoute,
17
+    private tabService: TabService,
16 18
   ) {}
17 19
 
18 20
   listOfData: any[] = []; //表格数据
@@ -23,6 +25,7 @@ export class GroupStatisticsComponent implements OnInit, AfterViewInit {
23 25
 
24 26
   ngOnInit() {
25 27
     this.initSessionData();
28
+    this.getQueryParams();
26 29
     this.search();
27 30
   }
28 31
 
@@ -34,13 +37,21 @@ export class GroupStatisticsComponent implements OnInit, AfterViewInit {
34 37
   @HostListener('window:resize')
35 38
   onResize(): void {
36 39
     setTimeout(() => {
37
-      this.tableHeight = window.innerHeight - 64 - 64 - 36 - 48 - 8 - 45 - 54 - this.getMoreFilter;
38
-      console.log('this.tableHeight:', this.tableHeight)
40
+      this.tableHeight = window.innerHeight - document.querySelector('.searchDataWrap').clientHeight - 64 - 36 - 48 - 8 - document.querySelector('.ant-table-header').clientHeight - 55 - this.getMoreFilter - 2;
41
+
39 42
     }, 0)
40 43
   }
41 44
 
45
+  getQueryParams(){
46
+    let queryParams = this.tabService.getQueryParams();
47
+    this.tabService.clearQueryParams();
48
+    if(queryParams.dateRange){
49
+      this.dateRange = queryParams.dateRange;
50
+    }
51
+  }
52
+
42 53
   get getMoreFilter(){
43
-    let flag = this.fieldConfig.fields.category1DTO || this.fieldConfig.fields.category2DTO || this.fieldConfig.fields.category3DTO;
54
+    let flag = this.fieldConfig.fields.category1DTO || this.fieldConfig.fields.category2DTO || this.fieldConfig.fields.category3DTO || this.fieldConfig.fields.buildingDTO || this.fieldConfig.fields.floorDTO;
44 55
     return flag ? 21 : 0;
45 56
   }
46 57
 
@@ -98,6 +109,7 @@ export class GroupStatisticsComponent implements OnInit, AfterViewInit {
98 109
       dutyId: this.dutyId || undefined,
99 110
       parentDutyId: this.parentDutyId || undefined,
100 111
       categoryId: this.fieldConfig.fields.categoryId || undefined,
112
+      hierarchy: this.fieldConfig.fields.hierarchy || undefined,
101 113
       buildingId: this.fieldConfig.fields.buildingId || undefined,
102 114
       placeId: this.fieldConfig.fields.floorId || undefined,
103 115
     };
@@ -159,6 +171,7 @@ export class GroupStatisticsComponent implements OnInit, AfterViewInit {
159 171
       dutyId: this.dutyId || undefined,
160 172
       parentDutyId: this.parentDutyId || undefined,
161 173
       categoryId: this.fieldConfig.fields.categoryId || undefined,
174
+      hierarchy: this.fieldConfig.fields.hierarchy || undefined,
162 175
       buildingId: this.fieldConfig.fields.buildingId || undefined,
163 176
       placeId: this.fieldConfig.fields.floorId || undefined,
164 177
     };

+ 5 - 4
src/app/views/new-statistics/maintenance-statistics/incident-statistics/incident-statistics.component.html

@@ -9,7 +9,7 @@
9 9
       <span class="label">报修科室</span>:
10 10
       <nz-select class="selectItem" [nzDropdownMatchSelectWidth]="false" nzServerSearch nzShowSearch (nzOnSearch)="changeRepairDeptInp($event)" nzAllowClear nzPlaceHolder="请选择报修科室" [(ngModel)]="repairDeptId" (nzOpenChange)="openChangeRepairDept($event)">
11 11
         <ng-container *ngFor="let option of repairDeptList">
12
-          <nz-option *ngIf="!isLoading" [nzLabel]="option.dept" [nzValue]="option.id"></nz-option>
12
+          <nz-option *ngIf="!isLoading" [nzLabel]="option.hospital.hosName + '-' + option.dept" [nzValue]="option.id"></nz-option>
13 13
         </ng-container>
14 14
         <nz-option *ngIf="isLoading" nzDisabled nzCustomContent>
15 15
           <i nz-icon nzType="loading" class="loading-icon"></i> 搜索中...
@@ -37,8 +37,8 @@
37 37
     <tr>
38 38
       <th nzWidth="10%" nzShowSort nzSortKey="startDate" [(nzSort)]="sortCurrent.startDate">时间</th>
39 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>
40
+      <th nzWidth="9%" nzShowSort nzSortKey="avgResponseTime" [(nzSort)]="sortCurrent.avgResponseTime">平均接单时长</th>
41
+      <th nzWidth="9%" nzShowSort nzSortKey="avgResolvedTime" [(nzSort)]="sortCurrent.avgResolvedTime">平均解决时</th>
42 42
       <th nzWidth="9%" nzShowSort nzSortKey="resolvedOverNum" [(nzSort)]="sortCurrent.resolvedOverNum">超时单数</th>
43 43
       <th nzWidth="9%" nzShowSort nzSortKey="overTimeNum" [(nzSort)]="sortCurrent.overTimeNum">挂起单数</th>
44 44
       <th nzWidth="9%" nzShowSort nzSortKey="consumablePrice" [(nzSort)]="sortCurrent.consumablePrice">耗材费用(元)</th>
@@ -82,7 +82,8 @@
82 82
   </ng-template>
83 83
 </nz-table>
84 84
 <div class="pagination">
85
-  <nz-pagination [(nzPageIndex)]="pageIndex" [(nzTotal)]="listLength" [(nzPageSize)]="pageSize" (nzPageIndexChange)="getList(pageIndex, sortCurrentKey, sortCurrentValue)" (nzPageSizeChange)="getList(pageIndex, sortCurrentKey, sortCurrentValue)"></nz-pagination>
85
+  <ng-template #totalTemplate let-total> 共 {{ total }} 条 </ng-template>
86
+  <nz-pagination [(nzPageIndex)]="pageIndex" [(nzTotal)]="listLength" [(nzPageSize)]="pageSize" (nzPageIndexChange)="getList(pageIndex, sortCurrentKey, sortCurrentValue)" (nzPageSizeChange)="getList(pageIndex, sortCurrentKey, sortCurrentValue)" nzShowSizeChanger [nzPageSizeOptions]="[30,50,100,200]" [nzShowTotal]="totalTemplate"></nz-pagination>
86 87
 </div>
87 88
 
88 89
 <!-- 详细搜索 -->

+ 16 - 5
src/app/views/new-statistics/maintenance-statistics/incident-statistics/incident-statistics.component.ts

@@ -1,3 +1,4 @@
1
+import { TabService } from './../../services/tab.service';
1 2
 import { debounceTime } from 'rxjs/operators';
2 3
 import { Subject } from 'rxjs';
3 4
 import { NzMessageService } from 'ng-zorro-antd/message';
@@ -15,6 +16,7 @@ export class IncidentStatisticsComponent implements OnInit, AfterViewInit {
15 16
     private mainService: MainService,
16 17
     private message: NzMessageService,
17 18
     private route: ActivatedRoute,
19
+    private tabService: TabService,
18 20
   ) {}
19 21
 
20 22
   listOfData: any[] = []; //表格数据
@@ -33,6 +35,7 @@ export class IncidentStatisticsComponent implements OnInit, AfterViewInit {
33 35
       fun.call(this, v[1]);
34 36
     });
35 37
     this.initSessionData();
38
+    this.getQueryParams();
36 39
     this.search();
37 40
   }
38 41
 
@@ -44,11 +47,19 @@ export class IncidentStatisticsComponent implements OnInit, AfterViewInit {
44 47
   @HostListener('window:resize')
45 48
   onResize(): void {
46 49
     setTimeout(() => {
47
-      this.tableHeight = window.innerHeight - 64 - 64 - 36 - 48 - 8 - 45 - 54 - this.getMoreFilter;
48
-      console.log('this.tableHeight:', this.tableHeight)
50
+      this.tableHeight = window.innerHeight - document.querySelector('.searchDataWrap').clientHeight - 64 - 36 - 48 - 8 - document.querySelector('.ant-table-header').clientHeight - 55 - this.getMoreFilter - 2;
51
+
49 52
     }, 0)
50 53
   }
51 54
 
55
+  getQueryParams(){
56
+    let queryParams = this.tabService.getQueryParams();
57
+    this.tabService.clearQueryParams();
58
+    if(queryParams.dateRange){
59
+      this.dateRange = queryParams.dateRange;
60
+    }
61
+  }
62
+
52 63
   get getMoreFilter(){
53 64
     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;
54 65
     return flag ? 21 : 0;
@@ -108,7 +119,7 @@ export class IncidentStatisticsComponent implements OnInit, AfterViewInit {
108 119
       dutyId: this.dutyId || undefined,
109 120
       parentDutyId: this.parentDutyId || undefined,
110 121
       repairDeptId: this.repairDeptId || undefined,
111
-      groupId: this.fieldConfig.fields.groupId || undefined,
122
+      groupId: this.fieldConfig.fields.userId ? undefined : (this.fieldConfig.fields.groupId || undefined),
112 123
       userId: this.fieldConfig.fields.userId || undefined,
113 124
       categoryId: this.fieldConfig.fields.categoryId || undefined,
114 125
       sourceId: this.fieldConfig.fields.sourceId || undefined,
@@ -172,7 +183,7 @@ export class IncidentStatisticsComponent implements OnInit, AfterViewInit {
172 183
       dutyId: this.dutyId || undefined,
173 184
       parentDutyId: this.parentDutyId || undefined,
174 185
       repairDeptId: this.repairDeptId || undefined,
175
-      groupId: this.fieldConfig.fields.groupId || undefined,
186
+      groupId: this.fieldConfig.fields.userId ? undefined : (this.fieldConfig.fields.groupId || undefined),
176 187
       userId: this.fieldConfig.fields.userId || undefined,
177 188
       categoryId: this.fieldConfig.fields.categoryId || undefined,
178 189
       sourceId: this.fieldConfig.fields.sourceId || undefined,
@@ -236,7 +247,7 @@ export class IncidentStatisticsComponent implements OnInit, AfterViewInit {
236 247
   getRepairDeptList(keyword?) {
237 248
     let data = {
238 249
       department: {
239
-        cascadeHosId: this.getHosId,
250
+        statisticalHosId: this.getHosId,
240 251
         dept: keyword,
241 252
         searchType: 1,
242 253
       },

+ 22 - 4
src/app/views/new-statistics/maintenance-statistics/maintenance-statistics-routing.module.ts

@@ -54,21 +54,21 @@ const routes: Routes = [
54 54
         }
55 55
       },
56 56
       {
57
-        // 处理组统计
57
+        // 维修组统计
58 58
         path: 'groupStatistics',
59 59
         loadChildren: () => import('./group-statistics/group-statistics.module').then(m => m.GroupStatisticsModule),
60 60
         data: {
61 61
           reuse: true,
62
-          title: '处理组统计'
62
+          title: '维修组统计'
63 63
         }
64 64
       },
65 65
       {
66
-        // 处理人统计
66
+        // 维修人统计
67 67
         path: 'userStatistics',
68 68
         loadChildren: () => import('./user-statistics/user-statistics.module').then(m => m.UserStatisticsModule),
69 69
         data: {
70 70
           reuse: true,
71
-          title: '处理人统计'
71
+          title: '维修人统计'
72 72
         }
73 73
       },
74 74
       {
@@ -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
 ];

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

@@ -51,6 +51,8 @@
51 51
       .icon_transport{
52 52
         color: #666666;
53 53
         font-size: 24px;
54
+        position: relative;
55
+        top: 2px;
54 56
       }
55 57
     }
56 58
   }

+ 30 - 14
src/app/views/new-statistics/maintenance-statistics/maintenance-statistics.component.ts

@@ -1,7 +1,6 @@
1 1
 import { ActivatedRoute, Router } from '@angular/router';
2 2
 import { Component, OnInit, OnDestroy } from "@angular/core";
3 3
 import { ToolService } from 'src/app/services/tool.service';
4
-import { SimpleReuseStrategy } from '../../../SimpleReuseStrategy';
5 4
 import { TabService } from '../services/tab.service';
6 5
 @Component({
7 6
   selector: "app-maintenance-statistics",
@@ -26,9 +25,8 @@ export class MaintenanceStatisticsComponent implements OnInit, OnDestroy {
26 25
   }
27 26
 
28 27
   ngOnDestroy(){
29
-    this.sessionRemove();
30
-    this.tabService.tabs = [];
31
-    SimpleReuseStrategy.deleteAllRouteCache();
28
+    // this.sessionRemove();
29
+    this.tabService.deleteAllRouteSnapshot();
32 30
   }
33 31
 
34 32
   getMenuList(){
@@ -41,20 +39,23 @@ export class MaintenanceStatisticsComponent implements OnInit, OnDestroy {
41 39
   clickMenu(data){
42 40
     this.activeMenuId = data.id;
43 41
     this.secondMenuList = this.menuList.find(v => v.id == this.activeMenuId).childrens || [];
44
-    this.tabService.tabs = [];
45
-    SimpleReuseStrategy.deleteAllRouteCache();
46
-    this.secondMenuList.length && this.clickSecondMenu(this.secondMenuList[0]);
42
+    // this.tabService.deleteAllRouteSnapshot();
43
+    console.log(this.tabService.tabs)
44
+    let activeTab = this.tabService.tabs.find(v => v.active);
45
+    // return;
46
+    if(this.secondMenuList.length){
47
+      if(activeTab.path === `/newStatistics/${this.route.parent.snapshot.routeConfig.path}/${this.secondMenuList[0].link}`){
48
+        this.clickSecondMenu(this.secondMenuList[0]);
49
+      }else{
50
+        this.activeSecondMenuLink = activeTab.path.split('/').reverse()[0];
51
+      }
52
+    }
47 53
   }
48 54
 
49 55
   // 点击二级菜单
50 56
   activeSecondMenuLink:string;
51 57
   clickSecondMenu(data){
52 58
     this.activeSecondMenuLink = data.link;
53
-    let hasCache = SimpleReuseStrategy.cacheRouters.has(`/newStatistics/${this.route.parent.snapshot.routeConfig.path}/${this.activeSecondMenuLink}`);
54
-    console.log('tabs', this.tabService.tabs);
55
-    console.log('cacheRouters', SimpleReuseStrategy.cacheRouters);
56
-    console.log('cacheRouters', hasCache);
57
-    !hasCache && SimpleReuseStrategy.deleteRouteCache(`/newStatistics/${this.route.parent.snapshot.routeConfig.path}/${this.activeSecondMenuLink}`);
58 59
     this.router.navigate([`/newStatistics/${this.route.parent.snapshot.routeConfig.path}/${this.activeSecondMenuLink}`], { replaceUrl: true });
59 60
   }
60 61
 
@@ -69,6 +70,14 @@ export class MaintenanceStatisticsComponent implements OnInit, OnDestroy {
69 70
   queryType;//查询范围
70 71
   // 初始化院区、部门显示
71 72
   initHospitalAndDuty(hospitalOrDuty){
73
+    let sessionData = JSON.parse(sessionStorage.getItem('maintenanceStatistics'));
74
+    console.log(sessionData);
75
+    if(sessionData){
76
+      this.hospital = sessionData.hospital;
77
+      this.duty = sessionData.duty;
78
+      this.queryType = sessionData.queryType;
79
+      return;
80
+    }
72 81
     let type = 'hospital';//默认是院区
73 82
     if(hospitalOrDuty.type){
74 83
       // 当前是责任部门
@@ -107,7 +116,7 @@ export class MaintenanceStatisticsComponent implements OnInit, OnDestroy {
107 116
 
108 117
   // 缓存数据
109 118
   sessionSave(){
110
-    sessionStorage.setItem('maintenanceStatistics', JSON.stringify({queryType: this.queryType, hospitalId: this.hospital ? this.hospital.id : undefined, dutyId: this.duty ? this.duty.id : undefined}))
119
+    sessionStorage.setItem('maintenanceStatistics', JSON.stringify({queryType: this.queryType, hospitalId: this.hospital ? this.hospital.id : undefined, dutyId: this.duty ? this.duty.id : undefined, hospital: this.hospital, duty: this.duty}));
111 120
   }
112 121
 
113 122
   // 清除缓存数据
@@ -130,7 +139,14 @@ export class MaintenanceStatisticsComponent implements OnInit, OnDestroy {
130 139
     this.queryRangeFlag = false;
131 140
 
132 141
     this.sessionSave();
133
-    this.router.navigate([`newStatistics/${this.route.parent.snapshot.routeConfig.path}/${this.activeSecondMenuLink}`], { replaceUrl: true });
142
+    // this.tabService.deleteRouteSnapshot(`/newStatistics/${this.route.parent.snapshot.routeConfig.path}/${this.activeSecondMenuLink}`);
143
+    // this.router.navigate([`/newStatistics/${this.route.parent.snapshot.routeConfig.path}/${this.activeSecondMenuLink}`], { replaceUrl: true });
144
+
145
+    this.router.navigateByUrl('/redirect', {
146
+      skipLocationChange: true
147
+    }).then(() => {
148
+      this.router.navigate([`/newStatistics/${this.route.parent.snapshot.routeConfig.path}/${this.activeSecondMenuLink}`], { replaceUrl: true });
149
+    });
134 150
   }
135 151
   cancelQueryRange() {
136 152
     this.queryRangeFlag = false;

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

@@ -58,7 +58,7 @@
58 58
 					<div class="statistics-select-list" [ngClass]="{'activeClass': activeIndex == 0}" (click)="selectCheck(0)">维修人员</div>
59 59
 					<div class="statistics-select-list" [ngClass]="{'activeClass': activeIndex == 1}" (click)="selectCheck(1)">维修组</div>
60 60
 				</div>
61
-				<div class="more" (click)="toPath(1)">更多></div>
61
+				<div class="more" *ngIf="showMore(activeIndex == 0 ? 'userStatistics' : 'groupStatistics')" (click)="toPath(activeIndex == 0 ? '/newStatistics/maintenanceStatistics/userStatistics' : '/newStatistics/maintenanceStatistics/groupStatistics')">更多></div>
62 62
 			</div>
63 63
 			<div class="table">
64 64
 				<div class="td">
@@ -67,7 +67,7 @@
67 67
 					<div class="table-td" *ngIf="activeIndex==1">维修组</div>
68 68
 					<div class="table-td">工单量</div>
69 69
 					<div class="table-td">平均接单时长</div>
70
-					<div class="table-td">平均处理时长</div>
70
+					<div class="table-td">平均解决时长</div>
71 71
 					<div class="table-td">超时单</div>
72 72
 				</div>
73 73
 				<div class="th" *ngFor="let item of maintainData; let index = index;">
@@ -88,8 +88,8 @@
88 88
 		<div class="statistics width-40">
89 89
 			<div class="statistics-box">
90 90
 				<div class="sign-green"></div>
91
-				<div class="statistics-title">报修来源</div>
92
-				<div class="more" (click)="toPath(2)">更多></div>
91
+				<div class="statistics-title">故障来源</div>
92
+				<div class="more" *ngIf="showMore('categorySourceStatistics')" (click)="toPath('/newStatistics/maintenanceStatistics/categorySourceStatistics')">更多></div>
93 93
 			</div>
94 94
 			<div class="echarts-repairs">
95 95
 			  <div echarts class="echarts" [options]='repairsOptions'></div>
@@ -101,7 +101,7 @@
101 101
 			<div class="statistics-box">
102 102
 				<div class="sign-green"></div>
103 103
 				<div class="statistics-title">一级故障现象Top5</div>
104
-				<div class="more" (click)="toPath(3)">更多></div>
104
+				<div class="more" *ngIf="showMore('categoryOneStatistics')" (click)="toPath('/newStatistics/maintenanceStatistics/categoryOneStatistics')">更多></div>
105 105
 			</div>
106 106
 			<div class="echarts-repairs">
107 107
 				<div echarts class="echarts" [options]='malfunctionOptions'></div>
@@ -111,7 +111,7 @@
111 111
 			<div class="statistics-box">
112 112
 				<div class="sign-green"></div>
113 113
 				<div class="statistics-title">楼栋报修Top5</div>
114
-				<div class="more" (click)="toPath(4)">更多></div>
114
+				<div class="more" *ngIf="showMore('buildingStatistics')" (click)="toPath('/newStatistics/maintenanceStatistics/buildingStatistics')">更多></div>
115 115
 			</div>
116 116
 			<div class="echarts-repairs">
117 117
 				<div echarts class="echarts" [options]='buildingOptions'></div>
@@ -123,7 +123,7 @@
123 123
 			<div class="statistics-box">
124 124
 				<div class="sign-green"></div>
125 125
 				<div class="statistics-title">科室费用Top5</div>
126
-				<div class="more" (click)="toPath(5)">更多></div>
126
+				<div class="more" *ngIf="showMore('departmentIncidentStatistics')" (click)="toPath('/newStatistics/maintenanceStatistics/departmentIncidentStatistics')">更多></div>
127 127
 			</div>
128 128
 			<div class="table">
129 129
 				<div class="td">
@@ -144,7 +144,7 @@
144 144
 			<div class="statistics-box">
145 145
 				<div class="sign-green"></div>
146 146
 				<div class="statistics-title">耗材Top5</div>
147
-				<div class="more" (click)="toPath(6)">更多></div>
147
+				<div class="more" *ngIf="showMore('consumableStatistics')" (click)="toPath('/newStatistics/maintenanceStatistics/consumableStatistics')">更多></div>
148 148
 			</div>
149 149
 			<div class="table">
150 150
 				<div class="td">

+ 30 - 17
src/app/views/new-statistics/maintenance-statistics/synthesize-statistics/synthesize-statistics.component.ts

@@ -1,6 +1,8 @@
1
+import { Router } from '@angular/router';
1 2
 import { format, addMonths, startOfMonth, endOfMonth } from 'date-fns';
2 3
 import { Component, OnInit } from "@angular/core";
3 4
 import { MainService } from 'src/app/services/main.service';
5
+import { TabService } from '../../services/tab.service';
4 6
 @Component({
5 7
   selector: "app-synthesize-statistics",
6 8
   templateUrl: "./synthesize-statistics.component.html",
@@ -9,8 +11,10 @@ import { MainService } from 'src/app/services/main.service';
9 11
 export class SynthesizeStatisticsComponent implements OnInit {
10 12
   constructor(
11 13
     private mainService: MainService,
14
+    private tabService: TabService,
15
+    public router: Router,
12 16
   ) {}
13
-	
17
+
14 18
 	isLoading:Boolean = false;
15 19
 	workData:any = []; //工单统计
16 20
   listOfData: any[] = []; //表格数据
@@ -59,13 +63,13 @@ export class SynthesizeStatisticsComponent implements OnInit {
59 63
   ngOnInit() {
60 64
     this.search();
61 65
   }
62
-	
66
+
63 67
 	// 维修处理类型切换
64 68
 	selectCheck(type){
65 69
 		this.activeIndex = type
66 70
 		this.getMaintainData();
67 71
 	}
68
-	
72
+
69 73
 	// 报修来源
70 74
 	repairsChart() {
71 75
 		let postData:any = {
@@ -109,7 +113,7 @@ export class SynthesizeStatisticsComponent implements OnInit {
109 113
 							},
110 114
 							label: {
111 115
 									show: true,
112
-									formatter: '{b}: {c} {d}%'  
116
+									formatter: '{b}: {c} {d}%'
113 117
 							},
114 118
 				      // itemStyle: {
115 119
 				      //   normal: {
@@ -130,7 +134,7 @@ export class SynthesizeStatisticsComponent implements OnInit {
130 134
 				};
131 135
 		  });
132 136
 	}
133
-	
137
+
134 138
 	// 一级故障
135 139
 	malfunctionChart(){
136 140
 		let postData:any = {
@@ -195,7 +199,7 @@ export class SynthesizeStatisticsComponent implements OnInit {
195 199
 				}
196 200
 		  });
197 201
 	}
198
-	
202
+
199 203
 	// 楼栋报修
200 204
 	buildingChart(){
201 205
 		let postData:any = {
@@ -260,7 +264,7 @@ export class SynthesizeStatisticsComponent implements OnInit {
260 264
 		    }
261 265
 		  });
262 266
 	}
263
-	
267
+
264 268
 	// 科室费用
265 269
 	getDeptCostData() {
266 270
 	  let postData:any = {
@@ -277,7 +281,7 @@ export class SynthesizeStatisticsComponent implements OnInit {
277 281
 	      this.deptCostData = result.data || [];
278 282
 	    });
279 283
 	}
280
-	
284
+
281 285
 	// 耗材
282 286
 	getConsumableData() {
283 287
 	  let postData:any = {
@@ -295,12 +299,21 @@ export class SynthesizeStatisticsComponent implements OnInit {
295 299
 	      this.consumableData = result.data || [];
296 300
 	    });
297 301
 	}
298
-	
302
+
299 303
 	// 更多跳转
300
-	toPath(type){
301
-		console.log(type)
304
+	toPath(path){
305
+    let flag = this.tabService.tabs.some(v => v.path === path);
306
+    flag && this.tabService.deleteRouteSnapshot(path);
307
+    this.tabService.setQueryParams('dateRange', this.dateRange);
308
+    this.router.navigate([path], { replaceUrl: true });
302 309
 	}
303
-	
310
+
311
+  // 判断更多是否显示
312
+  showMore(path){
313
+    let menus = JSON.parse(localStorage.getItem("menu"));
314
+    return menus.find(v => v.link === 'maintenanceStatistics').childrens.some(v => v.link === path);
315
+  }
316
+
304 317
   // 初始化缓存数据
305 318
   queryType:any;
306 319
   hosId:any;
@@ -334,7 +347,7 @@ export class SynthesizeStatisticsComponent implements OnInit {
334 347
       this.dutyId = undefined;
335 348
       this.parentDutyId = dutyId;
336 349
     }
337
-		
350
+
338 351
 		this.isLoading = true
339 352
 		this.getWorkData();
340 353
 		this.getMaintainData();
@@ -369,7 +382,7 @@ export class SynthesizeStatisticsComponent implements OnInit {
369 382
         this.listLength = result.totalCount;
370 383
       });
371 384
   }
372
-	
385
+
373 386
 	// 头部工单数据
374 387
 	getWorkData() {
375 388
 	  let postData:any = {
@@ -386,7 +399,7 @@ export class SynthesizeStatisticsComponent implements OnInit {
386 399
 	      this.workData = result.data[0] || [];
387 400
 	    });
388 401
 	}
389
-	
402
+
390 403
 	// 维修处理
391 404
 	getMaintainData() {
392 405
 	  let postData:any = {
@@ -404,14 +417,14 @@ export class SynthesizeStatisticsComponent implements OnInit {
404 417
 	      this.maintainData = result.data || [];
405 418
 	    });
406 419
 	}
407
-	
420
+
408 421
 	// 重置
409 422
 	reset(){
410 423
 		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')];
411 424
 		this.activeIndex = 0;
412 425
 		this.search();
413 426
 	}
414
-	
427
+
415 428
   // 搜索
416 429
   search() {
417 430
 		this.initSessionData();

+ 18 - 6
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.hospital.hosName + '-' + 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,10 +34,10 @@
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
-      <th nzWidth="9%" nzShowSort nzSortKey="avgResponseTime" [(nzSort)]="sortCurrent.avgResponseTime">平均响应时间</th>
29
-      <th nzWidth="9%" nzShowSort nzSortKey="avgResolvedTime" [(nzSort)]="sortCurrent.avgResolvedTime">平均解决时</th>
39
+      <th nzWidth="9%" nzShowSort nzSortKey="avgResponseTime" [(nzSort)]="sortCurrent.avgResponseTime">平均接单时长</th>
40
+      <th nzWidth="9%" nzShowSort nzSortKey="avgResolvedTime" [(nzSort)]="sortCurrent.avgResolvedTime">平均解决时</th>
30 41
       <th nzWidth="9%" nzShowSort nzSortKey="resolvedOverNum" [(nzSort)]="sortCurrent.resolvedOverNum">超时单数</th>
31 42
       <th nzWidth="9%" nzShowSort nzSortKey="overTimeNum" [(nzSort)]="sortCurrent.overTimeNum">挂起单数</th>
32 43
       <th nzWidth="9%" nzShowSort nzSortKey="consumablePrice" [(nzSort)]="sortCurrent.consumablePrice">耗材费用(元)</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>
@@ -70,7 +81,8 @@
70 81
   </ng-template>
71 82
 </nz-table>
72 83
 <div class="pagination">
73
-  <nz-pagination [(nzPageIndex)]="pageIndex" [(nzTotal)]="listLength" [(nzPageSize)]="pageSize" (nzPageIndexChange)="getList(pageIndex, sortCurrentKey, sortCurrentValue)" (nzPageSizeChange)="getList(pageIndex, sortCurrentKey, sortCurrentValue)"></nz-pagination>
84
+  <ng-template #totalTemplate let-total> 共 {{ total }} 条 </ng-template>
85
+  <nz-pagination [(nzPageIndex)]="pageIndex" [(nzTotal)]="listLength" [(nzPageSize)]="pageSize" (nzPageIndexChange)="getList(pageIndex, sortCurrentKey, sortCurrentValue)" (nzPageSizeChange)="getList(pageIndex, sortCurrentKey, sortCurrentValue)" nzShowSizeChanger [nzPageSizeOptions]="[30,50,100,200]" [nzShowTotal]="totalTemplate"></nz-pagination>
74 86
 </div>
75 87
 
76 88
 <!-- 详细搜索 -->

+ 63 - 3
src/app/views/new-statistics/maintenance-statistics/tripartite-company-statistics/tripartite-company-statistics.component.ts

@@ -1,3 +1,6 @@
1
+import { TabService } from './../../services/tab.service';
2
+import { debounceTime } from 'rxjs/operators';
3
+import { Subject } from 'rxjs';
1 4
 import { NzMessageService } from 'ng-zorro-antd/message';
2 5
 import { format, addMonths, startOfMonth, endOfMonth, startOfDay, endOfDay } from 'date-fns';
3 6
 import { Component, OnInit, HostListener, AfterViewInit } from "@angular/core";
@@ -13,6 +16,7 @@ export class TripartiteCompanyStatisticsComponent implements OnInit, AfterViewIn
13 16
     private mainService: MainService,
14 17
     private message: NzMessageService,
15 18
     private route: ActivatedRoute,
19
+    private tabService: TabService,
16 20
   ) {}
17 21
 
18 22
   listOfData: any[] = []; //表格数据
@@ -21,8 +25,17 @@ export class TripartiteCompanyStatisticsComponent implements OnInit, AfterViewIn
21 25
   pageSize: number = 30; //表格每页展示条数
22 26
   listLength: number = 0; //表格总数据量
23 27
 
28
+  repairDeptId;//报修科室id
29
+
30
+  searchTimerSubject = new Subject();
31
+
24 32
   ngOnInit() {
33
+    this.searchTimerSubject.pipe(debounceTime(500)).subscribe((v) => {
34
+      let fun = v[0];
35
+      fun.call(this, v[1]);
36
+    });
25 37
     this.initSessionData();
38
+    this.getQueryParams();
26 39
     this.search();
27 40
   }
28 41
 
@@ -34,13 +47,21 @@ export class TripartiteCompanyStatisticsComponent implements OnInit, AfterViewIn
34 47
   @HostListener('window:resize')
35 48
   onResize(): void {
36 49
     setTimeout(() => {
37
-      this.tableHeight = window.innerHeight - 64 - 64 - 36 - 48 - 8 - 45 - 54 - this.getMoreFilter;
38
-      console.log('this.tableHeight:', this.tableHeight)
50
+      this.tableHeight = window.innerHeight - document.querySelector('.searchDataWrap').clientHeight - 64 - 36 - 48 - 8 - document.querySelector('.ant-table-header').clientHeight - 55 - this.getMoreFilter - 2;
51
+
39 52
     }, 0)
40 53
   }
41 54
 
55
+  getQueryParams(){
56
+    let queryParams = this.tabService.getQueryParams();
57
+    this.tabService.clearQueryParams();
58
+    if(queryParams.dateRange){
59
+      this.dateRange = queryParams.dateRange;
60
+    }
61
+  }
62
+
42 63
   get getMoreFilter(){
43
-    let flag = this.fieldConfig.fields.category1DTO || this.fieldConfig.fields.category2DTO || this.fieldConfig.fields.category3DTO;
64
+    let flag = this.fieldConfig.fields.category1DTO || this.fieldConfig.fields.category2DTO || this.fieldConfig.fields.category3DTO || this.fieldConfig.fields.buildingDTO || this.fieldConfig.fields.floorDTO;
44 65
     return flag ? 21 : 0;
45 66
   }
46 67
 
@@ -97,7 +118,9 @@ export class TripartiteCompanyStatisticsComponent implements OnInit, AfterViewIn
97 118
       hosId: this.hosId || undefined,
98 119
       dutyId: this.dutyId || undefined,
99 120
       parentDutyId: this.parentDutyId || undefined,
121
+      repairDeptId: this.repairDeptId || undefined,
100 122
       categoryId: this.fieldConfig.fields.categoryId || undefined,
123
+      hierarchy: this.fieldConfig.fields.hierarchy || undefined,
101 124
       buildingId: this.fieldConfig.fields.buildingId || undefined,
102 125
       placeId: this.fieldConfig.fields.floorId || undefined,
103 126
     };
@@ -158,7 +181,9 @@ export class TripartiteCompanyStatisticsComponent implements OnInit, AfterViewIn
158 181
       hosId: this.hosId || undefined,
159 182
       dutyId: this.dutyId || undefined,
160 183
       parentDutyId: this.parentDutyId || undefined,
184
+      repairDeptId: this.repairDeptId || undefined,
161 185
       categoryId: this.fieldConfig.fields.categoryId || undefined,
186
+      hierarchy: this.fieldConfig.fields.hierarchy || undefined,
162 187
       buildingId: this.fieldConfig.fields.buildingId || undefined,
163 188
       placeId: this.fieldConfig.fields.floorId || undefined,
164 189
     };
@@ -194,12 +219,47 @@ export class TripartiteCompanyStatisticsComponent implements OnInit, AfterViewIn
194 219
 		this.sortCurrentValue = "";
195 220
 		this.sortCurrent = {};
196 221
     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')]
222
+    this.repairDeptId = undefined;
197 223
     this.fieldConfig.fields = {categoryId: undefined, buildingId: undefined, floorId: undefined};
198 224
     this.search();
199 225
   }
200 226
 
227
+  // 科室搜索
228
+  changeRepairDeptInp(e) {
229
+    this.searchTimer(this.getRepairDeptList, e);
230
+  }
231
+
201 232
   // 防抖
202 233
   isLoading = false;
234
+  searchTimer(fun, e) {
235
+    this.isLoading = true;
236
+    this.searchTimerSubject.next([fun, e]);
237
+  }
238
+
239
+  openChangeRepairDept(flag){
240
+    flag && this.getRepairDeptList();
241
+  }
242
+
243
+  // 获取报修科室列表
244
+  repairDeptList:any[] = [];
245
+  getRepairDeptList(keyword?) {
246
+    let data = {
247
+      department: {
248
+        statisticalHosId: this.getHosId,
249
+        dept: keyword,
250
+        searchType: 1,
251
+      },
252
+      idx: 0,
253
+      sum: 20,
254
+    };
255
+    this.isLoading = true;
256
+    this.mainService
257
+      .getFetchDataList("data", "department", data)
258
+      .subscribe((data) => {
259
+        this.isLoading = false;
260
+        this.repairDeptList = data.list;
261
+      });
262
+  }
203 263
 
204 264
   // 详细搜索
205 265
   fieldConfig:any = {

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

@@ -36,8 +36,8 @@
36 36
     <tr>
37 37
       <th nzWidth="10%">人员姓名(工号)</th>
38 38
       <th nzWidth="9%" nzShowSort nzSortKey="sum" [(nzSort)]="sortCurrent.sum">工单总数</th>
39
-      <th nzWidth="9%" nzShowSort nzSortKey="avgResponseTime" [(nzSort)]="sortCurrent.avgResponseTime">平均响应时间</th>
40
-      <th nzWidth="9%" nzShowSort nzSortKey="avgResolvedTime" [(nzSort)]="sortCurrent.avgResolvedTime">平均解决时</th>
39
+      <th nzWidth="9%" nzShowSort nzSortKey="avgResponseTime" [(nzSort)]="sortCurrent.avgResponseTime">平均接单时长</th>
40
+      <th nzWidth="9%" nzShowSort nzSortKey="avgResolvedTime" [(nzSort)]="sortCurrent.avgResolvedTime">平均解决时</th>
41 41
       <th nzWidth="9%" nzShowSort nzSortKey="resolvedOverNum" [(nzSort)]="sortCurrent.resolvedOverNum">超时单数</th>
42 42
       <th nzWidth="9%" nzShowSort nzSortKey="overTimeNum" [(nzSort)]="sortCurrent.overTimeNum">挂起单数</th>
43 43
       <th nzWidth="9%" nzShowSort nzSortKey="consumablePrice" [(nzSort)]="sortCurrent.consumablePrice">耗材费用(元)</th>
@@ -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>
@@ -81,7 +81,8 @@
81 81
   </ng-template>
82 82
 </nz-table>
83 83
 <div class="pagination">
84
-  <nz-pagination [(nzPageIndex)]="pageIndex" [(nzTotal)]="listLength" [(nzPageSize)]="pageSize" (nzPageIndexChange)="getList(pageIndex, sortCurrentKey, sortCurrentValue)" (nzPageSizeChange)="getList(pageIndex, sortCurrentKey, sortCurrentValue)"></nz-pagination>
84
+  <ng-template #totalTemplate let-total> 共 {{ total }} 条 </ng-template>
85
+  <nz-pagination [(nzPageIndex)]="pageIndex" [(nzTotal)]="listLength" [(nzPageSize)]="pageSize" (nzPageIndexChange)="getList(pageIndex, sortCurrentKey, sortCurrentValue)" (nzPageSizeChange)="getList(pageIndex, sortCurrentKey, sortCurrentValue)" nzShowSizeChanger [nzPageSizeOptions]="[30,50,100,200]" [nzShowTotal]="totalTemplate"></nz-pagination>
85 86
 </div>
86 87
 
87 88
 <!-- 详细搜索 -->

+ 18 - 5
src/app/views/new-statistics/maintenance-statistics/user-statistics/user-statistics.component.ts

@@ -5,6 +5,7 @@ import { format, addMonths, startOfMonth, endOfMonth, startOfDay, endOfDay } fro
5 5
 import { Component, OnInit, HostListener, AfterViewInit } from "@angular/core";
6 6
 import { MainService } from 'src/app/services/main.service';
7 7
 import { ActivatedRoute } from '@angular/router';
8
+import { TabService } from '../../services/tab.service';
8 9
 @Component({
9 10
   selector: "app-user-statistics",
10 11
   templateUrl: "./user-statistics.component.html",
@@ -15,6 +16,7 @@ export class UserStatisticsComponent implements OnInit, AfterViewInit {
15 16
     private mainService: MainService,
16 17
     private message: NzMessageService,
17 18
     private route: ActivatedRoute,
19
+    private tabService: TabService,
18 20
   ) {}
19 21
 
20 22
   listOfData: any[] = []; //表格数据
@@ -33,6 +35,7 @@ export class UserStatisticsComponent implements OnInit, AfterViewInit {
33 35
       fun.call(this, v[1]);
34 36
     });
35 37
     this.initSessionData();
38
+    this.getQueryParams();
36 39
     this.search();
37 40
   }
38 41
 
@@ -44,11 +47,19 @@ export class UserStatisticsComponent implements OnInit, AfterViewInit {
44 47
   @HostListener('window:resize')
45 48
   onResize(): void {
46 49
     setTimeout(() => {
47
-      this.tableHeight = window.innerHeight - 64 - 64 - 36 - 48 - 8 - 45 - 54 - this.getMoreFilter;
48
-      console.log('this.tableHeight:', this.tableHeight)
50
+      this.tableHeight = window.innerHeight - document.querySelector('.searchDataWrap').clientHeight - 64 - 36 - 48 - 8 - document.querySelector('.ant-table-header').clientHeight - 55 - this.getMoreFilter - 2;
51
+
49 52
     }, 0)
50 53
   }
51 54
 
55
+  getQueryParams(){
56
+    let queryParams = this.tabService.getQueryParams();
57
+    this.tabService.clearQueryParams();
58
+    if(queryParams.dateRange){
59
+      this.dateRange = queryParams.dateRange;
60
+    }
61
+  }
62
+
52 63
   get getMoreFilter(){
53 64
     let flag = this.fieldConfig.fields.buildingDTO || this.fieldConfig.fields.floorDTO || this.fieldConfig.fields.category1DTO || this.fieldConfig.fields.category2DTO || this.fieldConfig.fields.category3DTO;
54 65
     return flag ? 21 : 0;
@@ -109,8 +120,9 @@ export class UserStatisticsComponent implements OnInit, AfterViewInit {
109 120
       parentDutyId: this.parentDutyId || undefined,
110 121
       groupId: this.groupId || undefined,
111 122
       buildingId: this.fieldConfig.fields.buildingId || undefined,
112
-      placeId: this.fieldConfig.fields.buildingId || undefined,
123
+      placeId: this.fieldConfig.fields.floorId || undefined,
113 124
       categoryId: this.fieldConfig.fields.categoryId || undefined,
125
+      hierarchy: this.fieldConfig.fields.hierarchy || undefined,
114 126
     };
115 127
     if (field && sort) {
116 128
       postData.sort = `${field} ${sort === "ascend" ? `asc` : `desc`}`
@@ -171,8 +183,9 @@ export class UserStatisticsComponent implements OnInit, AfterViewInit {
171 183
       parentDutyId: this.parentDutyId || undefined,
172 184
       groupId: this.groupId || undefined,
173 185
       buildingId: this.fieldConfig.fields.buildingId || undefined,
174
-      placeId: this.fieldConfig.fields.buildingId || undefined,
186
+      placeId: this.fieldConfig.fields.floorId || undefined,
175 187
       categoryId: this.fieldConfig.fields.categoryId || undefined,
188
+      hierarchy: this.fieldConfig.fields.hierarchy || undefined,
176 189
     };
177 190
     if (this.sortCurrentKey && this.sortCurrentValue) {
178 191
       postData.sort = `${this.sortCurrentKey} ${this.sortCurrentValue === "ascend" ? `asc` : `desc`}`
@@ -232,7 +245,7 @@ export class UserStatisticsComponent implements OnInit, AfterViewInit {
232 245
   getGroupList(keyword?) {
233 246
     let data = {
234 247
       group2: {
235
-        hospitals: this.getHosId,
248
+        statisticalHosId: this.getHosId,
236 249
         groupName: keyword,
237 250
         type: 3,
238 251
       },

+ 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 { }

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

@@ -0,0 +1,71 @@
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.hospital.hosName + '-' + 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
+  <ng-template #totalTemplate let-total> 共 {{ total }} 条 </ng-template>
67
+  <nz-pagination [(nzPageIndex)]="pageIndex" [(nzTotal)]="listLength" [(nzPageSize)]="pageSize" (nzPageIndexChange)="getList(pageIndex, sortCurrentKey, sortCurrentValue)" (nzPageSizeChange)="getList(pageIndex, sortCurrentKey, sortCurrentValue)" nzShowSizeChanger [nzPageSizeOptions]="[30,50,100,200]" [nzShowTotal]="totalTemplate"></nz-pagination>
68
+</div>
69
+
70
+<!-- 详细搜索 -->
71
+<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
+}

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

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

+ 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 { }

+ 36 - 7
src/app/views/new-statistics/services/tab.service.ts

@@ -19,10 +19,39 @@ export class TabService {
19 19
     this.router.events
20 20
       .pipe(filter(event => event instanceof NavigationEnd))
21 21
       .subscribe((event: NavigationEnd) => {
22
-        event.urlAfterRedirects.startsWith('/newStatistics/') && this.updateTabs(event.urlAfterRedirects);
22
+      	console.log('event:', event)
23
+        if(event.urlAfterRedirects.startsWith('/newStatistics/')){
24
+          this.updateTabs(event.urlAfterRedirects);
25
+        }else if(event.urlAfterRedirects !== '/'){
26
+          sessionStorage.removeItem('maintenanceStatistics')
27
+        }
23 28
       });
24 29
   }
25 30
 
31
+  public queryParams: any = {};
32
+  setQueryParams(key, value){
33
+    this.queryParams[key] = value;
34
+  }
35
+
36
+  getQueryParams(){
37
+    return this.queryParams;
38
+  }
39
+
40
+  clearQueryParams(){
41
+    this.queryParams = {};
42
+  }
43
+
44
+  public deleteAllRouteSnapshot(){
45
+    this.tabs.forEach(v => {
46
+      SimpleReuseStrategy.deleteRouteSnapshot(v.path);
47
+    })
48
+    this.tabs = [];
49
+  }
50
+
51
+  public deleteRouteSnapshot(path){
52
+    SimpleReuseStrategy.deleteRouteSnapshot(path);
53
+  }
54
+
26 55
   private updateTabs(url: string) {
27 56
     const normalizedUrl = this.getNormalizedUrl(url);
28 57
     const existingTab = this.tabs.find(t => t.path === normalizedUrl);
@@ -60,7 +89,6 @@ export class TabService {
60 89
 
61 90
   closeTab(path: string): any {
62 91
     console.log('path:', path)
63
-    SimpleReuseStrategy.deleteRouteCache(path);
64 92
 
65 93
     const index = this.tabs.findIndex(t => t.path === path);
66 94
     if (index === -1) return;
@@ -84,6 +112,7 @@ export class TabService {
84 112
 
85 113
     // 执行删除
86 114
     this.tabs.splice(index, 1);
115
+    SimpleReuseStrategy.deleteRouteSnapshot(path);
87 116
 
88 117
     // 设置新激活页签
89 118
     if (newActiveTab) {
@@ -108,16 +137,16 @@ export class TabService {
108 137
 
109 138
   closeOtherTabs(keepTab: Tab): void {
110 139
     // 强制激活当前右键页签
111
-    this.tabs = this.tabs.filter(t => t.path === keepTab.path);
112
-    keepTab.active = true;
113
-    this.currentTab = keepTab;
114
-
115 140
     this.tabs.forEach(v => {
116 141
       if (v.path !== keepTab.path) {
117
-        SimpleReuseStrategy.deleteRouteCache(v.path);
142
+        SimpleReuseStrategy.deleteRouteSnapshot(v.path);
118 143
       }
119 144
     })
120 145
 
146
+    this.tabs = this.tabs.filter(t => t.path === keepTab.path);
147
+    keepTab.active = true;
148
+    this.currentTab = keepTab;
149
+
121 150
     // 触发路由跳转
122 151
     this.router.navigate([keepTab.path], {
123 152
       replaceUrl: true