Browse Source

按天月年及快捷选择

seimin 1 week ago
parent
commit
94b5a9fbb2
99 changed files with 528 additions and 744 deletions
  1. 1 1
      proxy.conf.json
  2. 1 5
      src/app/views/new-statistics/distribution-inspection-statistics/business-classify-statistics/business-classify-statistics.component.html
  3. 1 1
      src/app/views/new-statistics/distribution-inspection-statistics/business-classify-statistics/business-classify-statistics.component.less
  4. 17 25
      src/app/views/new-statistics/distribution-inspection-statistics/business-classify-statistics/business-classify-statistics.component.ts
  5. 2 0
      src/app/views/new-statistics/distribution-inspection-statistics/business-classify-statistics/business-classify-statistics.module.ts
  6. 1 5
      src/app/views/new-statistics/distribution-inspection-statistics/date-business-statistics/date-business-statistics.component.html
  7. 1 1
      src/app/views/new-statistics/distribution-inspection-statistics/date-business-statistics/date-business-statistics.component.less
  8. 19 25
      src/app/views/new-statistics/distribution-inspection-statistics/date-business-statistics/date-business-statistics.component.ts
  9. 2 0
      src/app/views/new-statistics/distribution-inspection-statistics/date-business-statistics/date-business-statistics.module.ts
  10. 1 5
      src/app/views/new-statistics/distribution-inspection-statistics/date-quality-control-statistics/date-quality-control-statistics.component.html
  11. 1 1
      src/app/views/new-statistics/distribution-inspection-statistics/date-quality-control-statistics/date-quality-control-statistics.component.less
  12. 19 25
      src/app/views/new-statistics/distribution-inspection-statistics/date-quality-control-statistics/date-quality-control-statistics.component.ts
  13. 2 0
      src/app/views/new-statistics/distribution-inspection-statistics/date-quality-control-statistics/date-quality-control-statistics.module.ts
  14. 1 5
      src/app/views/new-statistics/distribution-inspection-statistics/department-business-statistics/department-business-statistics.component.html
  15. 1 1
      src/app/views/new-statistics/distribution-inspection-statistics/department-business-statistics/department-business-statistics.component.less
  16. 20 27
      src/app/views/new-statistics/distribution-inspection-statistics/department-business-statistics/department-business-statistics.component.ts
  17. 2 0
      src/app/views/new-statistics/distribution-inspection-statistics/department-business-statistics/department-business-statistics.module.ts
  18. 1 5
      src/app/views/new-statistics/distribution-inspection-statistics/department-quality-control-statistics/department-quality-control-statistics.component.html
  19. 1 1
      src/app/views/new-statistics/distribution-inspection-statistics/department-quality-control-statistics/department-quality-control-statistics.component.less
  20. 22 27
      src/app/views/new-statistics/distribution-inspection-statistics/department-quality-control-statistics/department-quality-control-statistics.component.ts
  21. 2 0
      src/app/views/new-statistics/distribution-inspection-statistics/department-quality-control-statistics/department-quality-control-statistics.module.ts
  22. 1 5
      src/app/views/new-statistics/distribution-inspection-statistics/distribution-department-evaluate-statistics/distribution-department-evaluate-statistics.component.html
  23. 1 1
      src/app/views/new-statistics/distribution-inspection-statistics/distribution-department-evaluate-statistics/distribution-department-evaluate-statistics.component.less
  24. 16 23
      src/app/views/new-statistics/distribution-inspection-statistics/distribution-department-evaluate-statistics/distribution-department-evaluate-statistics.component.ts
  25. 2 0
      src/app/views/new-statistics/distribution-inspection-statistics/distribution-department-evaluate-statistics/distribution-department-evaluate-statistics.module.ts
  26. 1 5
      src/app/views/new-statistics/distribution-inspection-statistics/distribution-department-source-statistics/distribution-department-source-statistics.component.html
  27. 1 1
      src/app/views/new-statistics/distribution-inspection-statistics/distribution-department-source-statistics/distribution-department-source-statistics.component.less
  28. 20 27
      src/app/views/new-statistics/distribution-inspection-statistics/distribution-department-source-statistics/distribution-department-source-statistics.component.ts
  29. 2 0
      src/app/views/new-statistics/distribution-inspection-statistics/distribution-department-source-statistics/distribution-department-source-statistics.module.ts
  30. 1 1
      src/app/views/new-statistics/distribution-inspection-statistics/distribution-user-evaluate-statistics/distribution-user-evaluate-statistics.component.html
  31. 1 5
      src/app/views/new-statistics/distribution-inspection-statistics/source-statistics/source-statistics.component.html
  32. 1 1
      src/app/views/new-statistics/distribution-inspection-statistics/source-statistics/source-statistics.component.less
  33. 16 23
      src/app/views/new-statistics/distribution-inspection-statistics/source-statistics/source-statistics.component.ts
  34. 2 0
      src/app/views/new-statistics/distribution-inspection-statistics/source-statistics/source-statistics.module.ts
  35. 1 5
      src/app/views/new-statistics/distribution-inspection-statistics/user-business-statistics/user-business-statistics.component.html
  36. 1 1
      src/app/views/new-statistics/distribution-inspection-statistics/user-business-statistics/user-business-statistics.component.less
  37. 16 23
      src/app/views/new-statistics/distribution-inspection-statistics/user-business-statistics/user-business-statistics.component.ts
  38. 2 0
      src/app/views/new-statistics/distribution-inspection-statistics/user-business-statistics/user-business-statistics.module.ts
  39. 1 5
      src/app/views/new-statistics/distribution-inspection-statistics/user-quality-control-statistics/user-quality-control-statistics.component.html
  40. 1 1
      src/app/views/new-statistics/distribution-inspection-statistics/user-quality-control-statistics/user-quality-control-statistics.component.less
  41. 16 23
      src/app/views/new-statistics/distribution-inspection-statistics/user-quality-control-statistics/user-quality-control-statistics.component.ts
  42. 2 0
      src/app/views/new-statistics/distribution-inspection-statistics/user-quality-control-statistics/user-quality-control-statistics.module.ts
  43. 1 5
      src/app/views/new-statistics/maintenance-statistics/building-statistics/building-statistics.component.html
  44. 1 1
      src/app/views/new-statistics/maintenance-statistics/building-statistics/building-statistics.component.less
  45. 17 25
      src/app/views/new-statistics/maintenance-statistics/building-statistics/building-statistics.component.ts
  46. 2 0
      src/app/views/new-statistics/maintenance-statistics/building-statistics/building-statistics.module.ts
  47. 1 5
      src/app/views/new-statistics/maintenance-statistics/category-one-statistics/category-one-statistics.component.html
  48. 1 1
      src/app/views/new-statistics/maintenance-statistics/category-one-statistics/category-one-statistics.component.less
  49. 17 25
      src/app/views/new-statistics/maintenance-statistics/category-one-statistics/category-one-statistics.component.ts
  50. 2 0
      src/app/views/new-statistics/maintenance-statistics/category-one-statistics/category-one-statistics.module.ts
  51. 1 5
      src/app/views/new-statistics/maintenance-statistics/category-source-statistics/category-source-statistics.component.html
  52. 1 1
      src/app/views/new-statistics/maintenance-statistics/category-source-statistics/category-source-statistics.component.less
  53. 17 25
      src/app/views/new-statistics/maintenance-statistics/category-source-statistics/category-source-statistics.component.ts
  54. 2 0
      src/app/views/new-statistics/maintenance-statistics/category-source-statistics/category-source-statistics.module.ts
  55. 1 5
      src/app/views/new-statistics/maintenance-statistics/category-three-statistics/category-three-statistics.component.html
  56. 1 1
      src/app/views/new-statistics/maintenance-statistics/category-three-statistics/category-three-statistics.component.less
  57. 16 24
      src/app/views/new-statistics/maintenance-statistics/category-three-statistics/category-three-statistics.component.ts
  58. 2 0
      src/app/views/new-statistics/maintenance-statistics/category-three-statistics/category-three-statistics.module.ts
  59. 1 5
      src/app/views/new-statistics/maintenance-statistics/category-two-statistics/category-two-statistics.component.html
  60. 1 1
      src/app/views/new-statistics/maintenance-statistics/category-two-statistics/category-two-statistics.component.less
  61. 16 23
      src/app/views/new-statistics/maintenance-statistics/category-two-statistics/category-two-statistics.component.ts
  62. 2 0
      src/app/views/new-statistics/maintenance-statistics/category-two-statistics/category-two-statistics.module.ts
  63. 1 5
      src/app/views/new-statistics/maintenance-statistics/consumable-statistics/consumable-statistics.component.html
  64. 1 1
      src/app/views/new-statistics/maintenance-statistics/consumable-statistics/consumable-statistics.component.less
  65. 16 23
      src/app/views/new-statistics/maintenance-statistics/consumable-statistics/consumable-statistics.component.ts
  66. 2 0
      src/app/views/new-statistics/maintenance-statistics/consumable-statistics/consumable-statistics.module.ts
  67. 1 5
      src/app/views/new-statistics/maintenance-statistics/department-evaluate-statistics/department-evaluate-statistics.component.html
  68. 1 1
      src/app/views/new-statistics/maintenance-statistics/department-evaluate-statistics/department-evaluate-statistics.component.less
  69. 22 29
      src/app/views/new-statistics/maintenance-statistics/department-evaluate-statistics/department-evaluate-statistics.component.ts
  70. 2 0
      src/app/views/new-statistics/maintenance-statistics/department-evaluate-statistics/department-evaluate-statistics.module.ts
  71. 1 5
      src/app/views/new-statistics/maintenance-statistics/department-incident-statistics/department-incident-statistics.component.html
  72. 1 1
      src/app/views/new-statistics/maintenance-statistics/department-incident-statistics/department-incident-statistics.component.less
  73. 23 30
      src/app/views/new-statistics/maintenance-statistics/department-incident-statistics/department-incident-statistics.component.ts
  74. 2 0
      src/app/views/new-statistics/maintenance-statistics/department-incident-statistics/department-incident-statistics.module.ts
  75. 1 5
      src/app/views/new-statistics/maintenance-statistics/department-source-statistics/department-source-statistics.component.html
  76. 1 1
      src/app/views/new-statistics/maintenance-statistics/department-source-statistics/department-source-statistics.component.less
  77. 20 27
      src/app/views/new-statistics/maintenance-statistics/department-source-statistics/department-source-statistics.component.ts
  78. 2 0
      src/app/views/new-statistics/maintenance-statistics/department-source-statistics/department-source-statistics.module.ts
  79. 1 5
      src/app/views/new-statistics/maintenance-statistics/floor-statistics/floor-statistics.component.html
  80. 1 1
      src/app/views/new-statistics/maintenance-statistics/floor-statistics/floor-statistics.component.less
  81. 16 23
      src/app/views/new-statistics/maintenance-statistics/floor-statistics/floor-statistics.component.ts
  82. 2 0
      src/app/views/new-statistics/maintenance-statistics/floor-statistics/floor-statistics.module.ts
  83. 1 5
      src/app/views/new-statistics/maintenance-statistics/group-statistics/group-statistics.component.html
  84. 1 1
      src/app/views/new-statistics/maintenance-statistics/group-statistics/group-statistics.component.less
  85. 17 25
      src/app/views/new-statistics/maintenance-statistics/group-statistics/group-statistics.component.ts
  86. 2 0
      src/app/views/new-statistics/maintenance-statistics/group-statistics/group-statistics.module.ts
  87. 2 0
      src/app/views/new-statistics/maintenance-statistics/incident-statistics/incident-statistics.component.ts
  88. 1 5
      src/app/views/new-statistics/maintenance-statistics/tripartite-company-statistics/tripartite-company-statistics.component.html
  89. 1 1
      src/app/views/new-statistics/maintenance-statistics/tripartite-company-statistics/tripartite-company-statistics.component.less
  90. 18 25
      src/app/views/new-statistics/maintenance-statistics/tripartite-company-statistics/tripartite-company-statistics.component.ts
  91. 2 0
      src/app/views/new-statistics/maintenance-statistics/tripartite-company-statistics/tripartite-company-statistics.module.ts
  92. 1 5
      src/app/views/new-statistics/maintenance-statistics/work-hour-big-statistics/work-hour-big-statistics.component.html
  93. 1 1
      src/app/views/new-statistics/maintenance-statistics/work-hour-big-statistics/work-hour-big-statistics.component.less
  94. 16 23
      src/app/views/new-statistics/maintenance-statistics/work-hour-big-statistics/work-hour-big-statistics.component.ts
  95. 2 0
      src/app/views/new-statistics/maintenance-statistics/work-hour-big-statistics/work-hour-big-statistics.module.ts
  96. 1 5
      src/app/views/new-statistics/maintenance-statistics/work-hour-small-statistics/work-hour-small-statistics.component.html
  97. 1 1
      src/app/views/new-statistics/maintenance-statistics/work-hour-small-statistics/work-hour-small-statistics.component.less
  98. 16 23
      src/app/views/new-statistics/maintenance-statistics/work-hour-small-statistics/work-hour-small-statistics.component.ts
  99. 2 0
      src/app/views/new-statistics/maintenance-statistics/work-hour-small-statistics/work-hour-small-statistics.module.ts

+ 1 - 1
proxy.conf.json

@@ -1,6 +1,6 @@
1 1
 {
2 2
   "/service": {
3
-		"target": "http://192.168.4.163",
3
+		"target": "http://192.168.3.108",
4 4
     "logLevel": "debug",
5 5
     "changeOrigin": true,
6 6
     "pathRewrite": {

+ 1 - 5
src/app/views/new-statistics/distribution-inspection-statistics/business-classify-statistics/business-classify-statistics.component.html

@@ -1,10 +1,6 @@
1 1
 <div class="searchDataWrap">
2 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>
3
+    <app-custom-change-date #customChangeDate [isShowType]="false"></app-custom-change-date>
8 4
   </div>
9 5
   <div class="operation">
10 6
     <i class="icon_transport transport-gengduo" nz-tooltip nzTooltipTitle="更多搜索" (click)="showMore()"></i>

+ 1 - 1
src/app/views/new-statistics/distribution-inspection-statistics/business-classify-statistics/business-classify-statistics.component.less

@@ -27,7 +27,7 @@
27 27
           font-size: 16px;
28 28
         }
29 29
         .selectItem{
30
-          width: 224px;
30
+          width: 160px;
31 31
         }
32 32
       }
33 33
     }

+ 17 - 25
src/app/views/new-statistics/distribution-inspection-statistics/business-classify-statistics/business-classify-statistics.component.ts

@@ -1,15 +1,16 @@
1 1
 import { TabService } from './../../services/tab.service';
2 2
 import { NzMessageService } from 'ng-zorro-antd/message';
3
-import { format, addMonths, startOfMonth, endOfMonth, startOfDay, endOfDay } from 'date-fns';
4
-import { Component, OnInit, HostListener, AfterViewInit } from "@angular/core";
3
+import { Component, OnInit, HostListener, AfterViewInit, ViewChild } from "@angular/core";
5 4
 import { MainService } from 'src/app/services/main.service';
6 5
 import { ActivatedRoute } from '@angular/router';
6
+import { CustomChangeDateComponent } from '../../components/custom-change-date/custom-change-date.component';
7 7
 @Component({
8 8
   selector: "app-business-classify-statistics",
9 9
   templateUrl: "./business-classify-statistics.component.html",
10 10
   styleUrls: ["./business-classify-statistics.component.less"],
11 11
 })
12 12
 export class BusinessClassifyStatisticsComponent implements OnInit, AfterViewInit {
13
+  @ViewChild('customChangeDate', { static: false }) customChangeDateComponent!: CustomChangeDateComponent;
13 14
   constructor(
14 15
     private mainService: MainService,
15 16
     private message: NzMessageService,
@@ -25,13 +26,14 @@ export class BusinessClassifyStatisticsComponent implements OnInit, AfterViewIni
25 26
 
26 27
   statisticsTypeId;//统计分类id
27 28
 
28
-  ngOnInit() {
29
-    this.initSessionData();
30
-    this.getQueryParams();
31
-    this.search();
32
-  }
29
+  ngOnInit() {}
33 30
 
34 31
   ngAfterViewInit(){
32
+    this.initSessionData();
33
+    this.getQueryParams();
34
+    setTimeout(() => {
35
+      this.search();
36
+    }, 0)
35 37
     this.onResize();
36 38
   }
37 39
 
@@ -49,6 +51,7 @@ export class BusinessClassifyStatisticsComponent implements OnInit, AfterViewIni
49 51
     this.tabService.clearQueryParams();
50 52
     if(queryParams.dateRange){
51 53
       this.dateRange = queryParams.dateRange;
54
+      this.customChangeDateComponent.initByDate(this.dateRange);
52 55
     }
53 56
   }
54 57
 
@@ -105,8 +108,8 @@ export class BusinessClassifyStatisticsComponent implements OnInit, AfterViewIni
105 108
     let postData:any = {
106 109
       idx: this.pageIndex - 1,
107 110
       sum: this.pageSize,
108
-      startDate: this.dateRange[0] || undefined,
109
-      endDate: this.dateRange[1] || undefined,
111
+      startDate: this.customChangeDateComponent.startDate || undefined,
112
+      endDate: this.customChangeDateComponent.endDate || undefined,
110 113
       hosId: this.getHosId,
111 114
       groupId: this.fieldConfig.fields.userId ? undefined : (this.fieldConfig.fields.groupId || undefined),
112 115
       userId: this.fieldConfig.fields.userId || undefined,
@@ -144,19 +147,7 @@ export class BusinessClassifyStatisticsComponent implements OnInit, AfterViewIni
144 147
   }
145 148
 
146 149
   // 日期选择
147
-  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')];
148
-  changeDate(result?): void {
149
-    result[0] = format(startOfDay(result[0]), 'yyyy-MM-dd HH:mm:ss');
150
-    result[1] = format(endOfDay(result[1]), 'yyyy-MM-dd HH:mm:ss');
151
-    this.dateRange = result;
152
-  }
153
-
154
-  onCalendarChangeDate(dateArr){
155
-    console.log(dateArr)
156
-    if(dateArr.length == 2){
157
-      this.dateRange = [format(startOfDay(dateArr[0]), 'yyyy-MM-dd HH:mm:ss'), format(endOfDay(dateArr[1]), 'yyyy-MM-dd HH:mm:ss')];
158
-    }
159
-  }
150
+  dateRange: any = [];
160 151
 
161 152
   // 导出
162 153
   excelExportLoading:any = false;
@@ -165,8 +156,8 @@ export class BusinessClassifyStatisticsComponent implements OnInit, AfterViewIni
165 156
       nzDuration: 0,
166 157
     }).messageId;
167 158
     let postData:any = {
168
-      startDate: this.dateRange[0] || undefined,
169
-      endDate: this.dateRange[1] || undefined,
159
+      startDate: this.customChangeDateComponent.startDate || undefined,
160
+      endDate: this.customChangeDateComponent.endDate || undefined,
170 161
       hosId: this.getHosId,
171 162
       groupId: this.fieldConfig.fields.userId ? undefined : (this.fieldConfig.fields.groupId || undefined),
172 163
       userId: this.fieldConfig.fields.userId || undefined,
@@ -204,8 +195,9 @@ export class BusinessClassifyStatisticsComponent implements OnInit, AfterViewIni
204 195
     this.sortCurrentKey = "";
205 196
 		this.sortCurrentValue = "";
206 197
 		this.sortCurrent = {};
207
-    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')]
198
+    this.dateRange = []
208 199
     this.fieldConfig.fields = {groupId: undefined, userId: undefined, buildingId: undefined, deptId: undefined};
200
+    this.customChangeDateComponent.resetByDate();
209 201
     this.search();
210 202
   }
211 203
 

+ 2 - 0
src/app/views/new-statistics/distribution-inspection-statistics/business-classify-statistics/business-classify-statistics.module.ts

@@ -5,6 +5,7 @@ import { CommonModule } from '@angular/common';
5 5
 import { BusinessClassifyStatisticsRoutingModule } from './business-classify-statistics-routing.module';
6 6
 import { ShareModule } from 'src/app/share/share.module';
7 7
 import { DistributionSearchMoreModule } from '../../components/distribution-search-more/distribution-search-more.module';
8
+import { CustomChangeDateModule } from '../../components/custom-change-date/custom-change-date.module';
8 9
 
9 10
 
10 11
 @NgModule({
@@ -16,6 +17,7 @@ import { DistributionSearchMoreModule } from '../../components/distribution-sear
16 17
     BusinessClassifyStatisticsRoutingModule,
17 18
     ShareModule,
18 19
     DistributionSearchMoreModule,
20
+    CustomChangeDateModule,
19 21
   ]
20 22
 })
21 23
 export class BusinessClassifyStatisticsModule { }

+ 1 - 5
src/app/views/new-statistics/distribution-inspection-statistics/date-business-statistics/date-business-statistics.component.html

@@ -1,10 +1,6 @@
1 1
 <div class="searchDataWrap">
2 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>
3
+    <app-custom-change-date #customChangeDate [isShowType]="true"></app-custom-change-date>
8 4
   </div>
9 5
   <div class="operation">
10 6
     <i class="icon_transport transport-gengduo" nz-tooltip nzTooltipTitle="更多搜索" (click)="showMore()"></i>

+ 1 - 1
src/app/views/new-statistics/distribution-inspection-statistics/date-business-statistics/date-business-statistics.component.less

@@ -27,7 +27,7 @@
27 27
           font-size: 16px;
28 28
         }
29 29
         .selectItem{
30
-          width: 224px;
30
+          width: 160px;
31 31
         }
32 32
       }
33 33
     }

+ 19 - 25
src/app/views/new-statistics/distribution-inspection-statistics/date-business-statistics/date-business-statistics.component.ts

@@ -1,16 +1,17 @@
1 1
 import { TabService } from './../../services/tab.service';
2 2
 import { NzMessageService } from 'ng-zorro-antd/message';
3
-import { format, addMonths, startOfMonth, endOfMonth, startOfDay, endOfDay } from 'date-fns';
4
-import { Component, OnInit, HostListener, AfterViewInit } from "@angular/core";
3
+import { Component, OnInit, HostListener, AfterViewInit, ViewChild } from "@angular/core";
5 4
 import { MainService } from 'src/app/services/main.service';
6 5
 import { ActivatedRoute } from '@angular/router';
7 6
 import cloneDeep from 'lodash-es/cloneDeep'
7
+import { CustomChangeDateComponent } from '../../components/custom-change-date/custom-change-date.component';
8 8
 @Component({
9 9
   selector: "app-date-business-statistics",
10 10
   templateUrl: "./date-business-statistics.component.html",
11 11
   styleUrls: ["./date-business-statistics.component.less"],
12 12
 })
