Browse Source

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

maotao 4 months ago
parent
commit
0943ead9a8
48 changed files with 1803 additions and 805 deletions
  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
 export class SimpleReuseStrategy implements RouteReuseStrategy {
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
       return null;
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
     path: "newStatistics",
185
     path: "newStatistics",
186
     loadChildren: () => import("./views/new-statistics/new-statistics.module").then((m) => m.NewStatisticsModule),
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
     path: '**',
196
     path: '**',

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

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

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

@@ -21,7 +21,7 @@
21
         <nz-form-item [hidden]="!fieldConfig.config.groupAndUser">
21
         <nz-form-item [hidden]="!fieldConfig.config.groupAndUser">
22
           <nz-form-label [nzSpan]="6" nzFor="userId">维修人员</nz-form-label>
22
           <nz-form-label [nzSpan]="6" nzFor="userId">维修人员</nz-form-label>
23
           <nz-form-control [nzSpan]="18" nzErrorTip="请选择维修人员!">
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
               <ng-container *ngFor="let option of userList">
25
               <ng-container *ngFor="let option of userList">
26
                 <nz-option *ngIf="!isLoading" [nzLabel]="option.name" [nzValue]="option.id"></nz-option>
26
                 <nz-option *ngIf="!isLoading" [nzLabel]="option.name" [nzValue]="option.id"></nz-option>
27
               </ng-container>
27
               </ng-container>
@@ -63,7 +63,7 @@
63
         <nz-form-item [hidden]="!fieldConfig.config.category123">
63
         <nz-form-item [hidden]="!fieldConfig.config.category123">
64
           <nz-form-label [nzSpan]="6" nzFor="category3Id">三级分类</nz-form-label>
64
           <nz-form-label [nzSpan]="6" nzFor="category3Id">三级分类</nz-form-label>
65
           <nz-form-control [nzSpan]="18" nzErrorTip="请选择三级分类!">
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
               <ng-container *ngFor="let option of category3List">
67
               <ng-container *ngFor="let option of category3List">
68
                 <nz-option *ngIf="!isLoading" [nzLabel]="option.category" [nzValue]="option.id"></nz-option>
68
                 <nz-option *ngIf="!isLoading" [nzLabel]="option.category" [nzValue]="option.id"></nz-option>
69
               </ng-container>
69
               </ng-container>
@@ -93,7 +93,7 @@
93
           <nz-form-control [nzSpan]="18" nzErrorTip="请选择楼栋!">
93
           <nz-form-control [nzSpan]="18" nzErrorTip="请选择楼栋!">
94
             <nz-select [nzDropdownMatchSelectWidth]="false" nzAllowClear nzServerSearch nzShowSearch (nzOnSearch)="changeBuildingInp($event)" formControlName="buildingId" nzPlaceHolder="请选择楼栋" (nzOpenChange)="openChangeBuilding($event)" (ngModelChange)="changeBuilding($event)">
94
             <nz-select [nzDropdownMatchSelectWidth]="false" nzAllowClear nzServerSearch nzShowSearch (nzOnSearch)="changeBuildingInp($event)" formControlName="buildingId" nzPlaceHolder="请选择楼栋" (nzOpenChange)="openChangeBuilding($event)" (ngModelChange)="changeBuilding($event)">
95
               <ng-container *ngFor="let option of buildingList">
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
               </ng-container>
97
               </ng-container>
98
               <nz-option *ngIf="isLoading" nzDisabled nzCustomContent>
98
               <nz-option *ngIf="isLoading" nzDisabled nzCustomContent>
99
                 <i nz-icon nzType="loading" class="loading-icon"></i> 搜索中...
99
                 <i nz-icon nzType="loading" class="loading-icon"></i> 搜索中...
@@ -105,7 +105,7 @@
105
         <nz-form-item [hidden]="!fieldConfig.config.buildingAndFloor">
105
         <nz-form-item [hidden]="!fieldConfig.config.buildingAndFloor">
106
           <nz-form-label [nzSpan]="6" nzFor="floorId">楼<span style="visibility: hidden;">囧囧</span>层</nz-form-label>
106
           <nz-form-label [nzSpan]="6" nzFor="floorId">楼<span style="visibility: hidden;">囧囧</span>层</nz-form-label>
107
           <nz-form-control [nzSpan]="18" nzErrorTip="请选择楼层!">
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
               <ng-container *ngFor="let option of floorList">
109
               <ng-container *ngFor="let option of floorList">
110
                 <nz-option *ngIf="!isLoading" [nzLabel]="option.floorName" [nzValue]="option.id"></nz-option>
110
                 <nz-option *ngIf="!isLoading" [nzLabel]="option.floorName" [nzValue]="option.id"></nz-option>
111
               </ng-container>
111
               </ng-container>
@@ -119,7 +119,7 @@
119
         <nz-form-item [hidden]="!fieldConfig.config.company">
119
         <nz-form-item [hidden]="!fieldConfig.config.company">
120
           <nz-form-label [nzSpan]="6" nzFor="companyId">三方公司</nz-form-label>
120
           <nz-form-label [nzSpan]="6" nzFor="companyId">三方公司</nz-form-label>
121
           <nz-form-control [nzSpan]="18" nzErrorTip="请选择三方公司!">
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
               <ng-container *ngFor="let option of companyList">
123
               <ng-container *ngFor="let option of companyList">
124
                 <nz-option *ngIf="!isLoading" [nzLabel]="option.name" [nzValue]="option.id"></nz-option>
124
                 <nz-option *ngIf="!isLoading" [nzLabel]="option.name" [nzValue]="option.id"></nz-option>
125
               </ng-container>
125
               </ng-container>
@@ -133,9 +133,9 @@
133
         <nz-form-item [hidden]="!fieldConfig.config.repairDept">
133
         <nz-form-item [hidden]="!fieldConfig.config.repairDept">
134
           <nz-form-label [nzSpan]="6" nzFor="repairDeptId">报修科室</nz-form-label>
134
           <nz-form-label [nzSpan]="6" nzFor="repairDeptId">报修科室</nz-form-label>
135
           <nz-form-control [nzSpan]="18" nzErrorTip="请选择报修科室!">
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
               <ng-container *ngFor="let option of repairDeptList">
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
               </ng-container>
139
               </ng-container>
140
               <nz-option *ngIf="isLoading" nzDisabled nzCustomContent>
140
               <nz-option *ngIf="isLoading" nzDisabled nzCustomContent>
141
                 <i nz-icon nzType="loading" class="loading-icon"></i> 搜索中...
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
       fields.floorDTO = this.floorList.find(item => item.id == this.validateForm.value.floorId);
109
       fields.floorDTO = this.floorList.find(item => item.id == this.validateForm.value.floorId);
110
     }
110
     }
111
     if(this.fieldConfig.config.company){
111
     if(this.fieldConfig.config.company){
112
+      fields.companyId = this.validateForm.value.companyId;
112
       fields.companyDTO = this.companyList.find(item => item.id == this.validateForm.value.companyId);
113
       fields.companyDTO = this.companyList.find(item => item.id == this.validateForm.value.companyId);
113
     }
114
     }
114
     if(this.fieldConfig.config.repairDept){
115
     if(this.fieldConfig.config.repairDept){
116
+      fields.repairDeptId = this.validateForm.value.repairDeptId;
115
       fields.repairDeptDTO = this.repairDeptList.find(item => item.id == this.validateForm.value.repairDeptId);
117
       fields.repairDeptDTO = this.repairDeptList.find(item => item.id == this.validateForm.value.repairDeptId);
116
     }
118
     }
117
     this.submitEvent.emit(fields);
119
     this.submitEvent.emit(fields);
@@ -124,11 +126,21 @@ export class SearchMoreComponent implements OnInit {
124
 
126
 
125
   // 防抖
127
   // 防抖
126
   isLoading = false;
128
   isLoading = false;
129
+  isSelecting:boolean = false; // 是否在选中状态
127
   searchTimer(fun, e) {
130
   searchTimer(fun, e) {
131
+    if (this.isSelecting) {
132
+      this.isSelecting = false; // 重置标志
133
+      return; // 跳过处理
134
+    }
128
     this.isLoading = true;
135
     this.isLoading = true;
129
     this.searchTimerSubject.next([fun, e]);
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
       idx: 0,
155
       idx: 0,
144
       sum: 20,
156
       sum: 20,
145
       group2: {
157
       group2: {
146
-        hospitals: this.getHosId,
158
+        statisticalHosId: this.getHosId,
147
         groupName: keyword,
159
         groupName: keyword,
148
         type: 3,
160
         type: 3,
149
       },
161
       },
@@ -163,9 +175,10 @@ export class SearchMoreComponent implements OnInit {
163
   }
175
   }
164
 
176
 
165
   changeGroup(id){
177
   changeGroup(id){
178
+    this.setIsSelecting();
166
     this.userList = [];
179
     this.userList = [];
167
     this.validateForm.controls.userId.setValue(null);
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
   userList:any[] = [];
192
   userList:any[] = [];
180
-  getUserList(keyword = '', groupId = ''){
181
-    if(!groupId){
193
+  getUserList(keyword = ''){
194
+    if(!this.validateForm.value.groupId){
182
       this.isLoading = false;
195
       this.isLoading = false;
183
       this.userList = [];
196
       this.userList = [];
184
       return;
197
       return;
@@ -189,7 +202,7 @@ export class SearchMoreComponent implements OnInit {
189
       user: {
202
       user: {
190
         name: keyword,
203
         name: keyword,
191
         simpleQuery: true,
204
         simpleQuery: true,
192
-        groupdata: { id: groupId },
205
+        groupdata: { id: this.validateForm.value.groupId },
193
         roleCodes: 'first-line support,second-line support,incident manager',
206
         roleCodes: 'first-line support,second-line support,incident manager',
194
         engineer: 1,
207
         engineer: 1,
195
       },
208
       },
@@ -205,7 +218,7 @@ export class SearchMoreComponent implements OnInit {
205
     });
218
     });
206
   }
219
   }
207
   openChangeUser(flag){
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
       category: {
235
       category: {
223
         category: keyword,
236
         category: keyword,
224
         selectType: 'mutlQuery',
237
         selectType: 'mutlQuery',
225
-        dutyIds: this.queryType == 3 ? this.dutyId : undefined,
226
-        parentDutyId: this.queryType == 3 ? this.parentDutyId : undefined,
238
+        statisticalHosId: this.getHosId,
227
         hierarchy: 1,
239
         hierarchy: 1,
228
       },
240
       },
229
     };
241
     };
@@ -242,9 +254,10 @@ export class SearchMoreComponent implements OnInit {
242
   }
254
   }
243
 
255
 
244
   changeCategory1(id){
256
   changeCategory1(id){
257
+    this.setIsSelecting();
245
     this.category2List = [];
258
     this.category2List = [];
246
     this.validateForm.controls.category2Id.setValue(null);
259
     this.validateForm.controls.category2Id.setValue(null);
247
-    this.getCategory2List('', id);
260
+    this.getCategory2List();
248
 
261
 
249
     this.category3List = [];
262
     this.category3List = [];
250
     this.validateForm.controls.category3Id.setValue(null);
263
     this.validateForm.controls.category3Id.setValue(null);
@@ -259,8 +272,8 @@ export class SearchMoreComponent implements OnInit {
259
 
272
 
260
   // 获取二级分类列表
273
   // 获取二级分类列表
261
   category2List:any[] = [];
274
   category2List:any[] = [];
262
-  getCategory2List(keyword = '', parentId = ''){
263
-    if(!parentId){
275
+  getCategory2List(keyword = ''){
276
+    if(!this.validateForm.value.category1Id){
264
       this.isLoading = false;
277
       this.isLoading = false;
265
       this.category2List = [];
278
       this.category2List = [];
266
       return;
279
       return;
@@ -269,7 +282,7 @@ export class SearchMoreComponent implements OnInit {
269
       category: {
282
       category: {
270
         category: keyword,
283
         category: keyword,
271
         selectType: 'mutlQuery',
284
         selectType: 'mutlQuery',
272
-        parent: { id: parentId },
285
+        parent: { id: this.validateForm.value.category1Id },
273
       },
286
       },
274
     };
287
     };
275
     this.isLoading = true;
288
     this.isLoading = true;
@@ -283,13 +296,14 @@ export class SearchMoreComponent implements OnInit {
283
     });
296
     });
284
   }
297
   }
285
   openChangeCategory2(flag){
298
   openChangeCategory2(flag){
286
-    flag && this.getCategory2List('', this.validateForm.value.category1Id);
299
+    flag && this.getCategory2List();
287
   }
300
   }
288
 
301
 
289
   changeCategory2(id){
302
   changeCategory2(id){
303
+    this.setIsSelecting();
290
     this.category3List = [];
304
     this.category3List = [];
291
     this.validateForm.controls.category3Id.setValue(null);
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
   category3List:any[] = [];
317
   category3List:any[] = [];
304
-  getCategory3List(keyword = '', parentId = ''){
305
-    if(!parentId){
318
+  getCategory3List(keyword = ''){
319
+    if(!this.validateForm.value.category2Id){
306
       this.isLoading = false;
320
       this.isLoading = false;
307
       this.category3List = [];
321
       this.category3List = [];
308
       return;
322
       return;
@@ -311,7 +325,7 @@ export class SearchMoreComponent implements OnInit {
311
       category: {
325
       category: {
312
         category: keyword,
326
         category: keyword,
313
         selectType: 'mutlQuery',
327
         selectType: 'mutlQuery',
314
-        parent: { id: parentId },
328
+        parent: { id: this.validateForm.value.category2Id },
315
       },
329
       },
316
     };
330
     };
317
     this.isLoading = true;
331
     this.isLoading = true;
@@ -325,7 +339,7 @@ export class SearchMoreComponent implements OnInit {
325
     });
339
     });
326
   }
340
   }
327
   openChangeCategory3(flag){
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
       building: {
368
       building: {
355
         simpleQuery: true,
369
         simpleQuery: true,
356
         buildingName: keyword,
370
         buildingName: keyword,
357
-        cascadeHosId:this.getHosId,
371
+        statisticalHosId:this.getHosId,
358
       },
372
       },
359
     };
373
     };
360
     this.isLoading = true;
374
     this.isLoading = true;
@@ -372,9 +386,10 @@ export class SearchMoreComponent implements OnInit {
372
   }
386
   }
373
 
387
 
374
   changeBuilding(id){
388
   changeBuilding(id){
389
+    this.setIsSelecting();
375
     this.floorList = [];
390
     this.floorList = [];
376
     this.validateForm.controls.floorId.setValue(null);
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
   floorList:any[] = [];
403
   floorList:any[] = [];
389
-  getFloorList(keyword = '', buildingId = ''){
390
-    if(!buildingId){
404
+  getFloorList(keyword = ''){
405
+    if(!this.validateForm.value.buildingId){
391
       this.isLoading = false;
406
       this.isLoading = false;
392
       this.floorList = [];
407
       this.floorList = [];
393
       return;
408
       return;
@@ -397,7 +412,7 @@ export class SearchMoreComponent implements OnInit {
397
       sum: 20,
412
       sum: 20,
398
       floor: {
413
       floor: {
399
         floorName: keyword,
414
         floorName: keyword,
400
-        buildId : buildingId,
415
+        buildId : this.validateForm.value.buildingId,
401
       },
416
       },
402
     };
417
     };
403
     this.isLoading = true;
418
     this.isLoading = true;
@@ -411,7 +426,7 @@ export class SearchMoreComponent implements OnInit {
411
     });
426
     });
412
   }
427
   }
413
   openChangeFloor(flag){
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
       company: {
445
       company: {
431
         busiType: { key: "company_busi_type", value: "2" },
446
         busiType: { key: "company_busi_type", value: "2" },
432
         name: keyword,
447
         name: keyword,
433
-        hosId: this.getHosId,
448
+        statisticalHosId: this.getHosId,
434
       },
449
       },
435
     };
450
     };
436
     this.isLoading = true;
451
     this.isLoading = true;