13 13
 export class DateBusinessStatisticsComponent implements OnInit, AfterViewInit {
14
+  @ViewChild('customChangeDate', { static: false }) customChangeDateComponent!: CustomChangeDateComponent;
14 15
   constructor(
15 16
     private mainService: MainService,
16 17
     private message: NzMessageService,
@@ -25,13 +26,14 @@ export class DateBusinessStatisticsComponent implements OnInit, AfterViewInit {
25 26
   listLength: number = 0; //表格总数据量
26 27
   widthConfig: any[] = [];
27 28
 
28
-  ngOnInit() {
29
-    this.initSessionData();
30
-    this.getQueryParams();
31
-    this.search();
32
-  }
29
+  ngOnInit() {}
33 30
 
34 31
   ngAfterViewInit(){
32
+    this.initSessionData();
33
+    this.getQueryParams();
34
+    setTimeout(() => {
35
+      this.search();
36
+    }, 0)
35 37
     this.onResize();
36 38
   }
37 39
 
@@ -49,6 +51,7 @@ export class DateBusinessStatisticsComponent implements OnInit, AfterViewInit {
49 51
     this.tabService.clearQueryParams();
50 52
     if(queryParams.dateRange){
51 53
       this.dateRange = queryParams.dateRange;
54
+      this.customChangeDateComponent.initByDate(this.dateRange);
52 55
     }
53 56
   }
54 57
 
@@ -113,8 +116,9 @@ export class DateBusinessStatisticsComponent implements OnInit, AfterViewInit {
113 116
       let postData:any = {
114 117
         idx: this.pageIndex - 1,
115 118
         sum: this.pageSize,
116
-        startDate: this.dateRange[0] || undefined,
117
-        endDate: this.dateRange[1] || undefined,
119
+        dateType: this.customChangeDateComponent.dateType,
120
+        startDate: this.customChangeDateComponent.startDate || undefined,
121
+        endDate: this.customChangeDateComponent.endDate || undefined,
118 122
         hosId: this.getHosId,
119 123
         groupId: this.fieldConfig.fields.userId ? undefined : (this.fieldConfig.fields.groupId || undefined),
120 124
         userId: this.fieldConfig.fields.userId || undefined,
@@ -153,19 +157,7 @@ export class DateBusinessStatisticsComponent implements OnInit, AfterViewInit {
153 157
   }
154 158
 
155 159
   // 日期选择
156
-  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')];
157
-  changeDate(result?): void {
158
-    result[0] = format(startOfDay(result[0]), 'yyyy-MM-dd HH:mm:ss');
159
-    result[1] = format(endOfDay(result[1]), 'yyyy-MM-dd HH:mm:ss');
160
-    this.dateRange = result;
161
-  }
162
-
163
-  onCalendarChangeDate(dateArr){
164
-    console.log(dateArr)
165
-    if(dateArr.length == 2){
166
-      this.dateRange = [format(startOfDay(dateArr[0]), 'yyyy-MM-dd HH:mm:ss'), format(endOfDay(dateArr[1]), 'yyyy-MM-dd HH:mm:ss')];
167
-    }
168
-  }
160
+  dateRange: any = [];
169 161
 
170 162
   // 导出
171 163
   excelExportLoading:any = false;
@@ -174,8 +166,9 @@ export class DateBusinessStatisticsComponent implements OnInit, AfterViewInit {
174 166
       nzDuration: 0,
175 167
     }).messageId;
176 168
     let postData:any = {
177
-      startDate: this.dateRange[0] || undefined,
178
-      endDate: this.dateRange[1] || undefined,
169
+      dateType: this.customChangeDateComponent.dateType,
170
+      startDate: this.customChangeDateComponent.startDate || undefined,
171
+      endDate: this.customChangeDateComponent.endDate || undefined,
179 172
       hosId: this.getHosId,
180 173
       groupId: this.fieldConfig.fields.userId ? undefined : (this.fieldConfig.fields.groupId || undefined),
181 174
       userId: this.fieldConfig.fields.userId || undefined,
@@ -213,8 +206,9 @@ export class DateBusinessStatisticsComponent implements OnInit, AfterViewInit {
213 206
     this.sortCurrentKey = "";
214 207
 		this.sortCurrentValue = "";
215 208
 		this.sortCurrent = {};
216
-    this.dateRange = [format(startOfMonth(addMonths(new Date(), -1)), 'yyyy-MM-dd HH:mm:ss'), format(endOfMonth(addMonths(new Date(), -1)), 'yyyy-MM-dd HH:mm:ss')]
209
+    this.dateRange = []
217 210
     this.fieldConfig.fields = {groupId: undefined, userId: undefined, buildingId: undefined, deptId: undefined};
211
+    this.customChangeDateComponent.resetByDate();
218 212
     this.search();
219 213
   }
220 214
 

+ 2 - 0
src/app/views/new-statistics/distribution-inspection-statistics/date-business-statistics/date-business-statistics.module.ts

@@ -6,6 +6,7 @@ import { DateBusinessStatisticsRoutingModule } from './date-business-statistics-
6 6
 import { ShareModule } from 'src/app/share/share.module';
7 7
 import { VirtualScrollerModule } from 'ngx-virtual-scroller';
8 8
 import { DistributionSearchMoreModule } from '../../components/distribution-search-more/distribution-search-more.module';
9
+import { CustomChangeDateModule } from '../../components/custom-change-date/custom-change-date.module';
9 10
 
10 11
 
11 12
 @NgModule({
@@ -18,6 +19,7 @@ import { DistributionSearchMoreModule } from '../../components/distribution-sear
18 19
     ShareModule,
19 20
     VirtualScrollerModule,
20 21
     DistributionSearchMoreModule,
22
+    CustomChangeDateModule,
21 23
   ]
22 24
 })
23 25
 export class DateBusinessStatisticsModule { }

+ 1 - 5
src/app/views/new-statistics/distribution-inspection-statistics/date-quality-control-statistics/date-quality-control-statistics.component.html

@@ -1,10 +1,6 @@
1 1
 <div class="searchDataWrap">
2 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>
3
+    <app-custom-change-date #customChangeDate [isShowType]="true"></app-custom-change-date>
8 4
     <div class="searchDataItem">
9 5
       <span class="label">统计分类</span>
10 6
       <nz-select class="selectItem" [nzDropdownMatchSelectWidth]="false" nzAllowClear nzPlaceHolder="请选择统计分类" [(ngModel)]="statisticsTypeId" (nzOpenChange)="openChangeStatisticsType($event)">

+ 1 - 1
src/app/views/new-statistics/distribution-inspection-statistics/date-quality-control-statistics/date-quality-control-statistics.component.less

@@ -27,7 +27,7 @@
27 27
           font-size: 16px;
28 28
         }
29 29
         .selectItem{
30
-          width: 224px;
30
+          width: 160px;
31 31
         }
32 32
       }
33 33
     }

+ 19 - 25
src/app/views/new-statistics/distribution-inspection-statistics/date-quality-control-statistics/date-quality-control-statistics.component.ts

@@ -1,15 +1,16 @@
1 1
 import { TabService } from './../../services/tab.service';
2 2
 import { NzMessageService } from 'ng-zorro-antd/message';
3
-import { format, addMonths, startOfMonth, endOfMonth, startOfDay, endOfDay } from 'date-fns';
4
-import { Component, OnInit, HostListener, AfterViewInit } from "@angular/core";
3
+import { Component, OnInit, HostListener, AfterViewInit, ViewChild } from "@angular/core";
5 4
 import { MainService } from 'src/app/services/main.service';
6 5
 import { ActivatedRoute } from '@angular/router';
6
+import { CustomChangeDateComponent } from '../../components/custom-change-date/custom-change-date.component';
7 7
 @Component({
8 8
   selector: "app-date-quality-control-statistics",
9 9
   templateUrl: "./date-quality-control-statistics.component.html",
10 10
   styleUrls: ["./date-quality-control-statistics.component.less"],
11 11
 })
12 12
 export class DateQualityControlStatisticsComponent implements OnInit, AfterViewInit {
13
+  @ViewChild('customChangeDate', { static: false }) customChangeDateComponent!: CustomChangeDateComponent;
13 14
   constructor(
14 15
     private mainService: MainService,
15 16
     private message: NzMessageService,
@@ -25,13 +26,14 @@ export class DateQualityControlStatisticsComponent implements OnInit, AfterViewI
25 26
 
26 27
   statisticsTypeId;//统计分类id
27 28
 
28
-  ngOnInit() {
29
-    this.initSessionData();
30
-    this.getQueryParams();
31
-    this.search();
32
-  }
29
+  ngOnInit() {}
33 30
 
34 31
   ngAfterViewInit(){
32
+    this.initSessionData();
33
+    this.getQueryParams();
34
+    setTimeout(() => {
35
+      this.search();
36
+    }, 0)
35 37
     this.onResize();
36 38
   }
37 39
 
@@ -49,6 +51,7 @@ export class DateQualityControlStatisticsComponent implements OnInit, AfterViewI
49 51
     this.tabService.clearQueryParams();
50 52
     if(queryParams.dateRange){
51 53
       this.dateRange = queryParams.dateRange;
54
+      this.customChangeDateComponent.initByDate(this.dateRange);
52 55
     }
53 56
   }
54 57
 
@@ -105,8 +108,9 @@ export class DateQualityControlStatisticsComponent implements OnInit, AfterViewI
105 108
     let postData:any = {
106 109
       idx: this.pageIndex - 1,
107 110
       sum: this.pageSize,
108
-      startDate: this.dateRange[0] || undefined,
109
-      endDate: this.dateRange[1] || undefined,
111
+      dateType: this.customChangeDateComponent.dateType,
112
+      startDate: this.customChangeDateComponent.startDate || undefined,
113
+      endDate: this.customChangeDateComponent.endDate || undefined,
110 114
       hosId: this.getHosId,
111 115
       statisticsTypeId: this.statisticsTypeId || undefined,
112 116
       groupId: this.fieldConfig.fields.userId ? undefined : (this.fieldConfig.fields.groupId || undefined),
@@ -146,19 +150,7 @@ export class DateQualityControlStatisticsComponent implements OnInit, AfterViewI
146 150
   }
147 151
 
148 152
   // 日期选择
149
-  dateRange: any = [format(startOfMonth(addMonths(new Date(), -1)), 'yyyy-MM-dd HH:mm:ss'), format(endOfMonth(addMonths(new Date(), -1)), 'yyyy-MM-dd HH:mm:ss')];
150
-  changeDate(result?): void {
151
-    result[0] = format(startOfDay(result[0]), 'yyyy-MM-dd HH:mm:ss');
152
-    result[1] = format(endOfDay(result[1]), 'yyyy-MM-dd HH:mm:ss');
153
-    this.dateRange = result;
154
-  }
155
-
156
-  onCalendarChangeDate(dateArr){
157
-    console.log(dateArr)
158
-    if(dateArr.length == 2){
159
-      this.dateRange = [format(startOfDay(dateArr[0]), 'yyyy-MM-dd HH:mm:ss'), format(endOfDay(dateArr[1]), 'yyyy-MM-dd HH:mm:ss')];
160
-    }
161
-  }
153
+  dateRange: any = [];
162 154
 
163 155
   // 导出
164 156
   excelExportLoading:any = false;
@@ -167,8 +159,9 @@ export class DateQualityControlStatisticsComponent implements OnInit, AfterViewI
167 159
       nzDuration: 0,
168 160
     }).messageId;
169 161
     let postData:any = {
170
-      startDate: this.dateRange[0] || undefined,
171
-      endDate: this.dateRange[1] || undefined,
162
+      dateType: this.customChangeDateComponent.dateType,
163
+      startDate: this.customChangeDateComponent.startDate || undefined,
164
+      endDate: this.customChangeDateComponent.endDate || undefined,
172 165
       hosId: this.getHosId,
173 166
       statisticsTypeId: this.statisticsTypeId || undefined,
174 167
       groupId: this.fieldConfig.fields.userId ? undefined : (this.fieldConfig.fields.groupId || undefined),
@@ -208,9 +201,10 @@ export class DateQualityControlStatisticsComponent implements OnInit, AfterViewI
208 201
     this.sortCurrentKey = "";
209 202
 		this.sortCurrentValue = "";
210 203
 		this.sortCurrent = {};
211
-    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')]
204
+    this.dateRange = []
212 205
     this.statisticsTypeId = undefined;
213 206
     this.fieldConfig.fields = {groupId: undefined, userId: undefined, taskTypeId: undefined, buildingId: undefined, deptId: undefined};
207
+    this.customChangeDateComponent.resetByDate();
214 208
     this.search();
215 209
   }
216 210
 

+ 2 - 0
src/app/views/new-statistics/distribution-inspection-statistics/date-quality-control-statistics/date-quality-control-statistics.module.ts

@@ -5,6 +5,7 @@ import { CommonModule } from '@angular/common';
5 5
 import { DateQualityControlStatisticsRoutingModule } from './date-quality-control-statistics-routing.module';
6 6
 import { ShareModule } from 'src/app/share/share.module';
7 7
 import { DistributionSearchMoreModule } from '../../components/distribution-search-more/distribution-search-more.module';
8
+import { CustomChangeDateModule } from '../../components/custom-change-date/custom-change-date.module';
8 9
 
9 10
 
10 11
 @NgModule({
@@ -16,6 +17,7 @@ import { DistributionSearchMoreModule } from '../../components/distribution-sear
16 17
     DateQualityControlStatisticsRoutingModule,
17 18
     ShareModule,
18 19
     DistributionSearchMoreModule,
20
+    CustomChangeDateModule,
19 21
   ]
20 22
 })
21 23
 export class DateQualityControlStatisticsModule { }

+ 1 - 5
src/app/views/new-statistics/distribution-inspection-statistics/department-business-statistics/department-business-statistics.component.html

@@ -1,10 +1,6 @@
1 1
 <div class="searchDataWrap">
2 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>
3
+    <app-custom-change-date #customChangeDate [isShowType]="false"></app-custom-change-date>
8 4
 
9 5
 		<div class="searchDataItem">
10 6
 		  <span class="label">科室</span>

+ 1 - 1
src/app/views/new-statistics/distribution-inspection-statistics/department-business-statistics/department-business-statistics.component.less

@@ -27,7 +27,7 @@
27 27
           font-size: 16px;
28 28
         }
29 29
         .selectItem{
30
-          width: 224px;
30
+          width: 160px;
31 31
         }
32 32
       }
33 33
     }

+ 20 - 27
src/app/views/new-statistics/distribution-inspection-statistics/department-business-statistics/department-business-statistics.component.ts

@@ -2,12 +2,12 @@ import { TabService } from './../../services/tab.service';
2 2
 import { debounceTime } from 'rxjs/operators';
3 3
 import { Subject } from 'rxjs';
4 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";
5
+import { Component, OnInit, HostListener, AfterViewInit, ViewChild } from "@angular/core";
7 6
 import { MainService } from 'src/app/services/main.service';
8 7
 import { ActivatedRoute } from '@angular/router';
9 8
 import cloneDeep from 'lodash-es/cloneDeep'
10 9
 import { ToolService } from "../../../../services/tool.service";
10
+import { CustomChangeDateComponent } from '../../components/custom-change-date/custom-change-date.component';
11 11
 
12 12
 @Component({
13 13
   selector: "app-department-business-statistics",
@@ -15,6 +15,7 @@ import { ToolService } from "../../../../services/tool.service";
15 15
   styleUrls: ["./department-business-statistics.component.less"],
16 16
 })
17 17
 export class DepartmentBusinessStatisticsComponent implements OnInit, AfterViewInit {
18
+  @ViewChild('customChangeDate', { static: false }) customChangeDateComponent!: CustomChangeDateComponent;
18 19
   constructor(
19 20
     private mainService: MainService,
20 21
     private message: NzMessageService,
@@ -41,13 +42,15 @@ export class DepartmentBusinessStatisticsComponent implements OnInit, AfterViewI
41 42
       let fun = v[0];
42 43
       fun.call(this, v[1]);
43 44
     });
44
-    this.initSessionData();
45
-    this.getQueryParams();
46
-		this.getDeparts();
47
-    this.search();
48 45
   }
49 46
 
50 47
   ngAfterViewInit(){
48
+    this.initSessionData();
49
+    this.getQueryParams();
50
+    this.getDeparts();
51
+    setTimeout(() => {
52
+      this.search();
53
+    }, 0)
51 54
     this.onResize();
52 55
   }
53 56
 
@@ -65,6 +68,7 @@ export class DepartmentBusinessStatisticsComponent implements OnInit, AfterViewI
65 68
     this.tabService.clearQueryParams();
66 69
     if(queryParams.dateRange){
67 70
       this.dateRange = queryParams.dateRange;
71
+      this.customChangeDateComponent.initByDate(this.dateRange);
68 72
     }
69 73
   }
70 74
 
@@ -140,8 +144,8 @@ export class DepartmentBusinessStatisticsComponent implements OnInit, AfterViewI
140 144
 				showParentDept: this.parent==1 ? 'true' : undefined,
141 145
 				deptId: this.deptId || undefined,
142 146
 				buildingId: this.fieldConfig.fields.buildingId || undefined,
143
-        startDate: this.dateRange[0] || undefined,
144
-        endDate: this.dateRange[1] || undefined,
147
+        startDate: this.customChangeDateComponent.startDate || undefined,
148
+        endDate: this.customChangeDateComponent.endDate || undefined,
145 149
         hosId: this.getHosId,
146 150
         groupId: this.fieldConfig.fields.userId ? undefined : (this.fieldConfig.fields.groupId || undefined),
147 151
         userId: this.fieldConfig.fields.userId || undefined
@@ -178,19 +182,7 @@ export class DepartmentBusinessStatisticsComponent implements OnInit, AfterViewI
178 182
   }
179 183
 
180 184
   // 日期选择
181
-  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')];
182
-  changeDate(result?): void {
183
-    result[0] = format(startOfDay(result[0]), 'yyyy-MM-dd HH:mm:ss');
184
-    result[1] = format(endOfDay(result[1]), 'yyyy-MM-dd HH:mm:ss');
185
-    this.dateRange = result;
186
-  }
187
-
188
-  onCalendarChangeDate(dateArr){
189
-    console.log(dateArr)
190
-    if(dateArr.length == 2){
191
-      this.dateRange = [format(startOfDay(dateArr[0]), 'yyyy-MM-dd HH:mm:ss'), format(endOfDay(dateArr[1]), 'yyyy-MM-dd HH:mm:ss')];
192
-    }
193
-  }
185
+  dateRange: any = [];
194 186
 
195 187
   // 导出
196 188
   excelExportLoading:any = false;
@@ -202,8 +194,8 @@ export class DepartmentBusinessStatisticsComponent implements OnInit, AfterViewI
202 194
 			showParentDept: this.parent==1 ? 'true' : undefined,
203 195
 			deptId: this.deptId || undefined,
204 196
 			buildingId: this.fieldConfig.fields.buildingId || undefined,
205
-      startDate: this.dateRange[0] || undefined,
206
-      endDate: this.dateRange[1] || undefined,
197
+      startDate: this.customChangeDateComponent.startDate || undefined,
198
+      endDate: this.customChangeDateComponent.endDate || undefined,
207 199
       hosId: this.getHosId,
208 200
       groupId: this.fieldConfig.fields.userId ? undefined : (this.fieldConfig.fields.groupId || undefined),
209 201
       userId: this.fieldConfig.fields.userId || undefined,
@@ -239,9 +231,10 @@ export class DepartmentBusinessStatisticsComponent implements OnInit, AfterViewI
239 231
     this.sortCurrentKey = "";
240 232
 		this.sortCurrentValue = "";
241 233
 		this.sortCurrent = {};
242
-    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')]
234
+    this.dateRange = []
243 235
     this.deptId = undefined;
244 236
     this.fieldConfig.fields = {groupId: undefined, userId: undefined, buildingId: undefined};
237
+    this.customChangeDateComponent.resetByDate();
245 238
     this.search();
246 239
   }
247 240
 
@@ -260,12 +253,12 @@ export class DepartmentBusinessStatisticsComponent implements OnInit, AfterViewI
260 253
   openChangeBuilding(flag){
261 254
     flag && this.getBuildingList();
262 255
   }
263
-	
256
+
264 257
 	// 科室搜索
265 258
 	changeInp(e) {
266 259
 	  this.searchTimer(this.getDeparts, e);
267 260
 	}
268
-	
261
+
269 262
 	// 获取所有科室
270 263
 	alldepart:any;
271 264
 	getDeparts(dept?) {
@@ -284,7 +277,7 @@ export class DepartmentBusinessStatisticsComponent implements OnInit, AfterViewI
284 277
 	      this.alldepart = data.list;
285 278
 	    });
286 279
 	}
287
-	
280
+
288 281
   // 获取报修科室列表
289 282
   buildingList:any[] = [];
290 283
   getBuildingList(keyword?) {

+ 2 - 0
src/app/views/new-statistics/distribution-inspection-statistics/department-business-statistics/department-business-statistics.module.ts

@@ -6,6 +6,7 @@ import { DepartmentBusinessStatisticsRoutingModule } from './department-business
6 6
 import { ShareModule } from 'src/app/share/share.module';
7 7
 import { VirtualScrollerModule } from 'ngx-virtual-scroller';
8 8
 import { DistributionSearchMoreModule } from '../../components/distribution-search-more/distribution-search-more.module';
9
+import { CustomChangeDateModule } from '../../components/custom-change-date/custom-change-date.module';
9 10
 
10 11
 
11 12
 @NgModule({
@@ -18,6 +19,7 @@ import { DistributionSearchMoreModule } from '../../components/distribution-sear
18 19
     ShareModule,
19 20
     VirtualScrollerModule,
20 21
     DistributionSearchMoreModule,
22
+    CustomChangeDateModule,
21 23
   ]
22 24
 })
23 25
 export class DepartmentBusinessStatisticsModule { }

+ 1 - 5
src/app/views/new-statistics/distribution-inspection-statistics/department-quality-control-statistics/department-quality-control-statistics.component.html

@@ -1,10 +1,6 @@
1 1
 <div class="searchDataWrap">
2 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>
3
+    <app-custom-change-date #customChangeDate [isShowType]="false"></app-custom-change-date>
8 4
     <div class="searchDataItem">
9 5
       <span class="label">科室</span>
10 6
       <nz-select class="selectItem" [nzDropdownMatchSelectWidth]="false" nzAllowClear nzPlaceHolder="请选择科室" [(ngModel)]="deptId" nzServerSearch nzShowSearch (nzOnSearch)="changeInp($event)">

+ 1 - 1
src/app/views/new-statistics/distribution-inspection-statistics/department-quality-control-statistics/department-quality-control-statistics.component.less

@@ -27,7 +27,7 @@
27 27
           font-size: 16px;
28 28
         }
29 29
         .selectItem{
30
-          width: 224px;
30
+          width: 160px;
31 31
         }
32 32
       }
33 33
     }

+ 22 - 27
src/app/views/new-statistics/distribution-inspection-statistics/department-quality-control-statistics/department-quality-control-statistics.component.ts

@@ -2,17 +2,18 @@ import { TabService } from './../../services/tab.service';
2 2
 import { debounceTime } from 'rxjs/operators';
3 3
 import { Subject } from 'rxjs';
4 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";
5
+import { Component, OnInit, HostListener, AfterViewInit, ViewChild } from "@angular/core";
7 6
 import { MainService } from 'src/app/services/main.service';
8 7
 import { ActivatedRoute } from '@angular/router';
9 8
 import { ToolService } from "../../../../services/tool.service";
9
+import { CustomChangeDateComponent } from '../../components/custom-change-date/custom-change-date.component';
10 10
 @Component({
11 11
   selector: "app-department-quality-control-statistics",
12 12
   templateUrl: "./department-quality-control-statistics.component.html",
13 13
   styleUrls: ["./department-quality-control-statistics.component.less"],
14 14
 })
15 15
 export class DepartmentQualityControlStatisticsComponent implements OnInit, AfterViewInit {
16
+  @ViewChild('customChangeDate', { static: false }) customChangeDateComponent!: CustomChangeDateComponent;
16 17
   constructor(
17 18
     private mainService: MainService,
18 19
     private message: NzMessageService,
@@ -38,13 +39,17 @@ export class DepartmentQualityControlStatisticsComponent implements OnInit, Afte
38 39
       let fun = v[0];
39 40
       fun.call(this, v[1]);
40 41
     });
41
-    this.initSessionData();
42
-    this.getQueryParams();
43
-		this.getDeparts();
44
-    this.search();
45 42
   }
46 43
 
44
+  ngOnInit() {}
45
+
47 46
   ngAfterViewInit(){
47
+    this.initSessionData();
48
+    this.getQueryParams();
49
+    this.getDeparts();
50
+    setTimeout(() => {
51
+      this.search();
52
+    }, 0)
48 53
     this.onResize();
49 54
   }
50 55
 
@@ -62,6 +67,7 @@ export class DepartmentQualityControlStatisticsComponent implements OnInit, Afte
62 67
     this.tabService.clearQueryParams();
63 68
     if(queryParams.dateRange){
64 69
       this.dateRange = queryParams.dateRange;
70
+      this.customChangeDateComponent.initByDate(this.dateRange);
65 71
     }
66 72
   }
67 73
 
@@ -123,8 +129,8 @@ export class DepartmentQualityControlStatisticsComponent implements OnInit, Afte
123 129
 			showParentDept: this.parent==1 ? 'true' : undefined,
124 130
 			deptId: this.deptId || undefined,
125 131
 			buildingId: this.fieldConfig.fields.buildingId || undefined,
126
-      startDate: this.dateRange[0] || undefined,
127
-      endDate: this.dateRange[1] || undefined,
132
+      startDate: this.customChangeDateComponent.startDate || undefined,
133
+      endDate: this.customChangeDateComponent.endDate || undefined,
128 134
       hosId: this.getHosId,
129 135
       groupId: this.fieldConfig.fields.userId ? undefined : (this.fieldConfig.fields.groupId || undefined),
130 136
       userId: this.fieldConfig.fields.userId || undefined,
@@ -162,19 +168,7 @@ export class DepartmentQualityControlStatisticsComponent implements OnInit, Afte
162 168
   }
163 169
 
164 170
   // 日期选择
165
-  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')];
166
-  changeDate(result?): void {
167
-    result[0] = format(startOfDay(result[0]), 'yyyy-MM-dd HH:mm:ss');
168
-    result[1] = format(endOfDay(result[1]), 'yyyy-MM-dd HH:mm:ss');
169
-    this.dateRange = result;
170
-  }
171
-
172
-  onCalendarChangeDate(dateArr){
173
-    console.log(dateArr)
174
-    if(dateArr.length == 2){
175
-      this.dateRange = [format(startOfDay(dateArr[0]), 'yyyy-MM-dd HH:mm:ss'), format(endOfDay(dateArr[1]), 'yyyy-MM-dd HH:mm:ss')];
176
-    }
177
-  }
171
+  dateRange: any = [];
178 172
 
179 173
   // 导出
180 174
   excelExportLoading:any = false;
@@ -186,8 +180,8 @@ export class DepartmentQualityControlStatisticsComponent implements OnInit, Afte
186 180
 			showParentDept: this.parent==1 ? 'true' : undefined,
187 181
 			deptId: this.deptId || undefined,
188 182
 			buildingId: this.fieldConfig.fields.buildingId || undefined,
189
-      startDate: this.dateRange[0] || undefined,
190
-      endDate: this.dateRange[1] || undefined,
183
+      startDate: this.customChangeDateComponent.startDate || undefined,
184
+      endDate: this.customChangeDateComponent.endDate || undefined,
191 185
       hosId: this.getHosId,
192 186
       groupId: this.fieldConfig.fields.userId ? undefined : (this.fieldConfig.fields.groupId || undefined),
193 187
       userId: this.fieldConfig.fields.userId || undefined,
@@ -225,9 +219,10 @@ export class DepartmentQualityControlStatisticsComponent implements OnInit, Afte
225 219
     this.sortCurrentKey = "";
226 220
 		this.sortCurrentValue = "";
227 221
 		this.sortCurrent = {};
228
-    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.dateRange = []
229 223
     this.deptId = undefined;
230 224
     this.fieldConfig.fields = {groupId: undefined, userId: undefined, statisticsTypeId: undefined, taskTypeId: undefined, buildingId: undefined};
225
+    this.customChangeDateComponent.resetByDate();
231 226
     this.search();
232 227
   }
233 228
 
@@ -246,12 +241,12 @@ export class DepartmentQualityControlStatisticsComponent implements OnInit, Afte
246 241
   openChangeBuilding(flag){
247 242
     flag && this.getBuildingList();
248 243
   }
249
-	
244
+
250 245
 	// 科室搜索
251 246
 	changeInp(e) {
252 247
 	  this.searchTimer(this.getDeparts, e);
253 248
 	}
254
-	
249
+
255 250
 	// 获取所有科室
256 251
 	alldepart:any;
257 252
 	getDeparts(dept?) {
@@ -270,7 +265,7 @@ export class DepartmentQualityControlStatisticsComponent implements OnInit, Afte
270 265
 	      this.alldepart = data.list;
271 266
 	    });
272 267
 	}
273
-	
268
+
274 269
   // 获取报修科室列表
275 270
   buildingList:any[] = [];
276 271
   getBuildingList(keyword?) {

+ 2 - 0
src/app/views/new-statistics/distribution-inspection-statistics/department-quality-control-statistics/department-quality-control-statistics.module.ts

@@ -5,6 +5,7 @@ import { CommonModule } from '@angular/common';
5 5
 import { DepartmentQualityControlStatisticsRoutingModule } from './department-quality-control-statistics-routing.module';
6 6
 import { ShareModule } from 'src/app/share/share.module';
7 7
 import { DistributionSearchMoreModule } from '../../components/distribution-search-more/distribution-search-more.module';
8
+import { CustomChangeDateModule } from '../../components/custom-change-date/custom-change-date.module';
8 9
 
9 10
 
10 11
 @NgModule({
@@ -16,6 +17,7 @@ import { DistributionSearchMoreModule } from '../../components/distribution-sear
16 17
     DepartmentQualityControlStatisticsRoutingModule,
17 18
     ShareModule,
18 19
     DistributionSearchMoreModule,
20
+    CustomChangeDateModule,
19 21
   ]
20 22
 })
21 23
 export class DepartmentQualityControlStatisticsModule { }

+ 1 - 5
src/app/views/new-statistics/distribution-inspection-statistics/distribution-department-evaluate-statistics/distribution-department-evaluate-statistics.component.html

@@ -1,10 +1,6 @@
1 1
 <div class="searchDataWrap">
2 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>
3
+    <app-custom-change-date #customChangeDate [isShowType]="false"></app-custom-change-date>
8 4
     <div class="searchDataItem">
9 5
       <span class="label">楼栋</span>
10 6
       <nz-select class="selectItem" [nzDropdownMatchSelectWidth]="false" nzServerSearch nzShowSearch (nzOnSearch)="changeBuildingInp($event)" nzAllowClear nzPlaceHolder="请选择楼栋" [(ngModel)]="buildingId" (nzOpenChange)="openChangeBuilding($event)">

+ 1 - 1
src/app/views/new-statistics/distribution-inspection-statistics/distribution-department-evaluate-statistics/distribution-department-evaluate-statistics.component.less

@@ -27,7 +27,7 @@
27 27
           font-size: 16px;
28 28
         }
29 29
         .selectItem{
30
-          width: 224px;
30
+          width: 160px;
31 31
         }
32 32
       }
33 33
     }

+ 16 - 23
src/app/views/new-statistics/distribution-inspection-statistics/distribution-department-evaluate-statistics/distribution-department-evaluate-statistics.component.ts

@@ -2,16 +2,17 @@ import { TabService } from './../../services/tab.service';
2 2
 import { debounceTime } from 'rxjs/operators';
3 3
 import { Subject } from 'rxjs';
4 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";
5
+import { Component, OnInit, HostListener, AfterViewInit, ViewChild } from "@angular/core";
7 6
 import { MainService } from 'src/app/services/main.service';
8 7
 import { ActivatedRoute } from '@angular/router';
8
+import { CustomChangeDateComponent } from '../../components/custom-change-date/custom-change-date.component';
9 9
 @Component({
10 10
   selector: "app-distribution-department-evaluate-statistics",
11 11
   templateUrl: "./distribution-department-evaluate-statistics.component.html",
12 12
   styleUrls: ["./distribution-department-evaluate-statistics.component.less"],
13 13
 })
14 14
 export class DistributionDepartmentEvaluateStatisticsComponent implements OnInit, AfterViewInit {
15
+  @ViewChild('customChangeDate', { static: false }) customChangeDateComponent!: CustomChangeDateComponent;
15 16
   constructor(
16 17
     private mainService: MainService,
17 18
     private message: NzMessageService,
@@ -34,12 +35,14 @@ export class DistributionDepartmentEvaluateStatisticsComponent implements OnInit
34 35
       let fun = v[0];
35 36
       fun.call(this, v[1]);
36 37
     });
37
-    this.initSessionData();
38
-    this.getQueryParams();
39
-    this.search();
40 38
   }
41 39
 
42 40
   ngAfterViewInit(){
41
+    this.initSessionData();
42
+    this.getQueryParams();
43
+    setTimeout(() => {
44
+      this.search();
45
+    }, 0)
43 46
     this.onResize();
44 47
   }
45 48
 
@@ -57,6 +60,7 @@ export class DistributionDepartmentEvaluateStatisticsComponent implements OnInit
57 60
     this.tabService.clearQueryParams();
58 61
     if(queryParams.dateRange){
59 62
       this.dateRange = queryParams.dateRange;
63
+      this.customChangeDateComponent.initByDate(this.dateRange);
60 64
     }
61 65
   }
62 66
 
@@ -113,8 +117,8 @@ export class DistributionDepartmentEvaluateStatisticsComponent implements OnInit
113 117
     let postData:any = {
114 118
       idx: this.pageIndex - 1,
115 119
       sum: this.pageSize,
116
-      startDate: this.dateRange[0] || undefined,
117
-      endDate: this.dateRange[1] || undefined,
120
+      startDate: this.customChangeDateComponent.startDate || undefined,
121
+      endDate: this.customChangeDateComponent.endDate || undefined,
118 122
       hosId: this.getHosId,
119 123
       buildingId: this.buildingId || undefined,
120 124
       groupId: this.fieldConfig.fields.userId ? undefined : (this.fieldConfig.fields.groupId || undefined),
@@ -153,19 +157,7 @@ export class DistributionDepartmentEvaluateStatisticsComponent implements OnInit
153 157
   }
154 158
 
155 159
   // 日期选择
156
-  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')];
157
-  changeDate(result?): void {
158
-    result[0] = format(startOfDay(result[0]), 'yyyy-MM-dd HH:mm:ss');
159
-    result[1] = format(endOfDay(result[1]), 'yyyy-MM-dd HH:mm:ss');
160
-    this.dateRange = result;
161
-  }
162
-
163
-  onCalendarChangeDate(dateArr){
164
-    console.log(dateArr)
165
-    if(dateArr.length == 2){
166
-      this.dateRange = [format(startOfDay(dateArr[0]), 'yyyy-MM-dd HH:mm:ss'), format(endOfDay(dateArr[1]), 'yyyy-MM-dd HH:mm:ss')];
167
-    }
168
-  }
160
+  dateRange: any = [];
169 161
 
170 162
   // 导出
171 163
   excelExportLoading:any = false;
@@ -174,8 +166,8 @@ export class DistributionDepartmentEvaluateStatisticsComponent implements OnInit
174 166
       nzDuration: 0,
175 167
     }).messageId;
176 168
     let postData:any = {
177
-      startDate: this.dateRange[0] || undefined,
178
-      endDate: this.dateRange[1] || undefined,
169
+      startDate: this.customChangeDateComponent.startDate || undefined,
170
+      endDate: this.customChangeDateComponent.endDate || undefined,
179 171
       hosId: this.getHosId,
180 172
       buildingId: this.buildingId || undefined,
181 173
       groupId: this.fieldConfig.fields.userId ? undefined : (this.fieldConfig.fields.groupId || undefined),
@@ -214,9 +206,10 @@ export class DistributionDepartmentEvaluateStatisticsComponent implements OnInit
214 206
     this.sortCurrentKey = "";
215 207
 		this.sortCurrentValue = "";
216 208
 		this.sortCurrent = {};
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')]
209
+    this.dateRange = []
218 210
     this.buildingId = undefined;
219 211
     this.fieldConfig.fields = {groupId: undefined, userId: undefined, statisticsTypeId: undefined, taskTypeId: undefined};
212
+    this.customChangeDateComponent.resetByDate();
220 213
     this.search();
221 214
   }
222 215
 

+ 2 - 0
src/app/views/new-statistics/distribution-inspection-statistics/distribution-department-evaluate-statistics/distribution-department-evaluate-statistics.module.ts

@@ -5,6 +5,7 @@ import { CommonModule } from '@angular/common';
5 5
 import { DistributionDepartmentEvaluateStatisticsRoutingModule } from './distribution-department-evaluate-statistics-routing.module';
6 6
 import { ShareModule } from 'src/app/share/share.module';
7 7
 import { DistributionSearchMoreModule } from '../../components/distribution-search-more/distribution-search-more.module';
8
+import { CustomChangeDateModule } from '../../components/custom-change-date/custom-change-date.module';
8 9
 
9 10
 
10 11
 @NgModule({
@@ -16,6 +17,7 @@ import { DistributionSearchMoreModule } from '../../components/distribution-sear
16 17
     DistributionDepartmentEvaluateStatisticsRoutingModule,
17 18
     ShareModule,
18 19
     DistributionSearchMoreModule,
20
+    CustomChangeDateModule,
19 21
   ]
20 22
 })
21 23
 export class DistributionDepartmentEvaluateStatisticsModule { }

+ 1 - 5
src/app/views/new-statistics/distribution-inspection-statistics/distribution-department-source-statistics/distribution-department-source-statistics.component.html

@@ -1,10 +1,6 @@
1 1
 <div class="searchDataWrap">
2 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>
3
+    <app-custom-change-date #customChangeDate [isShowType]="false"></app-custom-change-date>
8 4
     <div class="searchDataItem">
9 5
       <span class="label">科室</span>
10 6
       <nz-select class="selectItem" [nzDropdownMatchSelectWidth]="false" nzAllowClear nzPlaceHolder="请选择科室" [(ngModel)]="deptId" nzServerSearch nzShowSearch (nzOnSearch)="changeInp($event)">

+ 1 - 1
src/app/views/new-statistics/distribution-inspection-statistics/distribution-department-source-statistics/distribution-department-source-statistics.component.less

@@ -27,7 +27,7 @@
27 27
           font-size: 16px;
28 28
         }
29 29
         .selectItem{
30
-          width: 224px;
30
+          width: 160px;
31 31
         }
32 32
       }
33 33
     }

+ 20 - 27
src/app/views/new-statistics/distribution-inspection-statistics/distribution-department-source-statistics/distribution-department-source-statistics.component.ts

@@ -2,17 +2,18 @@ import { TabService } from './../../services/tab.service';
2 2
 import { debounceTime } from 'rxjs/operators';
3 3
 import { Subject } from 'rxjs';
4 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";
5
+import { Component, OnInit, HostListener, AfterViewInit, ViewChild } from "@angular/core";
7 6
 import { MainService } from 'src/app/services/main.service';
8 7
 import { ActivatedRoute } from '@angular/router';
9 8
 import { ToolService } from "../../../../services/tool.service";
9
+import { CustomChangeDateComponent } from '../../components/custom-change-date/custom-change-date.component';
10 10
 @Component({
11 11
   selector: "app-distribution-department-source-statistics",
12 12
   templateUrl: "./distribution-department-source-statistics.component.html",
13 13
   styleUrls: ["./distribution-department-source-statistics.component.less"],
14 14
 })
15 15
 export class DistributionDepartmentSourceStatisticsComponent implements OnInit, AfterViewInit {
16
+  @ViewChild('customChangeDate', { static: false }) customChangeDateComponent!: CustomChangeDateComponent;
16 17
   constructor(
17 18
     private mainService: MainService,
18 19
     private message: NzMessageService,
@@ -38,13 +39,15 @@ export class DistributionDepartmentSourceStatisticsComponent implements OnInit,
38 39
       let fun = v[0];
39 40
       fun.call(this, v[1]);
40 41
     });
41
-    this.initSessionData();
42
-    this.getQueryParams();
43
-		this.getDeparts();
44
-    this.search();
45 42
   }
46 43
 
47 44
   ngAfterViewInit(){
45
+    this.initSessionData();
46
+    this.getQueryParams();
47
+    this.getDeparts();
48
+    setTimeout(() => {
49
+      this.search();
50
+    }, 0)
48 51
     this.onResize();
49 52
   }
50 53
 
@@ -62,6 +65,7 @@ export class DistributionDepartmentSourceStatisticsComponent implements OnInit,
62 65
     this.tabService.clearQueryParams();
63 66
     if(queryParams.dateRange){
64 67
       this.dateRange = queryParams.dateRange;
68
+      this.customChangeDateComponent.initByDate(this.dateRange);
65 69
     }
66 70
   }
67 71
 
@@ -123,8 +127,8 @@ export class DistributionDepartmentSourceStatisticsComponent implements OnInit,
123 127
 			showParentDept: this.parent==1 ? 'true' : undefined,
124 128
 			deptId: this.deptId || undefined,
125 129
 			buildingId: this.fieldConfig.fields.buildingId || undefined,
126
-      startDate: this.dateRange[0] || undefined,
127
-      endDate: this.dateRange[1] || undefined,
130
+      startDate: this.customChangeDateComponent.startDate || undefined,
131
+      endDate: this.customChangeDateComponent.endDate || undefined,
128 132
       hosId: this.getHosId,
129 133
       groupId: this.fieldConfig.fields.userId ? undefined : (this.fieldConfig.fields.groupId || undefined),
130 134
       userId: this.fieldConfig.fields.userId || undefined,
@@ -162,19 +166,7 @@ export class DistributionDepartmentSourceStatisticsComponent implements OnInit,
162 166
   }
163 167
 
164 168
   // 日期选择
165
-  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')];
166
-  changeDate(result?): void {
167
-    result[0] = format(startOfDay(result[0]), 'yyyy-MM-dd HH:mm:ss');
168
-    result[1] = format(endOfDay(result[1]), 'yyyy-MM-dd HH:mm:ss');
169
-    this.dateRange = result;
170
-  }
171
-
172
-  onCalendarChangeDate(dateArr){
173
-    console.log(dateArr)
174
-    if(dateArr.length == 2){
175
-      this.dateRange = [format(startOfDay(dateArr[0]), 'yyyy-MM-dd HH:mm:ss'), format(endOfDay(dateArr[1]), 'yyyy-MM-dd HH:mm:ss')];
176
-    }
177
-  }
169
+  dateRange: any = [];
178 170
 
179 171
   // 导出
180 172
   excelExportLoading:any = false;
@@ -186,8 +178,8 @@ export class DistributionDepartmentSourceStatisticsComponent implements OnInit,
186 178
 			showParentDept: this.parent==1 ? 'true' : undefined,
187 179
 			deptId: this.deptId || undefined,
188 180
 			buildingId: this.fieldConfig.fields.buildingId || undefined,
189
-      startDate: this.dateRange[0] || undefined,
190
-      endDate: this.dateRange[1] || undefined,
181
+      startDate: this.customChangeDateComponent.startDate || undefined,
182
+      endDate: this.customChangeDateComponent.endDate || undefined,
191 183
       hosId: this.getHosId,
192 184
       groupId: this.fieldConfig.fields.userId ? undefined : (this.fieldConfig.fields.groupId || undefined),
193 185
       userId: this.fieldConfig.fields.userId || undefined,
@@ -225,9 +217,10 @@ export class DistributionDepartmentSourceStatisticsComponent implements OnInit,
225 217
     this.sortCurrentKey = "";
226 218
 		this.sortCurrentValue = "";
227 219
 		this.sortCurrent = {};
228
-    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')]
220
+    this.dateRange = []
229 221
 		this.deptId = undefined;
230 222
     this.fieldConfig.fields = {groupId: undefined, userId: undefined, statisticsTypeId: undefined, taskTypeId: undefined, buildingId: undefined};
223
+    this.customChangeDateComponent.resetByDate();
231 224
     this.search();
232 225
   }
233 226
 
@@ -235,12 +228,12 @@ export class DistributionDepartmentSourceStatisticsComponent implements OnInit,
235 228
   changeBuildingInp(e) {
236 229
     this.searchTimer(this.getBuildingList, e);
237 230
   }
238
-	
231
+
239 232
 	// 科室搜索
240 233
 	changeInp(e) {
241 234
 	  this.searchTimer(this.getDeparts, e);
242 235
 	}
243
-	
236
+
244 237
 	// 获取所有科室
245 238
 	alldepart:any;
246 239
 	getDeparts(dept?) {
@@ -259,7 +252,7 @@ export class DistributionDepartmentSourceStatisticsComponent implements OnInit,
259 252
 	      this.alldepart = data.list;
260 253
 	    });
261 254
 	}
262
-	
255
+
263 256
   // 防抖
264 257
   isLoading = false;
265 258
   searchTimer(fun, e) {

+ 2 - 0
src/app/views/new-statistics/distribution-inspection-statistics/distribution-department-source-statistics/distribution-department-source-statistics.module.ts

@@ -5,6 +5,7 @@ import { CommonModule } from '@angular/common';
5 5
 import { DistributionDepartmentSourceStatisticsRoutingModule } from './distribution-department-source-statistics-routing.module';
6 6
 import { ShareModule } from 'src/app/share/share.module';
7 7
 import { DistributionSearchMoreModule } from '../../components/distribution-search-more/distribution-search-more.module';
8
+import { CustomChangeDateModule } from '../../components/custom-change-date/custom-change-date.module';
8 9
 
9 10
 
10 11
 @NgModule({
@@ -16,6 +17,7 @@ import { DistributionSearchMoreModule } from '../../components/distribution-sear
16 17
     DistributionDepartmentSourceStatisticsRoutingModule,
17 18
     ShareModule,
18 19
     DistributionSearchMoreModule,
20
+    CustomChangeDateModule,
19 21
   ]
20 22
 })
21 23
 export class DistributionDepartmentSourceStatisticsModule { }

+ 1 - 1
src/app/views/new-statistics/distribution-inspection-statistics/distribution-user-evaluate-statistics/distribution-user-evaluate-statistics.component.html

@@ -30,7 +30,7 @@
30 30
 <nz-table class="table" [nzData]="listOfData" nzSize="middle" [nzShowPagination]="false" [nzLoading]="loading1" [nzScroll]="{ y: tableHeight + 'px' }" [nzFooter]="footerTpl">
31 31
   <thead (nzSortChange)="sort($event)" nzSingleSort>
32 32
     <tr>
33
-      <th nzWidth="12%">人员姓名(工号)</th>
33
+      <th nzWidth="12%">人员(编码)</th>
34 34
       <th nzWidth="11%" nzShowSort nzSortKey="totalCount" [(nzSort)]="sortCurrent.totalCount">工单数量</th>
35 35
       <th nzWidth="11%" nzShowSort nzSortKey="evaCount" [(nzSort)]="sortCurrent.evaCount">评价总工单数</th>
36 36
       <th nzWidth="11%" nzShowSort nzSortKey="eva1" [(nzSort)]="sortCurrent.eva1">一星评价数</th>

+ 1 - 5
src/app/views/new-statistics/distribution-inspection-statistics/source-statistics/source-statistics.component.html

@@ -1,10 +1,6 @@
1 1
 <div class="searchDataWrap">
2 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>
3
+    <app-custom-change-date #customChangeDate [isShowType]="false"></app-custom-change-date>
8 4
     <div class="searchDataItem">
9 5
       <span class="label">科室</span>
10 6
       <nz-select class="selectItem" [nzDropdownMatchSelectWidth]="false" nzServerSearch nzShowSearch (nzOnSearch)="changeDeptInp($event)" nzAllowClear nzPlaceHolder="请选择科室" [(ngModel)]="deptId" (nzOpenChange)="openChangeDept($event)">

+ 1 - 1
src/app/views/new-statistics/distribution-inspection-statistics/source-statistics/source-statistics.component.less

@@ -27,7 +27,7 @@
27 27
           font-size: 16px;
28 28
         }
29 29
         .selectItem{
30
-          width: 224px;
30
+          width: 160px;
31 31
         }
32 32
       }
33 33
     }

+ 16 - 23
src/app/views/new-statistics/distribution-inspection-statistics/source-statistics/source-statistics.component.ts

@@ -2,16 +2,17 @@ import { TabService } from './../../services/tab.service';
2 2
 import { debounceTime } from 'rxjs/operators';
3 3
 import { Subject } from 'rxjs';
4 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";
5
+import { Component, OnInit, HostListener, AfterViewInit, ViewChild } from "@angular/core";
7 6
 import { MainService } from 'src/app/services/main.service';
8 7
 import { ActivatedRoute } from '@angular/router';
8
+import { CustomChangeDateComponent } from '../../components/custom-change-date/custom-change-date.component';
9 9
 @Component({
10 10
   selector: "app-source-statistics",
11 11
   templateUrl: "./source-statistics.component.html",
12 12
   styleUrls: ["./source-statistics.component.less"],
13 13
 })
14 14
 export class SourceStatisticsComponent implements OnInit, AfterViewInit {
15
+  @ViewChild('customChangeDate', { static: false }) customChangeDateComponent!: CustomChangeDateComponent;
15 16
   constructor(
16 17
     private mainService: MainService,
17 18
     private message: NzMessageService,
@@ -34,12 +35,14 @@ export class SourceStatisticsComponent implements OnInit, AfterViewInit {
34 35
       let fun = v[0];
35 36
       fun.call(this, v[1]);
36 37
     });
37
-    this.initSessionData();
38
-    this.getQueryParams();
39
-    this.search();
40 38
   }
41 39
 
42 40
   ngAfterViewInit(){
41
+    this.initSessionData();
42
+    this.getQueryParams();
43
+    setTimeout(() => {
44
+      this.search();
45
+    }, 0)
43 46
     this.onResize();
44 47
   }
45 48
 
@@ -57,6 +60,7 @@ export class SourceStatisticsComponent implements OnInit, AfterViewInit {
57 60
     this.tabService.clearQueryParams();
58 61
     if(queryParams.dateRange){
59 62
       this.dateRange = queryParams.dateRange;
63
+      this.customChangeDateComponent.initByDate(this.dateRange);
60 64
     }
61 65
   }
62 66
 