@@ -461,7 +476,7 @@ export class SearchMoreComponent implements OnInit {
461
       idx: 0,
476
       idx: 0,
462
       sum: 20,
477
       sum: 20,
463
       department: {
478
       department: {
464
-        cascadeHosId: this.getHosId,
479
+        statisticalHosId: this.getHosId,
465
         dept: keyword,
480
         dept: keyword,
466
         searchType: 1,
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
       <nz-range-picker [(ngModel)]="dateRange" [nzAllowClear]="false" (ngModelChange)="changeDate($event)" (nzOnCalendarChange)="onCalendarChangeDate($event)">
5
       <nz-range-picker [(ngModel)]="dateRange" [nzAllowClear]="false" (ngModelChange)="changeDate($event)" (nzOnCalendarChange)="onCalendarChangeDate($event)">
6
       </nz-range-picker>
6
       </nz-range-picker>
7
     </div>
7
     </div>
8
-    <div class="searchDataItem">
9
-      <span class="label">报修科室</span>:
10
-      <nz-select class="selectItem" [nzDropdownMatchSelectWidth]="false" nzServerSearch nzShowSearch (nzOnSearch)="changeRepairDeptInp($event)" nzAllowClear nzPlaceHolder="请选择报修科室" [(ngModel)]="repairDeptId" (nzOpenChange)="openChangeRepairDept($event)">
11
-      <ng-container *ngFor="let option of repairDeptList">
12
-        <nz-option *ngIf="!isLoading" [nzLabel]="option.dept" [nzValue]="option.id"></nz-option>
13
-      </ng-container>
14
-      <nz-option *ngIf="isLoading" nzDisabled nzCustomContent>
15
-        <i nz-icon nzType="loading" class="loading-icon"></i> 搜索中...
16
-      </nz-option>
17
-    </nz-select>
18
-    </div>
19
   </div>
8
   </div>
20
   <div class="operation">
9
   <div class="operation">
21
     <i class="icon_transport transport-gengduo" (click)="showMore()"></i>
10
     <i class="icon_transport transport-gengduo" (click)="showMore()"></i>
@@ -24,21 +13,18 @@
24
     <button nz-button class="btn default ml8" (click)="excelExport()" [nzLoading]="excelExportLoading">导出</button>
13
     <button nz-button class="btn default ml8" (click)="excelExport()" [nzLoading]="excelExportLoading">导出</button>
25
   </div>
14
   </div>
26
 </div>
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
   <span>{{fieldConfig.fields.category1DTO?.category}}</span>
17
   <span>{{fieldConfig.fields.category1DTO?.category}}</span>
31
   <span>{{fieldConfig.fields.category2DTO?.category}}</span>
18
   <span>{{fieldConfig.fields.category2DTO?.category}}</span>
32
   <span>{{fieldConfig.fields.category3DTO?.category}}</span>
19
   <span>{{fieldConfig.fields.category3DTO?.category}}</span>
33
-  <span>{{fieldConfig.fields.sourceDTO?.name}}</span>
34
 </div>
20
 </div>
35
 <nz-table class="table" [nzData]="listOfData" nzSize="middle" [nzShowPagination]="false" [nzLoading]="loading1" [nzScroll]="{ y: tableHeight + 'px' }" [nzFooter]="footerTpl">
21
 <nz-table class="table" [nzData]="listOfData" nzSize="middle" [nzShowPagination]="false" [nzLoading]="loading1" [nzScroll]="{ y: tableHeight + 'px' }" [nzFooter]="footerTpl">
36
   <thead (nzSortChange)="sort($event)" nzSingleSort>
22
   <thead (nzSortChange)="sort($event)" nzSingleSort>
37
     <tr>
23
     <tr>
38
-      <th nzWidth="10%" nzShowSort nzSortKey="startDate" [(nzSort)]="sortCurrent.startDate">时间</th>
24
+      <th nzWidth="10%">楼栋名称</th>
39
       <th nzWidth="9%" nzShowSort nzSortKey="sum" [(nzSort)]="sortCurrent.sum">工单总数</th>
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
       <th nzWidth="9%" nzShowSort nzSortKey="resolvedOverNum" [(nzSort)]="sortCurrent.resolvedOverNum">超时单数</th>
28
       <th nzWidth="9%" nzShowSort nzSortKey="resolvedOverNum" [(nzSort)]="sortCurrent.resolvedOverNum">超时单数</th>
43
       <th nzWidth="9%" nzShowSort nzSortKey="overTimeNum" [(nzSort)]="sortCurrent.overTimeNum">挂起单数</th>
29
       <th nzWidth="9%" nzShowSort nzSortKey="overTimeNum" [(nzSort)]="sortCurrent.overTimeNum">挂起单数</th>
44
       <th nzWidth="9%" nzShowSort nzSortKey="consumablePrice" [(nzSort)]="sortCurrent.consumablePrice">耗材费用(元)</th>
30
       <th nzWidth="9%" nzShowSort nzSortKey="consumablePrice" [(nzSort)]="sortCurrent.consumablePrice">耗材费用(元)</th>
@@ -50,7 +36,7 @@
50
   </thead>
36
   </thead>
51
   <tbody>
37
   <tbody>
52
     <tr *ngFor="let data of listOfData">
38
     <tr *ngFor="let data of listOfData">
53
-      <td>{{ data.startDate }}</td>
39
+      <td>{{ data.name }}</td>
54
       <td>{{ data.sum }}</td>
40
       <td>{{ data.sum }}</td>
55
       <td>{{ data.avgResponseTime }}</td>
41
       <td>{{ data.avgResponseTime }}</td>
56
       <td>{{ data.avgResolvedTime }}</td>
42
       <td>{{ data.avgResolvedTime }}</td>
@@ -66,7 +52,7 @@
66
   <ng-template #footerTpl>
52
   <ng-template #footerTpl>
67
     <table class="footTable">
53
     <table class="footTable">
68
       <tr *ngFor="let data of listOfDataEnd">
54
       <tr *ngFor="let data of listOfDataEnd">
69
-        <td style="width: 10%">{{ data.startDate }}</td>
55
+        <td style="width: 10%">{{ data.name }}</td>
70
         <td style="width: 9%">{{ data.sum }}</td>
56
         <td style="width: 9%">{{ data.sum }}</td>
71
         <td style="width: 9%">{{ data.avgResponseTime }}</td>
57
         <td style="width: 9%">{{ data.avgResponseTime }}</td>
72
         <td style="width: 9%">{{ data.avgResolvedTime }}</td>
58
         <td style="width: 9%">{{ data.avgResolvedTime }}</td>
@@ -82,7 +68,8 @@
82
   </ng-template>
68
   </ng-template>
83
 </nz-table>
69
 </nz-table>
84
 <div class="pagination">
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
 </div>
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
 import { NzMessageService } from 'ng-zorro-antd/message';
2
 import { NzMessageService } from 'ng-zorro-antd/message';
4
 import { format, addMonths, startOfMonth, endOfMonth, startOfDay, endOfDay } from 'date-fns';
3
 import { format, addMonths, startOfMonth, endOfMonth, startOfDay, endOfDay } from 'date-fns';
5
 import { Component, OnInit, HostListener, AfterViewInit } from "@angular/core";
4
 import { Component, OnInit, HostListener, AfterViewInit } from "@angular/core";
@@ -15,6 +14,7 @@ export class BuildingStatisticsComponent implements OnInit, AfterViewInit {
15
     private mainService: MainService,
14
     private mainService: MainService,
16
     private message: NzMessageService,
15
     private message: NzMessageService,
17
     private route: ActivatedRoute,
16
     private route: ActivatedRoute,
17
+    private tabService: TabService,
18
   ) {}
18
   ) {}
19
 
19
 
20
   listOfData: any[] = []; //表格数据
20
   listOfData: any[] = []; //表格数据
@@ -23,16 +23,9 @@ export class BuildingStatisticsComponent implements OnInit, AfterViewInit {
23
   pageSize: number = 30; //表格每页展示条数
23
   pageSize: number = 30; //表格每页展示条数
24
   listLength: number = 0; //表格总数据量
24
   listLength: number = 0; //表格总数据量
25
 
25
 
26
-  repairDeptId;//报修科室id
27
-
28
-  searchTimerSubject = new Subject();
29
-
30
   ngOnInit() {
26
   ngOnInit() {
31
-    this.searchTimerSubject.pipe(debounceTime(500)).subscribe((v) => {
32
-      let fun = v[0];
33
-      fun.call(this, v[1]);
34
-    });
35
     this.initSessionData();
27
     this.initSessionData();
28
+    this.getQueryParams();
36
     this.search();
29
     this.search();
37
   }
30
   }
38
 
31
 
@@ -44,13 +37,21 @@ export class BuildingStatisticsComponent implements OnInit, AfterViewInit {
44
   @HostListener('window:resize')
37
   @HostListener('window:resize')
45
   onResize(): void {
38
   onResize(): void {
46
     setTimeout(() => {
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
     }, 0)
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
   get getMoreFilter(){
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
     return flag ? 21 : 0;
55
     return flag ? 21 : 0;
55
   }
56
   }
56
 
57
 
@@ -102,24 +103,20 @@ export class BuildingStatisticsComponent implements OnInit, AfterViewInit {
102
     let postData:any = {
103
     let postData:any = {
103
       idx: this.pageIndex - 1,
104
       idx: this.pageIndex - 1,
104
       sum: this.pageSize,
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
     if (field && sort) {
114
     if (field && sort) {
118
       postData.sort = `${field} ${sort === "ascend" ? `asc` : `desc`}`
115
       postData.sort = `${field} ${sort === "ascend" ? `asc` : `desc`}`
119
     }
116
     }
120
     this.loading1 = true;
117
     this.loading1 = true;
121
     this.mainService
118
     this.mainService
122
-      .postCustom("itsm/report", "incidentWorkOrder", postData)
119
+      .postCustom("itsm/report", "buildingIncident", postData)
123
       .subscribe((result) => {
120
       .subscribe((result) => {
124
         this.loading1 = false;
121
         this.loading1 = false;
125
         this.listOfData = result.dataList.filter((v, i) => { return i != result.dataList.length - 1 });
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
       nzDuration: 0,
163
       nzDuration: 0,
167
     }).messageId;
164
     }).messageId;
168
     let postData:any = {
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
     if (this.sortCurrentKey && this.sortCurrentValue) {
174
     if (this.sortCurrentKey && this.sortCurrentValue) {
182
       postData.sort = `${this.sortCurrentKey} ${this.sortCurrentValue === "ascend" ? `asc` : `desc`}`
175
       postData.sort = `${this.sortCurrentKey} ${this.sortCurrentValue === "ascend" ? `asc` : `desc`}`
183
     }
176
     }
184
     this.mainService
177
     this.mainService
185
-      .postExportCustom("itsm/export", "incidentWorkOrder", postData)
178
+      .postExportCustom("itsm/export", "buildingIncident", postData)
186
       .subscribe((data) => {
179
       .subscribe((data) => {
187
         this.message.remove(this.excelExportLoading);
180
         this.message.remove(this.excelExportLoading);
188
         this.excelExportLoading = false;
181
         this.excelExportLoading = false;
@@ -210,52 +203,17 @@ export class BuildingStatisticsComponent implements OnInit, AfterViewInit {
210
 		this.sortCurrentValue = "";
203
 		this.sortCurrentValue = "";
211
 		this.sortCurrent = {};
204
 		this.sortCurrent = {};
212
     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')]
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
     this.search();
207
     this.search();
216
   }
208
   }
217
 
209
 
218
-  // 科室搜索
219
-  changeRepairDeptInp(e) {
220
-    this.searchTimer(this.getRepairDeptList, e);
221
-  }
222
-
223
   // 防抖
210
   // 防抖
224
   isLoading = false;
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
   fieldConfig:any = {
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
   showSearchMore:boolean = false;
218
   showSearchMore:boolean = false;
261
   showMore(){
219
   showMore(){
@@ -274,4 +232,3 @@ export class BuildingStatisticsComponent implements OnInit, AfterViewInit {
274
     this.onResize();
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
     <tr>
26
     <tr>
27
       <th nzWidth="10%">故障现象</th>
27
       <th nzWidth="10%">故障现象</th>
28
       <th nzWidth="9%" nzShowSort nzSortKey="sum" [(nzSort)]="sortCurrent.sum">工单总数</th>
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
       <th nzWidth="9%" nzShowSort nzSortKey="resolvedOverNum" [(nzSort)]="sortCurrent.resolvedOverNum">超时单数</th>
31
       <th nzWidth="9%" nzShowSort nzSortKey="resolvedOverNum" [(nzSort)]="sortCurrent.resolvedOverNum">超时单数</th>
32
       <th nzWidth="9%" nzShowSort nzSortKey="overTimeNum" [(nzSort)]="sortCurrent.overTimeNum">挂起单数</th>
32
       <th nzWidth="9%" nzShowSort nzSortKey="overTimeNum" [(nzSort)]="sortCurrent.overTimeNum">挂起单数</th>
33
       <th nzWidth="9%" nzShowSort nzSortKey="consumablePrice" [(nzSort)]="sortCurrent.consumablePrice">耗材费用(元)</th>
33
       <th nzWidth="9%" nzShowSort nzSortKey="consumablePrice" [(nzSort)]="sortCurrent.consumablePrice">耗材费用(元)</th>
@@ -71,7 +71,8 @@
71
   </ng-template>
71
   </ng-template>
72
 </nz-table>
72
 </nz-table>
73
 <div class="pagination">
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
 </div>
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
 import { NzMessageService } from 'ng-zorro-antd/message';
2
 import { NzMessageService } from 'ng-zorro-antd/message';
2
 import { format, addMonths, startOfMonth, endOfMonth, startOfDay, endOfDay } from 'date-fns';
3
 import { format, addMonths, startOfMonth, endOfMonth, startOfDay, endOfDay } from 'date-fns';
3
 import { Component, OnInit, HostListener, AfterViewInit } from "@angular/core";
4
 import { Component, OnInit, HostListener, AfterViewInit } from "@angular/core";
@@ -13,6 +14,7 @@ export class CategoryOneStatisticsComponent implements OnInit, AfterViewInit {
13
     private mainService: MainService,
14
     private mainService: MainService,
14
     private message: NzMessageService,
15
     private message: NzMessageService,
15
     private route: ActivatedRoute,
16
     private route: ActivatedRoute,
17
+    private tabService: TabService,
16
   ) {}
18
   ) {}
17
 
19
 
18
   listOfData: any[] = []; //表格数据
20
   listOfData: any[] = []; //表格数据
@@ -23,6 +25,7 @@ export class CategoryOneStatisticsComponent implements OnInit, AfterViewInit {
23
 
25
 
24
   ngOnInit() {
26
   ngOnInit() {
25
     this.initSessionData();
27
     this.initSessionData();
28
+    this.getQueryParams();
26
     this.search();
29
     this.search();
27
   }
30
   }
28
 
31
 
@@ -34,11 +37,19 @@ export class CategoryOneStatisticsComponent implements OnInit, AfterViewInit {
34
   @HostListener('window:resize')
37
   @HostListener('window:resize')
35
   onResize(): void {
38
   onResize(): void {
36
     setTimeout(() => {
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
     }, 0)
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
   get getMoreFilter(){
53
   get getMoreFilter(){
43
     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
     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
     return flag ? 21 : 0;
55
     return flag ? 21 : 0;
@@ -97,11 +108,11 @@ export class CategoryOneStatisticsComponent implements OnInit, AfterViewInit {
97
       hosId: this.hosId || undefined,
108
       hosId: this.hosId || undefined,
98
       dutyId: this.dutyId || undefined,
109
       dutyId: this.dutyId || undefined,
99
       parentDutyId: this.parentDutyId || undefined,
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
       userId: this.fieldConfig.fields.userId || undefined,
112
       userId: this.fieldConfig.fields.userId || undefined,
102
       buildingId: this.fieldConfig.fields.buildingId || undefined,
113
       buildingId: this.fieldConfig.fields.buildingId || undefined,
103
       placeId: this.fieldConfig.fields.floorId || undefined,
114
       placeId: this.fieldConfig.fields.floorId || undefined,
104
-      compantId: this.fieldConfig.fields.compantId || undefined,
115
+      companyId: this.fieldConfig.fields.companyId || undefined,
105
       repairDeptId: this.fieldConfig.fields.repairDeptId || undefined,
116
       repairDeptId: this.fieldConfig.fields.repairDeptId || undefined,
106
       categoryLevel: 1,
117
       categoryLevel: 1,
107
     };
118
     };
@@ -162,11 +173,11 @@ export class CategoryOneStatisticsComponent implements OnInit, AfterViewInit {
162
       hosId: this.hosId || undefined,
173
       hosId: this.hosId || undefined,
163
       dutyId: this.dutyId || undefined,
174
       dutyId: this.dutyId || undefined,
164
       parentDutyId: this.parentDutyId || undefined,
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
       userId: this.fieldConfig.fields.userId || undefined,
177
       userId: this.fieldConfig.fields.userId || undefined,
167
       buildingId: this.fieldConfig.fields.buildingId || undefined,
178
       buildingId: this.fieldConfig.fields.buildingId || undefined,
168
       placeId: this.fieldConfig.fields.floorId || undefined,
179
       placeId: this.fieldConfig.fields.floorId || undefined,
169
-      compantId: this.fieldConfig.fields.compantId || undefined,
180
+      companyId: this.fieldConfig.fields.companyId || undefined,
170
       repairDeptId: this.fieldConfig.fields.repairDeptId || undefined,
181
       repairDeptId: this.fieldConfig.fields.repairDeptId || undefined,
171
       categoryLevel: 1,
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
       <nz-range-picker [(ngModel)]="dateRange" [nzAllowClear]="false" (ngModelChange)="changeDate($event)" (nzOnCalendarChange)="onCalendarChangeDate($event)">
5
       <nz-range-picker [(ngModel)]="dateRange" [nzAllowClear]="false" (ngModelChange)="changeDate($event)" (nzOnCalendarChange)="onCalendarChangeDate($event)">
6
       </nz-range-picker>
6
       </nz-range-picker>
7
     </div>
7
     </div>
8
-    <div class="searchDataItem">
9
-      <span class="label">报修科室</span>:
10
-      <nz-select class="selectItem" [nzDropdownMatchSelectWidth]="false" nzServerSearch nzShowSearch (nzOnSearch)="changeRepairDeptInp($event)" nzAllowClear nzPlaceHolder="请选择报修科室" [(ngModel)]="repairDeptId" (nzOpenChange)="openChangeRepairDept($event)">
11
-      <ng-container *ngFor="let option of repairDeptList">
12
-        <nz-option *ngIf="!isLoading" [nzLabel]="option.dept" [nzValue]="option.id"></nz-option>
13
-      </ng-container>
14
-      <nz-option *ngIf="isLoading" nzDisabled nzCustomContent>
15
-        <i nz-icon nzType="loading" class="loading-icon"></i> 搜索中...
16
-      </nz-option>
17
-    </nz-select>
18
-    </div>
19
   </div>
8
   </div>
20
   <div class="operation">
9
   <div class="operation">
21
     <i class="icon_transport transport-gengduo" (click)="showMore()"></i>
10
     <i class="icon_transport transport-gengduo" (click)="showMore()"></i>
@@ -24,65 +13,43 @@
24
     <button nz-button class="btn default ml8" (click)="excelExport()" [nzLoading]="excelExportLoading">导出</button>
13
     <button nz-button class="btn default ml8" (click)="excelExport()" [nzLoading]="excelExportLoading">导出</button>
25
   </div>
14
   </div>
26
 </div>
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
   <span>{{fieldConfig.fields.groupDTO?.groupName}}</span>
17
   <span>{{fieldConfig.fields.groupDTO?.groupName}}</span>
29
   <span>{{fieldConfig.fields.userDTO?.name}}</span>
18
   <span>{{fieldConfig.fields.userDTO?.name}}</span>
30
   <span>{{fieldConfig.fields.category1DTO?.category}}</span>
19
   <span>{{fieldConfig.fields.category1DTO?.category}}</span>
31
   <span>{{fieldConfig.fields.category2DTO?.category}}</span>
20
   <span>{{fieldConfig.fields.category2DTO?.category}}</span>
32
   <span>{{fieldConfig.fields.category3DTO?.category}}</span>
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
 </div>
24
 </div>
35
 <nz-table class="table" [nzData]="listOfData" nzSize="middle" [nzShowPagination]="false" [nzLoading]="loading1" [nzScroll]="{ y: tableHeight + 'px' }" [nzFooter]="footerTpl">
25
 <nz-table class="table" [nzData]="listOfData" nzSize="middle" [nzShowPagination]="false" [nzLoading]="loading1" [nzScroll]="{ y: tableHeight + 'px' }" [nzFooter]="footerTpl">
36
   <thead (nzSortChange)="sort($event)" nzSingleSort>
26
   <thead (nzSortChange)="sort($event)" nzSingleSort>
37
     <tr>
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
     </tr>
31
     </tr>
50
   </thead>
32
   </thead>
51
   <tbody>
33
   <tbody>
52
     <tr *ngFor="let data of listOfData">
34
     <tr *ngFor="let data of listOfData">
53
-      <td>{{ data.startDate }}</td>
35
+      <td>{{ data.sourceName }}</td>
54
       <td>{{ data.sum }}</td>
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
     </tr>
38
     </tr>
65
   </tbody>
39
   </tbody>
66
   <ng-template #footerTpl>
40
   <ng-template #footerTpl>
67
     <table class="footTable">
41
     <table class="footTable">
68
       <tr *ngFor="let data of listOfDataEnd">
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
       </tr>
46
       </tr>
81
     </table>
47
     </table>
82
   </ng-template>
48
   </ng-template>
83
 </nz-table>
49
 </nz-table>
84
 <div class="pagination">
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
 </div>
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
 import { NzMessageService } from 'ng-zorro-antd/message';
2
 import { NzMessageService } from 'ng-zorro-antd/message';
4
 import { format, addMonths, startOfMonth, endOfMonth, startOfDay, endOfDay } from 'date-fns';
3
 import { format, addMonths, startOfMonth, endOfMonth, startOfDay, endOfDay } from 'date-fns';
5
 import { Component, OnInit, HostListener, AfterViewInit } from "@angular/core";
4
 import { Component, OnInit, HostListener, AfterViewInit } from "@angular/core";
@@ -15,6 +14,7 @@ export class CategorySourceStatisticsComponent implements OnInit, AfterViewInit
15
     private mainService: MainService,
14
     private mainService: MainService,
16
     private message: NzMessageService,
15
     private message: NzMessageService,
17
     private route: ActivatedRoute,
16
     private route: ActivatedRoute,
17
+    private tabService: TabService,
18
   ) {}
18
   ) {}
19
 
19
 
20
   listOfData: any[] = []; //表格数据
20
   listOfData: any[] = []; //表格数据
@@ -23,16 +23,9 @@ export class CategorySourceStatisticsComponent implements OnInit, AfterViewInit
23
   pageSize: number = 30; //表格每页展示条数
23
   pageSize: number = 30; //表格每页展示条数
24
   listLength: number = 0; //表格总数据量
24
   listLength: number = 0; //表格总数据量
25
 
25
 
26
-  repairDeptId;//报修科室id
27
-
28
-  searchTimerSubject = new Subject();
29
-
30
   ngOnInit() {
26
   ngOnInit() {
31
-    this.searchTimerSubject.pipe(debounceTime(500)).subscribe((v) => {
32
-      let fun = v[0];
33
-      fun.call(this, v[1]);
34
-    });
35
     this.initSessionData();
27
     this.initSessionData();
28
+    this.getQueryParams();
36
     this.search();
29
     this.search();
37
   }
30
   }
38
 
31
 
@@ -44,13 +37,21 @@ export class CategorySourceStatisticsComponent implements OnInit, AfterViewInit
44
   @HostListener('window:resize')
37
   @HostListener('window:resize')
45
   onResize(): void {
38
   onResize(): void {
46
     setTimeout(() => {
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
     }, 0)
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
   get getMoreFilter(){
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
     return flag ? 21 : 0;
55
     return flag ? 21 : 0;
55
   }
56
   }
56
 
57
 
@@ -102,24 +103,24 @@ export class CategorySourceStatisticsComponent implements OnInit, AfterViewInit
102
     let postData:any = {
103
     let postData:any = {
103
       idx: this.pageIndex - 1,
104
       idx: this.pageIndex - 1,
104
       sum: this.pageSize,
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
     if (field && sort) {
118
     if (field && sort) {
118
       postData.sort = `${field} ${sort === "ascend" ? `asc` : `desc`}`
119
       postData.sort = `${field} ${sort === "ascend" ? `asc` : `desc`}`
119
     }
120
     }
120
     this.loading1 = true;
121
     this.loading1 = true;
121
     this.mainService
122
     this.mainService
122
-      .postCustom("itsm/report", "incidentWorkOrder", postData)
123
+      .postCustom("itsm/report", "incidentSource", postData)
123
       .subscribe((result) => {
124
       .subscribe((result) => {
124
         this.loading1 = false;
125
         this.loading1 = false;
125
         this.listOfData = result.dataList.filter((v, i) => { return i != result.dataList.length - 1 });
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
       nzDuration: 0,
167
       nzDuration: 0,
167
     }).messageId;
168
     }).messageId;
168
     let postData:any = {
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
     if (this.sortCurrentKey && this.sortCurrentValue) {
182
     if (this.sortCurrentKey && this.sortCurrentValue) {
182
       postData.sort = `${this.sortCurrentKey} ${this.sortCurrentValue === "ascend" ? `asc` : `desc`}`
183
       postData.sort = `${this.sortCurrentKey} ${this.sortCurrentValue === "ascend" ? `asc` : `desc`}`
183
     }
184
     }
184
     this.mainService
185
     this.mainService
185
-      .postExportCustom("itsm/export", "incidentWorkOrder", postData)
186
+      .postExportCustom("itsm/export", "incidentSource", postData)
186
       .subscribe((data) => {
187
       .subscribe((data) => {
187
         this.message.remove(this.excelExportLoading);
188
         this.message.remove(this.excelExportLoading);
188
         this.excelExportLoading = false;
189
         this.excelExportLoading = false;
@@ -210,52 +211,17 @@ export class CategorySourceStatisticsComponent implements OnInit, AfterViewInit
210
 		this.sortCurrentValue = "";
211
 		this.sortCurrentValue = "";
211
 		this.sortCurrent = {};
212
 		this.sortCurrent = {};
212
     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.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
     this.search();
215
     this.search();
216
   }
216
   }
217
 
217
 
218
-  // 科室搜索
219
-  changeRepairDeptInp(e) {
220
-    this.searchTimer(this.getRepairDeptList, e);
221
-  }
222
-
223
   // 防抖
218
   // 防抖
224
   isLoading = false;
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
   fieldConfig:any = {
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
   showSearchMore:boolean = false;
226
   showSearchMore:boolean = false;
261
   showMore(){
227
   showMore(){
@@ -274,5 +240,3 @@ export class CategorySourceStatisticsComponent implements OnInit, AfterViewInit
274
     this.onResize();
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
     <tr>
46
     <tr>
47
       <th nzWidth="10%">故障现象</th>
47
       <th nzWidth="10%">故障现象</th>
48
       <th nzWidth="9%" nzShowSort nzSortKey="sum" [(nzSort)]="sortCurrent.sum">工单总数</th>
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
       <th nzWidth="9%" nzShowSort nzSortKey="resolvedOverNum" [(nzSort)]="sortCurrent.resolvedOverNum">超时单数</th>
51
       <th nzWidth="9%" nzShowSort nzSortKey="resolvedOverNum" [(nzSort)]="sortCurrent.resolvedOverNum">超时单数</th>
52
       <th nzWidth="9%" nzShowSort nzSortKey="overTimeNum" [(nzSort)]="sortCurrent.overTimeNum">挂起单数</th>
52
       <th nzWidth="9%" nzShowSort nzSortKey="overTimeNum" [(nzSort)]="sortCurrent.overTimeNum">挂起单数</th>
53
       <th nzWidth="9%" nzShowSort nzSortKey="consumablePrice" [(nzSort)]="sortCurrent.consumablePrice">耗材费用(元)</th>
53
       <th nzWidth="9%" nzShowSort nzSortKey="consumablePrice" [(nzSort)]="sortCurrent.consumablePrice">耗材费用(元)</th>
@@ -91,7 +91,8 @@
91
   </ng-template>
91
   </ng-template>
92
 </nz-table>
92
 </nz-table>
93
 <div class="pagination">
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
 </div>
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
 import { debounceTime } from 'rxjs/operators';
2
 import { debounceTime } from 'rxjs/operators';
2
 import { Subject } from 'rxjs';
3
 import { Subject } from 'rxjs';
3
 import { NzMessageService } from 'ng-zorro-antd/message';
4
 import { NzMessageService } from 'ng-zorro-antd/message';
@@ -15,6 +16,7 @@ export class CategoryThreeStatisticsComponent implements OnInit, AfterViewInit {
15
     private mainService: MainService,
16
     private mainService: MainService,
16
     private message: NzMessageService,
17
     private message: NzMessageService,
17
     private route: ActivatedRoute,
18
     private route: ActivatedRoute,
19
+    private tabService: TabService,
18
   ) {}
20
   ) {}
19
 
21
 
20
   listOfData: any[] = []; //表格数据
22
   listOfData: any[] = []; //表格数据
@@ -34,6 +36,7 @@ export class CategoryThreeStatisticsComponent implements OnInit, AfterViewInit {
34
       fun.call(this, v[1]);
36
       fun.call(this, v[1]);
35
     });
37
     });
36
     this.initSessionData();
38
     this.initSessionData();
39
+    this.getQueryParams();
37
     this.search();
40
     this.search();
38
   }
41
   }
39
 
42
 
@@ -45,11 +48,19 @@ export class CategoryThreeStatisticsComponent implements OnInit, AfterViewInit {
45
   @HostListener('window:resize')
48
   @HostListener('window:resize')
46
   onResize(): void {
49
   onResize(): void {
47
     setTimeout(() => {
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
     }, 0)
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
   get getMoreFilter(){
64
   get getMoreFilter(){
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;
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
     return flag ? 21 : 0;
66
     return flag ? 21 : 0;
@@ -109,11 +120,12 @@ export class CategoryThreeStatisticsComponent implements OnInit, AfterViewInit {
109
       dutyId: this.dutyId || undefined,
120
       dutyId: this.dutyId || undefined,
110
       parentDutyId: this.parentDutyId || undefined,
121
       parentDutyId: this.parentDutyId || undefined,
111
       categoryId: this.category2Id || this.category1Id || undefined,
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
       userId: this.fieldConfig.fields.userId || undefined,
125
       userId: this.fieldConfig.fields.userId || undefined,
114
       buildingId: this.fieldConfig.fields.buildingId || undefined,
126
       buildingId: this.fieldConfig.fields.buildingId || undefined,
115
       placeId: this.fieldConfig.fields.floorId || undefined,
127
       placeId: this.fieldConfig.fields.floorId || undefined,
116
-      compantId: this.fieldConfig.fields.compantId || undefined,
128
+      companyId: this.fieldConfig.fields.companyId || undefined,
117
       repairDeptId: this.fieldConfig.fields.repairDeptId || undefined,
129
       repairDeptId: this.fieldConfig.fields.repairDeptId || undefined,
118
       categoryLevel: 3,
130
       categoryLevel: 3,
119
     };
131
     };
@@ -175,11 +187,12 @@ export class CategoryThreeStatisticsComponent implements OnInit, AfterViewInit {
175
       dutyId: this.dutyId || undefined,
187
       dutyId: this.dutyId || undefined,
176
       parentDutyId: this.parentDutyId || undefined,
188
       parentDutyId: this.parentDutyId || undefined,
177
       categoryId: this.category2Id || this.category1Id || undefined,
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
       userId: this.fieldConfig.fields.userId || undefined,
192
       userId: this.fieldConfig.fields.userId || undefined,
180
       buildingId: this.fieldConfig.fields.buildingId || undefined,
193
       buildingId: this.fieldConfig.fields.buildingId || undefined,
181
       placeId: this.fieldConfig.fields.floorId || undefined,
194
       placeId: this.fieldConfig.fields.floorId || undefined,
182
-      compantId: this.fieldConfig.fields.compantId || undefined,
195
+      companyId: this.fieldConfig.fields.companyId || undefined,
183
       repairDeptId: this.fieldConfig.fields.repairDeptId || undefined,
196
       repairDeptId: this.fieldConfig.fields.repairDeptId || undefined,
184
       categoryLevel: 3,
197
       categoryLevel: 3,
185
     };
198
     };
@@ -242,7 +255,7 @@ export class CategoryThreeStatisticsComponent implements OnInit, AfterViewInit {
242
   changeCategory1(id){
255
   changeCategory1(id){
243
     this.category2List = [];
256
     this.category2List = [];
244
     this.category2Id = null;
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
       category: {
265
       category: {
253
         category: keyword,
266
         category: keyword,
254
         selectType: 'mutlQuery',
267
         selectType: 'mutlQuery',
255
-        dutyIds: this.queryType == 3 ? this.dutyId : undefined,
256
-        parentDutyId: this.queryType == 3 ? this.parentDutyId : undefined,
268
+        statisticalHosId: this.getHosId,
257
         hierarchy: 1,
269
         hierarchy: 1,
258
       },
270
       },
259
     };
271
     };
@@ -274,13 +286,13 @@ export class CategoryThreeStatisticsComponent implements OnInit, AfterViewInit {
274
   }
286
   }
275
 
287
 
276
   openChangeCategory2(flag){
288
   openChangeCategory2(flag){
277
-    flag && this.getCategory2List('', this.category1Id);
289
+    flag && this.getCategory2List();
278
   }
290
   }
279
 
291
 
280
   // 获取二级分类列表
292
   // 获取二级分类列表
281
   category2List:any[] = [];
293
   category2List:any[] = [];
282
-  getCategory2List(keyword = '', parentId = '') {
283
-    if(!parentId){
294
+  getCategory2List(keyword = '') {
295
+    if(!this.category1Id){
284
       this.isLoading = false;
296
       this.isLoading = false;
285
       this.category2List = [];
297
       this.category2List = [];
286
       return;
298
       return;
@@ -289,7 +301,7 @@ export class CategoryThreeStatisticsComponent implements OnInit, AfterViewInit {
289
       category: {
301
       category: {
290
         category: keyword,
302
         category: keyword,
291
         selectType: 'mutlQuery',
303
         selectType: 'mutlQuery',
292
-        parent: { id: parentId },
304
+        parent: { id: this.category1Id },
293
       },
305
       },
294
     };
306
     };
295
     this.isLoading = true;
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
     <tr>
36
     <tr>
37
       <th nzWidth="10%">故障现象</th>
37
       <th nzWidth="10%">故障现象</th>
38
       <th nzWidth="9%" nzShowSort nzSortKey="sum" [(nzSort)]="sortCurrent.sum">工单总数</th>
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
       <th nzWidth="9%" nzShowSort nzSortKey="resolvedOverNum" [(nzSort)]="sortCurrent.resolvedOverNum">超时单数</th>
41
       <th nzWidth="9%" nzShowSort nzSortKey="resolvedOverNum" [(nzSort)]="sortCurrent.resolvedOverNum">超时单数</th>
42
       <th nzWidth="9%" nzShowSort nzSortKey="overTimeNum" [(nzSort)]="sortCurrent.overTimeNum">挂起单数</th>
42
       <th nzWidth="9%" nzShowSort nzSortKey="overTimeNum" [(nzSort)]="sortCurrent.overTimeNum">挂起单数</th>
43
       <th nzWidth="9%" nzShowSort nzSortKey="consumablePrice" [(nzSort)]="sortCurrent.consumablePrice">耗材费用(元)</th>
43
       <th nzWidth="9%" nzShowSort nzSortKey="consumablePrice" [(nzSort)]="sortCurrent.consumablePrice">耗材费用(元)</th>
@@ -81,7 +81,8 @@
81
   </ng-template>
81
   </ng-template>
82
 </nz-table>
82
 </nz-table>
83
 <div class="pagination">
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
 </div>
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
 import { debounceTime } from 'rxjs/operators';
2
 import { debounceTime } from 'rxjs/operators';
2
 import { Subject } from 'rxjs';
3
 import { Subject } from 'rxjs';
3
 import { NzMessageService } from 'ng-zorro-antd/message';
4
 import { NzMessageService } from 'ng-zorro-antd/message';
@@ -15,6 +16,7 @@ export class CategoryTwoStatisticsComponent implements OnInit, AfterViewInit {
15
     private mainService: MainService,
16
     private mainService: MainService,
16
     private message: NzMessageService,
17
     private message: NzMessageService,
17
     private route: ActivatedRoute,
18
     private route: ActivatedRoute,
19
+    private tabService: TabService,
18
   ) {}
20
   ) {}
19
 
21
 
20
   listOfData: any[] = []; //表格数据
22
   listOfData: any[] = []; //表格数据
@@ -33,6 +35,7 @@ export class CategoryTwoStatisticsComponent implements OnInit, AfterViewInit {
33
       fun.call(this, v[1]);
35
       fun.call(this, v[1]);
34
     });
36
     });
35
     this.initSessionData();
37
     this.initSessionData();
38
+    this.getQueryParams();
36
     this.search();
39
     this.search();
37
   }
40
   }
38
 
41
 
@@ -44,11 +47,19 @@ export class CategoryTwoStatisticsComponent implements OnInit, AfterViewInit {
44
   @HostListener('window:resize')
47
   @HostListener('window:resize')
45
   onResize(): void {
48
   onResize(): void {
46
     setTimeout(() => {
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
     }, 0)
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
   get getMoreFilter(){
63
   get getMoreFilter(){
53
     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;
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
     return flag ? 21 : 0;
65
     return flag ? 21 : 0;
@@ -108,11 +119,12 @@ export class CategoryTwoStatisticsComponent implements OnInit, AfterViewInit {
108
       dutyId: this.dutyId || undefined,
119
       dutyId: this.dutyId || undefined,
109
       parentDutyId: this.parentDutyId || undefined,
120
       parentDutyId: this.parentDutyId || undefined,
110
       categoryId: this.category1Id || undefined,
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
       userId: this.fieldConfig.fields.userId || undefined,
124
       userId: this.fieldConfig.fields.userId || undefined,
113
       buildingId: this.fieldConfig.fields.buildingId || undefined,
125
       buildingId: this.fieldConfig.fields.buildingId || undefined,
114
       placeId: this.fieldConfig.fields.floorId || undefined,
126
       placeId: this.fieldConfig.fields.floorId || undefined,
115
-      compantId: this.fieldConfig.fields.compantId || undefined,
127
+      companyId: this.fieldConfig.fields.companyId || undefined,
116
       repairDeptId: this.fieldConfig.fields.repairDeptId || undefined,
128
       repairDeptId: this.fieldConfig.fields.repairDeptId || undefined,
117
       categoryLevel: 2,
129
       categoryLevel: 2,
118
     };
130
     };
@@ -174,11 +186,12 @@ export class CategoryTwoStatisticsComponent implements OnInit, AfterViewInit {
174
       dutyId: this.dutyId || undefined,
186
       dutyId: this.dutyId || undefined,
175
       parentDutyId: this.parentDutyId || undefined,
187
       parentDutyId: this.parentDutyId || undefined,
176
       categoryId: this.category1Id || undefined,
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
       userId: this.fieldConfig.fields.userId || undefined,
191
       userId: this.fieldConfig.fields.userId || undefined,
179
       buildingId: this.fieldConfig.fields.buildingId || undefined,
192
       buildingId: this.fieldConfig.fields.buildingId || undefined,
180
       placeId: this.fieldConfig.fields.floorId || undefined,
193
       placeId: this.fieldConfig.fields.floorId || undefined,
181
-      compantId: this.fieldConfig.fields.compantId || undefined,
194
+      companyId: this.fieldConfig.fields.companyId || undefined,
182
       repairDeptId: this.fieldConfig.fields.repairDeptId || undefined,
195
       repairDeptId: this.fieldConfig.fields.repairDeptId || undefined,
183
       categoryLevel: 2,
196
       categoryLevel: 2,
184
     };
197
     };
@@ -242,8 +255,7 @@ export class CategoryTwoStatisticsComponent implements OnInit, AfterViewInit {
242
       category: {
255
       category: {
243
         category: keyword,
256
         category: keyword,
244
         selectType: 'mutlQuery',
257
         selectType: 'mutlQuery',
245
-        dutyIds: this.queryType == 3 ? this.dutyId : undefined,
246
-        parentDutyId: this.queryType == 3 ? this.parentDutyId : undefined,
258
+        statisticalHosId: this.getHosId,
247
         hierarchy: 1,
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
       </nz-range-picker>
6
       </nz-range-picker>
7
     </div>
7
     </div>
8
     <div class="searchDataItem">
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
     </div>
18
     </div>
19
   </div>
19
   </div>
20
   <div class="operation">
20
   <div class="operation">
@@ -24,65 +24,64 @@
24
     <button nz-button class="btn default ml8" (click)="excelExport()" [nzLoading]="excelExportLoading">导出</button>
24
     <button nz-button class="btn default ml8" (click)="excelExport()" [nzLoading]="excelExportLoading">导出</button>
25
   </div>
25
   </div>
26
 </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.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
   <span>{{fieldConfig.fields.groupDTO?.groupName}}</span>
28
   <span>{{fieldConfig.fields.groupDTO?.groupName}}</span>
29
   <span>{{fieldConfig.fields.userDTO?.name}}</span>
29
   <span>{{fieldConfig.fields.userDTO?.name}}</span>
30
   <span>{{fieldConfig.fields.category1DTO?.category}}</span>
30
   <span>{{fieldConfig.fields.category1DTO?.category}}</span>
31
   <span>{{fieldConfig.fields.category2DTO?.category}}</span>
31
   <span>{{fieldConfig.fields.category2DTO?.category}}</span>
32
   <span>{{fieldConfig.fields.category3DTO?.category}}</span>
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
 </div>
35
 </div>
35
 <nz-table class="table" [nzData]="listOfData" nzSize="middle" [nzShowPagination]="false" [nzLoading]="loading1" [nzScroll]="{ y: tableHeight + 'px' }" [nzFooter]="footerTpl">
36
 <nz-table class="table" [nzData]="listOfData" nzSize="middle" [nzShowPagination]="false" [nzLoading]="loading1" [nzScroll]="{ y: tableHeight + 'px' }" [nzFooter]="footerTpl">
36
   <thead (nzSortChange)="sort($event)" nzSingleSort>
37
   <thead (nzSortChange)="sort($event)" nzSingleSort>
37
     <tr>
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
     </tr>
49
     </tr>
50
   </thead>
50
   </thead>
51
   <tbody>
51
   <tbody>
52
     <tr *ngFor="let data of listOfData">
52
     <tr *ngFor="let data of listOfData">
53
-      <td>{{ data.startDate }}</td>
53
+      <td>{{ data.deptName }}({{ data.deptCode }})</td>
54
       <td>{{ data.sum }}</td>
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
     </tr>
63
     </tr>
65
   </tbody>
64
   </tbody>
66
   <ng-template #footerTpl>
65
   <ng-template #footerTpl>
67
     <table class="footTable">
66
     <table class="footTable">
68
       <tr *ngFor="let data of listOfDataEnd">
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
       </tr>
78
       </tr>
81
     </table>
79
     </table>
82
   </ng-template>
80
   </ng-template>
83
 </nz-table>
81
 </nz-table>
84
 <div class="pagination">
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
 </div>
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
 import { NzMessageService } from 'ng-zorro-antd/message';
2
 import { NzMessageService } from 'ng-zorro-antd/message';
4
 import { format, addMonths, startOfMonth, endOfMonth, startOfDay, endOfDay } from 'date-fns';
3
 import { format, addMonths, startOfMonth, endOfMonth, startOfDay, endOfDay } from 'date-fns';
5
 import { Component, OnInit, HostListener, AfterViewInit } from "@angular/core";
4
 import { Component, OnInit, HostListener, AfterViewInit } from "@angular/core";
@@ -15,6 +14,7 @@ export class DepartmentEvaluateStatisticsComponent implements OnInit, AfterViewI
15
     private mainService: MainService,
14
     private mainService: MainService,
16
     private message: NzMessageService,
15
     private message: NzMessageService,
17
     private route: ActivatedRoute,
16
     private route: ActivatedRoute,
17
+    private tabService: TabService,
18
   ) {}
18
   ) {}
19
 
19
 
20
   listOfData: any[] = []; //表格数据
20
   listOfData: any[] = []; //表格数据
@@ -23,16 +23,11 @@ export class DepartmentEvaluateStatisticsComponent implements OnInit, AfterViewI
23
   pageSize: number = 30; //表格每页展示条数
23
   pageSize: number = 30; //表格每页展示条数
24
   listLength: number = 0; //表格总数据量
24
   listLength: number = 0; //表格总数据量
25
 
25
 
26
-  repairDeptId;//报修科室id
27
-
28
-  searchTimerSubject = new Subject();
26
+  deptTypeId;//科室类型id
29
 
27
 
30
   ngOnInit() {
28
   ngOnInit() {
31
-    this.searchTimerSubject.pipe(debounceTime(500)).subscribe((v) => {
32
-      let fun = v[0];
33
-      fun.call(this, v[1]);
34
-    });
35
     this.initSessionData();
29
     this.initSessionData();
30
+    this.getQueryParams();
36
     this.search();
31
     this.search();
37
   }
32
   }
38
 
33
 
@@ -44,13 +39,21 @@ export class DepartmentEvaluateStatisticsComponent implements OnInit, AfterViewI
44
   @HostListener('window:resize')
39
   @HostListener('window:resize')
45
   onResize(): void {
40
   onResize(): void {
46
     setTimeout(() => {
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
     }, 0)
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
   get getMoreFilter(){
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
     return flag ? 21 : 0;
57
     return flag ? 21 : 0;
55
   }
58
   }
56
 
59
 
@@ -102,24 +105,25 @@ export class DepartmentEvaluateStatisticsComponent implements OnInit, AfterViewI
102
     let postData:any = {
105
     let postData:any = {
103
       idx: this.pageIndex - 1,
106
       idx: this.pageIndex - 1,
104
       sum: this.pageSize,
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
     if (field && sort) {
121
     if (field && sort) {
118
       postData.sort = `${field} ${sort === "ascend" ? `asc` : `desc`}`
122
       postData.sort = `${field} ${sort === "ascend" ? `asc` : `desc`}`
119
     }
123
     }
120
     this.loading1 = true;
124
     this.loading1 = true;
121
     this.mainService
125
     this.mainService
122
-      .postCustom("itsm/report", "incidentWorkOrder", postData)
126
+      .postCustom("itsm/report", "deptEvaluate", postData)
123
       .subscribe((result) => {
127
       .subscribe((result) => {
124
         this.loading1 = false;
128
         this.loading1 = false;
125
         this.listOfData = result.dataList.filter((v, i) => { return i != result.dataList.length - 1 });
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
       nzDuration: 0,
170
       nzDuration: 0,
167
     }).messageId;
171
     }).messageId;
168
     let postData:any = {
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
     if (this.sortCurrentKey && this.sortCurrentValue) {
186
     if (this.sortCurrentKey && this.sortCurrentValue) {
182
       postData.sort = `${this.sortCurrentKey} ${this.sortCurrentValue === "ascend" ? `asc` : `desc`}`
187
       postData.sort = `${this.sortCurrentKey} ${this.sortCurrentValue === "ascend" ? `asc` : `desc`}`
183
     }
188
     }
184
     this.mainService
189
     this.mainService
185
-      .postExportCustom("itsm/export", "incidentWorkOrder", postData)
190
+      .postExportCustom("itsm/export", "deptEvaluate", postData)
186
       .subscribe((data) => {
191
       .subscribe((data) => {
187
         this.message.remove(this.excelExportLoading);
192
         this.message.remove(this.excelExportLoading);
188
         this.excelExportLoading = false;
193
         this.excelExportLoading = false;
@@ -210,52 +215,34 @@ export class DepartmentEvaluateStatisticsComponent implements OnInit, AfterViewI
210
 		this.sortCurrentValue = "";
215
 		this.sortCurrentValue = "";
211
 		this.sortCurrent = {};
216
 		this.sortCurrent = {};
212
     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')]
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
     this.search();
220
     this.search();
216
   }
221
   }
217
 
222
 
218
-  // 科室搜索
219
-  changeRepairDeptInp(e) {
220
-    this.searchTimer(this.getRepairDeptList, e);
221
-  }
222
-
223
   // 防抖
223
   // 防抖
224
   isLoading = false;
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
     this.isLoading = true;
233
     this.isLoading = true;
247
     this.mainService
234
     this.mainService
248
-      .getFetchDataList("data", "department", data)
235
+      .getDictionary("list", "dept_type")
249
       .subscribe((data) => {
236
       .subscribe((data) => {
250
         this.isLoading = false;
237
         this.isLoading = false;
251
-        this.repairDeptList = data.list;
238
+        this.deptTypeList = data;
252
       });
239
       });
253
   }
240
   }
254
 
241
 
255
   // 详细搜索
242
   // 详细搜索
256
   fieldConfig:any = {
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
   showSearchMore:boolean = false;
247
   showSearchMore:boolean = false;
261
   showMore(){
248
   showMore(){
@@ -274,5 +261,3 @@ export class DepartmentEvaluateStatisticsComponent implements OnInit, AfterViewI
274
     this.onResize();
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
       </nz-range-picker>
6
       </nz-range-picker>
7
     </div>
7
     </div>
8
     <div class="searchDataItem">
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
     </div>
18
     </div>
19
   </div>
19
   </div>
20
   <div class="operation">
20
   <div class="operation">
@@ -24,21 +24,22 @@
24
     <button nz-button class="btn default ml8" (click)="excelExport()" [nzLoading]="excelExportLoading">导出</button>
24
     <button nz-button class="btn default ml8" (click)="excelExport()" [nzLoading]="excelExportLoading">导出</button>
25
   </div>
25
   </div>
26
 </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.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
   <span>{{fieldConfig.fields.groupDTO?.groupName}}</span>
28
   <span>{{fieldConfig.fields.groupDTO?.groupName}}</span>
29
   <span>{{fieldConfig.fields.userDTO?.name}}</span>
29
   <span>{{fieldConfig.fields.userDTO?.name}}</span>
30
   <span>{{fieldConfig.fields.category1DTO?.category}}</span>
30
   <span>{{fieldConfig.fields.category1DTO?.category}}</span>
31
   <span>{{fieldConfig.fields.category2DTO?.category}}</span>
31
   <span>{{fieldConfig.fields.category2DTO?.category}}</span>
32
   <span>{{fieldConfig.fields.category3DTO?.category}}</span>
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
 </div>
35
 </div>
35
 <nz-table class="table" [nzData]="listOfData" nzSize="middle" [nzShowPagination]="false" [nzLoading]="loading1" [nzScroll]="{ y: tableHeight + 'px' }" [nzFooter]="footerTpl">
36
 <nz-table class="table" [nzData]="listOfData" nzSize="middle" [nzShowPagination]="false" [nzLoading]="loading1" [nzScroll]="{ y: tableHeight + 'px' }" [nzFooter]="footerTpl">
36
   <thead (nzSortChange)="sort($event)" nzSingleSort>
37
   <thead (nzSortChange)="sort($event)" nzSingleSort>
37
     <tr>
38
     <tr>
38
-      <th nzWidth="10%" nzShowSort nzSortKey="startDate" [(nzSort)]="sortCurrent.startDate">时间</th>
39
+      <th nzWidth="10%">科室名称(编码)</th>
39
       <th nzWidth="9%" nzShowSort nzSortKey="sum" [(nzSort)]="sortCurrent.sum">工单总数</th>
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
       <th nzWidth="9%" nzShowSort nzSortKey="resolvedOverNum" [(nzSort)]="sortCurrent.resolvedOverNum">超时单数</th>
43
       <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="overTimeNum" [(nzSort)]="sortCurrent.overTimeNum">挂起单数</th>
44
       <th nzWidth="9%" nzShowSort nzSortKey="consumablePrice" [(nzSort)]="sortCurrent.consumablePrice">耗材费用(元)</th>
45
       <th nzWidth="9%" nzShowSort nzSortKey="consumablePrice" [(nzSort)]="sortCurrent.consumablePrice">耗材费用(元)</th>
@@ -50,7 +51,7 @@
50
   </thead>
51
   </thead>
51
   <tbody>
52
   <tbody>
52
     <tr *ngFor="let data of listOfData">
53
     <tr *ngFor="let data of listOfData">
53
-      <td>{{ data.startDate }}</td>
54
+      <td>{{ data.deptName }}({{ data.deptCode }})</td>
54
       <td>{{ data.sum }}</td>
55
       <td>{{ data.sum }}</td>
55
       <td>{{ data.avgResponseTime }}</td>
56
       <td>{{ data.avgResponseTime }}</td>
56
       <td>{{ data.avgResolvedTime }}</td>
57
       <td>{{ data.avgResolvedTime }}</td>
@@ -66,7 +67,7 @@
66
   <ng-template #footerTpl>
67
   <ng-template #footerTpl>
67
     <table class="footTable">
68
     <table class="footTable">
68
       <tr *ngFor="let data of listOfDataEnd">
69
       <tr *ngFor="let data of listOfDataEnd">
69
-        <td style="width: 10%">{{ data.startDate }}</td>
70
+        <td style="width: 10%">{{ data.deptCode }}</td>
70
         <td style="width: 9%">{{ data.sum }}</td>
71
         <td style="width: 9%">{{ data.sum }}</td>
71
         <td style="width: 9%">{{ data.avgResponseTime }}</td>
72
         <td style="width: 9%">{{ data.avgResponseTime }}</td>
72
         <td style="width: 9%">{{ data.avgResolvedTime }}</td>
73
         <td style="width: 9%">{{ data.avgResolvedTime }}</td>
@@ -82,7 +83,8 @@
82
   </ng-template>
83
   </ng-template>
83
 </nz-table>
84
 </nz-table>
84
 <div class="pagination">
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
 </div>
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
 import { NzMessageService } from 'ng-zorro-antd/message';
2
 import { NzMessageService } from 'ng-zorro-antd/message';
4
 import { format, addMonths, startOfMonth, endOfMonth, startOfDay, endOfDay } from 'date-fns';
3
 import { format, addMonths, startOfMonth, endOfMonth, startOfDay, endOfDay } from 'date-fns';
5
 import { Component, OnInit, HostListener, AfterViewInit } from "@angular/core";
4
 import { Component, OnInit, HostListener, AfterViewInit } from "@angular/core";
@@ -15,6 +14,7 @@ export class DepartmentIncidentStatisticsComponent implements OnInit, AfterViewI
15
     private mainService: MainService,
14
     private mainService: MainService,
16
     private message: NzMessageService,
15
     private message: NzMessageService,
17
     private route: ActivatedRoute,
16
     private route: ActivatedRoute,
17
+    private tabService: TabService,
18
   ) {}
18
   ) {}
19
 
19
 
20
   listOfData: any[] = []; //表格数据
20
   listOfData: any[] = []; //表格数据
@@ -23,16 +23,11 @@ export class DepartmentIncidentStatisticsComponent implements OnInit, AfterViewI
23
   pageSize: number = 30; //表格每页展示条数
23
   pageSize: number = 30; //表格每页展示条数
24
   listLength: number = 0; //表格总数据量
24
   listLength: number = 0; //表格总数据量
25
 
25
 
26
-  repairDeptId;//报修科室id
27
-
28
-  searchTimerSubject = new Subject();
26
+  deptTypeId;//科室类型id
29
 
27
 
30
   ngOnInit() {
28
   ngOnInit() {
31
-    this.searchTimerSubject.pipe(debounceTime(500)).subscribe((v) => {
32
-      let fun = v[0];
33
-      fun.call(this, v[1]);
34
-    });
35
     this.initSessionData();
29
     this.initSessionData();
30
+    this.getQueryParams();
36
     this.search();
31
     this.search();
37
   }
32
   }
38
 
33
 
@@ -44,13 +39,21 @@ export class DepartmentIncidentStatisticsComponent implements OnInit, AfterViewI
44
   @HostListener('window:resize')
39
   @HostListener('window:resize')
45
   onResize(): void {
40
   onResize(): void {
46
     setTimeout(() => {
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
     }, 0)
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
   get getMoreFilter(){
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
     return flag ? 21 : 0;
57
     return flag ? 21 : 0;
55
   }
58
   }
56
 
59
 
@@ -102,24 +105,25 @@ export class DepartmentIncidentStatisticsComponent implements OnInit, AfterViewI
102
     let postData:any = {
105
     let postData:any = {
103
       idx: this.pageIndex - 1,
106
       idx: this.pageIndex - 1,
104
       sum: this.pageSize,
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
     if (field && sort) {
121
     if (field && sort) {
118
       postData.sort = `${field} ${sort === "ascend" ? `asc` : `desc`}`
122
       postData.sort = `${field} ${sort === "ascend" ? `asc` : `desc`}`
119
     }
123
     }
120
     this.loading1 = true;
124
     this.loading1 = true;
121
     this.mainService
125
     this.mainService
122
-      .postCustom("itsm/report", "incidentWorkOrder", postData)
126
+      .postCustom("itsm/report", "repairDept", postData)
123
       .subscribe((result) => {
127
       .subscribe((result) => {
124
         this.loading1 = false;
128
         this.loading1 = false;
125
         this.listOfData = result.dataList.filter((v, i) => { return i != result.dataList.length - 1 });
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
       nzDuration: 0,
170
       nzDuration: 0,
167
     }).messageId;
171
     }).messageId;
168
     let postData:any = {
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
     if (this.sortCurrentKey && this.sortCurrentValue) {
186
     if (this.sortCurrentKey && this.sortCurrentValue) {
182
       postData.sort = `${this.sortCurrentKey} ${this.sortCurrentValue === "ascend" ? `asc` : `desc`}`
187
       postData.sort = `${this.sortCurrentKey} ${this.sortCurrentValue === "ascend" ? `asc` : `desc`}`
183
     }
188
     }
184
     this.mainService
189
     this.mainService
185
-      .postExportCustom("itsm/export", "incidentWorkOrder", postData)
190
+      .postExportCustom("itsm/export", "repairDept", postData)
186
       .subscribe((data) => {
191
       .subscribe((data) => {
187
         this.message.remove(this.excelExportLoading);
192
         this.message.remove(this.excelExportLoading);
188
         this.excelExportLoading = false;
193
         this.excelExportLoading = false;
@@ -210,52 +215,34 @@ export class DepartmentIncidentStatisticsComponent implements OnInit, AfterViewI
210
 		this.sortCurrentValue = "";
215
 		this.sortCurrentValue = "";
211
 		this.sortCurrent = {};
216
 		this.sortCurrent = {};
212
     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')]
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
     this.search();
220
     this.search();
216
   }
221
   }
217
 
222
 
218
-  // 科室搜索
219
-  changeRepairDeptInp(e) {
220
-    this.searchTimer(this.getRepairDeptList, e);
221
-  }
222
-
223
   // 防抖
223
   // 防抖
224
   isLoading = false;
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
     this.isLoading = true;
233
     this.isLoading = true;
247
     this.mainService
234
     this.mainService
248
-      .getFetchDataList("data", "department", data)
235
+      .getDictionary("list", "dept_type")
249
       .subscribe((data) => {
236
       .subscribe((data) => {
250
         this.isLoading = false;
237
         this.isLoading = false;
251
-        this.repairDeptList = data.list;
238
+        this.deptTypeList = data;
252
       });
239
       });
253
   }
240
   }
254
 
241
 
255
   // 详细搜索
242
   // 详细搜索
256
   fieldConfig:any = {
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
   showSearchMore:boolean = false;
247
   showSearchMore:boolean = false;
261
   showMore(){
248
   showMore(){
@@ -274,5 +261,3 @@ export class DepartmentIncidentStatisticsComponent implements OnInit, AfterViewI
274
     this.onResize();
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
       </nz-range-picker>
6
       </nz-range-picker>
7
     </div>
7
     </div>
8
     <div class="searchDataItem">
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
     </div>
18
     </div>
19
   </div>
19
   </div>
20
   <div class="operation">
20
   <div class="operation">
@@ -24,65 +24,52 @@
24
     <button nz-button class="btn default ml8" (click)="excelExport()" [nzLoading]="excelExportLoading">导出</button>
24
     <button nz-button class="btn default ml8" (click)="excelExport()" [nzLoading]="excelExportLoading">导出</button>
25
   </div>
25
   </div>
26
 </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.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
   <span>{{fieldConfig.fields.groupDTO?.groupName}}</span>
28
   <span>{{fieldConfig.fields.groupDTO?.groupName}}</span>
29
   <span>{{fieldConfig.fields.userDTO?.name}}</span>
29
   <span>{{fieldConfig.fields.userDTO?.name}}</span>
30
   <span>{{fieldConfig.fields.category1DTO?.category}}</span>
30
   <span>{{fieldConfig.fields.category1DTO?.category}}</span>
31
   <span>{{fieldConfig.fields.category2DTO?.category}}</span>
31
   <span>{{fieldConfig.fields.category2DTO?.category}}</span>
32
   <span>{{fieldConfig.fields.category3DTO?.category}}</span>
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
 </div>
35
 </div>
35
 <nz-table class="table" [nzData]="listOfData" nzSize="middle" [nzShowPagination]="false" [nzLoading]="loading1" [nzScroll]="{ y: tableHeight + 'px' }" [nzFooter]="footerTpl">
36
 <nz-table class="table" [nzData]="listOfData" nzSize="middle" [nzShowPagination]="false" [nzLoading]="loading1" [nzScroll]="{ y: tableHeight + 'px' }" [nzFooter]="footerTpl">
36
   <thead (nzSortChange)="sort($event)" nzSingleSort>
37
   <thead (nzSortChange)="sort($event)" nzSingleSort>
37
     <tr>
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
     </tr>
45
     </tr>
50
   </thead>
46
   </thead>
51
   <tbody>
47
   <tbody>
52
     <tr *ngFor="let data of listOfData">
48
     <tr *ngFor="let data of listOfData">
53
-      <td>{{ data.startDate }}</td>
49
+      <td>{{ data.deptName }}({{ data.deptCode }})</td>
54
       <td>{{ data.sum }}</td>
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
     </tr>
55
     </tr>
65
   </tbody>
56
   </tbody>
66
   <ng-template #footerTpl>
57
   <ng-template #footerTpl>
67
     <table class="footTable">
58
     <table class="footTable">
68
       <tr *ngFor="let data of listOfDataEnd">
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
       </tr>
66
       </tr>
81
     </table>
67
     </table>
82
   </ng-template>
68
   </ng-template>
83
 </nz-table>
69
 </nz-table>
84
 <div class="pagination">
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
 </div>
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
 import { NzMessageService } from 'ng-zorro-antd/message';
2
 import { NzMessageService } from 'ng-zorro-antd/message';
4
 import { format, addMonths, startOfMonth, endOfMonth, startOfDay, endOfDay } from 'date-fns';
3
 import { format, addMonths, startOfMonth, endOfMonth, startOfDay, endOfDay } from 'date-fns';
5
 import { Component, OnInit, HostListener, AfterViewInit } from "@angular/core";
4
 import { Component, OnInit, HostListener, AfterViewInit } from "@angular/core";
@@ -15,6 +14,7 @@ export class DepartmentSourceStatisticsComponent implements OnInit, AfterViewIni
15
     private mainService: MainService,
14
     private mainService: MainService,
16
     private message: NzMessageService,
15
     private message: NzMessageService,
17
     private route: ActivatedRoute,
16
     private route: ActivatedRoute,
17
+    private tabService: TabService,
18
   ) {}
18
   ) {}
19
 
19
 
20
   listOfData: any[] = []; //表格数据
20
   listOfData: any[] = []; //表格数据
@@ -23,16 +23,11 @@ export class DepartmentSourceStatisticsComponent implements OnInit, AfterViewIni
23
   pageSize: number = 30; //表格每页展示条数
23
   pageSize: number = 30; //表格每页展示条数
24
   listLength: number = 0; //表格总数据量
24
   listLength: number = 0; //表格总数据量
25
 
25
 
26
-  repairDeptId;//报修科室id
27
-
28
-  searchTimerSubject = new Subject();
26
+  deptTypeId;//科室类型id
29
 
27
 
30
   ngOnInit() {
28
   ngOnInit() {
31
-    this.searchTimerSubject.pipe(debounceTime(500)).subscribe((v) => {
32
-      let fun = v[0];
33
-      fun.call(this, v[1]);
34
-    });
35
     this.initSessionData();
29
     this.initSessionData();
30
+    this.getQueryParams();
36
     this.search();
31
     this.search();
37
   }
32
   }
38
 
33
 
@@ -44,13 +39,21 @@ export class DepartmentSourceStatisticsComponent implements OnInit, AfterViewIni
44
   @HostListener('window:resize')
39
   @HostListener('window:resize')
45
   onResize(): void {
40
   onResize(): void {
46
     setTimeout(() => {
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
     }, 0)
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
   get getMoreFilter(){
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
     return flag ? 21 : 0;
57
     return flag ? 21 : 0;
55
   }
58
   }
56
 
59
 
@@ -102,24 +105,25 @@ export class DepartmentSourceStatisticsComponent implements OnInit, AfterViewIni
102
     let postData:any = {
105
     let postData:any = {
103
       idx: this.pageIndex - 1,
106
       idx: this.pageIndex - 1,
104
       sum: this.pageSize,
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
     if (field && sort) {
121
     if (field && sort) {
118
       postData.sort = `${field} ${sort === "ascend" ? `asc` : `desc`}`
122
       postData.sort = `${field} ${sort === "ascend" ? `asc` : `desc`}`
119
     }
123
     }
120
     this.loading1 = true;
124
     this.loading1 = true;
121
     this.mainService
125
     this.mainService
122
-      .postCustom("itsm/report", "incidentWorkOrder", postData)
126
+      .postCustom("itsm/report", "deptSource", postData)
123
       .subscribe((result) => {
127
       .subscribe((result) => {
124
         this.loading1 = false;
128
         this.loading1 = false;
125
         this.listOfData = result.dataList.filter((v, i) => { return i != result.dataList.length - 1 });
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
       nzDuration: 0,
170
       nzDuration: 0,
167
     }).messageId;
171
     }).messageId;
168
     let postData:any = {
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
     if (this.sortCurrentKey && this.sortCurrentValue) {
186
     if (this.sortCurrentKey && this.sortCurrentValue) {
182
       postData.sort = `${this.sortCurrentKey} ${this.sortCurrentValue === "ascend" ? `asc` : `desc`}`
187
       postData.sort = `${this.sortCurrentKey} ${this.sortCurrentValue === "ascend" ? `asc` : `desc`}`
183
     }
188
     }
184
     this.mainService
189
     this.mainService
185
-      .postExportCustom("itsm/export", "incidentWorkOrder", postData)
190
+      .postExportCustom("itsm/export", "deptSource", postData)
186
       .subscribe((data) => {
191
       .subscribe((data) => {
187
         this.message.remove(this.excelExportLoading);
192
         this.message.remove(this.excelExportLoading);
188
         this.excelExportLoading = false;
193
         this.excelExportLoading = false;
@@ -210,52 +215,34 @@ export class DepartmentSourceStatisticsComponent implements OnInit, AfterViewIni
210
 		this.sortCurrentValue = "";
215
 		this.sortCurrentValue = "";
211
 		this.sortCurrent = {};
216
 		this.sortCurrent = {};
212
     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')]
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
     this.search();
220
     this.search();
216
   }
221
   }
217
 
222
 
218
-  // 科室搜索
219
-  changeRepairDeptInp(e) {
220
-    this.searchTimer(this.getRepairDeptList, e);
221
-  }
222
-
223
   // 防抖
223
   // 防抖
224
   isLoading = false;
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
     this.isLoading = true;
233
     this.isLoading = true;
247
     this.mainService
234
     this.mainService
248
-      .getFetchDataList("data", "department", data)
235
+      .getDictionary("list", "dept_type")
249
       .subscribe((data) => {
236
       .subscribe((data) => {
250
         this.isLoading = false;
237
         this.isLoading = false;
251
-        this.repairDeptList = data.list;
238
+        this.deptTypeList = data;
252
       });
239
       });
253
   }
240
   }
254
 
241
 
255
   // 详细搜索
242
   // 详细搜索
256
   fieldConfig:any = {
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
   showSearchMore:boolean = false;
247
   showSearchMore:boolean = false;
261
   showMore(){
248
   showMore(){
@@ -274,5 +261,3 @@ export class DepartmentSourceStatisticsComponent implements OnInit, AfterViewIni
274
     this.onResize();
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
       </nz-range-picker>
6
       </nz-range-picker>
7
     </div>
7
     </div>
8
     <div class="searchDataItem">
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
     </div>
18
     </div>
19
   </div>
19
   </div>
20
   <div class="operation">
20
   <div class="operation">
@@ -24,21 +24,18 @@
24
     <button nz-button class="btn default ml8" (click)="excelExport()" [nzLoading]="excelExportLoading">导出</button>
24
     <button nz-button class="btn default ml8" (click)="excelExport()" [nzLoading]="excelExportLoading">导出</button>
25
   </div>
25
   </div>
26
 </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.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
   <span>{{fieldConfig.fields.category1DTO?.category}}</span>
28
   <span>{{fieldConfig.fields.category1DTO?.category}}</span>
31
   <span>{{fieldConfig.fields.category2DTO?.category}}</span>
29
   <span>{{fieldConfig.fields.category2DTO?.category}}</span>
32
   <span>{{fieldConfig.fields.category3DTO?.category}}</span>
30
   <span>{{fieldConfig.fields.category3DTO?.category}}</span>
33
-  <span>{{fieldConfig.fields.sourceDTO?.name}}</span>
34
 </div>
31
 </div>
35
 <nz-table class="table" [nzData]="listOfData" nzSize="middle" [nzShowPagination]="false" [nzLoading]="loading1" [nzScroll]="{ y: tableHeight + 'px' }" [nzFooter]="footerTpl">
32
 <nz-table class="table" [nzData]="listOfData" nzSize="middle" [nzShowPagination]="false" [nzLoading]="loading1" [nzScroll]="{ y: tableHeight + 'px' }" [nzFooter]="footerTpl">
36
   <thead (nzSortChange)="sort($event)" nzSingleSort>
33
   <thead (nzSortChange)="sort($event)" nzSingleSort>
37
     <tr>
34
     <tr>
38
-      <th nzWidth="10%" nzShowSort nzSortKey="startDate" [(nzSort)]="sortCurrent.startDate">时间</th>
35
+      <th nzWidth="10%">楼栋楼层名称</th>
39
       <th nzWidth="9%" nzShowSort nzSortKey="sum" [(nzSort)]="sortCurrent.sum">工单总数</th>
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
       <th nzWidth="9%" nzShowSort nzSortKey="resolvedOverNum" [(nzSort)]="sortCurrent.resolvedOverNum">超时单数</th>
39
       <th nzWidth="9%" nzShowSort nzSortKey="resolvedOverNum" [(nzSort)]="sortCurrent.resolvedOverNum">超时单数</th>
43
       <th nzWidth="9%" nzShowSort nzSortKey="overTimeNum" [(nzSort)]="sortCurrent.overTimeNum">挂起单数</th>
40
       <th nzWidth="9%" nzShowSort nzSortKey="overTimeNum" [(nzSort)]="sortCurrent.overTimeNum">挂起单数</th>
44
       <th nzWidth="9%" nzShowSort nzSortKey="consumablePrice" [(nzSort)]="sortCurrent.consumablePrice">耗材费用(元)</th>
41
       <th nzWidth="9%" nzShowSort nzSortKey="consumablePrice" [(nzSort)]="sortCurrent.consumablePrice">耗材费用(元)</th>
@@ -50,7 +47,7 @@
50
   </thead>
47
   </thead>
51
   <tbody>
48
   <tbody>
52
     <tr *ngFor="let data of listOfData">
49
     <tr *ngFor="let data of listOfData">
53
-      <td>{{ data.startDate }}</td>
50
+      <td>{{ data.name }}</td>
54
       <td>{{ data.sum }}</td>
51
       <td>{{ data.sum }}</td>
55
       <td>{{ data.avgResponseTime }}</td>
52
       <td>{{ data.avgResponseTime }}</td>
56
       <td>{{ data.avgResolvedTime }}</td>
53
       <td>{{ data.avgResolvedTime }}</td>
@@ -66,7 +63,7 @@
66
   <ng-template #footerTpl>
63
   <ng-template #footerTpl>
67
     <table class="footTable">
64
     <table class="footTable">
68
       <tr *ngFor="let data of listOfDataEnd">
65
       <tr *ngFor="let data of listOfDataEnd">
69
-        <td style="width: 10%">{{ data.startDate }}</td>
66
+        <td style="width: 10%">{{ data.name }}</td>
70
         <td style="width: 9%">{{ data.sum }}</td>
67
         <td style="width: 9%">{{ data.sum }}</td>
71
         <td style="width: 9%">{{ data.avgResponseTime }}</td>
68
         <td style="width: 9%">{{ data.avgResponseTime }}</td>
72
         <td style="width: 9%">{{ data.avgResolvedTime }}</td>
69
         <td style="width: 9%">{{ data.avgResolvedTime }}</td>
@@ -82,7 +79,8 @@
82
   </ng-template>
79
   </ng-template>
83
 </nz-table>
80
 </nz-table>
84
 <div class="pagination">
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
 </div>
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
 import { debounceTime } from 'rxjs/operators';
2
 import { debounceTime } from 'rxjs/operators';
2
 import { Subject } from 'rxjs';
3
 import { Subject } from 'rxjs';
3
 import { NzMessageService } from 'ng-zorro-antd/message';
4
 import { NzMessageService } from 'ng-zorro-antd/message';
@@ -15,6 +16,7 @@ export class FloorStatisticsComponent implements OnInit, AfterViewInit {
15
     private mainService: MainService,
16
     private mainService: MainService,
16
     private message: NzMessageService,
17
     private message: NzMessageService,
17
     private route: ActivatedRoute,
18
     private route: ActivatedRoute,
19
+    private tabService: TabService,
18
   ) {}
20
   ) {}
19
 
21
 
20
   listOfData: any[] = []; //表格数据
22
   listOfData: any[] = []; //表格数据
@@ -23,7 +25,7 @@ export class FloorStatisticsComponent implements OnInit, AfterViewInit {
23
   pageSize: number = 30; //表格每页展示条数
25
   pageSize: number = 30; //表格每页展示条数
24
   listLength: number = 0; //表格总数据量
26
   listLength: number = 0; //表格总数据量
25
 
27
 
26
-  repairDeptId;//报修科室id
28
+  buildingId;//楼栋id
27
 
29
 
28
   searchTimerSubject = new Subject();
30
   searchTimerSubject = new Subject();
29
 
31
 
@@ -33,6 +35,7 @@ export class FloorStatisticsComponent implements OnInit, AfterViewInit {
33
       fun.call(this, v[1]);
35
       fun.call(this, v[1]);
34
     });
36
     });
35
     this.initSessionData();
37
     this.initSessionData();
38
+    this.getQueryParams();
36
     this.search();
39
     this.search();
37
   }
40
   }
38
 
41
 
@@ -44,13 +47,21 @@ export class FloorStatisticsComponent implements OnInit, AfterViewInit {
44
   @HostListener('window:resize')
47
   @HostListener('window:resize')
45
   onResize(): void {
48
   onResize(): void {
46
     setTimeout(() => {
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
     }, 0)
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
   get getMoreFilter(){
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
     return flag ? 21 : 0;
65
     return flag ? 21 : 0;
55
   }
66
   }
56
 
67
 
@@ -102,24 +113,21 @@ export class FloorStatisticsComponent implements OnInit, AfterViewInit {
102
     let postData:any = {
113
     let postData:any = {
103
       idx: this.pageIndex - 1,
114
       idx: this.pageIndex - 1,
104
       sum: this.pageSize,
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
     if (field && sort) {
125
     if (field && sort) {
118
       postData.sort = `${field} ${sort === "ascend" ? `asc` : `desc`}`
126
       postData.sort = `${field} ${sort === "ascend" ? `asc` : `desc`}`
119
     }
127
     }
120
     this.loading1 = true;
128
     this.loading1 = true;
121
     this.mainService
129
     this.mainService
122
-      .postCustom("itsm/report", "incidentWorkOrder", postData)
130
+      .postCustom("itsm/report", "floorIncident", postData)
123
       .subscribe((result) => {
131
       .subscribe((result) => {
124
         this.loading1 = false;
132
         this.loading1 = false;
125
         this.listOfData = result.dataList.filter((v, i) => { return i != result.dataList.length - 1 });
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
       nzDuration: 0,
174
       nzDuration: 0,
167
     }).messageId;
175
     }).messageId;
168
     let postData:any = {
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
     if (this.sortCurrentKey && this.sortCurrentValue) {
186
     if (this.sortCurrentKey && this.sortCurrentValue) {
182
       postData.sort = `${this.sortCurrentKey} ${this.sortCurrentValue === "ascend" ? `asc` : `desc`}`
187
       postData.sort = `${this.sortCurrentKey} ${this.sortCurrentValue === "ascend" ? `asc` : `desc`}`
183
     }
188
     }
184
     this.mainService
189
     this.mainService
185
-      .postExportCustom("itsm/export", "incidentWorkOrder", postData)
190
+      .postExportCustom("itsm/export", "floorIncident", postData)
186
       .subscribe((data) => {
191
       .subscribe((data) => {
187
         this.message.remove(this.excelExportLoading);
192
         this.message.remove(this.excelExportLoading);
188
         this.excelExportLoading = false;
193
         this.excelExportLoading = false;
@@ -210,14 +215,14 @@ export class FloorStatisticsComponent implements OnInit, AfterViewInit {
210
 		this.sortCurrentValue = "";
215
 		this.sortCurrentValue = "";
211
 		this.sortCurrent = {};
216
 		this.sortCurrent = {};
212
     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')]
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
     this.search();
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
     this.searchTimerSubject.next([fun, e]);
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
     let data = {
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
       idx: 0,
248
       idx: 0,
244
       sum: 20,
249
       sum: 20,
245
     };
250
     };
246
     this.isLoading = true;
251
     this.isLoading = true;
247
     this.mainService
252
     this.mainService
248
-      .getFetchDataList("data", "department", data)
253
+      .getFetchDataList("data", "building", data)
249
       .subscribe((data) => {
254
       .subscribe((data) => {
250
         this.isLoading = false;
255
         this.isLoading = false;
251
-        this.repairDeptList = data.list;
256
+        this.buildingList = data.list;
252
       });
257
       });
253
   }
258
   }
254
 
259
 
255
   // 详细搜索
260
   // 详细搜索
256
   fieldConfig:any = {
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
   showSearchMore:boolean = false;
265
   showSearchMore:boolean = false;
261
   showMore(){
266
   showMore(){
@@ -274,5 +279,3 @@ export class FloorStatisticsComponent implements OnInit, AfterViewInit {
274
     this.onResize();
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
     <tr>
25
     <tr>
26
       <th nzWidth="10%">分组名称</th>
26
       <th nzWidth="10%">分组名称</th>
27
       <th nzWidth="9%" nzShowSort nzSortKey="sum" [(nzSort)]="sortCurrent.sum">工单总数</th>
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
       <th nzWidth="9%" nzShowSort nzSortKey="resolvedOverNum" [(nzSort)]="sortCurrent.resolvedOverNum">超时单数</th>
30
       <th nzWidth="9%" nzShowSort nzSortKey="resolvedOverNum" [(nzSort)]="sortCurrent.resolvedOverNum">超时单数</th>
31
       <th nzWidth="9%" nzShowSort nzSortKey="overTimeNum" [(nzSort)]="sortCurrent.overTimeNum">挂起单数</th>
31
       <th nzWidth="9%" nzShowSort nzSortKey="overTimeNum" [(nzSort)]="sortCurrent.overTimeNum">挂起单数</th>
32
       <th nzWidth="9%" nzShowSort nzSortKey="consumablePrice" [(nzSort)]="sortCurrent.consumablePrice">耗材费用(元)</th>
32
       <th nzWidth="9%" nzShowSort nzSortKey="consumablePrice" [(nzSort)]="sortCurrent.consumablePrice">耗材费用(元)</th>
@@ -70,7 +70,8 @@
70
   </ng-template>
70
   </ng-template>
71
 </nz-table>
71
 </nz-table>
72
 <div class="pagination">
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
 </div>
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
 import { NzMessageService } from 'ng-zorro-antd/message';
2
 import { NzMessageService } from 'ng-zorro-antd/message';
2
 import { format, addMonths, startOfMonth, endOfMonth, startOfDay, endOfDay } from 'date-fns';
3
 import { format, addMonths, startOfMonth, endOfMonth, startOfDay, endOfDay } from 'date-fns';
3
 import { Component, OnInit, HostListener, AfterViewInit } from "@angular/core";
4
 import { Component, OnInit, HostListener, AfterViewInit } from "@angular/core";
@@ -13,6 +14,7 @@ export class GroupStatisticsComponent implements OnInit, AfterViewInit {
13
     private mainService: MainService,
14
     private mainService: MainService,
14
     private message: NzMessageService,
15
     private message: NzMessageService,
15
     private route: ActivatedRoute,
16
     private route: ActivatedRoute,
17
+    private tabService: TabService,
16
   ) {}
18
   ) {}
17
 
19
 
18
   listOfData: any[] = []; //表格数据
20
   listOfData: any[] = []; //表格数据
@@ -23,6 +25,7 @@ export class GroupStatisticsComponent implements OnInit, AfterViewInit {
23
 
25
 
24
   ngOnInit() {
26
   ngOnInit() {
25
     this.initSessionData();
27
     this.initSessionData();
28
+    this.getQueryParams();
26
     this.search();
29
     this.search();
27
   }
30
   }
28
 
31
 
@@ -34,13 +37,21 @@ export class GroupStatisticsComponent implements OnInit, AfterViewInit {
34
   @HostListener('window:resize')
37
   @HostListener('window:resize')
35
   onResize(): void {
38
   onResize(): void {
36
     setTimeout(() => {
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
     }, 0)
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
   get getMoreFilter(){
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
     return flag ? 21 : 0;
55
     return flag ? 21 : 0;
45
   }
56
   }
46
 
57
 
@@ -98,6 +109,7 @@ export class GroupStatisticsComponent implements OnInit, AfterViewInit {
98
       dutyId: this.dutyId || undefined,
109
       dutyId: this.dutyId || undefined,
99
       parentDutyId: this.parentDutyId || undefined,
110
       parentDutyId: this.parentDutyId || undefined,
100
       categoryId: this.fieldConfig.fields.categoryId || undefined,
111
       categoryId: this.fieldConfig.fields.categoryId || undefined,
112
+      hierarchy: this.fieldConfig.fields.hierarchy || undefined,
101
       buildingId: this.fieldConfig.fields.buildingId || undefined,
113
       buildingId: this.fieldConfig.fields.buildingId || undefined,
102
       placeId: this.fieldConfig.fields.floorId || undefined,
114
       placeId: this.fieldConfig.fields.floorId || undefined,
103
     };
115
     };
@@ -159,6 +171,7 @@ export class GroupStatisticsComponent implements OnInit, AfterViewInit {
159
       dutyId: this.dutyId || undefined,
171
       dutyId: this.dutyId || undefined,
160
       parentDutyId: this.parentDutyId || undefined,
172
       parentDutyId: this.parentDutyId || undefined,
161
       categoryId: this.fieldConfig.fields.categoryId || undefined,
173
       categoryId: this.fieldConfig.fields.categoryId || undefined,
174
+      hierarchy: this.fieldConfig.fields.hierarchy || undefined,
162
       buildingId: this.fieldConfig.fields.buildingId || undefined,
175
       buildingId: this.fieldConfig.fields.buildingId || undefined,
163
       placeId: this.fieldConfig.fields.floorId || undefined,
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
       <span class="label">报修科室</span>:
9
       <span class="label">报修科室</span>:
10
       <nz-select class="selectItem" [nzDropdownMatchSelectWidth]="false" nzServerSearch nzShowSearch (nzOnSearch)="changeRepairDeptInp($event)" nzAllowClear nzPlaceHolder="请选择报修科室" [(ngModel)]="repairDeptId" (nzOpenChange)="openChangeRepairDept($event)">
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">
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
         </ng-container>
13
         </ng-container>
14
         <nz-option *ngIf="isLoading" nzDisabled nzCustomContent>
14
         <nz-option *ngIf="isLoading" nzDisabled nzCustomContent>
15
           <i nz-icon nzType="loading" class="loading-icon"></i> 搜索中...
15
           <i nz-icon nzType="loading" class="loading-icon"></i> 搜索中...
@@ -37,8 +37,8 @@
37
     <tr>
37
     <tr>
38
       <th nzWidth="10%" nzShowSort nzSortKey="startDate" [(nzSort)]="sortCurrent.startDate">时间</th>
38
       <th nzWidth="10%" nzShowSort nzSortKey="startDate" [(nzSort)]="sortCurrent.startDate">时间</th>
39
       <th nzWidth="9%" nzShowSort nzSortKey="sum" [(nzSort)]="sortCurrent.sum">工单总数</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>
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>
42
       <th nzWidth="9%" nzShowSort nzSortKey="resolvedOverNum" [(nzSort)]="sortCurrent.resolvedOverNum">超时单数</th>
43
       <th nzWidth="9%" nzShowSort nzSortKey="overTimeNum" [(nzSort)]="sortCurrent.overTimeNum">挂起单数</th>
43
       <th nzWidth="9%" nzShowSort nzSortKey="overTimeNum" [(nzSort)]="sortCurrent.overTimeNum">挂起单数</th>
44
       <th nzWidth="9%" nzShowSort nzSortKey="consumablePrice" [(nzSort)]="sortCurrent.consumablePrice">耗材费用(元)</th>
44
       <th nzWidth="9%" nzShowSort nzSortKey="consumablePrice" [(nzSort)]="sortCurrent.consumablePrice">耗材费用(元)</th>
@@ -82,7 +82,8 @@
82
   </ng-template>
82
   </ng-template>
83
 </nz-table>
83
 </nz-table>
84
 <div class="pagination">
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
 </div>
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
 import { debounceTime } from 'rxjs/operators';
2
 import { debounceTime } from 'rxjs/operators';
2
 import { Subject } from 'rxjs';
3
 import { Subject } from 'rxjs';
3
 import { NzMessageService } from 'ng-zorro-antd/message';
4
 import { NzMessageService } from 'ng-zorro-antd/message';
@@ -15,6 +16,7 @@ export class IncidentStatisticsComponent implements OnInit, AfterViewInit {
15
     private mainService: MainService,
16
     private mainService: MainService,
16
     private message: NzMessageService,
17
     private message: NzMessageService,
17
     private route: ActivatedRoute,
18
     private route: ActivatedRoute,
19
+    private tabService: TabService,
18
   ) {}
20
   ) {}
19
 
21
 
20
   listOfData: any[] = []; //表格数据
22
   listOfData: any[] = []; //表格数据
@@ -33,6 +35,7 @@ export class IncidentStatisticsComponent implements OnInit, AfterViewInit {
33
       fun.call(this, v[1]);
35
       fun.call(this, v[1]);
34
     });
36
     });
35
     this.initSessionData();
37
     this.initSessionData();
38
+    this.getQueryParams();
36
     this.search();
39
     this.search();
37
   }
40
   }
38
 
41
 
@@ -44,11 +47,19 @@ export class IncidentStatisticsComponent implements OnInit, AfterViewInit {
44
   @HostListener('window:resize')
47
   @HostListener('window:resize')
45
   onResize(): void {
48
   onResize(): void {
46
     setTimeout(() => {
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
     }, 0)
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
   get getMoreFilter(){
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.groupDTO || this.fieldConfig.fields.userDTO || this.fieldConfig.fields.category1DTO || this.fieldConfig.fields.category2DTO || this.fieldConfig.fields.category3DTO || this.fieldConfig.fields.sourceDTO;
54
     return flag ? 21 : 0;
65
     return flag ? 21 : 0;
@@ -108,7 +119,7 @@ export class IncidentStatisticsComponent implements OnInit, AfterViewInit {
108
       dutyId: this.dutyId || undefined,
119
       dutyId: this.dutyId || undefined,
109
       parentDutyId: this.parentDutyId || undefined,
120
       parentDutyId: this.parentDutyId || undefined,
110
       repairDeptId: this.repairDeptId || undefined,
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
       userId: this.fieldConfig.fields.userId || undefined,
123
       userId: this.fieldConfig.fields.userId || undefined,
113
       categoryId: this.fieldConfig.fields.categoryId || undefined,
124
       categoryId: this.fieldConfig.fields.categoryId || undefined,
114
       sourceId: this.fieldConfig.fields.sourceId || undefined,
125
       sourceId: this.fieldConfig.fields.sourceId || undefined,
@@ -172,7 +183,7 @@ export class IncidentStatisticsComponent implements OnInit, AfterViewInit {
172
       dutyId: this.dutyId || undefined,
183
       dutyId: this.dutyId || undefined,
173
       parentDutyId: this.parentDutyId || undefined,
184
       parentDutyId: this.parentDutyId || undefined,
174
       repairDeptId: this.repairDeptId || undefined,
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
       userId: this.fieldConfig.fields.userId || undefined,
187
       userId: this.fieldConfig.fields.userId || undefined,
177
       categoryId: this.fieldConfig.fields.categoryId || undefined,
188
       categoryId: this.fieldConfig.fields.categoryId || undefined,
178
       sourceId: this.fieldConfig.fields.sourceId || undefined,
189
       sourceId: this.fieldConfig.fields.sourceId || undefined,
@@ -236,7 +247,7 @@ export class IncidentStatisticsComponent implements OnInit, AfterViewInit {
236
   getRepairDeptList(keyword?) {
247
   getRepairDeptList(keyword?) {
237
     let data = {
248
     let data = {
238
       department: {
249
       department: {
239
-        cascadeHosId: this.getHosId,
250
+        statisticalHosId: this.getHosId,
240
         dept: keyword,
251
         dept: keyword,
241
         searchType: 1,
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
         path: 'groupStatistics',
58
         path: 'groupStatistics',
59
         loadChildren: () => import('./group-statistics/group-statistics.module').then(m => m.GroupStatisticsModule),
59
         loadChildren: () => import('./group-statistics/group-statistics.module').then(m => m.GroupStatisticsModule),
60
         data: {
60
         data: {
61
           reuse: true,
61
           reuse: true,
62
-          title: '处理组统计'
62
+          title: '维修组统计'
63
         }
63
         }
64
       },
64
       },
65
       {
65
       {
66
-        // 处理人统计
66
+        // 维修人统计
67
         path: 'userStatistics',
67
         path: 'userStatistics',
68
         loadChildren: () => import('./user-statistics/user-statistics.module').then(m => m.UserStatisticsModule),
68
         loadChildren: () => import('./user-statistics/user-statistics.module').then(m => m.UserStatisticsModule),
69
         data: {
69
         data: {
70
           reuse: true,
70
           reuse: true,
71
-          title: '处理人统计'
71
+          title: '维修人统计'
72
         }
72
         }
73
       },
73
       },
74
       {
74
       {
@@ -134,6 +134,24 @@ const routes: Routes = [
134
           title: '故障来源统计'
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
       .icon_transport{
51
       .icon_transport{
52
         color: #666666;
52
         color: #666666;
53
         font-size: 24px;
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
 import { ActivatedRoute, Router } from '@angular/router';
1
 import { ActivatedRoute, Router } from '@angular/router';
2
 import { Component, OnInit, OnDestroy } from "@angular/core";
2
 import { Component, OnInit, OnDestroy } from "@angular/core";
3
 import { ToolService } from 'src/app/services/tool.service';
3
 import { ToolService } from 'src/app/services/tool.service';
4
-import { SimpleReuseStrategy } from '../../../SimpleReuseStrategy';
5
 import { TabService } from '../services/tab.service';
4
 import { TabService } from '../services/tab.service';
6
 @Component({
5
 @Component({
7
   selector: "app-maintenance-statistics",
6
   selector: "app-maintenance-statistics",
@@ -26,9 +25,8 @@ export class MaintenanceStatisticsComponent implements OnInit, OnDestroy {
26
   }
25
   }
27
 
26
 
28
   ngOnDestroy(){
27
   ngOnDestroy(){
29
-    this.sessionRemove();
30
-    this.tabService.tabs = [];
31
-    SimpleReuseStrategy.deleteAllRouteCache();
28
+    // this.sessionRemove();
29
+    this.tabService.deleteAllRouteSnapshot();
32
   }
30
   }
33
 
31
 
34
   getMenuList(){
32
   getMenuList(){
@@ -41,20 +39,23 @@ export class MaintenanceStatisticsComponent implements OnInit, OnDestroy {
41
   clickMenu(data){
39
   clickMenu(data){
42
     this.activeMenuId = data.id;
40
     this.activeMenuId = data.id;
43
     this.secondMenuList = this.menuList.find(v => v.id == this.activeMenuId).childrens || [];
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
   activeSecondMenuLink:string;
56
   activeSecondMenuLink:string;
51
   clickSecondMenu(data){
57
   clickSecondMenu(data){
52
     this.activeSecondMenuLink = data.link;
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
     this.router.navigate([`/newStatistics/${this.route.parent.snapshot.routeConfig.path}/${this.activeSecondMenuLink}`], { replaceUrl: true });
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
   queryType;//查询范围
70
   queryType;//查询范围
70
   // 初始化院区、部门显示
71
   // 初始化院区、部门显示
71
   initHospitalAndDuty(hospitalOrDuty){
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
     let type = 'hospital';//默认是院区
81
     let type = 'hospital';//默认是院区
73
     if(hospitalOrDuty.type){
82
     if(hospitalOrDuty.type){
74
       // 当前是责任部门
83
       // 当前是责任部门
@@ -107,7 +116,7 @@ export class MaintenanceStatisticsComponent implements OnInit, OnDestroy {
107
 
116
 
108
   // 缓存数据
117
   // 缓存数据
109
   sessionSave(){
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
     this.queryRangeFlag = false;
139
     this.queryRangeFlag = false;
131
 
140
 
132
     this.sessionSave();
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
   cancelQueryRange() {
151
   cancelQueryRange() {
136
     this.queryRangeFlag = false;
152
     this.queryRangeFlag = false;

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

@@ -58,7 +58,7 @@
58
 					<div class="statistics-select-list" [ngClass]="{'activeClass': activeIndex == 0}" (click)="selectCheck(0)">维修人员</div>
58
 					<div class="statistics-select-list" [ngClass]="{'activeClass': activeIndex == 0}" (click)="selectCheck(0)">维修人员</div>
59
 					<div class="statistics-select-list" [ngClass]="{'activeClass': activeIndex == 1}" (click)="selectCheck(1)">维修组</div>
59
 					<div class="statistics-select-list" [ngClass]="{'activeClass': activeIndex == 1}" (click)="selectCheck(1)">维修组</div>
60
 				</div>
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
 			</div>
62
 			</div>
63
 			<div class="table">
63
 			<div class="table">
64
 				<div class="td">
64
 				<div class="td">
@@ -67,7 +67,7 @@
67
 					<div class="table-td" *ngIf="activeIndex==1">维修组</div>
67
 					<div class="table-td" *ngIf="activeIndex==1">维修组</div>
68
 					<div class="table-td">工单量</div>
68
 					<div class="table-td">工单量</div>
69
 					<div class="table-td">平均接单时长</div>
69
 					<div class="table-td">平均接单时长</div>
70
-					<div class="table-td">平均处理时长</div>
70
+					<div class="table-td">平均解决时长</div>
71
 					<div class="table-td">超时单</div>
71
 					<div class="table-td">超时单</div>
72
 				</div>
72
 				</div>
73
 				<div class="th" *ngFor="let item of maintainData; let index = index;">
73
 				<div class="th" *ngFor="let item of maintainData; let index = index;">
@@ -88,8 +88,8 @@
88
 		<div class="statistics width-40">
88
 		<div class="statistics width-40">
89
 			<div class="statistics-box">
89
 			<div class="statistics-box">
90
 				<div class="sign-green"></div>
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
 			</div>
93
 			</div>
94
 			<div class="echarts-repairs">
94
 			<div class="echarts-repairs">
95
 			  <div echarts class="echarts" [options]='repairsOptions'></div>
95
 			  <div echarts class="echarts" [options]='repairsOptions'></div>
@@ -101,7 +101,7 @@
101
 			<div class="statistics-box">
101
 			<div class="statistics-box">
102
 				<div class="sign-green"></div>
102
 				<div class="sign-green"></div>
103
 				<div class="statistics-title">一级故障现象Top5</div>
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
 			</div>
105
 			</div>
106
 			<div class="echarts-repairs">
106
 			<div class="echarts-repairs">
107
 				<div echarts class="echarts" [options]='malfunctionOptions'></div>
107
 				<div echarts class="echarts" [options]='malfunctionOptions'></div>
@@ -111,7 +111,7 @@
111
 			<div class="statistics-box">
111
 			<div class="statistics-box">
112
 				<div class="sign-green"></div>
112
 				<div class="sign-green"></div>
113
 				<div class="statistics-title">楼栋报修Top5</div>
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
 			</div>
115
 			</div>
116
 			<div class="echarts-repairs">
116
 			<div class="echarts-repairs">
117
 				<div echarts class="echarts" [options]='buildingOptions'></div>
117
 				<div echarts class="echarts" [options]='buildingOptions'></div>
@@ -123,7 +123,7 @@
123
 			<div class="statistics-box">
123
 			<div class="statistics-box">
124
 				<div class="sign-green"></div>
124
 				<div class="sign-green"></div>
125
 				<div class="statistics-title">科室费用Top5</div>
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
 			</div>
127
 			</div>
128
 			<div class="table">
128
 			<div class="table">
129
 				<div class="td">
129
 				<div class="td">
@@ -144,7 +144,7 @@
144
 			<div class="statistics-box">
144
 			<div class="statistics-box">
145
 				<div class="sign-green"></div>
145
 				<div class="sign-green"></div>
146
 				<div class="statistics-title">耗材Top5</div>
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
 			</div>
148
 			</div>
149
 			<div class="table">
149
 			<div class="table">
150
 				<div class="td">
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
 import { format, addMonths, startOfMonth, endOfMonth } from 'date-fns';
2
 import { format, addMonths, startOfMonth, endOfMonth } from 'date-fns';
2
 import { Component, OnInit } from "@angular/core";
3
 import { Component, OnInit } from "@angular/core";
3
 import { MainService } from 'src/app/services/main.service';
4
 import { MainService } from 'src/app/services/main.service';
5
+import { TabService } from '../../services/tab.service';
4
 @Component({
6
 @Component({
5
   selector: "app-synthesize-statistics",
7
   selector: "app-synthesize-statistics",
6
   templateUrl: "./synthesize-statistics.component.html",
8
   templateUrl: "./synthesize-statistics.component.html",
@@ -9,8 +11,10 @@ import { MainService } from 'src/app/services/main.service';
9
 export class SynthesizeStatisticsComponent implements OnInit {
11
 export class SynthesizeStatisticsComponent implements OnInit {
10
   constructor(
12
   constructor(
11
     private mainService: MainService,
13
     private mainService: MainService,
14
+    private tabService: TabService,
15
+    public router: Router,
12
   ) {}
16
   ) {}
13
-	
17
+
14
 	isLoading:Boolean = false;
18
 	isLoading:Boolean = false;
15
 	workData:any = []; //工单统计
19
 	workData:any = []; //工单统计
16
   listOfData: any[] = []; //表格数据
20
   listOfData: any[] = []; //表格数据
@@ -59,13 +63,13 @@ export class SynthesizeStatisticsComponent implements OnInit {
59
   ngOnInit() {
63
   ngOnInit() {
60
     this.search();
64
     this.search();
61
   }
65
   }
62
-	
66
+
63
 	// 维修处理类型切换
67
 	// 维修处理类型切换
64
 	selectCheck(type){
68
 	selectCheck(type){
65
 		this.activeIndex = type
69
 		this.activeIndex = type
66
 		this.getMaintainData();
70
 		this.getMaintainData();
67
 	}
71
 	}
68
-	
72
+
69
 	// 报修来源
73
 	// 报修来源
70
 	repairsChart() {
74
 	repairsChart() {
71
 		let postData:any = {
75
 		let postData:any = {
@@ -109,7 +113,7 @@ export class SynthesizeStatisticsComponent implements OnInit {
109
 							},
113
 							},
110
 							label: {
114
 							label: {
111
 									show: true,
115
 									show: true,
112
-									formatter: '{b}: {c} {d}%'  
116
+									formatter: '{b}: {c} {d}%'
113
 							},
117
 							},
114
 				      // itemStyle: {
118
 				      // itemStyle: {
115
 				      //   normal: {
119
 				      //   normal: {
@@ -130,7 +134,7 @@ export class SynthesizeStatisticsComponent implements OnInit {
130
 				};
134
 				};
131
 		  });
135
 		  });
132
 	}
136
 	}
133
-	
137
+
134
 	// 一级故障
138
 	// 一级故障
135
 	malfunctionChart(){
139
 	malfunctionChart(){
136
 		let postData:any = {
140
 		let postData:any = {
@@ -195,7 +199,7 @@ export class SynthesizeStatisticsComponent implements OnInit {
195
 				}
199
 				}
196
 		  });
200
 		  });
197
 	}
201
 	}
198
-	
202
+
199
 	// 楼栋报修
203
 	// 楼栋报修
200
 	buildingChart(){
204
 	buildingChart(){
201
 		let postData:any = {
205
 		let postData:any = {
@@ -260,7 +264,7 @@ export class SynthesizeStatisticsComponent implements OnInit {
260
 		    }
264
 		    }
261
 		  });
265
 		  });
262
 	}
266
 	}
263
-	
267
+
264
 	// 科室费用
268
 	// 科室费用
265
 	getDeptCostData() {
269
 	getDeptCostData() {
266
 	  let postData:any = {
270
 	  let postData:any = {
@@ -277,7 +281,7 @@ export class SynthesizeStatisticsComponent implements OnInit {
277
 	      this.deptCostData = result.data || [];
281
 	      this.deptCostData = result.data || [];
278
 	    });
282
 	    });
279
 	}
283
 	}
280
-	
284
+
281
 	// 耗材
285
 	// 耗材
282
 	getConsumableData() {
286
 	getConsumableData() {
283
 	  let postData:any = {
287
 	  let postData:any = {
@@ -295,12 +299,21 @@ export class SynthesizeStatisticsComponent implements OnInit {
295
 	      this.consumableData = result.data || [];
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
   queryType:any;
318
   queryType:any;
306
   hosId:any;
319
   hosId:any;
@@ -334,7 +347,7 @@ export class SynthesizeStatisticsComponent implements OnInit {
334
       this.dutyId = undefined;
347
       this.dutyId = undefined;
335
       this.parentDutyId = dutyId;
348
       this.parentDutyId = dutyId;
336
     }
349
     }
337
-		
350
+
338
 		this.isLoading = true
351
 		this.isLoading = true
339
 		this.getWorkData();
352
 		this.getWorkData();
340
 		this.getMaintainData();
353
 		this.getMaintainData();
@@ -369,7 +382,7 @@ export class SynthesizeStatisticsComponent implements OnInit {
369
         this.listLength = result.totalCount;
382
         this.listLength = result.totalCount;
370
       });
383
       });
371
   }
384
   }
372
-	
385
+
373
 	// 头部工单数据
386
 	// 头部工单数据
374
 	getWorkData() {
387
 	getWorkData() {
375
 	  let postData:any = {
388
 	  let postData:any = {
@@ -386,7 +399,7 @@ export class SynthesizeStatisticsComponent implements OnInit {
386
 	      this.workData = result.data[0] || [];
399
 	      this.workData = result.data[0] || [];
387
 	    });
400
 	    });
388
 	}
401
 	}
389
-	
402
+
390
 	// 维修处理
403
 	// 维修处理
391
 	getMaintainData() {
404
 	getMaintainData() {
392
 	  let postData:any = {
405
 	  let postData:any = {
@@ -404,14 +417,14 @@ export class SynthesizeStatisticsComponent implements OnInit {
404
 	      this.maintainData = result.data || [];
417
 	      this.maintainData = result.data || [];
405
 	    });
418
 	    });
406
 	}
419
 	}
407
-	
420
+
408
 	// 重置
421
 	// 重置
409
 	reset(){
422
 	reset(){
410
 		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')];
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
 		this.activeIndex = 0;
424
 		this.activeIndex = 0;
412
 		this.search();
425
 		this.search();
413
 	}
426
 	}
414
-	
427
+
415
   // 搜索
428
   // 搜索
416
   search() {
429
   search() {
417
 		this.initSessionData();
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
       <nz-range-picker [(ngModel)]="dateRange" [nzAllowClear]="false" (ngModelChange)="changeDate($event)" (nzOnCalendarChange)="onCalendarChangeDate($event)">
5
       <nz-range-picker [(ngModel)]="dateRange" [nzAllowClear]="false" (ngModelChange)="changeDate($event)" (nzOnCalendarChange)="onCalendarChangeDate($event)">
6
       </nz-range-picker>
6
       </nz-range-picker>
7
     </div>
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
   </div>
19
   </div>
9
   <div class="operation">
20
   <div class="operation">
10
     <i class="icon_transport transport-gengduo" (click)="showMore()"></i>
21
     <i class="icon_transport transport-gengduo" (click)="showMore()"></i>
@@ -23,10 +34,10 @@
23
 <nz-table class="table" [nzData]="listOfData" nzSize="middle" [nzShowPagination]="false" [nzLoading]="loading1" [nzScroll]="{ y: tableHeight + 'px' }" [nzFooter]="footerTpl">
34
 <nz-table class="table" [nzData]="listOfData" nzSize="middle" [nzShowPagination]="false" [nzLoading]="loading1" [nzScroll]="{ y: tableHeight + 'px' }" [nzFooter]="footerTpl">
24
   <thead (nzSortChange)="sort($event)" nzSingleSort>
35
   <thead (nzSortChange)="sort($event)" nzSingleSort>
25
     <tr>
36
     <tr>
26
-      <th nzWidth="10%">分组名称</th>
37
+      <th nzWidth="10%">公司名称</th>
27
       <th nzWidth="9%" nzShowSort nzSortKey="sum" [(nzSort)]="sortCurrent.sum">工单总数</th>
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
       <th nzWidth="9%" nzShowSort nzSortKey="resolvedOverNum" [(nzSort)]="sortCurrent.resolvedOverNum">超时单数</th>
41
       <th nzWidth="9%" nzShowSort nzSortKey="resolvedOverNum" [(nzSort)]="sortCurrent.resolvedOverNum">超时单数</th>
31
       <th nzWidth="9%" nzShowSort nzSortKey="overTimeNum" [(nzSort)]="sortCurrent.overTimeNum">挂起单数</th>
42
       <th nzWidth="9%" nzShowSort nzSortKey="overTimeNum" [(nzSort)]="sortCurrent.overTimeNum">挂起单数</th>
32
       <th nzWidth="9%" nzShowSort nzSortKey="consumablePrice" [(nzSort)]="sortCurrent.consumablePrice">耗材费用(元)</th>
43
       <th nzWidth="9%" nzShowSort nzSortKey="consumablePrice" [(nzSort)]="sortCurrent.consumablePrice">耗材费用(元)</th>
@@ -38,7 +49,7 @@
38
   </thead>
49
   </thead>
39
   <tbody>
50
   <tbody>
40
     <tr *ngFor="let data of listOfData">
51
     <tr *ngFor="let data of listOfData">
41
-      <td>{{ data.groupName }}</td>
52
+      <td>{{ data.companyName }}</td>
42
       <td>{{ data.sum }}</td>
53
       <td>{{ data.sum }}</td>
43
       <td>{{ data.avgResponseTime }}</td>
54
       <td>{{ data.avgResponseTime }}</td>
44
       <td>{{ data.avgResolvedTime }}</td>
55
       <td>{{ data.avgResolvedTime }}</td>
@@ -54,7 +65,7 @@
54
   <ng-template #footerTpl>
65
   <ng-template #footerTpl>
55
     <table class="footTable">
66
     <table class="footTable">
56
       <tr *ngFor="let data of listOfDataEnd">
67
       <tr *ngFor="let data of listOfDataEnd">
57
-        <td style="width: 10%">{{ data.groupName }}</td>
68
+        <td style="width: 10%">{{ data.companyName }}</td>
58
         <td style="width: 9%">{{ data.sum }}</td>
69
         <td style="width: 9%">{{ data.sum }}</td>
59
         <td style="width: 9%">{{ data.avgResponseTime }}</td>
70
         <td style="width: 9%">{{ data.avgResponseTime }}</td>
60
         <td style="width: 9%">{{ data.avgResolvedTime }}</td>
71
         <td style="width: 9%">{{ data.avgResolvedTime }}</td>
@@ -70,7 +81,8 @@
70
   </ng-template>
81
   </ng-template>
71
 </nz-table>
82
 </nz-table>
72
 <div class="pagination">
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
 </div>
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
 import { NzMessageService } from 'ng-zorro-antd/message';
4
 import { NzMessageService } from 'ng-zorro-antd/message';
2
 import { format, addMonths, startOfMonth, endOfMonth, startOfDay, endOfDay } from 'date-fns';
5
 import { format, addMonths, startOfMonth, endOfMonth, startOfDay, endOfDay } from 'date-fns';
3
 import { Component, OnInit, HostListener, AfterViewInit } from "@angular/core";
6
 import { Component, OnInit, HostListener, AfterViewInit } from "@angular/core";
@@ -13,6 +16,7 @@ export class TripartiteCompanyStatisticsComponent implements OnInit, AfterViewIn
13
     private mainService: MainService,
16
     private mainService: MainService,
14
     private message: NzMessageService,
17
     private message: NzMessageService,
15
     private route: ActivatedRoute,
18
     private route: ActivatedRoute,
19
+    private tabService: TabService,
16
   ) {}
20
   ) {}
17
 
21
 
18
   listOfData: any[] = []; //表格数据
22
   listOfData: any[] = []; //表格数据
@@ -21,8 +25,17 @@ export class TripartiteCompanyStatisticsComponent implements OnInit, AfterViewIn
21
   pageSize: number = 30; //表格每页展示条数
25
   pageSize: number = 30; //表格每页展示条数
22
   listLength: number = 0; //表格总数据量
26
   listLength: number = 0; //表格总数据量
23
 
27
 
28
+  repairDeptId;//报修科室id
29
+
30
+  searchTimerSubject = new Subject();
31
+
24
   ngOnInit() {
32
   ngOnInit() {
33
+    this.searchTimerSubject.pipe(debounceTime(500)).subscribe((v) => {
34
+      let fun = v[0];
35
+      fun.call(this, v[1]);
36
+    });
25
     this.initSessionData();
37
     this.initSessionData();
38
+    this.getQueryParams();
26
     this.search();
39
     this.search();
27
   }
40
   }
28
 
41
 
@@ -34,13 +47,21 @@ export class TripartiteCompanyStatisticsComponent implements OnInit, AfterViewIn
34
   @HostListener('window:resize')
47
   @HostListener('window:resize')
35
   onResize(): void {
48
   onResize(): void {
36
     setTimeout(() => {
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
     }, 0)
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
   get getMoreFilter(){
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
     return flag ? 21 : 0;
65
     return flag ? 21 : 0;
45
   }
66
   }
46
 
67
 
@@ -97,7 +118,9 @@ export class TripartiteCompanyStatisticsComponent implements OnInit, AfterViewIn
97
       hosId: this.hosId || undefined,
118
       hosId: this.hosId || undefined,
98
       dutyId: this.dutyId || undefined,
119
       dutyId: this.dutyId || undefined,
99
       parentDutyId: this.parentDutyId || undefined,
120
       parentDutyId: this.parentDutyId || undefined,
121
+      repairDeptId: this.repairDeptId || undefined,
100
       categoryId: this.fieldConfig.fields.categoryId || undefined,
122
       categoryId: this.fieldConfig.fields.categoryId || undefined,
123
+      hierarchy: this.fieldConfig.fields.hierarchy || undefined,
101
       buildingId: this.fieldConfig.fields.buildingId || undefined,
124
       buildingId: this.fieldConfig.fields.buildingId || undefined,
102
       placeId: this.fieldConfig.fields.floorId || undefined,
125
       placeId: this.fieldConfig.fields.floorId || undefined,
103
     };
126
     };
@@ -158,7 +181,9 @@ export class TripartiteCompanyStatisticsComponent implements OnInit, AfterViewIn
158
       hosId: this.hosId || undefined,
181
       hosId: this.hosId || undefined,
159
       dutyId: this.dutyId || undefined,
182
       dutyId: this.dutyId || undefined,
160
       parentDutyId: this.parentDutyId || undefined,
183
       parentDutyId: this.parentDutyId || undefined,
184
+      repairDeptId: this.repairDeptId || undefined,
161
       categoryId: this.fieldConfig.fields.categoryId || undefined,
185
       categoryId: this.fieldConfig.fields.categoryId || undefined,
186
+      hierarchy: this.fieldConfig.fields.hierarchy || undefined,
162
       buildingId: this.fieldConfig.fields.buildingId || undefined,
187
       buildingId: this.fieldConfig.fields.buildingId || undefined,
163
       placeId: this.fieldConfig.fields.floorId || undefined,
188
       placeId: this.fieldConfig.fields.floorId || undefined,
164
     };
189
     };
@@ -194,12 +219,47 @@ export class TripartiteCompanyStatisticsComponent implements OnInit, AfterViewIn
194
 		this.sortCurrentValue = "";
219
 		this.sortCurrentValue = "";
195
 		this.sortCurrent = {};
220
 		this.sortCurrent = {};
196
     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')]
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
     this.fieldConfig.fields = {categoryId: undefined, buildingId: undefined, floorId: undefined};
223
     this.fieldConfig.fields = {categoryId: undefined, buildingId: undefined, floorId: undefined};
198
     this.search();
224
     this.search();
199
   }
225
   }
200
 
226
 
227
+  // 科室搜索
228
+  changeRepairDeptInp(e) {
229
+    this.searchTimer(this.getRepairDeptList, e);
230
+  }
231
+
201
   // 防抖
232
   // 防抖
202
   isLoading = false;
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
   fieldConfig:any = {
265
   fieldConfig:any = {

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

@@ -36,8 +36,8 @@
36
     <tr>
36
     <tr>
37
       <th nzWidth="10%">人员姓名(工号)</th>
37
       <th nzWidth="10%">人员姓名(工号)</th>
38
       <th nzWidth="9%" nzShowSort nzSortKey="sum" [(nzSort)]="sortCurrent.sum">工单总数</th>
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
       <th nzWidth="9%" nzShowSort nzSortKey="resolvedOverNum" [(nzSort)]="sortCurrent.resolvedOverNum">超时单数</th>
41
       <th nzWidth="9%" nzShowSort nzSortKey="resolvedOverNum" [(nzSort)]="sortCurrent.resolvedOverNum">超时单数</th>
42
       <th nzWidth="9%" nzShowSort nzSortKey="overTimeNum" [(nzSort)]="sortCurrent.overTimeNum">挂起单数</th>
42
       <th nzWidth="9%" nzShowSort nzSortKey="overTimeNum" [(nzSort)]="sortCurrent.overTimeNum">挂起单数</th>
43
       <th nzWidth="9%" nzShowSort nzSortKey="consumablePrice" [(nzSort)]="sortCurrent.consumablePrice">耗材费用(元)</th>
43
       <th nzWidth="9%" nzShowSort nzSortKey="consumablePrice" [(nzSort)]="sortCurrent.consumablePrice">耗材费用(元)</th>
@@ -65,7 +65,7 @@
65
   <ng-template #footerTpl>
65
   <ng-template #footerTpl>
66
     <table class="footTable">
66
     <table class="footTable">
67
       <tr *ngFor="let data of listOfDataEnd">
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
         <td style="width: 9%">{{ data.sum }}</td>
69
         <td style="width: 9%">{{ data.sum }}</td>
70
         <td style="width: 9%">{{ data.avgResponseTime }}</td>
70
         <td style="width: 9%">{{ data.avgResponseTime }}</td>
71
         <td style="width: 9%">{{ data.avgResolvedTime }}</td>
71
         <td style="width: 9%">{{ data.avgResolvedTime }}</td>
@@ -81,7 +81,8 @@
81
   </ng-template>
81
   </ng-template>
82
 </nz-table>
82
 </nz-table>
83
 <div class="pagination">
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
 </div>
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
 import { Component, OnInit, HostListener, AfterViewInit } from "@angular/core";
5
 import { Component, OnInit, HostListener, AfterViewInit } from "@angular/core";
6
 import { MainService } from 'src/app/services/main.service';
6
 import { MainService } from 'src/app/services/main.service';
7
 import { ActivatedRoute } from '@angular/router';
7
 import { ActivatedRoute } from '@angular/router';
8
+import { TabService } from '../../services/tab.service';
8
 @Component({
9
 @Component({
9
   selector: "app-user-statistics",
10
   selector: "app-user-statistics",
10
   templateUrl: "./user-statistics.component.html",
11
   templateUrl: "./user-statistics.component.html",
@@ -15,6 +16,7 @@ export class UserStatisticsComponent implements OnInit, AfterViewInit {
15
     private mainService: MainService,
16
     private mainService: MainService,
16
     private message: NzMessageService,
17
     private message: NzMessageService,
17
     private route: ActivatedRoute,
18
     private route: ActivatedRoute,
19
+    private tabService: TabService,
18
   ) {}
20
   ) {}
19
 
21
 
20
   listOfData: any[] = []; //表格数据
22
   listOfData: any[] = []; //表格数据
@@ -33,6 +35,7 @@ export class UserStatisticsComponent implements OnInit, AfterViewInit {
33
       fun.call(this, v[1]);
35
       fun.call(this, v[1]);
34
     });
36
     });
35
     this.initSessionData();
37
     this.initSessionData();
38
+    this.getQueryParams();
36
     this.search();
39
     this.search();
37
   }
40
   }
38
 
41
 
@@ -44,11 +47,19 @@ export class UserStatisticsComponent implements OnInit, AfterViewInit {
44
   @HostListener('window:resize')
47
   @HostListener('window:resize')
45
   onResize(): void {
48
   onResize(): void {
46
     setTimeout(() => {
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
     }, 0)
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
   get getMoreFilter(){
63
   get getMoreFilter(){
53
     let flag = this.fieldConfig.fields.buildingDTO || this.fieldConfig.fields.floorDTO || this.fieldConfig.fields.category1DTO || this.fieldConfig.fields.category2DTO || this.fieldConfig.fields.category3DTO;
64
     let flag = this.fieldConfig.fields.buildingDTO || this.fieldConfig.fields.floorDTO || this.fieldConfig.fields.category1DTO || this.fieldConfig.fields.category2DTO || this.fieldConfig.fields.category3DTO;
54
     return flag ? 21 : 0;
65
     return flag ? 21 : 0;
@@ -109,8 +120,9 @@ export class UserStatisticsComponent implements OnInit, AfterViewInit {
109
       parentDutyId: this.parentDutyId || undefined,
120
       parentDutyId: this.parentDutyId || undefined,
110
       groupId: this.groupId || undefined,
121
       groupId: this.groupId || undefined,
111
       buildingId: this.fieldConfig.fields.buildingId || undefined,
122
       buildingId: this.fieldConfig.fields.buildingId || undefined,
112
-      placeId: this.fieldConfig.fields.buildingId || undefined,
123
+      placeId: this.fieldConfig.fields.floorId || undefined,
113
       categoryId: this.fieldConfig.fields.categoryId || undefined,
124
       categoryId: this.fieldConfig.fields.categoryId || undefined,
125
+      hierarchy: this.fieldConfig.fields.hierarchy || undefined,
114
     };
126
     };
115
     if (field && sort) {
127
     if (field && sort) {
116
       postData.sort = `${field} ${sort === "ascend" ? `asc` : `desc`}`
128
       postData.sort = `${field} ${sort === "ascend" ? `asc` : `desc`}`
@@ -171,8 +183,9 @@ export class UserStatisticsComponent implements OnInit, AfterViewInit {
171
       parentDutyId: this.parentDutyId || undefined,
183
       parentDutyId: this.parentDutyId || undefined,
172
       groupId: this.groupId || undefined,
184
       groupId: this.groupId || undefined,
173
       buildingId: this.fieldConfig.fields.buildingId || undefined,
185
       buildingId: this.fieldConfig.fields.buildingId || undefined,
174
-      placeId: this.fieldConfig.fields.buildingId || undefined,
186
+      placeId: this.fieldConfig.fields.floorId || undefined,
175
       categoryId: this.fieldConfig.fields.categoryId || undefined,
187
       categoryId: this.fieldConfig.fields.categoryId || undefined,
188
+      hierarchy: this.fieldConfig.fields.hierarchy || undefined,
176
     };
189
     };
177
     if (this.sortCurrentKey && this.sortCurrentValue) {
190
     if (this.sortCurrentKey && this.sortCurrentValue) {
178
       postData.sort = `${this.sortCurrentKey} ${this.sortCurrentValue === "ascend" ? `asc` : `desc`}`
191
       postData.sort = `${this.sortCurrentKey} ${this.sortCurrentValue === "ascend" ? `asc` : `desc`}`
@@ -232,7 +245,7 @@ export class UserStatisticsComponent implements OnInit, AfterViewInit {
232
   getGroupList(keyword?) {
245
   getGroupList(keyword?) {
233
     let data = {
246
     let data = {
234
       group2: {
247
       group2: {
235
-        hospitals: this.getHosId,
248
+        statisticalHosId: this.getHosId,
236
         groupName: keyword,
249
         groupName: keyword,
237
         type: 3,
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
     this.router.events
19
     this.router.events
20
       .pipe(filter(event => event instanceof NavigationEnd))
20
       .pipe(filter(event => event instanceof NavigationEnd))
21
       .subscribe((event: NavigationEnd) => {
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
   private updateTabs(url: string) {
55
   private updateTabs(url: string) {
27
     const normalizedUrl = this.getNormalizedUrl(url);
56
     const normalizedUrl = this.getNormalizedUrl(url);
28
     const existingTab = this.tabs.find(t => t.path === normalizedUrl);
57
     const existingTab = this.tabs.find(t => t.path === normalizedUrl);
@@ -60,7 +89,6 @@ export class TabService {
60
 
89
 
61
   closeTab(path: string): any {
90
   closeTab(path: string): any {
62
     console.log('path:', path)
91
     console.log('path:', path)
63
-    SimpleReuseStrategy.deleteRouteCache(path);
64
 
92
 
65
     const index = this.tabs.findIndex(t => t.path === path);
93
     const index = this.tabs.findIndex(t => t.path === path);
66
     if (index === -1) return;
94
     if (index === -1) return;
@@ -84,6 +112,7 @@ export class TabService {
84
 
112
 
85
     // 执行删除
113
     // 执行删除
86
     this.tabs.splice(index, 1);
114
     this.tabs.splice(index, 1);
115
+    SimpleReuseStrategy.deleteRouteSnapshot(path);
87
 
116
 
88
     // 设置新激活页签
117
     // 设置新激活页签
89
     if (newActiveTab) {
118
     if (newActiveTab) {
@@ -108,16 +137,16 @@ export class TabService {
108
 
137
 
109
   closeOtherTabs(keepTab: Tab): void {
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
     this.tabs.forEach(v => {
140
     this.tabs.forEach(v => {
116
       if (v.path !== keepTab.path) {
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
     this.router.navigate([keepTab.path], {
151
     this.router.navigate([keepTab.path], {
123
       replaceUrl: true
152
       replaceUrl: true