@@ -113,8 +117,8 @@ export class SourceStatisticsComponent implements OnInit, AfterViewInit {
113 117
     let postData:any = {
114 118
       idx: this.pageIndex - 1,
115 119
       sum: this.pageSize,
116
-      startDate: this.dateRange[0] || undefined,
117
-      endDate: this.dateRange[1] || undefined,
120
+      startDate: this.customChangeDateComponent.startDate || undefined,
121
+      endDate: this.customChangeDateComponent.endDate || undefined,
118 122
       hosId: this.getHosId,
119 123
       deptId: this.deptId || undefined,
120 124
       groupId: this.fieldConfig.fields.userId ? undefined : (this.fieldConfig.fields.groupId || undefined),
@@ -154,19 +158,7 @@ export class SourceStatisticsComponent implements OnInit, AfterViewInit {
154 158
   }
155 159
 
156 160
   // 日期选择
157
-  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')];
158
-  changeDate(result?): void {
159
-    result[0] = format(startOfDay(result[0]), 'yyyy-MM-dd HH:mm:ss');
160
-    result[1] = format(endOfDay(result[1]), 'yyyy-MM-dd HH:mm:ss');
161
-    this.dateRange = result;
162
-  }
163
-
164
-  onCalendarChangeDate(dateArr){
165
-    console.log(dateArr)
166
-    if(dateArr.length == 2){
167
-      this.dateRange = [format(startOfDay(dateArr[0]), 'yyyy-MM-dd HH:mm:ss'), format(endOfDay(dateArr[1]), 'yyyy-MM-dd HH:mm:ss')];
168
-    }
169
-  }
161
+  dateRange: any = [];
170 162
 
171 163
   // 导出
172 164
   excelExportLoading:any = false;
@@ -175,8 +167,8 @@ export class SourceStatisticsComponent implements OnInit, AfterViewInit {
175 167
       nzDuration: 0,
176 168
     }).messageId;
177 169
     let postData:any = {
178
-      startDate: this.dateRange[0] || undefined,
179
-      endDate: this.dateRange[1] || undefined,
170
+      startDate: this.customChangeDateComponent.startDate || undefined,
171
+      endDate: this.customChangeDateComponent.endDate || undefined,
180 172
       hosId: this.getHosId,
181 173
       deptId: this.deptId || undefined,
182 174
       groupId: this.fieldConfig.fields.userId ? undefined : (this.fieldConfig.fields.groupId || undefined),
@@ -216,9 +208,10 @@ export class SourceStatisticsComponent implements OnInit, AfterViewInit {
216 208
     this.sortCurrentKey = "";
217 209
 		this.sortCurrentValue = "";
218 210
 		this.sortCurrent = {};
219
-    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')]
211
+    this.dateRange = []
220 212
     this.deptId = undefined;
221 213
     this.fieldConfig.fields = {groupId: undefined, userId: undefined, taskTypeId: undefined, buildingId: undefined, statisticsTypeId: undefined};
214
+    this.customChangeDateComponent.resetByDate();
222 215
     this.search();
223 216
   }
224 217
 

+ 2 - 0
src/app/views/new-statistics/distribution-inspection-statistics/source-statistics/source-statistics.module.ts

@@ -5,6 +5,7 @@ import { CommonModule } from '@angular/common';
5 5
 import { SourceStatisticsRoutingModule } from './source-statistics-routing.module';
6 6
 import { ShareModule } from 'src/app/share/share.module';
7 7
 import { DistributionSearchMoreModule } from '../../components/distribution-search-more/distribution-search-more.module';
8
+import { CustomChangeDateModule } from '../../components/custom-change-date/custom-change-date.module';
8 9
 
9 10
 
10 11
 @NgModule({
@@ -16,6 +17,7 @@ import { DistributionSearchMoreModule } from '../../components/distribution-sear
16 17
     SourceStatisticsRoutingModule,
17 18
     ShareModule,
18 19
     DistributionSearchMoreModule,
20
+    CustomChangeDateModule,
19 21
   ]
20 22
 })
21 23
 export class SourceStatisticsModule { }

+ 1 - 5
src/app/views/new-statistics/distribution-inspection-statistics/user-business-statistics/user-business-statistics.component.html

@@ -1,10 +1,6 @@
1 1
 <div class="searchDataWrap">
2 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>
3
+    <app-custom-change-date #customChangeDate [isShowType]="false"></app-custom-change-date>
8 4
     <div class="searchDataItem">
9 5
       <span class="label">人员</span>
10 6
       <nz-select class="selectItem" [nzDropdownMatchSelectWidth]="false" nzServerSearch nzShowSearch (nzOnSearch)="changeUserInp($event)" nzAllowClear nzPlaceHolder="请选择人员" [(ngModel)]="userId" (nzOpenChange)="openChangeUser($event)">

+ 1 - 1
src/app/views/new-statistics/distribution-inspection-statistics/user-business-statistics/user-business-statistics.component.less

@@ -27,7 +27,7 @@
27 27
           font-size: 16px;
28 28
         }
29 29
         .selectItem{
30
-          width: 224px;
30
+          width: 160px;
31 31
         }
32 32
       }
33 33
     }

+ 16 - 23
src/app/views/new-statistics/distribution-inspection-statistics/user-business-statistics/user-business-statistics.component.ts

@@ -2,17 +2,18 @@ import { TabService } from './../../services/tab.service';
2 2
 import { debounceTime } from 'rxjs/operators';
3 3
 import { Subject } from 'rxjs';
4 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";
5
+import { Component, OnInit, HostListener, AfterViewInit, ViewChild } from "@angular/core";
7 6
 import { MainService } from 'src/app/services/main.service';
8 7
 import { ActivatedRoute } from '@angular/router';
9 8
 import cloneDeep from 'lodash-es/cloneDeep'
9
+import { CustomChangeDateComponent } from '../../components/custom-change-date/custom-change-date.component';
10 10
 @Component({
11 11
   selector: "app-user-business-statistics",
12 12
   templateUrl: "./user-business-statistics.component.html",
13 13
   styleUrls: ["./user-business-statistics.component.less"],
14 14
 })
15 15
 export class UserBusinessStatisticsComponent implements OnInit, AfterViewInit {
16
+  @ViewChild('customChangeDate', { static: false }) customChangeDateComponent!: CustomChangeDateComponent;
16 17
   constructor(
17 18
     private mainService: MainService,
18 19
     private message: NzMessageService,
@@ -36,12 +37,14 @@ export class UserBusinessStatisticsComponent implements OnInit, AfterViewInit {
36 37
       let fun = v[0];
37 38
       fun.call(this, v[1]);
38 39
     });
39
-    this.initSessionData();
40
-    this.getQueryParams();
41
-    this.search();
42 40
   }
43 41
 
44 42
   ngAfterViewInit(){
43
+    this.initSessionData();
44
+    this.getQueryParams();
45
+    setTimeout(() => {
46
+      this.search();
47
+    }, 0)
45 48
     this.onResize();
46 49
   }
47 50
 
@@ -59,6 +62,7 @@ export class UserBusinessStatisticsComponent implements OnInit, AfterViewInit {
59 62
     this.tabService.clearQueryParams();
60 63
     if(queryParams.dateRange){
61 64
       this.dateRange = queryParams.dateRange;
65
+      this.customChangeDateComponent.initByDate(this.dateRange);
62 66
     }
63 67
   }
64 68
 
@@ -123,8 +127,8 @@ export class UserBusinessStatisticsComponent implements OnInit, AfterViewInit {
123 127
       let postData:any = {
124 128
         idx: this.pageIndex - 1,
125 129
         sum: this.pageSize,
126
-        startDate: this.dateRange[0] || undefined,
127
-        endDate: this.dateRange[1] || undefined,
130
+        startDate: this.customChangeDateComponent.startDate || undefined,
131
+        endDate: this.customChangeDateComponent.endDate || undefined,
128 132
         hosId: this.getHosId,
129 133
         buildingId: this.fieldConfig.fields.buildingId || undefined,
130 134
         groupId: this.fieldConfig.fields.groupId || undefined,
@@ -163,19 +167,7 @@ export class UserBusinessStatisticsComponent implements OnInit, AfterViewInit {
163 167
   }
164 168
 
165 169
   // 日期选择
166
-  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')];
167
-  changeDate(result?): void {
168
-    result[0] = format(startOfDay(result[0]), 'yyyy-MM-dd HH:mm:ss');
169
-    result[1] = format(endOfDay(result[1]), 'yyyy-MM-dd HH:mm:ss');
170
-    this.dateRange = result;
171
-  }
172
-
173
-  onCalendarChangeDate(dateArr){
174
-    console.log(dateArr)
175
-    if(dateArr.length == 2){
176
-      this.dateRange = [format(startOfDay(dateArr[0]), 'yyyy-MM-dd HH:mm:ss'), format(endOfDay(dateArr[1]), 'yyyy-MM-dd HH:mm:ss')];
177
-    }
178
-  }
170
+  dateRange: any = [];
179 171
 
180 172
   // 导出
181 173
   excelExportLoading:any = false;
@@ -184,8 +176,8 @@ export class UserBusinessStatisticsComponent implements OnInit, AfterViewInit {
184 176
       nzDuration: 0,
185 177
     }).messageId;
186 178
     let postData:any = {
187
-      startDate: this.dateRange[0] || undefined,
188
-      endDate: this.dateRange[1] || undefined,
179
+      startDate: this.customChangeDateComponent.startDate || undefined,
180
+      endDate: this.customChangeDateComponent.endDate || undefined,
189 181
       hosId: this.getHosId,
190 182
       buildingId: this.fieldConfig.fields.buildingId || undefined,
191 183
       groupId: this.fieldConfig.fields.groupId || undefined,
@@ -223,9 +215,10 @@ export class UserBusinessStatisticsComponent implements OnInit, AfterViewInit {
223 215
     this.sortCurrentKey = "";
224 216
 		this.sortCurrentValue = "";
225 217
 		this.sortCurrent = {};
226
-    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')]
218
+    this.dateRange = []
227 219
     this.userId = undefined;
228 220
     this.fieldConfig.fields = {buildingId: undefined, deptId: undefined, groupId: undefined};
221
+    this.customChangeDateComponent.resetByDate();
229 222
     this.search();
230 223
   }
231 224
 

+ 2 - 0
src/app/views/new-statistics/distribution-inspection-statistics/user-business-statistics/user-business-statistics.module.ts

@@ -6,6 +6,7 @@ import { UserBusinessStatisticsRoutingModule } from './user-business-statistics-
6 6
 import { ShareModule } from 'src/app/share/share.module';
7 7
 import { VirtualScrollerModule } from 'ngx-virtual-scroller';
8 8
 import { DistributionSearchMoreModule } from '../../components/distribution-search-more/distribution-search-more.module';
9
+import { CustomChangeDateModule } from '../../components/custom-change-date/custom-change-date.module';
9 10
 
10 11
 
11 12
 @NgModule({
@@ -18,6 +19,7 @@ import { DistributionSearchMoreModule } from '../../components/distribution-sear
18 19
     ShareModule,
19 20
     VirtualScrollerModule,
20 21
     DistributionSearchMoreModule,
22
+    CustomChangeDateModule,
21 23
   ]
22 24
 })
23 25
 export class UserBusinessStatisticsModule { }

+ 1 - 5
src/app/views/new-statistics/distribution-inspection-statistics/user-quality-control-statistics/user-quality-control-statistics.component.html

@@ -1,10 +1,6 @@
1 1
 <div class="searchDataWrap">
2 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>
3
+    <app-custom-change-date #customChangeDate [isShowType]="false"></app-custom-change-date>
8 4
     <div class="searchDataItem">
9 5
       <span class="label">人员</span>
10 6
       <nz-select class="selectItem" [nzDropdownMatchSelectWidth]="false" nzServerSearch nzShowSearch (nzOnSearch)="changeUserInp($event)" nzAllowClear nzPlaceHolder="请选择人员" [(ngModel)]="userId" (nzOpenChange)="openChangeUser($event)">

+ 1 - 1
src/app/views/new-statistics/distribution-inspection-statistics/user-quality-control-statistics/user-quality-control-statistics.component.less

@@ -27,7 +27,7 @@
27 27
           font-size: 16px;
28 28
         }
29 29
         .selectItem{
30
-          width: 224px;
30
+          width: 160px;
31 31
         }
32 32
       }
33 33
     }

+ 16 - 23
src/app/views/new-statistics/distribution-inspection-statistics/user-quality-control-statistics/user-quality-control-statistics.component.ts

@@ -2,16 +2,17 @@ import { TabService } from './../../services/tab.service';
2 2
 import { debounceTime } from 'rxjs/operators';
3 3
 import { Subject } from 'rxjs';
4 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";
5
+import { Component, OnInit, HostListener, AfterViewInit, ViewChild } from "@angular/core";
7 6
 import { MainService } from 'src/app/services/main.service';
8 7
 import { ActivatedRoute } from '@angular/router';
8
+import { CustomChangeDateComponent } from '../../components/custom-change-date/custom-change-date.component';
9 9
 @Component({
10 10
   selector: "app-user-quality-control-statistics",
11 11
   templateUrl: "./user-quality-control-statistics.component.html",
12 12
   styleUrls: ["./user-quality-control-statistics.component.less"],
13 13
 })
14 14
 export class UserQualityControlStatisticsComponent implements OnInit, AfterViewInit {
15
+  @ViewChild('customChangeDate', { static: false }) customChangeDateComponent!: CustomChangeDateComponent;
15 16
   constructor(
16 17
     private mainService: MainService,
17 18
     private message: NzMessageService,
@@ -34,12 +35,14 @@ export class UserQualityControlStatisticsComponent implements OnInit, AfterViewI
34 35
       let fun = v[0];
35 36
       fun.call(this, v[1]);
36 37
     });
37
-    this.initSessionData();
38
-    this.getQueryParams();
39
-    this.search();
40 38
   }
41 39
 
42 40
   ngAfterViewInit(){
41
+    this.initSessionData();
42
+    this.getQueryParams();
43
+    setTimeout(() => {
44
+      this.search();
45
+    }, 0)
43 46
     this.onResize();
44 47
   }
45 48
 
@@ -57,6 +60,7 @@ export class UserQualityControlStatisticsComponent implements OnInit, AfterViewI
57 60
     this.tabService.clearQueryParams();
58 61
     if(queryParams.dateRange){
59 62
       this.dateRange = queryParams.dateRange;
63
+      this.customChangeDateComponent.initByDate(this.dateRange);
60 64
     }
61 65
   }
62 66
 
@@ -113,8 +117,8 @@ export class UserQualityControlStatisticsComponent implements OnInit, AfterViewI
113 117
     let postData:any = {
114 118
       idx: this.pageIndex - 1,
115 119
       sum: this.pageSize,
116
-      startDate: this.dateRange[0] || undefined,
117
-      endDate: this.dateRange[1] || undefined,
120
+      startDate: this.customChangeDateComponent.startDate || undefined,
121
+      endDate: this.customChangeDateComponent.endDate || undefined,
118 122
       hosId: this.getHosId,
119 123
       userId: this.userId || undefined,
120 124
       buildingId: this.fieldConfig.fields.buildingId || undefined,
@@ -152,19 +156,7 @@ export class UserQualityControlStatisticsComponent implements OnInit, AfterViewI
152 156
   }
153 157
 
154 158
   // 日期选择
155
-  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')];
156
-  changeDate(result?): void {
157
-    result[0] = format(startOfDay(result[0]), 'yyyy-MM-dd HH:mm:ss');
158
-    result[1] = format(endOfDay(result[1]), 'yyyy-MM-dd HH:mm:ss');
159
-    this.dateRange = result;
160
-  }
161
-
162
-  onCalendarChangeDate(dateArr){
163
-    console.log(dateArr)
164
-    if(dateArr.length == 2){
165
-      this.dateRange = [format(startOfDay(dateArr[0]), 'yyyy-MM-dd HH:mm:ss'), format(endOfDay(dateArr[1]), 'yyyy-MM-dd HH:mm:ss')];
166
-    }
167
-  }
159
+  dateRange: any = [];
168 160
 
169 161
   // 导出
170 162
   excelExportLoading:any = false;
@@ -173,8 +165,8 @@ export class UserQualityControlStatisticsComponent implements OnInit, AfterViewI
173 165
       nzDuration: 0,
174 166
     }).messageId;
175 167
     let postData:any = {
176
-      startDate: this.dateRange[0] || undefined,
177
-      endDate: this.dateRange[1] || undefined,
168
+      startDate: this.customChangeDateComponent.startDate || undefined,
169
+      endDate: this.customChangeDateComponent.endDate || undefined,
178 170
       hosId: this.getHosId,
179 171
       userId: this.userId || undefined,
180 172
       buildingId: this.fieldConfig.fields.buildingId || undefined,
@@ -212,9 +204,10 @@ export class UserQualityControlStatisticsComponent implements OnInit, AfterViewI
212 204
     this.sortCurrentKey = "";
213 205
 		this.sortCurrentValue = "";
214 206
 		this.sortCurrent = {};
215
-    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')]
207
+    this.dateRange = []
216 208
     this.userId = undefined;
217 209
     this.fieldConfig.fields = {buildingId: undefined, deptId: undefined, groupId: undefined};
210
+    this.customChangeDateComponent.resetByDate();
218 211
     this.search();
219 212
   }
220 213
 

+ 2 - 0
src/app/views/new-statistics/distribution-inspection-statistics/user-quality-control-statistics/user-quality-control-statistics.module.ts

@@ -5,6 +5,7 @@ import { CommonModule } from '@angular/common';
5 5
 import { UserQualityControlStatisticsRoutingModule } from './user-quality-control-statistics-routing.module';
6 6
 import { ShareModule } from 'src/app/share/share.module';
7 7
 import { DistributionSearchMoreModule } from '../../components/distribution-search-more/distribution-search-more.module';
8
+import { CustomChangeDateModule } from '../../components/custom-change-date/custom-change-date.module';
8 9
 
9 10
 
10 11
 @NgModule({
@@ -16,6 +17,7 @@ import { DistributionSearchMoreModule } from '../../components/distribution-sear
16 17
     UserQualityControlStatisticsRoutingModule,
17 18
     ShareModule,
18 19
     DistributionSearchMoreModule,
20
+    CustomChangeDateModule,
19 21
   ]
20 22
 })
21 23
 export class UserQualityControlStatisticsModule { }

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

@@ -1,10 +1,6 @@
1 1
 <div class="searchDataWrap">
2 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>
3
+    <app-custom-change-date #customChangeDate [isShowType]="false"></app-custom-change-date>
8 4
   </div>
9 5
   <div class="operation">
10 6
     <i class="icon_transport transport-gengduo" nz-tooltip nzTooltipTitle="更多搜索" (click)="showMore()"></i>

+ 1 - 1
src/app/views/new-statistics/maintenance-statistics/building-statistics/building-statistics.component.less

@@ -27,7 +27,7 @@
27 27
           font-size: 16px;
28 28
         }
29 29
         .selectItem{
30
-          width: 224px;
30
+          width: 160px;
31 31
         }
32 32
       }
33 33
     }

+ 17 - 25
src/app/views/new-statistics/maintenance-statistics/building-statistics/building-statistics.component.ts

@@ -1,15 +1,16 @@
1 1
 import { TabService } from './../../services/tab.service';
2 2
 import { NzMessageService } from 'ng-zorro-antd/message';
3
-import { format, addMonths, startOfMonth, endOfMonth, startOfDay, endOfDay } from 'date-fns';
4
-import { Component, OnInit, HostListener, AfterViewInit } from "@angular/core";
3
+import { Component, OnInit, HostListener, AfterViewInit, ViewChild } from "@angular/core";
5 4
 import { MainService } from 'src/app/services/main.service';
6 5
 import { ActivatedRoute } from '@angular/router';
6
+import { CustomChangeDateComponent } from '../../components/custom-change-date/custom-change-date.component';
7 7
 @Component({
8 8
   selector: "app-building-statistics",
9 9
   templateUrl: "./building-statistics.component.html",
10 10
   styleUrls: ["./building-statistics.component.less"],
11 11
 })
12 12
 export class BuildingStatisticsComponent implements OnInit, AfterViewInit {
13
+  @ViewChild('customChangeDate', { static: false }) customChangeDateComponent!: CustomChangeDateComponent;
13 14
   constructor(
14 15
     private mainService: MainService,
15 16
     private message: NzMessageService,
@@ -23,13 +24,14 @@ export class BuildingStatisticsComponent implements OnInit, AfterViewInit {
23 24
   pageSize: number = 30; //表格每页展示条数
24 25
   listLength: number = 0; //表格总数据量
25 26
 
26
-  ngOnInit() {
27
-    this.initSessionData();
28
-    this.getQueryParams();
29
-    this.search();
30
-  }
27
+  ngOnInit() {}
31 28
 
32 29
   ngAfterViewInit(){
30
+    this.initSessionData();
31
+    this.getQueryParams();
32
+    setTimeout(() => {
33
+      this.search();
34
+    }, 0)
33 35
     this.onResize();
34 36
   }
35 37
 
@@ -47,6 +49,7 @@ export class BuildingStatisticsComponent implements OnInit, AfterViewInit {
47 49
     this.tabService.clearQueryParams();
48 50
     if(queryParams.dateRange){
49 51
       this.dateRange = queryParams.dateRange;
52
+      this.customChangeDateComponent.initByDate(this.dateRange);
50 53
     }
51 54
   }
52 55
 
@@ -103,8 +106,8 @@ export class BuildingStatisticsComponent implements OnInit, AfterViewInit {
103 106
     let postData:any = {
104 107
       idx: this.pageIndex - 1,
105 108
       sum: this.pageSize,
106
-      startDate: this.dateRange[0] || undefined,
107
-      endDate: this.dateRange[1] || undefined,
109
+      startDate: this.customChangeDateComponent.startDate || undefined,
110
+      endDate: this.customChangeDateComponent.endDate || undefined,
108 111
       hosId: this.hosId || undefined,
109 112
       dutyId: this.dutyId || undefined,
110 113
       parentDutyId: this.parentDutyId || undefined,
@@ -142,19 +145,7 @@ export class BuildingStatisticsComponent implements OnInit, AfterViewInit {
142 145
   }
143 146
 
144 147
   // 日期选择
145
-  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')];
146
-  changeDate(result?): void {
147
-    result[0] = format(startOfDay(result[0]), 'yyyy-MM-dd HH:mm:ss');
148
-    result[1] = format(endOfDay(result[1]), 'yyyy-MM-dd HH:mm:ss');
149
-    this.dateRange = result;
150
-  }
151
-
152
-  onCalendarChangeDate(dateArr){
153
-    console.log(dateArr)
154
-    if(dateArr.length == 2){
155
-      this.dateRange = [format(startOfDay(dateArr[0]), 'yyyy-MM-dd HH:mm:ss'), format(endOfDay(dateArr[1]), 'yyyy-MM-dd HH:mm:ss')];
156
-    }
157
-  }
148
+  dateRange: any = [];
158 149
 
159 150
   // 导出
160 151
   excelExportLoading:any = false;
@@ -163,8 +154,8 @@ export class BuildingStatisticsComponent implements OnInit, AfterViewInit {
163 154
       nzDuration: 0,
164 155
     }).messageId;
165 156
     let postData:any = {
166
-      startDate: this.dateRange[0] || undefined,
167
-      endDate: this.dateRange[1] || undefined,
157
+      startDate: this.customChangeDateComponent.startDate || undefined,
158
+      endDate: this.customChangeDateComponent.endDate || undefined,
168 159
       hosId: this.hosId || undefined,
169 160
       dutyId: this.dutyId || undefined,
170 161
       parentDutyId: this.parentDutyId || undefined,
@@ -202,8 +193,9 @@ export class BuildingStatisticsComponent implements OnInit, AfterViewInit {
202 193
     this.sortCurrentKey = "";
203 194
 		this.sortCurrentValue = "";
204 195
 		this.sortCurrent = {};
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')]
196
+    this.dateRange = []
206 197
     this.fieldConfig.fields = {category123: true};
198
+    this.customChangeDateComponent.resetByDate();
207 199
     this.search();
208 200
   }
209 201
 

+ 2 - 0
src/app/views/new-statistics/maintenance-statistics/building-statistics/building-statistics.module.ts

@@ -5,6 +5,7 @@ import { CommonModule } from '@angular/common';
5 5
 import { BuildingStatisticsRoutingModule } from './building-statistics-routing.module';
6 6
 import { ShareModule } from 'src/app/share/share.module';
7 7
 import { SearchMoreModule } from '../../components/search-more/search-more.module';
8
+import { CustomChangeDateModule } from '../../components/custom-change-date/custom-change-date.module';
8 9
 
9 10
 
10 11
 @NgModule({
@@ -16,6 +17,7 @@ import { SearchMoreModule } from '../../components/search-more/search-more.modul
16 17
     BuildingStatisticsRoutingModule,
17 18
     ShareModule,
18 19
     SearchMoreModule,
20
+    CustomChangeDateModule,
19 21
   ]
20 22
 })
21 23
 export class BuildingStatisticsModule { }

+ 1 - 5
src/app/views/new-statistics/maintenance-statistics/category-one-statistics/category-one-statistics.component.html

@@ -1,10 +1,6 @@
1 1
 <div class="searchDataWrap">
2 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>
3
+    <app-custom-change-date #customChangeDate [isShowType]="false"></app-custom-change-date>
8 4
   </div>
9 5
   <div class="operation">
10 6
     <i class="icon_transport transport-gengduo" nz-tooltip nzTooltipTitle="更多搜索" (click)="showMore()"></i>

+ 1 - 1
src/app/views/new-statistics/maintenance-statistics/category-one-statistics/category-one-statistics.component.less

@@ -27,7 +27,7 @@
27 27
           font-size: 16px;
28 28
         }
29 29
         .selectItem{
30
-          width: 224px;
30
+          width: 160px;
31 31
         }
32 32
       }
33 33
     }

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

@@ -1,15 +1,16 @@
1 1
 import { TabService } from './../../services/tab.service';
2 2
 import { NzMessageService } from 'ng-zorro-antd/message';
3
-import { format, addMonths, startOfMonth, endOfMonth, startOfDay, endOfDay } from 'date-fns';
4
-import { Component, OnInit, HostListener, AfterViewInit } from "@angular/core";
3
+import { Component, OnInit, HostListener, AfterViewInit, ViewChild } from "@angular/core";
5 4
 import { MainService } from 'src/app/services/main.service';
6 5
 import { ActivatedRoute } from '@angular/router';
6
+import { CustomChangeDateComponent } from '../../components/custom-change-date/custom-change-date.component';
7 7
 @Component({
8 8
   selector: "app-category-one-statistics",
9 9
   templateUrl: "./category-one-statistics.component.html",
10 10
   styleUrls: ["./category-one-statistics.component.less"],
11 11
 })
12 12
 export class CategoryOneStatisticsComponent implements OnInit, AfterViewInit {
13
+  @ViewChild('customChangeDate', { static: false }) customChangeDateComponent!: CustomChangeDateComponent;
13 14
   constructor(
14 15
     private mainService: MainService,
15 16
     private message: NzMessageService,
@@ -23,13 +24,14 @@ export class CategoryOneStatisticsComponent implements OnInit, AfterViewInit {
23 24
   pageSize: number = 30; //表格每页展示条数
24 25
   listLength: number = 0; //表格总数据量
25 26
 
26
-  ngOnInit() {
27
-    this.initSessionData();
28
-    this.getQueryParams();
29
-    this.search();
30
-  }
27
+  ngOnInit() {}
31 28
 
32 29
   ngAfterViewInit(){
30
+    this.initSessionData();
31
+    this.getQueryParams();
32
+    setTimeout(() => {
33
+      this.search();
34
+    }, 0)
33 35
     this.onResize();
34 36
   }
35 37
 
@@ -47,6 +49,7 @@ export class CategoryOneStatisticsComponent implements OnInit, AfterViewInit {
47 49
     this.tabService.clearQueryParams();
48 50
     if(queryParams.dateRange){
49 51
       this.dateRange = queryParams.dateRange;
52
+      this.customChangeDateComponent.initByDate(this.dateRange);
50 53
     }
51 54
   }
52 55
 
@@ -103,8 +106,8 @@ export class CategoryOneStatisticsComponent implements OnInit, AfterViewInit {
103 106
     let postData:any = {
104 107
       idx: this.pageIndex - 1,
105 108
       sum: this.pageSize,
106
-      startDate: this.dateRange[0] || undefined,
107
-      endDate: this.dateRange[1] || undefined,
109
+      startDate: this.customChangeDateComponent.startDate || undefined,
110
+      endDate: this.customChangeDateComponent.endDate || undefined,
108 111
       hosId: this.hosId || undefined,
109 112
       dutyId: this.dutyId || undefined,
110 113
       parentDutyId: this.parentDutyId || undefined,
@@ -147,19 +150,7 @@ export class CategoryOneStatisticsComponent implements OnInit, AfterViewInit {
147 150
   }
148 151
 
149 152
   // 日期选择
150
-  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')];
151
-  changeDate(result?): void {
152
-    result[0] = format(startOfDay(result[0]), 'yyyy-MM-dd HH:mm:ss');
153
-    result[1] = format(endOfDay(result[1]), 'yyyy-MM-dd HH:mm:ss');
154
-    this.dateRange = result;
155
-  }
156
-
157
-  onCalendarChangeDate(dateArr){
158
-    console.log(dateArr)
159
-    if(dateArr.length == 2){
160
-      this.dateRange = [format(startOfDay(dateArr[0]), 'yyyy-MM-dd HH:mm:ss'), format(endOfDay(dateArr[1]), 'yyyy-MM-dd HH:mm:ss')];
161
-    }
162
-  }
153
+  dateRange: any = [];
163 154
 
164 155
   // 导出
165 156
   excelExportLoading:any = false;
@@ -168,8 +159,8 @@ export class CategoryOneStatisticsComponent implements OnInit, AfterViewInit {
168 159
       nzDuration: 0,
169 160
     }).messageId;
170 161
     let postData:any = {
171
-      startDate: this.dateRange[0] || undefined,
172
-      endDate: this.dateRange[1] || undefined,
162
+      startDate: this.customChangeDateComponent.startDate || undefined,
163
+      endDate: this.customChangeDateComponent.endDate || undefined,
173 164
       hosId: this.hosId || undefined,
174 165
       dutyId: this.dutyId || undefined,
175 166
       parentDutyId: this.parentDutyId || undefined,
@@ -212,8 +203,9 @@ export class CategoryOneStatisticsComponent implements OnInit, AfterViewInit {
212 203
     this.sortCurrentKey = "";
213 204
 		this.sortCurrentValue = "";
214 205
 		this.sortCurrent = {};
215
-    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')]
206
+    this.dateRange = []
216 207
     this.fieldConfig.fields = {groupId: undefined, userId: undefined, buildingId: undefined, floorId: undefined, companyId: undefined, repairDeptId: undefined};
208
+    this.customChangeDateComponent.resetByDate();
217 209
     this.search();
218 210
   }
219 211
 

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

@@ -5,6 +5,7 @@ import { CommonModule } from '@angular/common';
5 5
 import { CategoryOneStatisticsRoutingModule } from './category-one-statistics-routing.module';
6 6
 import { ShareModule } from 'src/app/share/share.module';
7 7
 import { SearchMoreModule } from '../../components/search-more/search-more.module';
8
+import { CustomChangeDateModule } from '../../components/custom-change-date/custom-change-date.module';
8 9
 
9 10
 
10 11
 @NgModule({
@@ -16,6 +17,7 @@ import { SearchMoreModule } from '../../components/search-more/search-more.modul
16 17
     CategoryOneStatisticsRoutingModule,
17 18
     ShareModule,
18 19
     SearchMoreModule,
20
+    CustomChangeDateModule,
19 21
   ]
20 22
 })
21 23
 export class CategoryOneStatisticsModule { }

+ 1 - 5
src/app/views/new-statistics/maintenance-statistics/category-source-statistics/category-source-statistics.component.html

@@ -1,10 +1,6 @@
1 1
 <div class="searchDataWrap">
2 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>
3
+    <app-custom-change-date #customChangeDate [isShowType]="false"></app-custom-change-date>
8 4
   </div>
9 5
   <div class="operation">
10 6
     <i class="icon_transport transport-gengduo" nz-tooltip nzTooltipTitle="更多搜索" (click)="showMore()"></i>

+ 1 - 1
src/app/views/new-statistics/maintenance-statistics/category-source-statistics/category-source-statistics.component.less

@@ -27,7 +27,7 @@
27 27
           font-size: 16px;
28 28
         }
29 29
         .selectItem{
30
-          width: 224px;
30
+          width: 160px;
31 31
         }
32 32
       }
33 33
     }

+ 17 - 25
src/app/views/new-statistics/maintenance-statistics/category-source-statistics/category-source-statistics.component.ts

@@ -1,15 +1,16 @@
1 1
 import { TabService } from './../../services/tab.service';
2 2
 import { NzMessageService } from 'ng-zorro-antd/message';
3
-import { format, addMonths, startOfMonth, endOfMonth, startOfDay, endOfDay } from 'date-fns';
4
-import { Component, OnInit, HostListener, AfterViewInit } from "@angular/core";
3
+import { Component, OnInit, HostListener, AfterViewInit, ViewChild } from "@angular/core";
5 4
 import { MainService } from 'src/app/services/main.service';
6 5
 import { ActivatedRoute } from '@angular/router';
6
+import { CustomChangeDateComponent } from '../../components/custom-change-date/custom-change-date.component';
7 7
 @Component({
8 8
   selector: "app-category-source-statistics",
9 9
   templateUrl: "./category-source-statistics.component.html",
10 10
   styleUrls: ["./category-source-statistics.component.less"],
11 11
 })
12 12
 export class CategorySourceStatisticsComponent implements OnInit, AfterViewInit {
13
+  @ViewChild('customChangeDate', { static: false }) customChangeDateComponent!: CustomChangeDateComponent;
13 14
   constructor(
14 15
     private mainService: MainService,
15 16
     private message: NzMessageService,
@@ -23,13 +24,14 @@ export class CategorySourceStatisticsComponent implements OnInit, AfterViewInit
23 24
   pageSize: number = 30; //表格每页展示条数
24 25
   listLength: number = 0; //表格总数据量
25 26
 
26
-  ngOnInit() {
27
-    this.initSessionData();
28
-    this.getQueryParams();
29
-    this.search();
30
-  }
27
+  ngOnInit() {}
31 28
 
32 29
   ngAfterViewInit(){
30
+    this.initSessionData();
31
+    this.getQueryParams();
32
+    setTimeout(() => {
33
+      this.search();
34
+    }, 0)
33 35
     this.onResize();
34 36
   }
35 37
 
@@ -47,6 +49,7 @@ export class CategorySourceStatisticsComponent implements OnInit, AfterViewInit
47 49
     this.tabService.clearQueryParams();
48 50
     if(queryParams.dateRange){
49 51
       this.dateRange = queryParams.dateRange;
52
+      this.customChangeDateComponent.initByDate(this.dateRange);
50 53
     }
51 54
   }
52 55
 
@@ -103,8 +106,8 @@ export class CategorySourceStatisticsComponent implements OnInit, AfterViewInit
103 106
     let postData:any = {
104 107
       idx: this.pageIndex - 1,
105 108
       sum: this.pageSize,
106
-      startDate: this.dateRange[0] || undefined,
107
-      endDate: this.dateRange[1] || undefined,
109
+      startDate: this.customChangeDateComponent.startDate || undefined,
110
+      endDate: this.customChangeDateComponent.endDate || undefined,
108 111
       hosId: this.hosId || undefined,
109 112
       dutyId: this.dutyId || undefined,
110 113
       parentDutyId: this.parentDutyId || undefined,
@@ -146,19 +149,7 @@ export class CategorySourceStatisticsComponent implements OnInit, AfterViewInit
146 149
   }
147 150
 
148 151
   // 日期选择
149
-  dateRange: any = [format(startOfMonth(addMonths(new Date(), -1)), 'yyyy-MM-dd HH:mm:ss'), format(endOfMonth(addMonths(new Date(), -1)), 'yyyy-MM-dd HH:mm:ss')];
150
-  changeDate(result?): void {
151
-    result[0] = format(startOfDay(result[0]), 'yyyy-MM-dd HH:mm:ss');
152
-    result[1] = format(endOfDay(result[1]), 'yyyy-MM-dd HH:mm:ss');
153
-    this.dateRange = result;
154
-  }
155
-
156
-  onCalendarChangeDate(dateArr){
157
-    console.log(dateArr)
158
-    if(dateArr.length == 2){
159
-      this.dateRange = [format(startOfDay(dateArr[0]), 'yyyy-MM-dd HH:mm:ss'), format(endOfDay(dateArr[1]), 'yyyy-MM-dd HH:mm:ss')];
160
-    }
161
-  }
152
+  dateRange: any = [];
162 153
 
163 154
   // 导出
164 155
   excelExportLoading:any = false;
@@ -167,8 +158,8 @@ export class CategorySourceStatisticsComponent implements OnInit, AfterViewInit
167 158
       nzDuration: 0,
168 159
     }).messageId;
169 160
     let postData:any = {
170
-      startDate: this.dateRange[0] || undefined,
171
-      endDate: this.dateRange[1] || undefined,
161
+      startDate: this.customChangeDateComponent.startDate || undefined,
162
+      endDate: this.customChangeDateComponent.endDate || undefined,
172 163
       hosId: this.hosId || undefined,
173 164
       dutyId: this.dutyId || undefined,
174 165
       parentDutyId: this.parentDutyId || undefined,
@@ -210,8 +201,9 @@ export class CategorySourceStatisticsComponent implements OnInit, AfterViewInit
210 201
     this.sortCurrentKey = "";
211 202
 		this.sortCurrentValue = "";
212 203
 		this.sortCurrent = {};
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')]
204
+    this.dateRange = []
214 205
     this.fieldConfig.fields = {groupId: undefined, userId: undefined, categoryId: undefined, buildingId: undefined, floorId: undefined};
206
+    this.customChangeDateComponent.resetByDate();
215 207
     this.search();
216 208
   }
217 209
 

+ 2 - 0
src/app/views/new-statistics/maintenance-statistics/category-source-statistics/category-source-statistics.module.ts

@@ -5,6 +5,7 @@ import { CommonModule } from '@angular/common';
5 5
 import { CategorySourceStatisticsRoutingModule } from './category-source-statistics-routing.module';
6 6
 import { ShareModule } from 'src/app/share/share.module';
7 7
 import { SearchMoreModule } from '../../components/search-more/search-more.module';
8
+import { CustomChangeDateModule } from '../../components/custom-change-date/custom-change-date.module';
8 9
 
9 10
 
10 11
 @NgModule({
@@ -16,6 +17,7 @@ import { SearchMoreModule } from '../../components/search-more/search-more.modul
16 17
     CategorySourceStatisticsRoutingModule,
17 18
     ShareModule,
18 19
     SearchMoreModule,
20
+    CustomChangeDateModule,
19 21
   ]
20 22
 })
21 23
 export class CategorySourceStatisticsModule { }

+ 1 - 5
src/app/views/new-statistics/maintenance-statistics/category-three-statistics/category-three-statistics.component.html

@@ -1,10 +1,6 @@
1 1
 <div class="searchDataWrap">
2 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>
3
+    <app-custom-change-date #customChangeDate [isShowType]="false"></app-custom-change-date>
8 4
     <div class="searchDataItem">
9 5
       <nz-select class="selectItem" [nzDropdownMatchSelectWidth]="false" nzServerSearch nzShowSearch (nzOnSearch)="changeCategory1Inp($event)" nzAllowClear nzPlaceHolder="请选择一级分类" [(ngModel)]="category1Id" (nzOpenChange)="openChangeCategory1($event)" (ngModelChange)="changeCategory1($event)">
10 6
         <ng-container *ngFor="let option of category1List">

+ 1 - 1
src/app/views/new-statistics/maintenance-statistics/category-three-statistics/category-three-statistics.component.less

@@ -27,7 +27,7 @@
27 27
           font-size: 16px;
28 28
         }
29 29
         .selectItem{
30
-          width: 224px;
30
+          width: 160px;
31 31
         }
32 32
       }
33 33
     }

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

@@ -2,16 +2,17 @@ import { TabService } from './../../services/tab.service';
2 2
 import { debounceTime } from 'rxjs/operators';
3 3
 import { Subject } from 'rxjs';
4 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";
5
+import { Component, OnInit, HostListener, AfterViewInit, ViewChild } from "@angular/core";
7 6
 import { MainService } from 'src/app/services/main.service';
8 7
 import { ActivatedRoute } from '@angular/router';
8
+import { CustomChangeDateComponent } from '../../components/custom-change-date/custom-change-date.component';
9 9
 @Component({
10 10
   selector: "app-category-three-statistics",
11 11
   templateUrl: "./category-three-statistics.component.html",
12 12
   styleUrls: ["./category-three-statistics.component.less"],
13 13
 })
14 14
 export class CategoryThreeStatisticsComponent implements OnInit, AfterViewInit {
15
+  @ViewChild('customChangeDate', { static: false }) customChangeDateComponent!: CustomChangeDateComponent;
15 16
   constructor(
16 17
     private mainService: MainService,
17 18
     private message: NzMessageService,
@@ -35,12 +36,13 @@ export class CategoryThreeStatisticsComponent implements OnInit, AfterViewInit {
35 36
       let fun = v[0];
36 37
       fun.call(this, v[1]);
37 38
     });
38
-    this.initSessionData();
39
-    this.getQueryParams();
40
-    this.search();
41 39
   }
42
-
43 40
   ngAfterViewInit(){
41
+    this.initSessionData();
42
+    this.getQueryParams();
43
+    setTimeout(() => {
44
+      this.search();
45
+    }, 0)
44 46
     this.onResize();
45 47
   }
46 48
 
@@ -58,6 +60,7 @@ export class CategoryThreeStatisticsComponent implements OnInit, AfterViewInit {
58 60
     this.tabService.clearQueryParams();
59 61
     if(queryParams.dateRange){
60 62
       this.dateRange = queryParams.dateRange;
63
+      this.customChangeDateComponent.initByDate(this.dateRange);
61 64
     }
62 65
   }
63 66
 
@@ -114,8 +117,8 @@ export class CategoryThreeStatisticsComponent implements OnInit, AfterViewInit {
114 117
     let postData:any = {
115 118
       idx: this.pageIndex - 1,
116 119
       sum: this.pageSize,
117
-      startDate: this.dateRange[0] || undefined,
118
-      endDate: this.dateRange[1] || undefined,
120
+      startDate: this.customChangeDateComponent.startDate || undefined,
121
+      endDate: this.customChangeDateComponent.endDate || undefined,
119 122
       hosId: this.hosId || undefined,
120 123
       dutyId: this.dutyId || undefined,
121 124
       parentDutyId: this.parentDutyId || undefined,
@@ -160,19 +163,7 @@ export class CategoryThreeStatisticsComponent implements OnInit, AfterViewInit {
160 163
   }
161 164
 
162 165
   // 日期选择
163
-  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')];
164
-  changeDate(result?): void {
165
-    result[0] = format(startOfDay(result[0]), 'yyyy-MM-dd HH:mm:ss');
166
-    result[1] = format(endOfDay(result[1]), 'yyyy-MM-dd HH:mm:ss');
167
-    this.dateRange = result;
168
-  }
169
-
170
-  onCalendarChangeDate(dateArr){
171
-    console.log(dateArr)
172
-    if(dateArr.length == 2){
173
-      this.dateRange = [format(startOfDay(dateArr[0]), 'yyyy-MM-dd HH:mm:ss'), format(endOfDay(dateArr[1]), 'yyyy-MM-dd HH:mm:ss')];
174
-    }
175
-  }
166
+  dateRange: any = [];
176 167
 
177 168
   // 导出
178 169
   excelExportLoading:any = false;
@@ -181,8 +172,8 @@ export class CategoryThreeStatisticsComponent implements OnInit, AfterViewInit {
181 172
       nzDuration: 0,
182 173
     }).messageId;
183 174
     let postData:any = {
184
-      startDate: this.dateRange[0] || undefined,
185
-      endDate: this.dateRange[1] || undefined,
175
+      startDate: this.customChangeDateComponent.startDate || undefined,
176
+      endDate: this.customChangeDateComponent.endDate || undefined,
186 177
       hosId: this.hosId || undefined,
187 178
       dutyId: this.dutyId || undefined,
188 179
       parentDutyId: this.parentDutyId || undefined,
@@ -227,10 +218,11 @@ export class CategoryThreeStatisticsComponent implements OnInit, AfterViewInit {
227 218
     this.sortCurrentKey = "";
228 219
 		this.sortCurrentValue = "";
229 220
 		this.sortCurrent = {};
230
-    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 = []
231 222
     this.category1Id = undefined;
232 223
     this.category2Id = undefined;
233 224
     this.fieldConfig.fields = {groupId: undefined, userId: undefined, buildingId: undefined, floorId: undefined, companyId: undefined, repairDeptId: undefined};
225
+    this.customChangeDateComponent.resetByDate();
234 226
     this.search();
235 227
   }
236 228
 

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

@@ -5,6 +5,7 @@ import { CommonModule } from '@angular/common';
5 5
 import { CategoryThreeStatisticsRoutingModule } from './category-three-statistics-routing.module';
6 6
 import { ShareModule } from 'src/app/share/share.module';
7 7
 import { SearchMoreModule } from '../../components/search-more/search-more.module';
8
+import { CustomChangeDateModule } from '../../components/custom-change-date/custom-change-date.module';
8 9
 
9 10
 
10 11
 @NgModule({
@@ -16,6 +17,7 @@ import { SearchMoreModule } from '../../components/search-more/search-more.modul
16 17
     CategoryThreeStatisticsRoutingModule,
17 18
     ShareModule,
18 19
     SearchMoreModule,
20
+    CustomChangeDateModule,
19 21
   ]
20 22
 })
21 23
 export class CategoryThreeStatisticsModule { }

+ 1 - 5
src/app/views/new-statistics/maintenance-statistics/category-two-statistics/category-two-statistics.component.html

@@ -1,10 +1,6 @@
1 1
 <div class="searchDataWrap">
2 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>
3
+    <app-custom-change-date #customChangeDate [isShowType]="false"></app-custom-change-date>
8 4
     <div class="searchDataItem">
9 5
       <nz-select class="selectItem" [nzDropdownMatchSelectWidth]="false" nzServerSearch nzShowSearch (nzOnSearch)="changeCategory1Inp($event)" nzAllowClear nzPlaceHolder="请选择一级分类" [(ngModel)]="category1Id" (nzOpenChange)="openChangeCategory1($event)">
10 6
         <ng-container *ngFor="let option of category1List">

+ 1 - 1
src/app/views/new-statistics/maintenance-statistics/category-two-statistics/category-two-statistics.component.less

@@ -27,7 +27,7 @@
27 27
           font-size: 16px;
28 28
         }
29 29
         .selectItem{
30
-          width: 224px;
30
+          width: 160px;
31 31
         }
32 32
       }
33 33
     }

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

@@ -2,16 +2,17 @@ import { TabService } from './../../services/tab.service';
2 2
 import { debounceTime } from 'rxjs/operators';
3 3
 import { Subject } from 'rxjs';
4 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";
5
+import { Component, OnInit, HostListener, AfterViewInit, ViewChild } from "@angular/core";
7 6
 import { MainService } from 'src/app/services/main.service';
8 7
 import { ActivatedRoute } from '@angular/router';
8
+import { CustomChangeDateComponent } from '../../components/custom-change-date/custom-change-date.component';
9 9
 @Component({
10 10
   selector: "app-category-two-statistics",
11 11
   templateUrl: "./category-two-statistics.component.html",
12 12
   styleUrls: ["./category-two-statistics.component.less"],
13 13
 })
14 14
 export class CategoryTwoStatisticsComponent implements OnInit, AfterViewInit {
15
+  @ViewChild('customChangeDate', { static: false }) customChangeDateComponent!: CustomChangeDateComponent;
15 16
   constructor(
16 17
     private mainService: MainService,
17 18
     private message: NzMessageService,
@@ -34,12 +35,14 @@ export class CategoryTwoStatisticsComponent implements OnInit, AfterViewInit {
34 35
       let fun = v[0];
35 36
       fun.call(this, v[1]);
36 37
     });
37
-    this.initSessionData();
38
-    this.getQueryParams();
39
-    this.search();
40 38
   }
41 39
 
42 40
   ngAfterViewInit(){
41
+    this.initSessionData();
42
+    this.getQueryParams();
43
+    setTimeout(() => {
44
+      this.search();
45
+    }, 0)
43 46
     this.onResize();
44 47
   }
45 48
 
@@ -57,6 +60,7 @@ export class CategoryTwoStatisticsComponent implements OnInit, AfterViewInit {
57 60
     this.tabService.clearQueryParams();
58 61
     if(queryParams.dateRange){
59 62
       this.dateRange = queryParams.dateRange;
63
+      this.customChangeDateComponent.initByDate(this.dateRange);
60 64
     }
61 65
   }
62 66
 
@@ -113,8 +117,8 @@ export class CategoryTwoStatisticsComponent implements OnInit, AfterViewInit {
113 117
     let postData:any = {
114 118
       idx: this.pageIndex - 1,
115 119
       sum: this.pageSize,
116
-      startDate: this.dateRange[0] || undefined,
117
-      endDate: this.dateRange[1] || undefined,
120
+      startDate: this.customChangeDateComponent.startDate || undefined,
121
+      endDate: this.customChangeDateComponent.endDate || undefined,
118 122
       hosId: this.hosId || undefined,
119 123
       dutyId: this.dutyId || undefined,
120 124
       parentDutyId: this.parentDutyId || undefined,
@@ -159,19 +163,7 @@ export class CategoryTwoStatisticsComponent implements OnInit, AfterViewInit {
159 163
   }
160 164
 
161 165
   // 日期选择
162
-  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')];
163
-  changeDate(result?): void {
164
-    result[0] = format(startOfDay(result[0]), 'yyyy-MM-dd HH:mm:ss');
165
-    result[1] = format(endOfDay(result[1]), 'yyyy-MM-dd HH:mm:ss');
166
-    this.dateRange = result;
167
-  }
168
-
169
-  onCalendarChangeDate(dateArr){
170
-    console.log(dateArr)
171
-    if(dateArr.length == 2){
172
-      this.dateRange = [format(startOfDay(dateArr[0]), 'yyyy-MM-dd HH:mm:ss'), format(endOfDay(dateArr[1]), 'yyyy-MM-dd HH:mm:ss')];
173
-    }
174
-  }
166
+  dateRange: any = [];
175 167
 
176 168
   // 导出
177 169
   excelExportLoading:any = false;
@@ -180,8 +172,8 @@ export class CategoryTwoStatisticsComponent implements OnInit, AfterViewInit {
180 172
       nzDuration: 0,
181 173
     }).messageId;
182 174
     let postData:any = {
183
-      startDate: this.dateRange[0] || undefined,
184
-      endDate: this.dateRange[1] || undefined,
175
+      startDate: this.customChangeDateComponent.startDate || undefined,
176
+      endDate: this.customChangeDateComponent.endDate || undefined,
185 177
       hosId: this.hosId || undefined,
186 178
       dutyId: this.dutyId || undefined,
187 179
       parentDutyId: this.parentDutyId || undefined,
@@ -226,9 +218,10 @@ export class CategoryTwoStatisticsComponent implements OnInit, AfterViewInit {
226 218
     this.sortCurrentKey = "";
227 219
 		this.sortCurrentValue = "";
228 220
 		this.sortCurrent = {};
229
-    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 = []
230 222
     this.category1Id = undefined;
231 223
     this.fieldConfig.fields = {groupId: undefined, userId: undefined, buildingId: undefined, floorId: undefined, companyId: undefined, repairDeptId: undefined};
224
+    this.customChangeDateComponent.resetByDate();
232 225
     this.search();
233 226
   }
234 227
 

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

@@ -5,6 +5,7 @@ import { CommonModule } from '@angular/common';
5 5
 import { CategoryTwoStatisticsRoutingModule } from './category-two-statistics-routing.module';
6 6
 import { ShareModule } from 'src/app/share/share.module';
7 7
 import { SearchMoreModule } from '../../components/search-more/search-more.module';
8
+import { CustomChangeDateModule } from '../../components/custom-change-date/custom-change-date.module';
8 9
 
9 10
 
10 11
 @NgModule({
@@ -16,6 +17,7 @@ import { SearchMoreModule } from '../../components/search-more/search-more.modul
16 17
     CategoryTwoStatisticsRoutingModule,
17 18
     ShareModule,
18 19
     SearchMoreModule,
20
+    CustomChangeDateModule,
19 21
   ]
20 22
 })
21 23
 export class CategoryTwoStatisticsModule { }

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

@@ -1,10 +1,6 @@
1 1
 <div class="searchDataWrap">
2 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>
3
+    <app-custom-change-date #customChangeDate [isShowType]="false"></app-custom-change-date>
8 4
     <div class="searchDataItem">
9 5
       <span class="label">报修科室</span>
10 6
       <nz-select class="selectItem" [nzDropdownMatchSelectWidth]="false" nzServerSearch nzShowSearch (nzOnSearch)="changeRepairDeptInp($event)" nzAllowClear nzPlaceHolder="请选择报修科室" [(ngModel)]="repairDeptId" (nzOpenChange)="openChangeRepairDept($event)">

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

@@ -27,7 +27,7 @@
27 27
           font-size: 16px;
28 28
         }
29 29
         .selectItem{
30
-          width: 224px;
30
+          width: 160px;
31 31
         }
32 32
       }
33 33
     }

+ 16 - 23
src/app/views/new-statistics/maintenance-statistics/consumable-statistics/consumable-statistics.component.ts

@@ -2,16 +2,17 @@ import { TabService } from './../../services/tab.service';
2 2
 import { debounceTime } from 'rxjs/operators';
3 3
 import { Subject } from 'rxjs';
4 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";
5
+import { Component, OnInit, HostListener, AfterViewInit, ViewChild } from "@angular/core";
7 6
 import { MainService } from 'src/app/services/main.service';
8 7
 import { ActivatedRoute } from '@angular/router';
8
+import { CustomChangeDateComponent } from '../../components/custom-change-date/custom-change-date.component';
9 9
 @Component({
10 10
   selector: "app-consumable-statistics",
11 11
   templateUrl: "./consumable-statistics.component.html",
12 12
   styleUrls: ["./consumable-statistics.component.less"],
13 13
 })
14 14
 export class ConsumableStatisticsComponent implements OnInit, AfterViewInit {
15
+  @ViewChild('customChangeDate', { static: false }) customChangeDateComponent!: CustomChangeDateComponent;
15 16
   constructor(
16 17
     private mainService: MainService,
17 18
     private message: NzMessageService,
@@ -34,12 +35,14 @@ export class ConsumableStatisticsComponent implements OnInit, AfterViewInit {
34 35
       let fun = v[0];
35 36
       fun.call(this, v[1]);
36 37
     });
37
-    this.initSessionData();
38
-    this.getQueryParams();
39
-    this.search();
40 38
   }
41 39
 
42 40
   ngAfterViewInit(){
41
+    this.initSessionData();
42
+    this.getQueryParams();
43
+    setTimeout(() => {
44
+      this.search();
45
+    }, 0)
43 46
     this.onResize();
44 47
   }
45 48
 
@@ -57,6 +60,7 @@ export class ConsumableStatisticsComponent implements OnInit, AfterViewInit {
57 60
     this.tabService.clearQueryParams();
58 61
     if(queryParams.dateRange){
59 62
       this.dateRange = queryParams.dateRange;
63
+      this.customChangeDateComponent.initByDate(this.dateRange);
60 64
     }
61 65
   }
62 66
 
@@ -113,8 +117,8 @@ export class ConsumableStatisticsComponent implements OnInit, AfterViewInit {
113 117
     let postData:any = {
114 118
       idx: this.pageIndex - 1,
115 119
       sum: this.pageSize,
116
-      startDate: this.dateRange[0] || undefined,
117
-      endDate: this.dateRange[1] || undefined,
120
+      startDate: this.customChangeDateComponent.startDate || undefined,
121
+      endDate: this.customChangeDateComponent.endDate || undefined,
118 122
       hosId: this.hosId || undefined,
119 123
       dutyId: this.dutyId || undefined,
120 124
       parentDutyId: this.parentDutyId || undefined,
@@ -158,19 +162,7 @@ export class ConsumableStatisticsComponent implements OnInit, AfterViewInit {
158 162
   }
159 163
 
160 164
   // 日期选择
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
-  }
165
+  dateRange: any = [];
174 166
 
175 167
   // 导出
176 168
   excelExportLoading:any = false;
@@ -179,8 +171,8 @@ export class ConsumableStatisticsComponent implements OnInit, AfterViewInit {
179 171
       nzDuration: 0,
180 172
     }).messageId;
181 173
     let postData:any = {
182
-      startDate: this.dateRange[0] || undefined,
183
-      endDate: this.dateRange[1] || undefined,
174
+      startDate: this.customChangeDateComponent.startDate || undefined,
175
+      endDate: this.customChangeDateComponent.endDate || undefined,
184 176
       hosId: this.hosId || undefined,
185 177
       dutyId: this.dutyId || undefined,
186 178
       parentDutyId: this.parentDutyId || undefined,
@@ -224,9 +216,10 @@ export class ConsumableStatisticsComponent implements OnInit, AfterViewInit {
224 216
     this.sortCurrentKey = "";
225 217
 		this.sortCurrentValue = "";
226 218
 		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')]
219
+    this.dateRange = []
228 220
     this.repairDeptId = undefined;
229 221
     this.fieldConfig.fields = {groupId: undefined, userId: undefined, categoryId: undefined, buildingId: undefined, floorId: undefined, companyId: undefined};
222
+    this.customChangeDateComponent.resetByDate();
230 223
     this.search();
231 224
   }
232 225
 

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

@@ -5,6 +5,7 @@ import { CommonModule } from '@angular/common';
5 5
 import { ConsumableStatisticsRoutingModule } from './consumable-statistics-routing.module';
6 6
 import { ShareModule } from 'src/app/share/share.module';
7 7
 import { SearchMoreModule } from '../../components/search-more/search-more.module';
8
+import { CustomChangeDateModule } from '../../components/custom-change-date/custom-change-date.module';
8 9
 
9 10
 
10 11
 @NgModule({
@@ -16,6 +17,7 @@ import { SearchMoreModule } from '../../components/search-more/search-more.modul
16 17
     ConsumableStatisticsRoutingModule,
17 18
     ShareModule,
18 19
     SearchMoreModule,
20
+    CustomChangeDateModule,
19 21
   ]
20 22
 })
21 23
 export class ConsumableStatisticsModule { }

+ 1 - 5
src/app/views/new-statistics/maintenance-statistics/department-evaluate-statistics/department-evaluate-statistics.component.html

@@ -1,10 +1,6 @@
1 1
 <div class="searchDataWrap">
2 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>
3
+    <app-custom-change-date #customChangeDate [isShowType]="false"></app-custom-change-date>
8 4
     <div class="searchDataItem">
9 5
       <span class="label">科室</span>
10 6
       <nz-select class="selectItem" [nzDropdownMatchSelectWidth]="false" nzAllowClear nzPlaceHolder="请选择科室" [(ngModel)]="deptId" nzServerSearch nzShowSearch (nzOnSearch)="changeInp($event)">

+ 1 - 1
src/app/views/new-statistics/maintenance-statistics/department-evaluate-statistics/department-evaluate-statistics.component.less

@@ -27,7 +27,7 @@
27 27
           font-size: 16px;
28 28
         }
29 29
         .selectItem{
30
-          width: 224px;
30
+          width: 160px;
31 31
         }
32 32
       }
33 33
     }

+ 22 - 29
src/app/views/new-statistics/maintenance-statistics/department-evaluate-statistics/department-evaluate-statistics.component.ts

@@ -1,12 +1,12 @@
1 1
 import { TabService } from './../../services/tab.service';
2 2
 import { NzMessageService } from 'ng-zorro-antd/message';
3
-import { format, addMonths, startOfMonth, endOfMonth, startOfDay, endOfDay } from 'date-fns';
4
-import { Component, OnInit, HostListener, AfterViewInit } from "@angular/core";
3
+import { Component, OnInit, HostListener, AfterViewInit, ViewChild } from "@angular/core";
5 4
 import { MainService } from 'src/app/services/main.service';
6 5
 import { ActivatedRoute } from '@angular/router';
7 6
 import { ToolService } from "../../../../services/tool.service";
8 7
 import { Subject } from "rxjs";
9 8
 import { debounceTime } from "rxjs/operators";
9
+import { CustomChangeDateComponent } from '../../components/custom-change-date/custom-change-date.component';
10 10
 
11 11
 @Component({
12 12
   selector: "app-department-evaluate-statistics",
@@ -14,6 +14,7 @@ import { debounceTime } from "rxjs/operators";
14 14
   styleUrls: ["./department-evaluate-statistics.component.less"],
15 15
 })
16 16
 export class DepartmentEvaluateStatisticsComponent implements OnInit, AfterViewInit {
17
+  @ViewChild('customChangeDate', { static: false }) customChangeDateComponent!: CustomChangeDateComponent;
17 18
   constructor(
18 19
     private mainService: MainService,
19 20
     private message: NzMessageService,
@@ -31,20 +32,22 @@ export class DepartmentEvaluateStatisticsComponent implements OnInit, AfterViewI
31 32
 	deptTypeId;//科室类型id
32 33
 	deptId;
33 34
 	searchTimerSubject = new Subject();
34
-	
35
+
35 36
   ngOnInit() {
36 37
 		this.hospital = this.tool.getCurrentHospital().id
37 38
 		this.searchTimerSubject.pipe(debounceTime(500)).subscribe((v) => {
38 39
 		  let fun = v[0];
39 40
 		  fun.call(this, v[1]);
40 41
 		});
41
-    this.initSessionData();
42
-    this.getQueryParams();
43
-		this.getDeparts();
44
-    this.search();
45 42
   }
46 43
 
47 44
   ngAfterViewInit(){
45
+    this.initSessionData();
46
+    this.getQueryParams();
47
+    this.getDeparts();
48
+    setTimeout(() => {
49
+      this.search();
50
+    }, 0)
48 51
     this.onResize();
49 52
   }
50 53
 
@@ -62,6 +65,7 @@ export class DepartmentEvaluateStatisticsComponent implements OnInit, AfterViewI
62 65
     this.tabService.clearQueryParams();
63 66
     if(queryParams.dateRange){
64 67
       this.dateRange = queryParams.dateRange;
68
+      this.customChangeDateComponent.initByDate(this.dateRange);
65 69
     }
66 70
   }
67 71
 
@@ -82,7 +86,7 @@ export class DepartmentEvaluateStatisticsComponent implements OnInit, AfterViewI
82 86
     let hosId:any = newStatistics.hospitalId;
83 87
     let dutyId:any = newStatistics.dutyId;
84 88
 		this.parent = newStatistics.parent;
85
-		
89
+
86 90
     queryType = queryType ? +queryType : undefined;
87 91
     hosId = hosId ? +hosId : undefined;
88 92
     dutyId = dutyId ? +dutyId : undefined;
@@ -121,8 +125,8 @@ export class DepartmentEvaluateStatisticsComponent implements OnInit, AfterViewI
121 125
       idx: this.pageIndex - 1,
122 126
       sum: this.pageSize,
123 127
 			showParentDept: this.parent==1 ? 'true' : undefined,
124
-      startDate: this.dateRange[0] || undefined,
125
-      endDate: this.dateRange[1] || undefined,
128
+      startDate: this.customChangeDateComponent.startDate || undefined,
129
+      endDate: this.customChangeDateComponent.endDate || undefined,
126 130
       hosId: this.hosId || undefined,
127 131
       dutyId: this.dutyId || undefined,
128 132
       repairDeptId: this.deptId || undefined,
@@ -166,19 +170,7 @@ export class DepartmentEvaluateStatisticsComponent implements OnInit, AfterViewI
166 170
   }
167 171
 
168 172
   // 日期选择
169
-  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')];
170
-  changeDate(result?): void {
171
-    result[0] = format(startOfDay(result[0]), 'yyyy-MM-dd HH:mm:ss');
172
-    result[1] = format(endOfDay(result[1]), 'yyyy-MM-dd HH:mm:ss');
173
-    this.dateRange = result;
174
-  }
175
-
176
-  onCalendarChangeDate(dateArr){
177
-    console.log(dateArr)
178
-    if(dateArr.length == 2){
179
-      this.dateRange = [format(startOfDay(dateArr[0]), 'yyyy-MM-dd HH:mm:ss'), format(endOfDay(dateArr[1]), 'yyyy-MM-dd HH:mm:ss')];
180
-    }
181
-  }
173
+  dateRange: any = [];
182 174
 
183 175
   // 导出
184 176
   excelExportLoading:any = false;
@@ -188,8 +180,8 @@ export class DepartmentEvaluateStatisticsComponent implements OnInit, AfterViewI
188 180
     }).messageId;
189 181
     let postData:any = {
190 182
 			showParentDept: this.parent==1 ? 'true' : undefined,
191
-      startDate: this.dateRange[0] || undefined,
192
-      endDate: this.dateRange[1] || undefined,
183
+      startDate: this.customChangeDateComponent.startDate || undefined,
184
+      endDate: this.customChangeDateComponent.endDate || undefined,
193 185
       hosId: this.hosId || undefined,
194 186
       dutyId: this.dutyId || undefined,
195 187
       parentDutyId: this.parentDutyId || undefined,
@@ -233,9 +225,10 @@ export class DepartmentEvaluateStatisticsComponent implements OnInit, AfterViewI
233 225
     this.sortCurrentKey = "";
234 226
 		this.sortCurrentValue = "";
235 227
 		this.sortCurrent = {};
236
-    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.dateRange = []
237 229
     this.deptId = undefined;
238 230
     this.fieldConfig.fields = {groupId: undefined, userId: undefined, categoryId: undefined, buildingId: undefined, floorId: undefined, deptTypeId: undefined};
231
+    this.customChangeDateComponent.resetByDate();
239 232
     this.search();
240 233
   }
241 234
 
@@ -244,18 +237,18 @@ export class DepartmentEvaluateStatisticsComponent implements OnInit, AfterViewI
244 237
   openChangeDeptType(flag){
245 238
     flag && this.getDeptTypeList();
246 239
   }
247
-	
240
+
248 241
 	// 科室搜索
249 242
   changeInp(e) {
250 243
     this.searchTimer(this.getDeparts, e);
251 244
   }
252
-	
245
+
253 246
 	// 边输入边搜索节流阀
254 247
 	searchTimer(fun, e) {
255 248
 	  this.isLoading = true;
256 249
 	  this.searchTimerSubject.next([fun, e]);
257 250
 	}
258
-	
251
+
259 252
 	// 获取所有科室
260 253
 	alldepart:any;
261 254
 	getDeparts(dept?) {

+ 2 - 0
src/app/views/new-statistics/maintenance-statistics/department-evaluate-statistics/department-evaluate-statistics.module.ts

@@ -5,6 +5,7 @@ import { CommonModule } from '@angular/common';
5 5
 import { DepartmentEvaluateStatisticsRoutingModule } from './department-evaluate-statistics-routing.module';
6 6
 import { ShareModule } from 'src/app/share/share.module';
7 7
 import { SearchMoreModule } from '../../components/search-more/search-more.module';
8
+import { CustomChangeDateModule } from '../../components/custom-change-date/custom-change-date.module';
8 9
 
9 10
 
10 11
 @NgModule({
@@ -16,6 +17,7 @@ import { SearchMoreModule } from '../../components/search-more/search-more.modul
16 17
     DepartmentEvaluateStatisticsRoutingModule,
17 18
     ShareModule,
18 19
     SearchMoreModule,
20
+    CustomChangeDateModule,
19 21
   ]
20 22
 })
21 23
 export class DepartmentEvaluateStatisticsModule { }

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

@@ -1,10 +1,6 @@
1 1
 <div class="searchDataWrap">
2 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>
3
+    <app-custom-change-date #customChangeDate [isShowType]="false"></app-custom-change-date>
8 4
 		<div class="searchDataItem">
9 5
 		  <span class="label">科室</span>
10 6
 		  <nz-select class="selectItem" [nzDropdownMatchSelectWidth]="false" nzAllowClear nzPlaceHolder="请选择科室" [(ngModel)]="deptId" nzServerSearch nzShowSearch (nzOnSearch)="changeInp($event)">

+ 1 - 1
src/app/views/new-statistics/maintenance-statistics/department-incident-statistics/department-incident-statistics.component.less

@@ -27,7 +27,7 @@
27 27
           font-size: 16px;
28 28
         }
29 29
         .selectItem{
30
-          width: 224px;
30
+          width: 160px;
31 31
         }
32 32
       }
33 33
     }

+ 23 - 30
src/app/views/new-statistics/maintenance-statistics/department-incident-statistics/department-incident-statistics.component.ts

@@ -1,12 +1,12 @@
1 1
 import { TabService } from './../../services/tab.service';
2 2
 import { NzMessageService } from 'ng-zorro-antd/message';
3
-import { format, addMonths, startOfMonth, endOfMonth, startOfDay, endOfDay } from 'date-fns';
4
-import { Component, OnInit, HostListener, AfterViewInit } from "@angular/core";
3
+import { Component, OnInit, HostListener, AfterViewInit, ViewChild } from "@angular/core";
5 4
 import { MainService } from 'src/app/services/main.service';
6 5
 import { ActivatedRoute } from '@angular/router';
7 6
 import { ToolService } from "../../../../services/tool.service";
8 7
 import { Subject } from "rxjs";
9 8
 import { debounceTime } from "rxjs/operators";
9
+import { CustomChangeDateComponent } from '../../components/custom-change-date/custom-change-date.component';
10 10
 
11 11
 @Component({
12 12
   selector: "app-department-incident-statistics",
@@ -14,6 +14,7 @@ import { debounceTime } from "rxjs/operators";
14 14
   styleUrls: ["./department-incident-statistics.component.less"],
15 15
 })
16 16
 export class DepartmentIncidentStatisticsComponent implements OnInit, AfterViewInit {
17
+  @ViewChild('customChangeDate', { static: false }) customChangeDateComponent!: CustomChangeDateComponent;
17 18
   constructor(
18 19
     private mainService: MainService,
19 20
     private message: NzMessageService,
@@ -31,20 +32,22 @@ export class DepartmentIncidentStatisticsComponent implements OnInit, AfterViewI
31 32
   deptTypeId;//科室类型id
32 33
 	deptId;
33 34
 	searchTimerSubject = new Subject();
34
-	
35
+
35 36
   ngOnInit() {
36 37
 		this.hospital = this.tool.getCurrentHospital().id
37 38
 		this.searchTimerSubject.pipe(debounceTime(500)).subscribe((v) => {
38 39
 		  let fun = v[0];
39 40
 		  fun.call(this, v[1]);
40 41
 		});
41
-    this.initSessionData();
42
-    this.getQueryParams();
43
-		this.getDeparts();
44
-    this.search();
45 42
   }
46 43
 
47 44
   ngAfterViewInit(){
45
+    this.initSessionData();
46
+    this.getQueryParams();
47
+		this.getDeparts();
48
+    setTimeout(() => {
49
+      this.search();
50
+    }, 0)
48 51
     this.onResize();
49 52
   }
50 53
 
@@ -62,6 +65,7 @@ export class DepartmentIncidentStatisticsComponent implements OnInit, AfterViewI
62 65
     this.tabService.clearQueryParams();
63 66
     if(queryParams.dateRange){
64 67
       this.dateRange = queryParams.dateRange;
68
+      this.customChangeDateComponent.initByDate(this.dateRange);
65 69
     }
66 70
   }
67 71
 
@@ -82,7 +86,7 @@ export class DepartmentIncidentStatisticsComponent implements OnInit, AfterViewI
82 86
     let hosId:any = newStatistics.hospitalId;
83 87
     let dutyId:any = newStatistics.dutyId;
84 88
 		this.parent = newStatistics.parent;
85
-		
89
+
86 90
     queryType = queryType ? +queryType : undefined;
87 91
     hosId = hosId ? +hosId : undefined;
88 92
     dutyId = dutyId ? +dutyId : undefined;
@@ -121,8 +125,8 @@ export class DepartmentIncidentStatisticsComponent implements OnInit, AfterViewI
121 125
       idx: this.pageIndex - 1,
122 126
       sum: this.pageSize,
123 127
 			showParentDept: this.parent==1 ? 'true' : undefined,
124
-      startDate: this.dateRange[0] || undefined,
125
-      endDate: this.dateRange[1] || undefined,
128
+      startDate: this.customChangeDateComponent.startDate || undefined,
129
+      endDate: this.customChangeDateComponent.endDate || undefined,
126 130
       hosId: this.hosId || undefined,
127 131
       dutyId: this.dutyId || undefined,
128 132
 			repairDeptId: this.deptId || undefined,
@@ -166,19 +170,7 @@ export class DepartmentIncidentStatisticsComponent implements OnInit, AfterViewI
166 170
   }
167 171
 
168 172
   // 日期选择
169
-  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')];
170
-  changeDate(result?): void {
171
-    result[0] = format(startOfDay(result[0]), 'yyyy-MM-dd HH:mm:ss');
172
-    result[1] = format(endOfDay(result[1]), 'yyyy-MM-dd HH:mm:ss');
173
-    this.dateRange = result;
174
-  }
175
-
176
-  onCalendarChangeDate(dateArr){
177
-    console.log(dateArr)
178
-    if(dateArr.length == 2){
179
-      this.dateRange = [format(startOfDay(dateArr[0]), 'yyyy-MM-dd HH:mm:ss'), format(endOfDay(dateArr[1]), 'yyyy-MM-dd HH:mm:ss')];
180
-    }
181
-  }
173
+  dateRange: any = [];
182 174
 
183 175
   // 导出
184 176
   excelExportLoading:any = false;
@@ -188,8 +180,8 @@ export class DepartmentIncidentStatisticsComponent implements OnInit, AfterViewI
188 180
     }).messageId;
189 181
     let postData:any = {
190 182
 			showParentDept: this.parent==1 ? 'true' : undefined,
191
-      startDate: this.dateRange[0] || undefined,
192
-      endDate: this.dateRange[1] || undefined,
183
+      startDate: this.customChangeDateComponent.startDate || undefined,
184
+      endDate: this.customChangeDateComponent.endDate || undefined,
193 185
       hosId: this.hosId || undefined,
194 186
       dutyId: this.dutyId || undefined,
195 187
       parentDutyId: this.parentDutyId || undefined,
@@ -233,9 +225,10 @@ export class DepartmentIncidentStatisticsComponent implements OnInit, AfterViewI
233 225
     this.sortCurrentKey = "";
234 226
 		this.sortCurrentValue = "";
235 227
 		this.sortCurrent = {};
236
-    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.dateRange = []
237 229
     this.deptId = undefined;
238 230
     this.fieldConfig.fields = {groupId: undefined, userId: undefined, categoryId: undefined, buildingId: undefined, floorId: undefined, deptTypeId: undefined};
231
+    this.customChangeDateComponent.resetByDate();
239 232
     this.search();
240 233
   }
241 234
 
@@ -244,18 +237,18 @@ export class DepartmentIncidentStatisticsComponent implements OnInit, AfterViewI
244 237
   openChangeDeptType(flag){
245 238
     flag && this.getDeptTypeList();
246 239
   }
247
-	
240
+
248 241
 	// 科室搜索
249 242
   changeInp(e) {
250 243
     this.searchTimer(this.getDeparts, e);
251 244
   }
252
-	
245
+
253 246
 	// 边输入边搜索节流阀
254 247
 	searchTimer(fun, e) {
255 248
 	  this.isLoading = true;
256 249
 	  this.searchTimerSubject.next([fun, e]);
257 250
 	}
258
-	
251
+
259 252
 	// 获取所有科室
260 253
 	alldepart:any;
261 254
 	getDeparts(dept?) {
@@ -274,7 +267,7 @@ export class DepartmentIncidentStatisticsComponent implements OnInit, AfterViewI
274 267
 	      this.alldepart = data.list;
275 268
 	    });
276 269
 	}
277
-	
270
+
278 271
   // 获取科室类型列表
279 272
   deptTypeList:any[] = [];
280 273
   getDeptTypeList(keyword?) {

+ 2 - 0
src/app/views/new-statistics/maintenance-statistics/department-incident-statistics/department-incident-statistics.module.ts

@@ -5,6 +5,7 @@ import { CommonModule } from '@angular/common';
5 5
 import { DepartmentIncidentStatisticsRoutingModule } from './department-incident-statistics-routing.module';
6 6
 import { ShareModule } from 'src/app/share/share.module';
7 7
 import { SearchMoreModule } from '../../components/search-more/search-more.module';
8
+import { CustomChangeDateModule } from '../../components/custom-change-date/custom-change-date.module';
8 9
 
9 10
 
10 11
 @NgModule({
@@ -16,6 +17,7 @@ import { SearchMoreModule } from '../../components/search-more/search-more.modul
16 17
     DepartmentIncidentStatisticsRoutingModule,
17 18
     ShareModule,
18 19
     SearchMoreModule,
20
+    CustomChangeDateModule,
19 21
   ]
20 22
 })
21 23
 export class DepartmentIncidentStatisticsModule { }

+ 1 - 5
src/app/views/new-statistics/maintenance-statistics/department-source-statistics/department-source-statistics.component.html

@@ -1,10 +1,6 @@
1 1
 <div class="searchDataWrap">
2 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>
3
+    <app-custom-change-date #customChangeDate [isShowType]="false"></app-custom-change-date>
8 4
     <div class="searchDataItem">
9 5
       <span class="label">科室</span>
10 6
       <nz-select class="selectItem" [nzDropdownMatchSelectWidth]="false" nzAllowClear nzPlaceHolder="请选择科室" [(ngModel)]="deptId" nzServerSearch nzShowSearch (nzOnSearch)="changeInp($event)">

+ 1 - 1
src/app/views/new-statistics/maintenance-statistics/department-source-statistics/department-source-statistics.component.less

@@ -27,7 +27,7 @@
27 27
           font-size: 16px;
28 28
         }
29 29
         .selectItem{
30
-          width: 224px;
30
+          width: 160px;
31 31
         }
32 32
       }
33 33
     }

+ 20 - 27
src/app/views/new-statistics/maintenance-statistics/department-source-statistics/department-source-statistics.component.ts

@@ -1,18 +1,19 @@
1 1
 import { TabService } from './../../services/tab.service';
2 2
 import { NzMessageService } from 'ng-zorro-antd/message';
3
-import { format, addMonths, startOfMonth, endOfMonth, startOfDay, endOfDay } from 'date-fns';
4
-import { Component, OnInit, HostListener, AfterViewInit } from "@angular/core";
3
+import { Component, OnInit, HostListener, AfterViewInit, ViewChild } from "@angular/core";
5 4
 import { MainService } from 'src/app/services/main.service';
6 5
 import { ActivatedRoute } from '@angular/router';
7 6
 import { ToolService } from "../../../../services/tool.service";
8 7
 import { Subject } from "rxjs";
9 8
 import { debounceTime } from "rxjs/operators";
9
+import { CustomChangeDateComponent } from '../../components/custom-change-date/custom-change-date.component';
10 10
 @Component({
11 11
   selector: "app-department-source-statistics",
12 12
   templateUrl: "./department-source-statistics.component.html",
13 13
   styleUrls: ["./department-source-statistics.component.less"],
14 14
 })
15 15
 export class DepartmentSourceStatisticsComponent implements OnInit, AfterViewInit {
16
+  @ViewChild('customChangeDate', { static: false }) customChangeDateComponent!: CustomChangeDateComponent;
16 17
   constructor(
17 18
     private mainService: MainService,
18 19
     private message: NzMessageService,
@@ -38,13 +39,15 @@ export class DepartmentSourceStatisticsComponent implements OnInit, AfterViewIni
38 39
 		  let fun = v[0];
39 40
 		  fun.call(this, v[1]);
40 41
 		});
41
-		this.initSessionData();
42
-		this.getQueryParams();
43
-		this.getDeparts();
44
-		this.search();
45 42
   }
46 43
 
47 44
   ngAfterViewInit(){
45
+    this.initSessionData();
46
+    this.getQueryParams();
47
+    this.getDeparts();
48
+    setTimeout(() => {
49
+      this.search();
50
+    }, 0)
48 51
     this.onResize();
49 52
   }
50 53
 
@@ -62,6 +65,7 @@ export class DepartmentSourceStatisticsComponent implements OnInit, AfterViewIni
62 65
     this.tabService.clearQueryParams();
63 66
     if(queryParams.dateRange){
64 67
       this.dateRange = queryParams.dateRange;
68
+      this.customChangeDateComponent.initByDate(this.dateRange);
65 69
     }
66 70
   }
67 71
 
@@ -121,8 +125,8 @@ export class DepartmentSourceStatisticsComponent implements OnInit, AfterViewIni
121 125
 			idx: this.pageIndex - 1,
122 126
 			sum: this.pageSize,
123 127
 			showParentDept: this.parent==1 ? 'true' : undefined,
124
-			startDate: this.dateRange[0] || undefined,
125
-			endDate: this.dateRange[1] || undefined,
128
+			startDate: this.customChangeDateComponent.startDate || undefined,
129
+      endDate: this.customChangeDateComponent.endDate || undefined,
126 130
 			hosId: this.hosId || undefined,
127 131
 			dutyId: this.dutyId || undefined,
128 132
 			repairDeptId: this.deptId || undefined,
@@ -166,19 +170,7 @@ export class DepartmentSourceStatisticsComponent implements OnInit, AfterViewIni
166 170
   }
167 171
 
168 172
   // 日期选择
169
-  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')];
170
-  changeDate(result?): void {
171
-    result[0] = format(startOfDay(result[0]), 'yyyy-MM-dd HH:mm:ss');
172
-    result[1] = format(endOfDay(result[1]), 'yyyy-MM-dd HH:mm:ss');
173
-    this.dateRange = result;
174
-  }
175
-
176
-  onCalendarChangeDate(dateArr){
177
-    console.log(dateArr)
178
-    if(dateArr.length == 2){
179
-      this.dateRange = [format(startOfDay(dateArr[0]), 'yyyy-MM-dd HH:mm:ss'), format(endOfDay(dateArr[1]), 'yyyy-MM-dd HH:mm:ss')];
180
-    }
181
-  }
173
+  dateRange: any = [];
182 174
 
183 175
   // 导出
184 176
   excelExportLoading:any = false;
@@ -188,8 +180,8 @@ export class DepartmentSourceStatisticsComponent implements OnInit, AfterViewIni
188 180
     }).messageId;
189 181
     let postData:any = {
190 182
 			showParentDept: this.parent==1 ? 'true' : undefined,
191
-			startDate: this.dateRange[0] || undefined,
192
-			endDate: this.dateRange[1] || undefined,
183
+			startDate: this.customChangeDateComponent.startDate || undefined,
184
+      endDate: this.customChangeDateComponent.endDate || undefined,
193 185
 			hosId: this.hosId || undefined,
194 186
 			dutyId: this.dutyId || undefined,
195 187
 			parentDutyId: this.parentDutyId || undefined,
@@ -233,9 +225,10 @@ export class DepartmentSourceStatisticsComponent implements OnInit, AfterViewIni
233 225
     this.sortCurrentKey = "";
234 226
 		this.sortCurrentValue = "";
235 227
 		this.sortCurrent = {};
236
-    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.dateRange = []
237 229
     this.deptId = undefined;
238 230
     this.fieldConfig.fields = {groupId: undefined, userId: undefined, categoryId: undefined, buildingId: undefined, floorId: undefined, deptTypeId: undefined};
231
+    this.customChangeDateComponent.resetByDate();
239 232
     this.search();
240 233
   }
241 234
 
@@ -244,18 +237,18 @@ export class DepartmentSourceStatisticsComponent implements OnInit, AfterViewIni
244 237
   openChangeDeptType(flag){
245 238
     flag && this.getDeptTypeList();
246 239
   }
247
-  
240
+
248 241
   // 科室搜索
249 242
   changeInp(e) {
250 243
     this.searchTimer(this.getDeparts, e);
251 244
   }
252
-  
245
+
253 246
   // 边输入边搜索节流阀
254 247
   searchTimer(fun, e) {
255 248
     this.isLoading = true;
256 249
     this.searchTimerSubject.next([fun, e]);
257 250
   }
258
-  
251
+
259 252
   // 获取所有科室
260 253
   alldepart:any;
261 254
   getDeparts(dept?) {

+ 2 - 0
src/app/views/new-statistics/maintenance-statistics/department-source-statistics/department-source-statistics.module.ts

@@ -5,6 +5,7 @@ import { CommonModule } from '@angular/common';
5 5
 import { DepartmentSourceStatisticsRoutingModule } from './department-source-statistics-routing.module';
6 6
 import { ShareModule } from 'src/app/share/share.module';
7 7
 import { SearchMoreModule } from '../../components/search-more/search-more.module';
8
+import { CustomChangeDateModule } from '../../components/custom-change-date/custom-change-date.module';
8 9
 
9 10
 
10 11
 @NgModule({
@@ -16,6 +17,7 @@ import { SearchMoreModule } from '../../components/search-more/search-more.modul
16 17
     DepartmentSourceStatisticsRoutingModule,
17 18
     ShareModule,
18 19
     SearchMoreModule,
20
+    CustomChangeDateModule,
19 21
   ]
20 22
 })
21 23
 export class DepartmentSourceStatisticsModule { }

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

@@ -1,10 +1,6 @@
1 1
 <div class="searchDataWrap">
2 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>
3
+    <app-custom-change-date #customChangeDate [isShowType]="false"></app-custom-change-date>
8 4
     <div class="searchDataItem">
9 5
       <span class="label">楼栋</span>
10 6
       <nz-select class="selectItem" [nzDropdownMatchSelectWidth]="false" nzServerSearch nzShowSearch (nzOnSearch)="changeBuildingInp($event)" nzAllowClear nzPlaceHolder="请选择楼栋" [(ngModel)]="buildingId" (nzOpenChange)="openChangeBuilding($event)">

+ 1 - 1
src/app/views/new-statistics/maintenance-statistics/floor-statistics/floor-statistics.component.less

@@ -27,7 +27,7 @@
27 27
           font-size: 16px;
28 28
         }
29 29
         .selectItem{
30
-          width: 224px;
30
+          width: 160px;
31 31
         }
32 32
       }
33 33
     }

+ 16 - 23
src/app/views/new-statistics/maintenance-statistics/floor-statistics/floor-statistics.component.ts

@@ -2,16 +2,17 @@ import { TabService } from './../../services/tab.service';
2 2
 import { debounceTime } from 'rxjs/operators';
3 3
 import { Subject } from 'rxjs';
4 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";
5
+import { Component, OnInit, HostListener, AfterViewInit, ViewChild } from "@angular/core";
7 6
 import { MainService } from 'src/app/services/main.service';
8 7
 import { ActivatedRoute } from '@angular/router';
8
+import { CustomChangeDateComponent } from '../../components/custom-change-date/custom-change-date.component';
9 9
 @Component({
10 10
   selector: "app-floor-statistics",
11 11
   templateUrl: "./floor-statistics.component.html",
12 12
   styleUrls: ["./floor-statistics.component.less"],
13 13
 })
14 14
 export class FloorStatisticsComponent implements OnInit, AfterViewInit {
15
+  @ViewChild('customChangeDate', { static: false }) customChangeDateComponent!: CustomChangeDateComponent;
15 16
   constructor(
16 17
     private mainService: MainService,
17 18
     private message: NzMessageService,
@@ -34,12 +35,14 @@ export class FloorStatisticsComponent implements OnInit, AfterViewInit {
34 35
       let fun = v[0];
35 36
       fun.call(this, v[1]);
36 37
     });
37
-    this.initSessionData();
38
-    this.getQueryParams();
39
-    this.search();
40 38
   }
41 39
 
42 40
   ngAfterViewInit(){
41
+    this.initSessionData();
42
+    this.getQueryParams();
43
+    setTimeout(() => {
44
+      this.search();
45
+    }, 0)
43 46
     this.onResize();
44 47
   }
45 48
 
@@ -57,6 +60,7 @@ export class FloorStatisticsComponent implements OnInit, AfterViewInit {
57 60
     this.tabService.clearQueryParams();
58 61
     if(queryParams.dateRange){
59 62
       this.dateRange = queryParams.dateRange;
63
+      this.customChangeDateComponent.initByDate(this.dateRange);
60 64
     }
61 65
   }
62 66
 
@@ -113,8 +117,8 @@ export class FloorStatisticsComponent implements OnInit, AfterViewInit {
113 117
     let postData:any = {
114 118
       idx: this.pageIndex - 1,
115 119
       sum: this.pageSize,
116
-      startDate: this.dateRange[0] || undefined,
117
-      endDate: this.dateRange[1] || undefined,
120
+      startDate: this.customChangeDateComponent.startDate || undefined,
121
+      endDate: this.customChangeDateComponent.endDate || undefined,
118 122
       hosId: this.hosId || undefined,
119 123
       dutyId: this.dutyId || undefined,
120 124
       parentDutyId: this.parentDutyId || undefined,
@@ -153,19 +157,7 @@ export class FloorStatisticsComponent implements OnInit, AfterViewInit {
153 157
   }
154 158
 
155 159
   // 日期选择
156
-  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')];
157
-  changeDate(result?): void {
158
-    result[0] = format(startOfDay(result[0]), 'yyyy-MM-dd HH:mm:ss');
159
-    result[1] = format(endOfDay(result[1]), 'yyyy-MM-dd HH:mm:ss');
160
-    this.dateRange = result;
161
-  }
162
-
163
-  onCalendarChangeDate(dateArr){
164
-    console.log(dateArr)
165
-    if(dateArr.length == 2){
166
-      this.dateRange = [format(startOfDay(dateArr[0]), 'yyyy-MM-dd HH:mm:ss'), format(endOfDay(dateArr[1]), 'yyyy-MM-dd HH:mm:ss')];
167
-    }
168
-  }
160
+  dateRange: any = [];
169 161
 
170 162
   // 导出
171 163
   excelExportLoading:any = false;
@@ -174,8 +166,8 @@ export class FloorStatisticsComponent implements OnInit, AfterViewInit {
174 166
       nzDuration: 0,
175 167
     }).messageId;
176 168
     let postData:any = {
177
-      startDate: this.dateRange[0] || undefined,
178
-      endDate: this.dateRange[1] || undefined,
169
+      startDate: this.customChangeDateComponent.startDate || undefined,
170
+      endDate: this.customChangeDateComponent.endDate || undefined,
179 171
       hosId: this.hosId || undefined,
180 172
       dutyId: this.dutyId || undefined,
181 173
       parentDutyId: this.parentDutyId || undefined,
@@ -214,9 +206,10 @@ export class FloorStatisticsComponent implements OnInit, AfterViewInit {
214 206
     this.sortCurrentKey = "";
215 207
 		this.sortCurrentValue = "";
216 208
 		this.sortCurrent = {};
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')]
209
+    this.dateRange = []
218 210
     this.buildingId = undefined;
219 211
     this.fieldConfig.fields = {categoryId: undefined};
212
+    this.customChangeDateComponent.resetByDate();
220 213
     this.search();
221 214
   }
222 215
 

+ 2 - 0
src/app/views/new-statistics/maintenance-statistics/floor-statistics/floor-statistics.module.ts

@@ -5,6 +5,7 @@ import { CommonModule } from '@angular/common';
5 5
 import { FloorStatisticsRoutingModule } from './floor-statistics-routing.module';
6 6
 import { ShareModule } from 'src/app/share/share.module';
7 7
 import { SearchMoreModule } from '../../components/search-more/search-more.module';
8
+import { CustomChangeDateModule } from '../../components/custom-change-date/custom-change-date.module';
8 9
 
9 10
 
10 11
 @NgModule({
@@ -16,6 +17,7 @@ import { SearchMoreModule } from '../../components/search-more/search-more.modul
16 17
     FloorStatisticsRoutingModule,
17 18
     ShareModule,
18 19
     SearchMoreModule,
20
+    CustomChangeDateModule,
19 21
   ]
20 22
 })
21 23
 export class FloorStatisticsModule { }

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

@@ -1,10 +1,6 @@
1 1
 <div class="searchDataWrap">
2 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>
3
+    <app-custom-change-date #customChangeDate [isShowType]="false"></app-custom-change-date>
8 4
   </div>
9 5
   <div class="operation">
10 6
     <i class="icon_transport transport-gengduo" nz-tooltip nzTooltipTitle="更多搜索" (click)="showMore()"></i>

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

@@ -27,7 +27,7 @@
27 27
           font-size: 16px;
28 28
         }
29 29
         .selectItem{
30
-          width: 224px;
30
+          width: 160px;
31 31
         }
32 32
       }
33 33
     }

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

@@ -1,15 +1,16 @@
1 1
 import { TabService } from './../../services/tab.service';
2 2
 import { NzMessageService } from 'ng-zorro-antd/message';
3
-import { format, addMonths, startOfMonth, endOfMonth, startOfDay, endOfDay } from 'date-fns';
4
-import { Component, OnInit, HostListener, AfterViewInit } from "@angular/core";
3
+import { Component, OnInit, HostListener, AfterViewInit, ViewChild } from "@angular/core";
5 4
 import { MainService } from 'src/app/services/main.service';
6 5
 import { ActivatedRoute } from '@angular/router';
6
+import { CustomChangeDateComponent } from '../../components/custom-change-date/custom-change-date.component';
7 7
 @Component({
8 8
   selector: "app-group-statistics",
9 9
   templateUrl: "./group-statistics.component.html",
10 10
   styleUrls: ["./group-statistics.component.less"],
11 11
 })
12 12
 export class GroupStatisticsComponent implements OnInit, AfterViewInit {
13
+  @ViewChild('customChangeDate', { static: false }) customChangeDateComponent!: CustomChangeDateComponent;
13 14
   constructor(
14 15
     private mainService: MainService,
15 16
     private message: NzMessageService,
@@ -23,13 +24,14 @@ export class GroupStatisticsComponent implements OnInit, AfterViewInit {
23 24
   pageSize: number = 30; //表格每页展示条数
24 25
   listLength: number = 0; //表格总数据量
25 26
 
26
-  ngOnInit() {
27
-    this.initSessionData();
28
-    this.getQueryParams();
29
-    this.search();
30
-  }
27
+  ngOnInit() {}
31 28
 
32 29
   ngAfterViewInit(){
30
+    this.initSessionData();
31
+    this.getQueryParams();
32
+    setTimeout(() => {
33
+      this.search();
34
+    }, 0)
33 35
     this.onResize();
34 36
   }
35 37
 
@@ -47,6 +49,7 @@ export class GroupStatisticsComponent implements OnInit, AfterViewInit {
47 49
     this.tabService.clearQueryParams();
48 50
     if(queryParams.dateRange){
49 51
       this.dateRange = queryParams.dateRange;
52
+      this.customChangeDateComponent.initByDate(this.dateRange);
50 53
     }
51 54
   }
52 55
 
@@ -103,8 +106,8 @@ export class GroupStatisticsComponent implements OnInit, AfterViewInit {
103 106
     let postData:any = {
104 107
       idx: this.pageIndex - 1,
105 108
       sum: this.pageSize,
106
-      startDate: this.dateRange[0] || undefined,
107
-      endDate: this.dateRange[1] || undefined,
109
+      startDate: this.customChangeDateComponent.startDate || undefined,
110
+      endDate: this.customChangeDateComponent.endDate || undefined,
108 111
       hosId: this.hosId || undefined,
109 112
       dutyId: this.dutyId || undefined,
110 113
       parentDutyId: this.parentDutyId || undefined,
@@ -144,19 +147,7 @@ export class GroupStatisticsComponent implements OnInit, AfterViewInit {
144 147
   }
145 148
 
146 149
   // 日期选择
147
-  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')];
148
-  changeDate(result?): void {
149
-    result[0] = format(startOfDay(result[0]), 'yyyy-MM-dd HH:mm:ss');
150
-    result[1] = format(endOfDay(result[1]), 'yyyy-MM-dd HH:mm:ss');
151
-    this.dateRange = result;
152
-  }
153
-
154
-  onCalendarChangeDate(dateArr){
155
-    console.log(dateArr)
156
-    if(dateArr.length == 2){
157
-      this.dateRange = [format(startOfDay(dateArr[0]), 'yyyy-MM-dd HH:mm:ss'), format(endOfDay(dateArr[1]), 'yyyy-MM-dd HH:mm:ss')];
158
-    }
159
-  }
150
+  dateRange: any = [];
160 151
 
161 152
   // 导出
162 153
   excelExportLoading:any = false;
@@ -165,8 +156,8 @@ export class GroupStatisticsComponent implements OnInit, AfterViewInit {
165 156
       nzDuration: 0,
166 157
     }).messageId;
167 158
     let postData:any = {
168
-      startDate: this.dateRange[0] || undefined,
169
-      endDate: this.dateRange[1] || undefined,
159
+      startDate: this.customChangeDateComponent.startDate || undefined,
160
+      endDate: this.customChangeDateComponent.endDate || undefined,
170 161
       hosId: this.hosId || undefined,
171 162
       dutyId: this.dutyId || undefined,
172 163
       parentDutyId: this.parentDutyId || undefined,
@@ -206,8 +197,9 @@ export class GroupStatisticsComponent implements OnInit, AfterViewInit {
206 197
     this.sortCurrentKey = "";
207 198
 		this.sortCurrentValue = "";
208 199
 		this.sortCurrent = {};
209
-    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')]
200
+    this.dateRange = []
210 201
     this.fieldConfig.fields = {categoryId: undefined, buildingId: undefined, floorId: undefined};
202
+    this.customChangeDateComponent.resetByDate();
211 203
     this.search();
212 204
   }
213 205
 

+ 2 - 0
src/app/views/new-statistics/maintenance-statistics/group-statistics/group-statistics.module.ts

@@ -5,6 +5,7 @@ import { CommonModule } from '@angular/common';
5 5
 import { GroupStatisticsRoutingModule } from './group-statistics-routing.module';
6 6
 import { ShareModule } from 'src/app/share/share.module';
7 7
 import { SearchMoreModule } from '../../components/search-more/search-more.module';
8
+import { CustomChangeDateModule } from '../../components/custom-change-date/custom-change-date.module';
8 9
 
9 10
 
10 11
 @NgModule({
@@ -16,6 +17,7 @@ import { SearchMoreModule } from '../../components/search-more/search-more.modul
16 17
     GroupStatisticsRoutingModule,
17 18
     ShareModule,
18 19
     SearchMoreModule,
20
+    CustomChangeDateModule,
19 21
   ]
20 22
 })
21 23
 export class GroupStatisticsModule { }

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

@@ -117,6 +117,7 @@ export class IncidentStatisticsComponent implements OnInit, AfterViewInit {
117 117
     let postData:any = {
118 118
       idx: this.pageIndex - 1,
119 119
       sum: this.pageSize,
120
+      dateType: this.customChangeDateComponent.dateType,
120 121
       startDate: this.customChangeDateComponent.startDate || undefined,
121 122
       endDate: this.customChangeDateComponent.endDate || undefined,
122 123
       hosId: this.hosId || undefined,
@@ -169,6 +170,7 @@ export class IncidentStatisticsComponent implements OnInit, AfterViewInit {
169 170
       nzDuration: 0,
170 171
     }).messageId;
171 172
     let postData:any = {
173
+      dateType: this.customChangeDateComponent.dateType,
172 174
       startDate: this.customChangeDateComponent.startDate || undefined,
173 175
       endDate: this.customChangeDateComponent.endDate || undefined,
174 176
       hosId: this.hosId || undefined,

+ 1 - 5
src/app/views/new-statistics/maintenance-statistics/tripartite-company-statistics/tripartite-company-statistics.component.html

@@ -1,10 +1,6 @@
1 1
 <div class="searchDataWrap">
2 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>
3
+    <app-custom-change-date #customChangeDate [isShowType]="false"></app-custom-change-date>
8 4
     <div class="searchDataItem">
9 5
       <span class="label">三方公司</span>
10 6
       <nz-select class="selectItem" [nzDropdownMatchSelectWidth]="false" nzServerSearch nzShowSearch (nzOnSearch)="changeRepairDeptInp($event)" nzAllowClear nzPlaceHolder="请选择三方公司" [(ngModel)]="companyId" (nzOpenChange)="openChangeRepairDept($event)">

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

@@ -27,7 +27,7 @@
27 27
           font-size: 16px;
28 28
         }
29 29
         .selectItem{
30
-          width: 224px;
30
+          width: 160px;
31 31
         }
32 32
       }
33 33
     }

+ 18 - 25
src/app/views/new-statistics/maintenance-statistics/tripartite-company-statistics/tripartite-company-statistics.component.ts

@@ -2,16 +2,17 @@ import { TabService } from './../../services/tab.service';
2 2
 import { debounceTime } from 'rxjs/operators';
3 3
 import { Subject } from 'rxjs';
4 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";
5
+import { Component, OnInit, HostListener, AfterViewInit, ViewChild } from "@angular/core";
7 6
 import { MainService } from 'src/app/services/main.service';
8 7
 import { ActivatedRoute } from '@angular/router';
8
+import { CustomChangeDateComponent } from '../../components/custom-change-date/custom-change-date.component';
9 9
 @Component({
10 10
   selector: "app-tripartite-company-statistics",
11 11
   templateUrl: "./tripartite-company-statistics.component.html",
12 12
   styleUrls: ["./tripartite-company-statistics.component.less"],
13 13
 })
14 14
 export class TripartiteCompanyStatisticsComponent implements OnInit, AfterViewInit {
15
+  @ViewChild('customChangeDate', { static: false }) customChangeDateComponent!: CustomChangeDateComponent;
15 16
   constructor(
16 17
     private mainService: MainService,
17 18
     private message: NzMessageService,
@@ -33,12 +34,14 @@ export class TripartiteCompanyStatisticsComponent implements OnInit, AfterViewIn
33 34
       let fun = v[0];
34 35
       fun.call(this, v[1]);
35 36
     });
36
-    this.initSessionData();
37
-    this.getQueryParams();
38
-    this.search();
39 37
   }
40 38
 
41 39
   ngAfterViewInit(){
40
+    this.initSessionData();
41
+    this.getQueryParams();
42
+    setTimeout(() => {
43
+      this.search();
44
+    }, 0)
42 45
     this.onResize();
43 46
   }
44 47
 
@@ -56,6 +59,7 @@ export class TripartiteCompanyStatisticsComponent implements OnInit, AfterViewIn
56 59
     this.tabService.clearQueryParams();
57 60
     if(queryParams.dateRange){
58 61
       this.dateRange = queryParams.dateRange;
62
+      this.customChangeDateComponent.initByDate(this.dateRange);
59 63
     }
60 64
   }
61 65
 
@@ -113,8 +117,8 @@ export class TripartiteCompanyStatisticsComponent implements OnInit, AfterViewIn
113 117
       idx: this.pageIndex - 1,
114 118
       sum: this.pageSize,
115 119
 			companyId: this.companyId,
116
-      startDate: this.dateRange[0] || undefined,
117
-      endDate: this.dateRange[1] || undefined,
120
+      startDate: this.customChangeDateComponent.startDate || undefined,
121
+      endDate: this.customChangeDateComponent.endDate || undefined,
118 122
       hosId: this.hosId || undefined,
119 123
       dutyId: this.dutyId || undefined,
120 124
       parentDutyId: this.parentDutyId || undefined,
@@ -155,19 +159,7 @@ export class TripartiteCompanyStatisticsComponent implements OnInit, AfterViewIn
155 159
   }
156 160
 
157 161
   // 日期选择
158
-  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')];
159
-  changeDate(result?): void {
160
-    result[0] = format(startOfDay(result[0]), 'yyyy-MM-dd HH:mm:ss');
161
-    result[1] = format(endOfDay(result[1]), 'yyyy-MM-dd HH:mm:ss');
162
-    this.dateRange = result;
163
-  }
164
-
165
-  onCalendarChangeDate(dateArr){
166
-    console.log(dateArr)
167
-    if(dateArr.length == 2){
168
-      this.dateRange = [format(startOfDay(dateArr[0]), 'yyyy-MM-dd HH:mm:ss'), format(endOfDay(dateArr[1]), 'yyyy-MM-dd HH:mm:ss')];
169
-    }
170
-  }
162
+  dateRange: any = [];
171 163
 
172 164
   // 导出
173 165
   excelExportLoading:any = false;
@@ -177,8 +169,8 @@ export class TripartiteCompanyStatisticsComponent implements OnInit, AfterViewIn
177 169
     }).messageId;
178 170
     let postData:any = {
179 171
 			companyId: this.companyId,
180
-      startDate: this.dateRange[0] || undefined,
181
-      endDate: this.dateRange[1] || undefined,
172
+      startDate: this.customChangeDateComponent.startDate || undefined,
173
+      endDate: this.customChangeDateComponent.endDate || undefined,
182 174
       hosId: this.hosId || undefined,
183 175
       dutyId: this.dutyId || undefined,
184 176
       parentDutyId: this.parentDutyId || undefined,
@@ -219,9 +211,10 @@ export class TripartiteCompanyStatisticsComponent implements OnInit, AfterViewIn
219 211
     this.sortCurrentKey = "";
220 212
 		this.sortCurrentValue = "";
221 213
 		this.sortCurrent = {};
222
-    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')]
214
+    this.dateRange = []
223 215
     this.companyId = undefined;
224 216
     this.fieldConfig.fields = {categoryId: undefined, buildingId: undefined, floorId: undefined, repairDeptId: undefined};
217
+    this.customChangeDateComponent.resetByDate();
225 218
     this.search();
226 219
   }
227 220
 
@@ -261,7 +254,7 @@ export class TripartiteCompanyStatisticsComponent implements OnInit, AfterViewIn
261 254
         this.repairDeptList = data.list;
262 255
       });
263 256
   }
264
-	
257
+
265 258
 	// 获取三方公司列表
266 259
 	companyId:any;
267 260
 	companyList:any[] = [];
@@ -285,7 +278,7 @@ export class TripartiteCompanyStatisticsComponent implements OnInit, AfterViewIn
285 278
 	    }
286 279
 	  });
287 280
 	}
288
-	
281
+
289 282
   // 详细搜索
290 283
   fieldConfig:any = {
291 284
     fields: {categoryId: undefined, buildingId: undefined, floorId: undefined, repairDeptId: true},

+ 2 - 0
src/app/views/new-statistics/maintenance-statistics/tripartite-company-statistics/tripartite-company-statistics.module.ts

@@ -5,6 +5,7 @@ import { CommonModule } from '@angular/common';
5 5
 import { TripartiteCompanyStatisticsRoutingModule } from './tripartite-company-statistics-routing.module';
6 6
 import { ShareModule } from 'src/app/share/share.module';
7 7
 import { SearchMoreModule } from '../../components/search-more/search-more.module';
8
+import { CustomChangeDateModule } from '../../components/custom-change-date/custom-change-date.module';
8 9
 
9 10
 
10 11
 @NgModule({
@@ -16,6 +17,7 @@ import { SearchMoreModule } from '../../components/search-more/search-more.modul
16 17
     TripartiteCompanyStatisticsRoutingModule,
17 18
     ShareModule,
18 19
     SearchMoreModule,
20
+    CustomChangeDateModule,
19 21
   ]
20 22
 })
21 23
 export class TripartiteCompanyStatisticsModule { }

+ 1 - 5
src/app/views/new-statistics/maintenance-statistics/work-hour-big-statistics/work-hour-big-statistics.component.html

@@ -1,10 +1,6 @@
1 1
 <div class="searchDataWrap">
2 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>
3
+    <app-custom-change-date #customChangeDate [isShowType]="false"></app-custom-change-date>
8 4
     <div class="searchDataItem">
9 5
       <span class="label">报修科室</span>
10 6
       <nz-select class="selectItem" [nzDropdownMatchSelectWidth]="false" nzServerSearch nzShowSearch (nzOnSearch)="changeRepairDeptInp($event)" nzAllowClear nzPlaceHolder="请选择报修科室" [(ngModel)]="repairDeptId" (nzOpenChange)="openChangeRepairDept($event)">

+ 1 - 1
src/app/views/new-statistics/maintenance-statistics/work-hour-big-statistics/work-hour-big-statistics.component.less

@@ -27,7 +27,7 @@
27 27
           font-size: 16px;
28 28
         }
29 29
         .selectItem{
30
-          width: 224px;
30
+          width: 160px;
31 31
         }
32 32
       }
33 33
     }

+ 16 - 23
src/app/views/new-statistics/maintenance-statistics/work-hour-big-statistics/work-hour-big-statistics.component.ts

@@ -2,16 +2,17 @@ import { TabService } from '../../services/tab.service';
2 2
 import { debounceTime } from 'rxjs/operators';
3 3
 import { Subject } from 'rxjs';
4 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";
5
+import { Component, OnInit, HostListener, AfterViewInit, ViewChild } from "@angular/core";
7 6
 import { MainService } from 'src/app/services/main.service';
8 7
 import { ActivatedRoute } from '@angular/router';
8
+import { CustomChangeDateComponent } from '../../components/custom-change-date/custom-change-date.component';
9 9
 @Component({
10 10
   selector: "app-work-hour-big-statistics",
11 11
   templateUrl: "./work-hour-big-statistics.component.html",
12 12
   styleUrls: ["./work-hour-big-statistics.component.less"],
13 13
 })
14 14
 export class WorkHourBigStatisticsComponent implements OnInit, AfterViewInit {
15
+  @ViewChild('customChangeDate', { static: false }) customChangeDateComponent!: CustomChangeDateComponent;
15 16
   constructor(
16 17
     private mainService: MainService,
17 18
     private message: NzMessageService,
@@ -34,12 +35,14 @@ export class WorkHourBigStatisticsComponent implements OnInit, AfterViewInit {
34 35
       let fun = v[0];
35 36
       fun.call(this, v[1]);
36 37
     });
37
-    this.initSessionData();
38
-    this.getQueryParams();
39
-    this.search();
40 38
   }
41 39
 
42 40
   ngAfterViewInit(){
41
+    this.initSessionData();
42
+    this.getQueryParams();
43
+    setTimeout(() => {
44
+      this.search();
45
+    }, 0)
43 46
     this.onResize();
44 47
   }
45 48
 
@@ -57,6 +60,7 @@ export class WorkHourBigStatisticsComponent implements OnInit, AfterViewInit {
57 60
     this.tabService.clearQueryParams();
58 61
     if(queryParams.dateRange){
59 62
       this.dateRange = queryParams.dateRange;
63
+      this.customChangeDateComponent.initByDate(this.dateRange);
60 64
     }
61 65
   }
62 66
 
@@ -114,8 +118,8 @@ export class WorkHourBigStatisticsComponent implements OnInit, AfterViewInit {
114 118
       idx: this.pageIndex - 1,
115 119
       sum: this.pageSize,
116 120
       treeLevel: 1,
117
-      startDate: this.dateRange[0] || undefined,
118
-      endDate: this.dateRange[1] || undefined,
121
+      startDate: this.customChangeDateComponent.startDate || undefined,
122
+      endDate: this.customChangeDateComponent.endDate || undefined,
119 123
       hosId: this.hosId || undefined,
120 124
       dutyId: this.dutyId || undefined,
121 125
       parentDutyId: this.parentDutyId || undefined,
@@ -159,19 +163,7 @@ export class WorkHourBigStatisticsComponent implements OnInit, AfterViewInit {
159 163
   }
160 164
 
161 165
   // 日期选择
162
-  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')];
163
-  changeDate(result?): void {
164
-    result[0] = format(startOfDay(result[0]), 'yyyy-MM-dd HH:mm:ss');
165
-    result[1] = format(endOfDay(result[1]), 'yyyy-MM-dd HH:mm:ss');
166
-    this.dateRange = result;
167
-  }
168
-
169
-  onCalendarChangeDate(dateArr){
170
-    console.log(dateArr)
171
-    if(dateArr.length == 2){
172
-      this.dateRange = [format(startOfDay(dateArr[0]), 'yyyy-MM-dd HH:mm:ss'), format(endOfDay(dateArr[1]), 'yyyy-MM-dd HH:mm:ss')];
173
-    }
174
-  }
166
+  dateRange: any = [];
175 167
 
176 168
   // 导出
177 169
   excelExportLoading:any = false;
@@ -181,8 +173,8 @@ export class WorkHourBigStatisticsComponent implements OnInit, AfterViewInit {
181 173
     }).messageId;
182 174
     let postData:any = {
183 175
       treeLevel: 1,
184
-      startDate: this.dateRange[0] || undefined,
185
-      endDate: this.dateRange[1] || undefined,
176
+      startDate: this.customChangeDateComponent.startDate || undefined,
177
+      endDate: this.customChangeDateComponent.endDate || undefined,
186 178
       hosId: this.hosId || undefined,
187 179
       dutyId: this.dutyId || undefined,
188 180
       parentDutyId: this.parentDutyId || undefined,
@@ -226,9 +218,10 @@ export class WorkHourBigStatisticsComponent implements OnInit, AfterViewInit {
226 218
     this.sortCurrentKey = "";
227 219
 		this.sortCurrentValue = "";
228 220
 		this.sortCurrent = {};
229
-    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 = []
230 222
     this.repairDeptId = undefined;
231 223
     this.fieldConfig.fields = {groupId: undefined, userId: undefined, categoryId: undefined, buildingId: undefined, floorId: undefined, companyId: undefined};
224
+    this.customChangeDateComponent.resetByDate();
232 225
     this.search();
233 226
   }
234 227
 

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

@@ -5,6 +5,7 @@ import { CommonModule } from '@angular/common';
5 5
 import { WorkHourBigStatisticsRoutingModule } from './work-hour-big-statistics-routing.module';
6 6
 import { ShareModule } from 'src/app/share/share.module';
7 7
 import { SearchMoreModule } from '../../components/search-more/search-more.module';
8
+import { CustomChangeDateModule } from '../../components/custom-change-date/custom-change-date.module';
8 9
 
9 10
 
10 11
 @NgModule({
@@ -16,6 +17,7 @@ import { SearchMoreModule } from '../../components/search-more/search-more.modul
16 17
     WorkHourBigStatisticsRoutingModule,
17 18
     ShareModule,
18 19
     SearchMoreModule,
20
+    CustomChangeDateModule,
19 21
   ]
20 22
 })
21 23
 export class WorkHourBigStatisticsModule { }

+ 1 - 5
src/app/views/new-statistics/maintenance-statistics/work-hour-small-statistics/work-hour-small-statistics.component.html

@@ -1,10 +1,6 @@
1 1
 <div class="searchDataWrap">
2 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>
3
+    <app-custom-change-date #customChangeDate [isShowType]="false"></app-custom-change-date>
8 4
     <div class="searchDataItem">
9 5
       <span class="label">报修科室</span>
10 6
       <nz-select class="selectItem" [nzDropdownMatchSelectWidth]="false" nzServerSearch nzShowSearch (nzOnSearch)="changeRepairDeptInp($event)" nzAllowClear nzPlaceHolder="请选择报修科室" [(ngModel)]="repairDeptId" (nzOpenChange)="openChangeRepairDept($event)">

+ 1 - 1
src/app/views/new-statistics/maintenance-statistics/work-hour-small-statistics/work-hour-small-statistics.component.less

@@ -27,7 +27,7 @@
27 27
           font-size: 16px;
28 28
         }
29 29
         .selectItem{
30
-          width: 224px;
30
+          width: 160px;
31 31
         }
32 32
       }
33 33
     }

+ 16 - 23
src/app/views/new-statistics/maintenance-statistics/work-hour-small-statistics/work-hour-small-statistics.component.ts

@@ -2,16 +2,17 @@ import { TabService } from './../../services/tab.service';
2 2
 import { debounceTime } from 'rxjs/operators';
3 3
 import { Subject } from 'rxjs';
4 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";
5
+import { Component, OnInit, HostListener, AfterViewInit, ViewChild } from "@angular/core";
7 6
 import { MainService } from 'src/app/services/main.service';
8 7
 import { ActivatedRoute } from '@angular/router';
8
+import { CustomChangeDateComponent } from '../../components/custom-change-date/custom-change-date.component';
9 9
 @Component({
10 10
   selector: "app-work-hour-small-statistics",
11 11
   templateUrl: "./work-hour-small-statistics.component.html",
12 12
   styleUrls: ["./work-hour-small-statistics.component.less"],
13 13
 })
14 14
 export class WorkHourSmallStatisticsComponent implements OnInit, AfterViewInit {
15
+  @ViewChild('customChangeDate', { static: false }) customChangeDateComponent!: CustomChangeDateComponent;
15 16
   constructor(
16 17
     private mainService: MainService,
17 18
     private message: NzMessageService,
@@ -34,12 +35,14 @@ export class WorkHourSmallStatisticsComponent implements OnInit, AfterViewInit {
34 35
       let fun = v[0];
35 36
       fun.call(this, v[1]);
36 37
     });
37
-    this.initSessionData();
38
-    this.getQueryParams();
39
-    this.search();
40 38
   }
41 39
 
42 40
   ngAfterViewInit(){
41
+    this.initSessionData();
42
+    this.getQueryParams();
43
+    setTimeout(() => {
44
+      this.search();
45
+    }, 0)
43 46
     this.onResize();
44 47
   }
45 48
 
@@ -57,6 +60,7 @@ export class WorkHourSmallStatisticsComponent implements OnInit, AfterViewInit {
57 60
     this.tabService.clearQueryParams();
58 61
     if(queryParams.dateRange){
59 62
       this.dateRange = queryParams.dateRange;
63
+      this.customChangeDateComponent.initByDate(this.dateRange);
60 64
     }
61 65
   }
62 66
 
@@ -114,8 +118,8 @@ export class WorkHourSmallStatisticsComponent implements OnInit, AfterViewInit {
114 118
       idx: this.pageIndex - 1,
115 119
       sum: this.pageSize,
116 120
       treeLevel: 2,
117
-      startDate: this.dateRange[0] || undefined,
118
-      endDate: this.dateRange[1] || undefined,
121
+      startDate: this.customChangeDateComponent.startDate || undefined,
122
+      endDate: this.customChangeDateComponent.endDate || undefined,
119 123
       hosId: this.hosId || undefined,
120 124
       dutyId: this.dutyId || undefined,
121 125
       parentDutyId: this.parentDutyId || undefined,
@@ -160,19 +164,7 @@ export class WorkHourSmallStatisticsComponent implements OnInit, AfterViewInit {
160 164
   }
161 165
 
162 166
   // 日期选择
163
-  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')];
164
-  changeDate(result?): void {
165
-    result[0] = format(startOfDay(result[0]), 'yyyy-MM-dd HH:mm:ss');
166
-    result[1] = format(endOfDay(result[1]), 'yyyy-MM-dd HH:mm:ss');
167
-    this.dateRange = result;
168
-  }
169
-
170
-  onCalendarChangeDate(dateArr){
171
-    console.log(dateArr)
172
-    if(dateArr.length == 2){
173
-      this.dateRange = [format(startOfDay(dateArr[0]), 'yyyy-MM-dd HH:mm:ss'), format(endOfDay(dateArr[1]), 'yyyy-MM-dd HH:mm:ss')];
174
-    }
175
-  }
167
+  dateRange: any = [];
176 168
 
177 169
   // 导出
178 170
   excelExportLoading:any = false;
@@ -182,8 +174,8 @@ export class WorkHourSmallStatisticsComponent implements OnInit, AfterViewInit {
182 174
     }).messageId;
183 175
     let postData:any = {
184 176
       treeLevel: 2,
185
-      startDate: this.dateRange[0] || undefined,
186
-      endDate: this.dateRange[1] || undefined,
177
+      startDate: this.customChangeDateComponent.startDate || undefined,
178
+      endDate: this.customChangeDateComponent.endDate || undefined,
187 179
       hosId: this.hosId || undefined,
188 180
       dutyId: this.dutyId || undefined,
189 181
       parentDutyId: this.parentDutyId || undefined,
@@ -228,9 +220,10 @@ export class WorkHourSmallStatisticsComponent implements OnInit, AfterViewInit {
228 220
     this.sortCurrentKey = "";
229 221
 		this.sortCurrentValue = "";
230 222
 		this.sortCurrent = {};
231
-    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')]
223
+    this.dateRange = []
232 224
     this.repairDeptId = undefined;
233 225
     this.fieldConfig.fields = {groupId: undefined, userId: undefined, categoryId: undefined, buildingId: undefined, floorId: undefined, companyId: undefined, workHourParentId: undefined};
226
+    this.customChangeDateComponent.resetByDate();
234 227
     this.search();
235 228
   }
236 229
 

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

@@ -5,6 +5,7 @@ import { CommonModule } from '@angular/common';
5 5
 import { WorkHourSmallStatisticsRoutingModule } from './work-hour-small-statistics-routing.module';
6 6
 import { ShareModule } from 'src/app/share/share.module';
7 7
 import { SearchMoreModule } from '../../components/search-more/search-more.module';
8
+import { CustomChangeDateModule } from '../../components/custom-change-date/custom-change-date.module';
8 9
 
9 10
 
10 11
 @NgModule({
@@ -16,6 +17,7 @@ import { SearchMoreModule } from '../../components/search-more/search-more.modul
16 17
     WorkHourSmallStatisticsRoutingModule,
17 18
     ShareModule,
18 19
     SearchMoreModule,
20
+    CustomChangeDateModule,
19 21
   ]
20 22
 })
21 23
 export class WorkHourSmallStatisticsModule { }