seimin 1 month ago
parent
commit
3b5ef52907
15 changed files with 440 additions and 467 deletions
  1. 1 1
      src/app/views/new-statistics/components/custom-change-date/custom-change-date.component.html
  2. 25 25
      src/app/views/new-statistics/components/custom-change-date/custom-change-date.component.ts
  3. 154 156
      src/app/views/new-statistics/distribution-inspection-statistics/distribution-synthesize-statistics/distribution-synthesize-statistics.component.html
  4. 4 1
      src/app/views/new-statistics/distribution-inspection-statistics/distribution-synthesize-statistics/distribution-synthesize-statistics.component.less
  5. 30 42
      src/app/views/new-statistics/distribution-inspection-statistics/distribution-synthesize-statistics/distribution-synthesize-statistics.component.ts
  6. 3 1
      src/app/views/new-statistics/distribution-inspection-statistics/distribution-synthesize-statistics/distribution-synthesize-statistics.module.ts
  7. 159 161
      src/app/views/new-statistics/maintenance-statistics/synthesize-statistics/synthesize-statistics.component.html
  8. 4 1
      src/app/views/new-statistics/maintenance-statistics/synthesize-statistics/synthesize-statistics.component.less
  9. 31 42
      src/app/views/new-statistics/maintenance-statistics/synthesize-statistics/synthesize-statistics.component.ts
  10. 3 1
      src/app/views/new-statistics/maintenance-statistics/synthesize-statistics/synthesize-statistics.module.ts
  11. 1 5
      src/app/views/new-statistics/maintenance-statistics/user-statistics/user-statistics.component.html
  12. 1 1
      src/app/views/new-statistics/maintenance-statistics/user-statistics/user-statistics.component.less
  13. 16 23
      src/app/views/new-statistics/maintenance-statistics/user-statistics/user-statistics.component.ts
  14. 2 0
      src/app/views/new-statistics/maintenance-statistics/user-statistics/user-statistics.module.ts
  15. 6 7
      src/app/views/new-statistics/phone-statistics/date-phone-statistics/date-phone-statistics.component.ts

+ 1 - 1
src/app/views/new-statistics/components/custom-change-date/custom-change-date.component.html

@@ -5,7 +5,7 @@
5
     </nz-radio-group>
5
     </nz-radio-group>
6
   </div>
6
   </div>
7
   <div class="searchDataItem">
7
   <div class="searchDataItem">
8
-    <span class="label">建单时间</span>:
8
+    <span class="label">{{name}}</span>:
9
     <nz-range-picker [ngStyle]="{width: '260px'}" [nzAllowClear]="false" *ngIf="dateType=='day'" [(ngModel)]="dateRange" [nzAllowClear]='false'
9
     <nz-range-picker [ngStyle]="{width: '260px'}" [nzAllowClear]="false" *ngIf="dateType=='day'" [(ngModel)]="dateRange" [nzAllowClear]='false'
10
       [nzDisabledDate]="disabledDate" (ngModelChange)="changeDate($event)">
10
       [nzDisabledDate]="disabledDate" (ngModelChange)="changeDate($event)">
11
     </nz-range-picker>
11
     </nz-range-picker>

+ 25 - 25
src/app/views/new-statistics/components/custom-change-date/custom-change-date.component.ts

@@ -1,5 +1,4 @@
1
-import { Component, OnInit, Output, Input } from '@angular/core';
2
-import { EventEmitter } from '@angular/core';
1
+import { Component, OnInit, Input } from '@angular/core';
3
 import { differenceInCalendarDays, endOfMonth, endOfYear, startOfDay, format, endOfDay, startOfMonth, startOfYear } from "date-fns";
2
 import { differenceInCalendarDays, endOfMonth, endOfYear, startOfDay, format, endOfDay, startOfMonth, startOfYear } from "date-fns";
4
 import { DateService } from 'src/app/services/date.service';
3
 import { DateService } from 'src/app/services/date.service';
5
 
4
 
@@ -9,8 +8,8 @@ import { DateService } from 'src/app/services/date.service';
9
   styleUrls: ['./custom-change-date.component.less']
8
   styleUrls: ['./custom-change-date.component.less']
10
 })
9
 })
11
 export class CustomChangeDateComponent implements OnInit {
10
 export class CustomChangeDateComponent implements OnInit {
12
-  // @Output() customChangeDateEmit = new EventEmitter();
13
   @Input() isShowType: boolean = true;
11
   @Input() isShowType: boolean = true;
12
+  @Input() name: string = '建单时间';
14
   constructor(
13
   constructor(
15
     private dateService: DateService,
14
     private dateService: DateService,
16
   ) { }
15
   ) { }
@@ -69,29 +68,26 @@ export class CustomChangeDateComponent implements OnInit {
69
   yearRangeEnd: any; //发起时间 年 止
68
   yearRangeEnd: any; //发起时间 年 止
70
 
69
 
71
   ngOnInit() {
70
   ngOnInit() {
72
-    this.dateType = 'day';
73
-    this.defRange = 6;
74
-    this.changeDateRange(this.defRange);
71
+    this.resetByDate();
75
   }
72
   }
76
 
73
 
77
   // 根据时间区间重置
74
   // 根据时间区间重置
78
-  reset(dateRange:any[]){
75
+  resetByDate(){
79
     this.dateType = 'day';
76
     this.dateType = 'day';
80
-    if(
81
-      this.dateService.getDateType(dateRange) == 1 ||
82
-      this.dateService.getDateType(dateRange) == 2 ||
83
-      this.dateService.getDateType(dateRange) == 3 ||
84
-      this.dateService.getDateType(dateRange) == 5 ||
85
-      this.dateService.getDateType(dateRange) == 6 ||
86
-      this.dateService.getDateType(dateRange) == 7
87
-    ){
88
-      this.defRange = this.dateService.getDateType(dateRange);
89
-    }
90
-    this.changeDateRange(this.defRange);
77
+    this.changeDateType(this.dateType, 6);
78
+  }
79
+
80
+  // 根据时间区间初始化
81
+  initByDate(dateRange:any[]){
82
+    setTimeout(() => {
83
+      this.dateType = 'day';
84
+      this.dateRange = dateRange;
85
+      this.changeDateType(this.dateType, null);
86
+    }, 0)
91
   }
87
   }
92
 
88
 
93
   // 修改时间展示维度
89
   // 修改时间展示维度
94
-  changeDateType(res) {
90
+  changeDateType(res, defRange) {
95
     console.log(res, this.dateType);
91
     console.log(res, this.dateType);
96
     this.dateType = res;
92
     this.dateType = res;
97
     switch (res) {
93
     switch (res) {
@@ -122,8 +118,8 @@ export class CustomChangeDateComponent implements OnInit {
122
             id: 7,
118
             id: 7,
123
           },
119
           },
124
         ]; //时间默认区间
120
         ]; //时间默认区间
125
-        this.defRange = this.defRanges[0].id;
126
-        this.changeDateRange(this.defRanges[0].id);
121
+        this.defRange = defRange === undefined ? this.defRanges[0].id : defRange;
122
+        this.changeDateRange(defRange === undefined ? this.defRanges[0].id : defRange);
127
         break;
123
         break;
128
       case "month":
124
       case "month":
129
         this.defRanges = [
125
         this.defRanges = [
@@ -140,8 +136,8 @@ export class CustomChangeDateComponent implements OnInit {
140
             id: 7,
136
             id: 7,
141
           },
137
           },
142
         ]; //时间默认区间
138
         ]; //时间默认区间
143
-        this.defRange = this.defRanges[0].id;
144
-        this.changeDateRange(this.defRanges[0].id);
139
+        this.defRange = defRange === undefined ? this.defRanges[0].id : defRange;
140
+        this.changeDateRange(defRange === undefined ? this.defRanges[0].id : defRange);
145
         break;
141
         break;
146
       case "year":
142
       case "year":
147
         this.defRanges = [
143
         this.defRanges = [
@@ -154,8 +150,8 @@ export class CustomChangeDateComponent implements OnInit {
154
             id: 7,
150
             id: 7,
155
           },
151
           },
156
         ]; //时间默认区间
152
         ]; //时间默认区间
157
-        this.defRange = this.defRanges[0].id;
158
-        this.changeDateRange(this.defRanges[0].id);
153
+        this.defRange = defRange === undefined ? this.defRanges[0].id : defRange;
154
+        this.changeDateRange(defRange === undefined ? this.defRanges[0].id : defRange);
159
         break;
155
         break;
160
     }
156
     }
161
   }
157
   }
@@ -335,6 +331,10 @@ export class CustomChangeDateComponent implements OnInit {
335
         this.changeYearStart(lastyearstartdate);
331
         this.changeYearStart(lastyearstartdate);
336
         this.changeYearEnd(lastyearenddate);
332
         this.changeYearEnd(lastyearenddate);
337
         break;
333
         break;
334
+      default:
335
+        // 回显initByDate
336
+        this.changeDate([new Date(this.dateRange[0]), new Date(this.dateRange[1])]);
337
+        break;
338
     }
338
     }
339
     this.quick = false;
339
     this.quick = false;
340
   }
340
   }

+ 154 - 156
src/app/views/new-statistics/distribution-inspection-statistics/distribution-synthesize-statistics/distribution-synthesize-statistics.component.html

@@ -1,170 +1,168 @@
1
-<div class="synthesize-box" *ngIf="!isLoading">
1
+<div class="synthesize-box">
2
 	<div class="searchDataWrap">
2
 	<div class="searchDataWrap">
3
 		<div class="searchData">
3
 		<div class="searchData">
4
-			<div class="searchDataItem">
5
-				<span class="label">选择日期</span>:
6
-				<nz-range-picker [(ngModel)]="dateRange" [nzAllowClear]="false" (ngModelChange)="changeDate($event)" (nzOnCalendarChange)="onCalendarChangeDate($event)">
7
-				</nz-range-picker>
8
-			</div>
4
+			<app-custom-change-date #customChangeDate [isShowType]="true" name="选择日期"></app-custom-change-date>
9
 		</div>
5
 		</div>
10
 		<div class="operation">
6
 		<div class="operation">
11
 			<button nz-button class="btn default" (click)="search()">搜索</button>
7
 			<button nz-button class="btn default" (click)="search()">搜索</button>
12
 			<button nz-button class="btn default ml8" (click)="reset()">重置</button>
8
 			<button nz-button class="btn default ml8" (click)="reset()">重置</button>
13
 		</div>
9
 		</div>
14
 	</div>
10
 	</div>
15
-	<div class="top1-statistics">
16
-		<div class="top-list">
17
-			<div class="special-box">
18
-				<div class="num">{{workData.totalCount || 0}}</div>
19
-				<div class="describe">工单总数</div>
20
-			</div>
21
-			<div class="special-box-right">
22
-				<div class="sign-describe">已完成: <span class="sign-num">{{workData.doneCount || 0}}</span></div>
23
-				<div class="sign-describe">待接单: <span class="sign-num">{{workData.waitCount || 0}}</span></div>
24
-				<div class="sign-describe">处理中: <span class="sign-num">{{workData.doingCount || 0}}</span></div>
25
-			</div>
26
-			<div class="border"></div>
27
-		</div>
28
-		<div class="top-list">
29
-			<div class="special-box">
30
-				<div class="num">{{workData.workerCount || 0}}</div>
31
-				<div class="describe">总人数</div>
32
-			</div>
33
-			<div class="border"></div>
34
-		</div>
35
-		<div class="top-list">
36
-			<div class="special-box">
37
-				<div class="num">{{workData.totalGrade || 0}}</div>
38
-				<div class="describe">总积分</div>
39
-			</div>
40
-			<div class="border"></div>
41
-		</div>
42
-		<div class="top-list">
43
-			<div class="special-box">
44
-				<div class="num">{{workData.badCount || 0}}</div>
45
-				<div class="describe">差评单数</div>
46
-			</div>
47
-			<div class="border"></div>
48
-		</div>
49
-		<div class="top-list">
50
-			<div class="special-box">
51
-				<div class="num">{{workData.doneRate || 0}}%</div>
52
-				<div class="describe">按时完成率</div>
53
-			</div>
54
-		</div>
55
-	</div>
56
-<!--  <div class="top0-statistics">
57
-    <div>标本<span class="num">{{businessData.specimenCount || 0}}</span></div>
58
-    <div>病理<span class="num">{{businessData.pathologyCount || 0}}</span></div>
59
-    <div>陪检<span class="num">{{businessData.inspectCount || 0}}</span></div>
60
-    <div>药品<span class="num">{{businessData.drugsCount || 0}}</span></div>
61
-    <div>静配<span class="num">{{businessData.drugsJpCount || 0}}</span></div>
62
-    <div>中药<span class="num">{{businessData.drugsHerbalCount || 0}}</span></div>
63
-    <div>血制品<span class="num">{{businessData.bloodCount || 0}}</span></div>
64
-  </div> -->
65
-	<div class="top2-statistics">
66
-    <div class="statistics width-60 mar-right-8">
67
-			<div class="statistics-box">
68
-				<div class="sign-green"></div>
69
-				<div class="statistics-title">业务分类top5</div>
70
-				<div class="more" *ngIf="showMore('businessClassifyStatistics')" (click)="toPath('/newStatistics/distributionInspectionStatistics/businessClassifyStatistics')">更多></div>
71
-			</div>
72
-			<div class="echarts-repairs">
73
-				<div echarts class="echarts" [options]='businessOptions'></div>
74
-			</div>
75
-		</div>
76
-		<div class="statistics width-40">
77
-			<div class="statistics-box">
78
-				<div class="sign-green"></div>
79
-				<div class="statistics-title">申请来源</div>
80
-				<div class="more" *ngIf="showMore('sourceStatistics')" (click)="toPath('/newStatistics/distributionInspectionStatistics/sourceStatistics')">更多></div>
81
-			</div>
82
-			<div class="echarts-repairs">
83
-			  <div echarts class="echarts" [options]='applyOptions'></div>
84
-			</div>
85
-		</div>
86
-	</div>
87
-  <div class="top2-statistics">
88
-		<div class="statistics width-49 mar-right-8">
89
-			<div class="statistics-box">
90
-				<div class="sign-green"></div>
91
-				<div class="statistics-title">科室Top5</div>
92
-				<div class="more" *ngIf="showMore('departmentQualityControlStatistics')" (click)="toPath('/newStatistics/distributionInspectionStatistics/departmentQualityControlStatistics')">更多></div>
93
-			</div>
94
-			<div class="table">
95
-				<div class="td">
96
-					<div class="table-td-4">排名</div>
97
-					<div class="table-td-4">科室名称</div>
98
-					<div class="table-td-4">工单量</div>
99
-					<div class="table-td-4">好评率</div>
100
-				</div>
101
-				<div class="th" *ngFor="let item of deptTopData; let index = index;">
102
-          <div class="table-list-4">
103
-						<img src="../../assets/images/top1.png" alt="" class="img" *ngIf="index==0">
104
-						<img src="../../assets/images/top2.png" alt="" class="img" *ngIf="index==1">
105
-						<img src="../../assets/images/top3.png" alt="" class="img" *ngIf="index==2">
106
-						<span *ngIf="index !=0 && index !=1 && index !=2">{{index+1}}</span>
107
-					</div>
108
-					<div class="table-list-4 ellipsis-oneline" title="{{item.dept}}">{{item.dept}}</div>
109
-					<div class="table-list-4">{{item.sum || 0}}</div>
110
-					<div class="table-list-4">{{item.goodRate || '0%'}}</div>
111
-				</div>
112
-			</div>
113
-		</div>
114
-		<div class="statistics width-50">
115
-			<div class="statistics-box">
116
-				<div class="sign-green"></div>
117
-				<div class="statistics-title">人员Top5</div>
118
-				<div class="more" *ngIf="showMore('userQualityControlStatistics')" (click)="toPath('/newStatistics/distributionInspectionStatistics/userQualityControlStatistics')">更多></div>
119
-			</div>
120
-			<div class="table">
121
-				<div class="td">
122
-					<div class="table-td-4">排名</div>
123
-					<div class="table-td-4">人员名称</div>
124
-					<div class="table-td-4">工单量</div>
125
-					<div class="table-td-4">积分总数</div>
126
-				</div>
127
-				<div class="th" *ngFor="let item of userTopData; let index = index;">
128
-					<div class="table-list-4">
129
-						<img src="../../assets/images/top1.png" alt="" class="img" *ngIf="index==0">
130
-						<img src="../../assets/images/top2.png" alt="" class="img" *ngIf="index==1">
131
-						<img src="../../assets/images/top3.png" alt="" class="img" *ngIf="index==2">
132
-						<span *ngIf="index !=0 && index !=1 && index !=2">{{index+1}}</span>
133
-					</div>
134
-					<div class="table-list-4 ellipsis-oneline" title="{{item.userName}}({{item.userAccount}})">{{item.userName}}<ng-container *ngIf="item.userAccount">({{item.userAccount}})</ng-container></div>
135
-					<div class="table-list-4">{{item.sum || 0}}</div>
136
-					<div class="table-list-4">{{item.totalGrade || 0}}</div>
137
-				</div>
138
-			</div>
139
-		</div>
140
-	</div>
141
-  <div class="top2-statistics">
142
-    <div class="statistics width-100">
143
-      <div class="statistics-box">
144
-        <div class="sign-green"></div>
145
-        <div class="statistics-title">日趋势图</div>
146
-        <div class="statistics-select">
147
-					<div class="statistics-select-list" [ngClass]="{'activeClass': activeIndex == 'day'}" (click)="selectCheck('day')">日</div>
148
-					<div class="statistics-select-list" [ngClass]="{'activeClass': activeIndex == 'hour'}" (click)="selectCheck('hour')">时</div>
149
-				</div>
150
-        <div class="searchDataItem ml8">
151
-          <span class="label">统计分类</span>:
152
-          <nz-select class="selectItem" [nzDropdownMatchSelectWidth]="false" nzAllowClear nzPlaceHolder="请选择统计分类" [(ngModel)]="statisticsTypeId" (ngModelChange)="changeStatisticsType($event)">
153
-            <ng-container *ngFor="let option of statisticsTypeList">
154
-              <nz-option *ngIf="!isLoading" [nzLabel]="option.name" [nzValue]="option.id"></nz-option>
155
-            </ng-container>
156
-            <nz-option *ngIf="isLoading" nzDisabled nzCustomContent>
157
-              <i nz-icon nzType="loading" class="loading-icon"></i> 搜索中...
158
-            </nz-option>
159
-          </nz-select>
160
-        </div>
161
-        <div class="more" *ngIf="showMore('dateQualityControlStatistics')" (click)="toPath('/newStatistics/distributionInspectionStatistics/dateQualityControlStatistics')">更多></div>
11
+  <ng-container *ngIf="!isLoading">
12
+    <div class="top1-statistics">
13
+      <div class="top-list">
14
+        <div class="special-box">
15
+          <div class="num">{{workData.totalCount || 0}}</div>
16
+          <div class="describe">工单总数</div>
17
+        </div>
18
+        <div class="special-box-right">
19
+          <div class="sign-describe">已完成: <span class="sign-num">{{workData.doneCount || 0}}</span></div>
20
+          <div class="sign-describe">待接单: <span class="sign-num">{{workData.waitCount || 0}}</span></div>
21
+          <div class="sign-describe">处理中: <span class="sign-num">{{workData.doingCount || 0}}</span></div>
22
+        </div>
23
+        <div class="border"></div>
24
+      </div>
25
+      <div class="top-list">
26
+        <div class="special-box">
27
+          <div class="num">{{workData.workerCount || 0}}</div>
28
+          <div class="describe">总人数</div>
29
+        </div>
30
+        <div class="border"></div>
31
+      </div>
32
+      <div class="top-list">
33
+        <div class="special-box">
34
+          <div class="num">{{workData.totalGrade || 0}}</div>
35
+          <div class="describe">总积分</div>
36
+        </div>
37
+        <div class="border"></div>
38
+      </div>
39
+      <div class="top-list">
40
+        <div class="special-box">
41
+          <div class="num">{{workData.badCount || 0}}</div>
42
+          <div class="describe">差评单数</div>
43
+        </div>
44
+        <div class="border"></div>
162
       </div>
45
       </div>
163
-      <div class="echarts-repairs">
164
-        <div echarts class="echarts" [options]='trendOptions'></div>
46
+      <div class="top-list">
47
+        <div class="special-box">
48
+          <div class="num">{{workData.doneRate || 0}}%</div>
49
+          <div class="describe">按时完成率</div>
50
+        </div>
51
+      </div>
52
+    </div>
53
+    <!--  <div class="top0-statistics">
54
+      <div>标本<span class="num">{{businessData.specimenCount || 0}}</span></div>
55
+      <div>病理<span class="num">{{businessData.pathologyCount || 0}}</span></div>
56
+      <div>陪检<span class="num">{{businessData.inspectCount || 0}}</span></div>
57
+      <div>药品<span class="num">{{businessData.drugsCount || 0}}</span></div>
58
+      <div>静配<span class="num">{{businessData.drugsJpCount || 0}}</span></div>
59
+      <div>中药<span class="num">{{businessData.drugsHerbalCount || 0}}</span></div>
60
+      <div>血制品<span class="num">{{businessData.bloodCount || 0}}</span></div>
61
+    </div> -->
62
+    <div class="top2-statistics">
63
+      <div class="statistics width-60 mar-right-8">
64
+        <div class="statistics-box">
65
+          <div class="sign-green"></div>
66
+          <div class="statistics-title">业务分类top5</div>
67
+          <div class="more" *ngIf="showMore('businessClassifyStatistics')" (click)="toPath('/newStatistics/distributionInspectionStatistics/businessClassifyStatistics')">更多></div>
68
+        </div>
69
+        <div class="echarts-repairs">
70
+          <div echarts class="echarts" [options]='businessOptions'></div>
71
+        </div>
72
+      </div>
73
+      <div class="statistics width-40">
74
+        <div class="statistics-box">
75
+          <div class="sign-green"></div>
76
+          <div class="statistics-title">申请来源</div>
77
+          <div class="more" *ngIf="showMore('sourceStatistics')" (click)="toPath('/newStatistics/distributionInspectionStatistics/sourceStatistics')">更多></div>
78
+        </div>
79
+        <div class="echarts-repairs">
80
+          <div echarts class="echarts" [options]='applyOptions'></div>
81
+        </div>
82
+      </div>
83
+    </div>
84
+    <div class="top2-statistics">
85
+      <div class="statistics width-49 mar-right-8">
86
+        <div class="statistics-box">
87
+          <div class="sign-green"></div>
88
+          <div class="statistics-title">科室Top5</div>
89
+          <div class="more" *ngIf="showMore('departmentQualityControlStatistics')" (click)="toPath('/newStatistics/distributionInspectionStatistics/departmentQualityControlStatistics')">更多></div>
90
+        </div>
91
+        <div class="table">
92
+          <div class="td">
93
+            <div class="table-td-4">排名</div>
94
+            <div class="table-td-4">科室名称</div>
95
+            <div class="table-td-4">工单量</div>
96
+            <div class="table-td-4">好评率</div>
97
+          </div>
98
+          <div class="th" *ngFor="let item of deptTopData; let index = index;">
99
+            <div class="table-list-4">
100
+              <img src="../../assets/images/top1.png" alt="" class="img" *ngIf="index==0">
101
+              <img src="../../assets/images/top2.png" alt="" class="img" *ngIf="index==1">
102
+              <img src="../../assets/images/top3.png" alt="" class="img" *ngIf="index==2">
103
+              <span *ngIf="index !=0 && index !=1 && index !=2">{{index+1}}</span>
104
+            </div>
105
+            <div class="table-list-4 ellipsis-oneline" title="{{item.dept}}">{{item.dept}}</div>
106
+            <div class="table-list-4">{{item.sum || 0}}</div>
107
+            <div class="table-list-4">{{item.goodRate || '0%'}}</div>
108
+          </div>
109
+        </div>
110
+      </div>
111
+      <div class="statistics width-50">
112
+        <div class="statistics-box">
113
+          <div class="sign-green"></div>
114
+          <div class="statistics-title">人员Top5</div>
115
+          <div class="more" *ngIf="showMore('userQualityControlStatistics')" (click)="toPath('/newStatistics/distributionInspectionStatistics/userQualityControlStatistics')">更多></div>
116
+        </div>
117
+        <div class="table">
118
+          <div class="td">
119
+            <div class="table-td-4">排名</div>
120
+            <div class="table-td-4">人员名称</div>
121
+            <div class="table-td-4">工单量</div>
122
+            <div class="table-td-4">积分总数</div>
123
+          </div>
124
+          <div class="th" *ngFor="let item of userTopData; let index = index;">
125
+            <div class="table-list-4">
126
+              <img src="../../assets/images/top1.png" alt="" class="img" *ngIf="index==0">
127
+              <img src="../../assets/images/top2.png" alt="" class="img" *ngIf="index==1">
128
+              <img src="../../assets/images/top3.png" alt="" class="img" *ngIf="index==2">
129
+              <span *ngIf="index !=0 && index !=1 && index !=2">{{index+1}}</span>
130
+            </div>
131
+            <div class="table-list-4 ellipsis-oneline" title="{{item.userName}}({{item.userAccount}})">{{item.userName}}<ng-container *ngIf="item.userAccount">({{item.userAccount}})</ng-container></div>
132
+            <div class="table-list-4">{{item.sum || 0}}</div>
133
+            <div class="table-list-4">{{item.totalGrade || 0}}</div>
134
+          </div>
135
+        </div>
136
+      </div>
137
+    </div>
138
+    <div class="top2-statistics">
139
+      <div class="statistics width-100">
140
+        <div class="statistics-box">
141
+          <div class="sign-green"></div>
142
+          <div class="statistics-title">日趋势图</div>
143
+          <div class="statistics-select">
144
+            <div class="statistics-select-list" [ngClass]="{'activeClass': activeIndex == 'day'}" (click)="selectCheck('day')">日</div>
145
+            <div class="statistics-select-list" [ngClass]="{'activeClass': activeIndex == 'hour'}" (click)="selectCheck('hour')">时</div>
146
+          </div>
147
+          <div class="searchDataItem ml8">
148
+            <span class="label">统计分类</span>:
149
+            <nz-select class="selectItem" [nzDropdownMatchSelectWidth]="false" nzAllowClear nzPlaceHolder="请选择统计分类" [(ngModel)]="statisticsTypeId" (ngModelChange)="changeStatisticsType($event)">
150
+              <ng-container *ngFor="let option of statisticsTypeList">
151
+                <nz-option *ngIf="!isLoading" [nzLabel]="option.name" [nzValue]="option.id"></nz-option>
152
+              </ng-container>
153
+              <nz-option *ngIf="isLoading" nzDisabled nzCustomContent>
154
+                <i nz-icon nzType="loading" class="loading-icon"></i> 搜索中...
155
+              </nz-option>
156
+            </nz-select>
157
+          </div>
158
+          <div class="more" *ngIf="showMore('dateQualityControlStatistics')" (click)="toPath('/newStatistics/distributionInspectionStatistics/dateQualityControlStatistics')">更多></div>
159
+        </div>
160
+        <div class="echarts-repairs">
161
+          <div echarts class="echarts" [options]='trendOptions'></div>
162
+        </div>
165
       </div>
163
       </div>
166
     </div>
164
     </div>
167
-  </div>
165
+  </ng-container>
168
 </div>
166
 </div>
169
 <div class="mask-style" *ngIf="isLoading">
167
 <div class="mask-style" *ngIf="isLoading">
170
 	<nz-spin nzSimple class="spin-style"></nz-spin>
168
 	<nz-spin nzSimple class="spin-style"></nz-spin>

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

@@ -23,6 +23,9 @@
23
 		      .label{
23
 		      .label{
24
 		        font-size: 16px;
24
 		        font-size: 16px;
25
 		      }
25
 		      }
26
+          .selectItem{
27
+            width: 160px;
28
+          }
26
 		    }
29
 		    }
27
 		  }
30
 		  }
28
 		}
31
 		}
@@ -144,7 +147,7 @@
144
 					}
147
 					}
145
           .searchDataItem{
148
           .searchDataItem{
146
             .selectItem{
149
             .selectItem{
147
-              width: 224px;
150
+              width: 160px;
148
             }
151
             }
149
           }
152
           }
150
 					.more{
153
 					.more{

+ 30 - 42
src/app/views/new-statistics/distribution-inspection-statistics/distribution-synthesize-statistics/distribution-synthesize-statistics.component.ts

@@ -1,14 +1,15 @@
1
 import { Router } from '@angular/router';
1
 import { Router } from '@angular/router';
2
-import { format, addMonths, startOfMonth, endOfMonth } from 'date-fns';
3
-import { Component, OnInit } from "@angular/core";
2
+import { Component, OnInit, ViewChild, AfterViewInit } from "@angular/core";
4
 import { MainService } from 'src/app/services/main.service';
3
 import { MainService } from 'src/app/services/main.service';
5
 import { TabService } from '../../services/tab.service';
4
 import { TabService } from '../../services/tab.service';
5
+import { CustomChangeDateComponent } from '../../components/custom-change-date/custom-change-date.component';
6
 @Component({
6
 @Component({
7
   selector: "app-distribution-synthesize-statistics",
7
   selector: "app-distribution-synthesize-statistics",
8
   templateUrl: "./distribution-synthesize-statistics.component.html",
8
   templateUrl: "./distribution-synthesize-statistics.component.html",
9
   styleUrls: ["./distribution-synthesize-statistics.component.less"],
9
   styleUrls: ["./distribution-synthesize-statistics.component.less"],
10
 })
10
 })
11
-export class DistributionSynthesizeStatisticsComponent implements OnInit {
11
+export class DistributionSynthesizeStatisticsComponent implements OnInit, AfterViewInit {
12
+  @ViewChild('customChangeDate', { static: false }) customChangeDateComponent!: CustomChangeDateComponent;
12
   constructor(
13
   constructor(
13
     private mainService: MainService,
14
     private mainService: MainService,
14
     private tabService: TabService,
15
     private tabService: TabService,
@@ -60,8 +61,12 @@ export class DistributionSynthesizeStatisticsComponent implements OnInit {
60
 			name:'王'
61
 			name:'王'
61
 		}
62
 		}
62
 	] //人员top5
63
 	] //人员top5
63
-  ngOnInit() {
64
-    this.search();
64
+  ngOnInit() {}
65
+
66
+  ngAfterViewInit(){
67
+    setTimeout(() => {
68
+      this.search();
69
+    }, 0)
65
   }
70
   }
66
 
71
 
67
 	// 维修处理类型切换
72
 	// 维修处理类型切换
@@ -73,8 +78,8 @@ export class DistributionSynthesizeStatisticsComponent implements OnInit {
73
 	// 申请来源
78
 	// 申请来源
74
 	applyChart() {
79
 	applyChart() {
75
 		let postData:any = {
80
 		let postData:any = {
76
-	    startDate: this.dateRange[0],
77
-	    endDate: this.dateRange[1],
81
+	    startDate: this.customChangeDateComponent.startDate || undefined,
82
+      endDate: this.customChangeDateComponent.endDate || undefined,
78
 			type: 'sourceCount',
83
 			type: 'sourceCount',
79
 	    hosId: this.getHosId,
84
 	    hosId: this.getHosId,
80
 	    businessType: 'hsms',
85
 	    businessType: 'hsms',
@@ -148,8 +153,8 @@ export class DistributionSynthesizeStatisticsComponent implements OnInit {
148
 	// 日趋势图
153
 	// 日趋势图
149
 	trendChart(){
154
 	trendChart(){
150
 		let postData:any = {
155
 		let postData:any = {
151
-	    startDate: this.dateRange[0],
152
-	    endDate: this.dateRange[1],
156
+	    startDate: this.customChangeDateComponent.startDate || undefined,
157
+      endDate: this.customChangeDateComponent.endDate || undefined,
153
 			type: 'dateTimeTrend',
158
 			type: 'dateTimeTrend',
154
 	    hosId: this.getHosId,
159
 	    hosId: this.getHosId,
155
 	    businessType: 'hsms',
160
 	    businessType: 'hsms',
@@ -234,8 +239,8 @@ export class DistributionSynthesizeStatisticsComponent implements OnInit {
234
   // 业务分类
239
   // 业务分类
235
 	businessChart(){
240
 	businessChart(){
236
     let postData:any = {
241
     let postData:any = {
237
-	    startDate: this.dateRange[0],
238
-	    endDate: this.dateRange[1],
242
+	    startDate: this.customChangeDateComponent.startDate || undefined,
243
+      endDate: this.customChangeDateComponent.endDate || undefined,
239
 			type: 'statisticsDateTypeTop5',
244
 			type: 'statisticsDateTypeTop5',
240
 	    hosId: this.getHosId,
245
 	    hosId: this.getHosId,
241
 	    businessType: 'hsms',
246
 	    businessType: 'hsms',
@@ -316,8 +321,8 @@ export class DistributionSynthesizeStatisticsComponent implements OnInit {
316
 	// 科室Top5
321
 	// 科室Top5
317
 	getDeptTopData() {
322
 	getDeptTopData() {
318
 	  let postData:any = {
323
 	  let postData:any = {
319
-	    startDate: this.dateRange[0],
320
-	    endDate: this.dateRange[1],
324
+	    startDate: this.customChangeDateComponent.startDate || undefined,
325
+      endDate: this.customChangeDateComponent.endDate || undefined,
321
 			type: 'deptTop5',
326
 			type: 'deptTop5',
322
 	    hosId: this.getHosId,
327
 	    hosId: this.getHosId,
323
 	    businessType: 'hsms',
328
 	    businessType: 'hsms',
@@ -332,8 +337,8 @@ export class DistributionSynthesizeStatisticsComponent implements OnInit {
332
 	// 人员Top5
337
 	// 人员Top5
333
 	getUserTopData() {
338
 	getUserTopData() {
334
 	  let postData:any = {
339
 	  let postData:any = {
335
-	    startDate: this.dateRange[0],
336
-	    endDate: this.dateRange[1],
340
+	    startDate: this.customChangeDateComponent.startDate || undefined,
341
+      endDate: this.customChangeDateComponent.endDate || undefined,
337
 			type: 'userTop5',
342
 			type: 'userTop5',
338
 	    hosId: this.getHosId,
343
 	    hosId: this.getHosId,
339
 	    businessType: 'hsms',
344
 	    businessType: 'hsms',
@@ -350,7 +355,7 @@ export class DistributionSynthesizeStatisticsComponent implements OnInit {
350
 	toPath(path){
355
 	toPath(path){
351
     let flag = this.tabService.tabs.some(v => v.path === path);
356
     let flag = this.tabService.tabs.some(v => v.path === path);
352
     flag && this.tabService.deleteRouteSnapshot(path);
357
     flag && this.tabService.deleteRouteSnapshot(path);
353
-    this.tabService.setQueryParams('dateRange', this.dateRange);
358
+    this.tabService.setQueryParams('dateRange', [this.customChangeDateComponent.startDate, this.customChangeDateComponent.endDate]);
354
     this.router.navigate([path], { replaceUrl: true });
359
     this.router.navigate([path], { replaceUrl: true });
355
 	}
360
 	}
356
 
361
 
@@ -418,8 +423,8 @@ export class DistributionSynthesizeStatisticsComponent implements OnInit {
418
     let postData:any = {
423
     let postData:any = {
419
       idx: this.pageIndex - 1,
424
       idx: this.pageIndex - 1,
420
       sum: this.pageSize,
425
       sum: this.pageSize,
421
-      startDate: this.dateRange[0],
422
-      endDate: this.dateRange[1],
426
+      startDate: this.customChangeDateComponent.startDate || undefined,
427
+      endDate: this.customChangeDateComponent.endDate || undefined,
423
       hosId: this.hosId,
428
       hosId: this.hosId,
424
       dutyId: this.dutyId,
429
       dutyId: this.dutyId,
425
       parentDutyId: this.parentDutyId,
430
       parentDutyId: this.parentDutyId,
@@ -437,8 +442,8 @@ export class DistributionSynthesizeStatisticsComponent implements OnInit {
437
 	// 头部工单数据
442
 	// 头部工单数据
438
 	getWorkData() {
443
 	getWorkData() {
439
 	  let postData:any = {
444
 	  let postData:any = {
440
-	    startDate: this.dateRange[0],
441
-	    endDate: this.dateRange[1],
445
+	    startDate: this.customChangeDateComponent.startDate || undefined,
446
+      endDate: this.customChangeDateComponent.endDate || undefined,
442
 			type: 'headerCount',
447
 			type: 'headerCount',
443
 	    hosId: this.getHosId,
448
 	    hosId: this.getHosId,
444
 	    businessType: 'hsms',
449
 	    businessType: 'hsms',
@@ -453,8 +458,8 @@ export class DistributionSynthesizeStatisticsComponent implements OnInit {
453
   // 头部业务数据
458
   // 头部业务数据
454
 	getBusinessData() {
459
 	getBusinessData() {
455
 	  let postData:any = {
460
 	  let postData:any = {
456
-	    startDate: this.dateRange[0],
457
-	    endDate: this.dateRange[1],
461
+	    startDate: this.customChangeDateComponent.startDate || undefined,
462
+      endDate: this.customChangeDateComponent.endDate || undefined,
458
 			type: 'businessCount',
463
 			type: 'businessCount',
459
 	    hosId: this.getHosId,
464
 	    hosId: this.getHosId,
460
 	    businessType: 'hsms',
465
 	    businessType: 'hsms',
@@ -468,8 +473,9 @@ export class DistributionSynthesizeStatisticsComponent implements OnInit {
468
 
473
 
469
 	// 重置
474
 	// 重置
470
 	reset(){
475
 	reset(){
471
-		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')];
476
+		this.dateRange = [];
472
 		this.activeIndex = 'day';
477
 		this.activeIndex = 'day';
478
+    this.customChangeDateComponent.resetByDate();
473
 		this.search();
479
 		this.search();
474
 	}
480
 	}
475
 
481
 
@@ -479,25 +485,7 @@ export class DistributionSynthesizeStatisticsComponent implements OnInit {
479
   }
485
   }
480
 
486
 
481
   // 日期选择 日
487
   // 日期选择 日
482
-  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')]; //发起时间区间 天
483
-  changeDate(result?): void {
484
-    result[0] = format(result[0], 'yyyy-MM-dd') + ' ' + '00:00:00';
485
-    result[1] = format(result[1], 'yyyy-MM-dd') + ' ' + '23:59:59';
486
-    this.dateRange = result;
487
-    // this.search();
488
-		console.log(this.dateRange);
489
-  }
490
-
491
-  onCalendarChangeDate(dateArr){
492
-    // console.log(dateArr)
493
-    // if(dateArr.length == 2){
494
-    //   let dateStart = new Date(dateArr[0]);
495
-    //   let dateEnd = new Date(dateArr[1]);
496
-    //   dateStart.setHours(0,0,0);
497
-    //   dateEnd.setHours(23,59,59);
498
-    //   this.dateRange = [dateStart,dateEnd];
499
-    // }
500
-  }
488
+  dateRange: any = []; //发起时间区间 天
501
 
489
 
502
   // 获取统计分类列表
490
   // 获取统计分类列表
503
   statisticsTypeList:any[] = [];
491
   statisticsTypeList:any[] = [];

+ 3 - 1
src/app/views/new-statistics/distribution-inspection-statistics/distribution-synthesize-statistics/distribution-synthesize-statistics.module.ts

@@ -6,6 +6,7 @@ import { DistributionSynthesizeStatisticsRoutingModule } from './distribution-sy
6
 import { ShareModule } from 'src/app/share/share.module';
6
 import { ShareModule } from 'src/app/share/share.module';
7
 import { VirtualScrollerModule } from 'ngx-virtual-scroller';
7
 import { VirtualScrollerModule } from 'ngx-virtual-scroller';
8
 import { NgxEchartsModule } from 'ngx-echarts';
8
 import { NgxEchartsModule } from 'ngx-echarts';
9
+import { CustomChangeDateModule } from '../../components/custom-change-date/custom-change-date.module';
9
 
10
 
10
 
11
 
11
 @NgModule({
12
 @NgModule({
@@ -17,7 +18,8 @@ import { NgxEchartsModule } from 'ngx-echarts';
17
     DistributionSynthesizeStatisticsRoutingModule,
18
     DistributionSynthesizeStatisticsRoutingModule,
18
     ShareModule,
19
     ShareModule,
19
     VirtualScrollerModule,
20
     VirtualScrollerModule,
20
-		NgxEchartsModule
21
+		NgxEchartsModule,
22
+    CustomChangeDateModule,
21
   ]
23
   ]
22
 })
24
 })
23
 export class DistributionSynthesizeStatisticsModule { }
25
 export class DistributionSynthesizeStatisticsModule { }

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

@@ -1,172 +1,170 @@
1
-<div class="synthesize-box" *ngIf="!isLoading">
1
+<div class="synthesize-box">
2
 	<div class="searchDataWrap">
2
 	<div class="searchDataWrap">
3
 		<div class="searchData">
3
 		<div class="searchData">
4
-			<div class="searchDataItem">
5
-				<span class="label">选择日期</span>:
6
-				<nz-range-picker [(ngModel)]="dateRange" [nzAllowClear]="false" (ngModelChange)="changeDate($event)" (nzOnCalendarChange)="onCalendarChangeDate($event)">
7
-				</nz-range-picker>
8
-			</div>
4
+      <app-custom-change-date #customChangeDate [isShowType]="true" name="选择日期"></app-custom-change-date>
9
 		</div>
5
 		</div>
10
 		<div class="operation">
6
 		<div class="operation">
11
 			<button nz-button class="btn default" (click)="search()">搜索</button>
7
 			<button nz-button class="btn default" (click)="search()">搜索</button>
12
 			<button nz-button class="btn default ml8" (click)="reset()">重置</button>
8
 			<button nz-button class="btn default ml8" (click)="reset()">重置</button>
13
 		</div>
9
 		</div>
14
 	</div>
10
 	</div>
15
-	<div class="top1-statistics">
16
-		<div class="top-list">
17
-			<div class="special-box">
18
-				<div class="num">{{workData.gd_total || 0}}</div>
19
-				<div class="describe">工单总数</div>
20
-			</div>
21
-			<div class="special-box-right">
22
-				<div class="sign-describe">已完成: <span class="sign-num">{{workData.gd_close || 0}}</span></div>
23
-				<div class="sign-describe">待接单: <span class="sign-num">{{workData.gd_todo || 0}}</span></div>
24
-				<div class="sign-describe">处理中: <span class="sign-num">{{workData.gd_doing || 0}}</span></div>
25
-			</div>
26
-			<div class="border"></div>
27
-		</div>
28
-		<div class="top-list">
29
-			<div class="special-box">
30
-				<div class="num">{{workData.sum_price || 0}}</div>
31
-				<div class="describe">总费用 (元)</div>
32
-			</div>
33
-			<div class="border"></div>
34
-		</div>
35
-		<div class="top-list">
36
-			<div class="special-box">
37
-				<div class="num">{{workData.gd_postpone || 0}}</div>
38
-				<div class="describe">挂起单数</div>
39
-			</div>
40
-			<div class="border"></div>
41
-		</div>
42
-		<div class="top-list">
43
-			<div class="special-box">
44
-				<div class="num">{{workData.gd_overtime || 0}}</div>
45
-				<div class="describe">超时单数</div>
46
-			</div>
47
-			<div class="border"></div>
48
-		</div>
49
-		<div class="top-list">
50
-			<div class="special-box">
51
-				<div class="num">{{workData.gd_degree}}</div>
52
-				<div class="describe">差评单数</div>
53
-			</div>
54
-		</div>
55
-	</div>
56
-	<div class="top2-statistics">
57
-		<div class="statistics width-60 mar-right-8">
58
-			<div class="statistics-box">
59
-				<div class="sign-green"></div>
60
-				<div class="statistics-title">维修处理Top5</div>
61
-				<div class="statistics-select">
62
-					<div class="statistics-select-list" [ngClass]="{'activeClass': activeIndex == 0}" (click)="selectCheck(0)">维修人员</div>
63
-					<div class="statistics-select-list" [ngClass]="{'activeClass': activeIndex == 1}" (click)="selectCheck(1)">维修组</div>
64
-				</div>
65
-				<div class="more" *ngIf="showMore(activeIndex == 0 ? 'userStatistics' : 'groupStatistics')" (click)="toPath(activeIndex == 0 ? '/newStatistics/maintenanceStatistics/userStatistics' : '/newStatistics/maintenanceStatistics/groupStatistics')">更多></div>
66
-			</div>
67
-			<div class="table">
68
-				<div class="td">
69
-					<div class="table-td">排名</div>
70
-					<div class="table-td" *ngIf="activeIndex==0">人员姓名</div>
71
-					<div class="table-td" *ngIf="activeIndex==1">维修组</div>
72
-					<div class="table-td">工单量</div>
73
-					<div class="table-td">平均接单时长</div>
74
-					<div class="table-td">平均解决时长</div>
75
-					<div class="table-td">超时单</div>
76
-				</div>
77
-				<div class="th" *ngFor="let item of maintainData; let index = index;">
78
-					<div class="table-list">
79
-						<img src="../../assets/images/top1.png" alt="" class="img" *ngIf="index==0">
80
-						<img src="../../assets/images/top2.png" alt="" class="img" *ngIf="index==1">
81
-						<img src="../../assets/images/top3.png" alt="" class="img" *ngIf="index==2">
82
-						<span *ngIf="index !=0 && index !=1 && index !=2">{{index+1}}</span>
83
-					</div>
84
-					<div class="table-list">{{item.name}}</div>
85
-					<div class="table-list">{{item.count || 0}}</div>
86
-					<div class="table-list">{{item.avg_response}}分</div>
87
-					<div class="table-list">{{item.avg_handle }}分</div>
88
-					<div class="table-list">{{item.overtime || 0}}</div>
89
-				</div>
90
-			</div>
91
-		</div>
92
-		<div class="statistics width-40">
93
-			<div class="statistics-box">
94
-				<div class="sign-green"></div>
95
-				<div class="statistics-title">故障来源</div>
96
-				<div class="more" *ngIf="showMore('categorySourceStatistics')" (click)="toPath('/newStatistics/maintenanceStatistics/categorySourceStatistics')">更多></div>
97
-			</div>
98
-			<div class="echarts-repairs">
99
-			  <div echarts class="echarts" [options]='repairsOptions'></div>
100
-			</div>
101
-		</div>
102
-	</div>
103
-	<div class="top2-statistics">
104
-		<div class="statistics width-49 mar-right-8">
105
-			<div class="statistics-box">
106
-				<div class="sign-green"></div>
107
-				<div class="statistics-title">一级故障现象Top5</div>
108
-				<div class="more" *ngIf="showMore('categoryOneStatistics')" (click)="toPath('/newStatistics/maintenanceStatistics/categoryOneStatistics')">更多></div>
109
-			</div>
110
-			<div class="echarts-repairs">
111
-				<div echarts class="echarts" [options]='malfunctionOptions'></div>
112
-			</div>
113
-		</div>
114
-		<div class="statistics width-50">
115
-			<div class="statistics-box">
116
-				<div class="sign-green"></div>
117
-				<div class="statistics-title">楼栋报修Top5</div>
118
-				<div class="more" *ngIf="showMore('buildingStatistics')" (click)="toPath('/newStatistics/maintenanceStatistics/buildingStatistics')">更多></div>
119
-			</div>
120
-			<div class="echarts-repairs">
121
-				<div echarts class="echarts" [options]='buildingOptions'></div>
122
-			</div>
123
-		</div>
124
-	</div>
125
-	<div class="top2-statistics">
126
-		<div class="statistics width-49 mar-right-8">
127
-			<div class="statistics-box">
128
-				<div class="sign-green"></div>
129
-				<div class="statistics-title">科室费用Top5</div>
130
-				<div class="more" *ngIf="showMore('departmentIncidentStatistics')" (click)="toPath('/newStatistics/maintenanceStatistics/departmentIncidentStatistics')">更多></div>
131
-			</div>
132
-			<div class="table">
133
-				<div class="td">
134
-					<div class="table-td-4">排名</div>
135
-					<div class="table-td-4">科室名称</div>
136
-					<div class="table-td-4">工单量</div>
137
-					<div class="table-td-4">总费用(元)</div>
138
-				</div>
139
-				<div class="th" *ngFor="let item of deptCostData; let index = index;">
140
-					<div class="table-list-4">{{index+1}}</div>
141
-					<div class="table-list-4 ellipsis-oneline" title="{{item.dept}}">{{item.dept}}</div>
142
-					<div class="table-list-4">{{item.sum || 0}}</div>
143
-					<div class="table-list-4">{{item.sum_price || 0}}</div>
144
-				</div>
145
-			</div>
146
-		</div>
147
-		<div class="statistics width-50">
148
-			<div class="statistics-box">
149
-				<div class="sign-green"></div>
150
-				<div class="statistics-title">耗材Top5</div>
151
-				<div class="more" *ngIf="showMore('consumableStatistics')" (click)="toPath('/newStatistics/maintenanceStatistics/consumableStatistics')">更多></div>
152
-			</div>
153
-			<div class="table">
154
-				<div class="td">
155
-					<div class="table-td-4">排名</div>
156
-					<div class="table-td-4">耗材名称(耗材编号)</div>
157
-					<div class="table-td-4">使用数量</div>
158
-					<div class="table-td-4">总费用(元)</div>
159
-				</div>
160
-				<div class="th" *ngFor="let item of consumableData; let index = index;">
161
-					<div class="table-list-4">{{index+1}}</div>
162
-					<div class="table-list-4 ellipsis-oneline" title="{{item.name}}({{item.spd_code}})">{{item.name}}<ng-container *ngIf="item.spd_code">({{item.spd_code}})</ng-container></div>
163
-					<div class="table-list-4">{{item.sum || 0}}</div>
164
-					<div class="table-list-4">{{item.sum_price || 0}}</div>
165
-				</div>
166
-			</div>
167
-		</div>
168
-	</div>
11
+  <ng-container *ngIf="!isLoading">
12
+    <div class="top1-statistics">
13
+      <div class="top-list">
14
+        <div class="special-box">
15
+          <div class="num">{{workData.gd_total || 0}}</div>
16
+          <div class="describe">工单总数</div>
17
+        </div>
18
+        <div class="special-box-right">
19
+          <div class="sign-describe">已完成: <span class="sign-num">{{workData.gd_close || 0}}</span></div>
20
+          <div class="sign-describe">待接单: <span class="sign-num">{{workData.gd_todo || 0}}</span></div>
21
+          <div class="sign-describe">处理中: <span class="sign-num">{{workData.gd_doing || 0}}</span></div>
22
+        </div>
23
+        <div class="border"></div>
24
+      </div>
25
+      <div class="top-list">
26
+        <div class="special-box">
27
+          <div class="num">{{workData.sum_price || 0}}</div>
28
+          <div class="describe">总费用 (元)</div>
29
+        </div>
30
+        <div class="border"></div>
31
+      </div>
32
+      <div class="top-list">
33
+        <div class="special-box">
34
+          <div class="num">{{workData.gd_postpone || 0}}</div>
35
+          <div class="describe">挂起单数</div>
36
+        </div>
37
+        <div class="border"></div>
38
+      </div>
39
+      <div class="top-list">
40
+        <div class="special-box">
41
+          <div class="num">{{workData.gd_overtime || 0}}</div>
42
+          <div class="describe">超时单数</div>
43
+        </div>
44
+        <div class="border"></div>
45
+      </div>
46
+      <div class="top-list">
47
+        <div class="special-box">
48
+          <div class="num">{{workData.gd_degree}}</div>
49
+          <div class="describe">差评单数</div>
50
+        </div>
51
+      </div>
52
+    </div>
53
+    <div class="top2-statistics">
54
+      <div class="statistics width-60 mar-right-8">
55
+        <div class="statistics-box">
56
+          <div class="sign-green"></div>
57
+          <div class="statistics-title">维修处理Top5</div>
58
+          <div class="statistics-select">
59
+            <div class="statistics-select-list" [ngClass]="{'activeClass': activeIndex == 0}" (click)="selectCheck(0)">维修人员</div>
60
+            <div class="statistics-select-list" [ngClass]="{'activeClass': activeIndex == 1}" (click)="selectCheck(1)">维修组</div>
61
+          </div>
62
+          <div class="more" *ngIf="showMore(activeIndex == 0 ? 'userStatistics' : 'groupStatistics')" (click)="toPath(activeIndex == 0 ? '/newStatistics/maintenanceStatistics/userStatistics' : '/newStatistics/maintenanceStatistics/groupStatistics')">更多></div>
63
+        </div>
64
+        <div class="table">
65
+          <div class="td">
66
+            <div class="table-td">排名</div>
67
+            <div class="table-td" *ngIf="activeIndex==0">人员姓名</div>
68
+            <div class="table-td" *ngIf="activeIndex==1">维修组</div>
69
+            <div class="table-td">工单量</div>
70
+            <div class="table-td">平均接单时长</div>
71
+            <div class="table-td">平均解决时长</div>
72
+            <div class="table-td">超时单</div>
73
+          </div>
74
+          <div class="th" *ngFor="let item of maintainData; let index = index;">
75
+            <div class="table-list">
76
+              <img src="../../assets/images/top1.png" alt="" class="img" *ngIf="index==0">
77
+              <img src="../../assets/images/top2.png" alt="" class="img" *ngIf="index==1">
78
+              <img src="../../assets/images/top3.png" alt="" class="img" *ngIf="index==2">
79
+              <span *ngIf="index !=0 && index !=1 && index !=2">{{index+1}}</span>
80
+            </div>
81
+            <div class="table-list">{{item.name}}</div>
82
+            <div class="table-list">{{item.count || 0}}</div>
83
+            <div class="table-list">{{item.avg_response}}分</div>
84
+            <div class="table-list">{{item.avg_handle }}分</div>
85
+            <div class="table-list">{{item.overtime || 0}}</div>
86
+          </div>
87
+        </div>
88
+      </div>
89
+      <div class="statistics width-40">
90
+        <div class="statistics-box">
91
+          <div class="sign-green"></div>
92
+          <div class="statistics-title">故障来源</div>
93
+          <div class="more" *ngIf="showMore('categorySourceStatistics')" (click)="toPath('/newStatistics/maintenanceStatistics/categorySourceStatistics')">更多></div>
94
+        </div>
95
+        <div class="echarts-repairs">
96
+          <div echarts class="echarts" [options]='repairsOptions'></div>
97
+        </div>
98
+      </div>
99
+    </div>
100
+    <div class="top2-statistics">
101
+      <div class="statistics width-49 mar-right-8">
102
+        <div class="statistics-box">
103
+          <div class="sign-green"></div>
104
+          <div class="statistics-title">一级故障现象Top5</div>
105
+          <div class="more" *ngIf="showMore('categoryOneStatistics')" (click)="toPath('/newStatistics/maintenanceStatistics/categoryOneStatistics')">更多></div>
106
+        </div>
107
+        <div class="echarts-repairs">
108
+          <div echarts class="echarts" [options]='malfunctionOptions'></div>
109
+        </div>
110
+      </div>
111
+      <div class="statistics width-50">
112
+        <div class="statistics-box">
113
+          <div class="sign-green"></div>
114
+          <div class="statistics-title">楼栋报修Top5</div>
115
+          <div class="more" *ngIf="showMore('buildingStatistics')" (click)="toPath('/newStatistics/maintenanceStatistics/buildingStatistics')">更多></div>
116
+        </div>
117
+        <div class="echarts-repairs">
118
+          <div echarts class="echarts" [options]='buildingOptions'></div>
119
+        </div>
120
+      </div>
121
+    </div>
122
+    <div class="top2-statistics">
123
+      <div class="statistics width-49 mar-right-8">
124
+        <div class="statistics-box">
125
+          <div class="sign-green"></div>
126
+          <div class="statistics-title">科室费用Top5</div>
127
+          <div class="more" *ngIf="showMore('departmentIncidentStatistics')" (click)="toPath('/newStatistics/maintenanceStatistics/departmentIncidentStatistics')">更多></div>
128
+        </div>
129
+        <div class="table">
130
+          <div class="td">
131
+            <div class="table-td-4">排名</div>
132
+            <div class="table-td-4">科室名称</div>
133
+            <div class="table-td-4">工单量</div>
134
+            <div class="table-td-4">总费用(元)</div>
135
+          </div>
136
+          <div class="th" *ngFor="let item of deptCostData; let index = index;">
137
+            <div class="table-list-4">{{index+1}}</div>
138
+            <div class="table-list-4 ellipsis-oneline" title="{{item.dept}}">{{item.dept}}</div>
139
+            <div class="table-list-4">{{item.sum || 0}}</div>
140
+            <div class="table-list-4">{{item.sum_price || 0}}</div>
141
+          </div>
142
+        </div>
143
+      </div>
144
+      <div class="statistics width-50">
145
+        <div class="statistics-box">
146
+          <div class="sign-green"></div>
147
+          <div class="statistics-title">耗材Top5</div>
148
+          <div class="more" *ngIf="showMore('consumableStatistics')" (click)="toPath('/newStatistics/maintenanceStatistics/consumableStatistics')">更多></div>
149
+        </div>
150
+        <div class="table">
151
+          <div class="td">
152
+            <div class="table-td-4">排名</div>
153
+            <div class="table-td-4">耗材名称(耗材编号)</div>
154
+            <div class="table-td-4">使用数量</div>
155
+            <div class="table-td-4">总费用(元)</div>
156
+          </div>
157
+          <div class="th" *ngFor="let item of consumableData; let index = index;">
158
+            <div class="table-list-4">{{index+1}}</div>
159
+            <div class="table-list-4 ellipsis-oneline" title="{{item.name}}({{item.spd_code}})">{{item.name}}<ng-container *ngIf="item.spd_code">({{item.spd_code}})</ng-container></div>
160
+            <div class="table-list-4">{{item.sum || 0}}</div>
161
+            <div class="table-list-4">{{item.sum_price || 0}}</div>
162
+          </div>
163
+        </div>
164
+      </div>
165
+    </div>
166
+  </ng-container>
169
 </div>
167
 </div>
170
 <div class="mask-style" *ngIf="isLoading">
168
 <div class="mask-style" *ngIf="isLoading">
171
 	<nz-spin nzSimple class="spin-style"></nz-spin>
169
 	<nz-spin nzSimple class="spin-style"></nz-spin>
172
-</div>
170
+</div>

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

@@ -23,6 +23,9 @@
23
 		      .label{
23
 		      .label{
24
 		        font-size: 16px;
24
 		        font-size: 16px;
25
 		      }
25
 		      }
26
+          .selectItem{
27
+            width: 160px;
28
+          }
26
 		    }
29
 		    }
27
 		  }
30
 		  }
28
 		}
31
 		}
@@ -224,4 +227,4 @@
224
 }
227
 }
225
 .spin-style{
228
 .spin-style{
226
 	z-index:9999;
229
 	z-index:9999;
227
-}
230
+}

+ 31 - 42
src/app/views/new-statistics/maintenance-statistics/synthesize-statistics/synthesize-statistics.component.ts

@@ -1,14 +1,15 @@
1
 import { Router } from '@angular/router';
1
 import { Router } from '@angular/router';
2
-import { format, addMonths, startOfMonth, endOfMonth } from 'date-fns';
3
-import { Component, OnInit } from "@angular/core";
2
+import { Component, OnInit, ViewChild, AfterViewInit } from "@angular/core";
4
 import { MainService } from 'src/app/services/main.service';
3
 import { MainService } from 'src/app/services/main.service';
5
 import { TabService } from '../../services/tab.service';
4
 import { TabService } from '../../services/tab.service';
5
+import { CustomChangeDateComponent } from '../../components/custom-change-date/custom-change-date.component';
6
 @Component({
6
 @Component({
7
   selector: "app-synthesize-statistics",
7
   selector: "app-synthesize-statistics",
8
   templateUrl: "./synthesize-statistics.component.html",
8
   templateUrl: "./synthesize-statistics.component.html",
9
   styleUrls: ["./synthesize-statistics.component.less"],
9
   styleUrls: ["./synthesize-statistics.component.less"],
10
 })
10
 })
11
-export class SynthesizeStatisticsComponent implements OnInit {
11
+export class SynthesizeStatisticsComponent implements OnInit, AfterViewInit {
12
+  @ViewChild('customChangeDate', { static: false }) customChangeDateComponent!: CustomChangeDateComponent;
12
   constructor(
13
   constructor(
13
     private mainService: MainService,
14
     private mainService: MainService,
14
     private tabService: TabService,
15
     private tabService: TabService,
@@ -60,8 +61,13 @@ export class SynthesizeStatisticsComponent implements OnInit {
60
 			name:'王'
61
 			name:'王'
61
 		}
62
 		}
62
 	] //报修耗材
63
 	] //报修耗材
63
-  ngOnInit() {
64
-    this.search();
64
+
65
+  ngOnInit() {}
66
+
67
+  ngAfterViewInit(){
68
+    setTimeout(() => {
69
+      this.search();
70
+    }, 0)
65
   }
71
   }
66
 
72
 
67
 	// 维修处理类型切换
73
 	// 维修处理类型切换
@@ -73,8 +79,8 @@ export class SynthesizeStatisticsComponent implements OnInit {
73
 	// 故障来源
79
 	// 故障来源
74
 	repairsChart() {
80
 	repairsChart() {
75
 		let postData:any = {
81
 		let postData:any = {
76
-		  startDate: this.dateRange[0],
77
-		  endDate: this.dateRange[1],
82
+		  startDate: this.customChangeDateComponent.startDate || undefined,
83
+      endDate: this.customChangeDateComponent.endDate || undefined,
78
 			type: 'sourceTop5',
84
 			type: 'sourceTop5',
79
 		  hosId: this.hosId,
85
 		  hosId: this.hosId,
80
 		  dutyId: this.dutyId,
86
 		  dutyId: this.dutyId,
@@ -149,8 +155,8 @@ export class SynthesizeStatisticsComponent implements OnInit {
149
 	// 一级故障
155
 	// 一级故障
150
 	malfunctionChart(){
156
 	malfunctionChart(){
151
 		let postData:any = {
157
 		let postData:any = {
152
-		  startDate: this.dateRange[0],
153
-		  endDate: this.dateRange[1],
158
+		  startDate: this.customChangeDateComponent.startDate || undefined,
159
+      endDate: this.customChangeDateComponent.endDate || undefined,
154
 			type: 'firstCategoryTop5',
160
 			type: 'firstCategoryTop5',
155
 		  hosId: this.hosId,
161
 		  hosId: this.hosId,
156
 		  dutyId: this.dutyId,
162
 		  dutyId: this.dutyId,
@@ -227,8 +233,8 @@ export class SynthesizeStatisticsComponent implements OnInit {
227
 	// 楼栋报修
233
 	// 楼栋报修
228
 	buildingChart(){
234
 	buildingChart(){
229
 		let postData:any = {
235
 		let postData:any = {
230
-		  startDate: this.dateRange[0],
231
-		  endDate: this.dateRange[1],
236
+		  startDate: this.customChangeDateComponent.startDate || undefined,
237
+      endDate: this.customChangeDateComponent.endDate || undefined,
232
 			type: 'buildingTop5',
238
 			type: 'buildingTop5',
233
 		  hosId: this.hosId,
239
 		  hosId: this.hosId,
234
 		  dutyId: this.dutyId,
240
 		  dutyId: this.dutyId,
@@ -305,8 +311,8 @@ export class SynthesizeStatisticsComponent implements OnInit {
305
 	// 科室费用
311
 	// 科室费用
306
 	getDeptCostData() {
312
 	getDeptCostData() {
307
 	  let postData:any = {
313
 	  let postData:any = {
308
-	    startDate: this.dateRange[0],
309
-	    endDate: this.dateRange[1],
314
+	    startDate: this.customChangeDateComponent.startDate || undefined,
315
+      endDate: this.customChangeDateComponent.endDate || undefined,
310
 			type: 'deptTop5',
316
 			type: 'deptTop5',
311
 	    hosId: this.hosId,
317
 	    hosId: this.hosId,
312
 	    dutyId: this.dutyId,
318
 	    dutyId: this.dutyId,
@@ -322,8 +328,8 @@ export class SynthesizeStatisticsComponent implements OnInit {
322
 	// 耗材
328
 	// 耗材
323
 	getConsumableData() {
329
 	getConsumableData() {
324
 	  let postData:any = {
330
 	  let postData:any = {
325
-	    startDate: this.dateRange[0],
326
-	    endDate: this.dateRange[1],
331
+	    startDate: this.customChangeDateComponent.startDate || undefined,
332
+      endDate: this.customChangeDateComponent.endDate || undefined,
327
 			type: 'consumableTop5',
333
 			type: 'consumableTop5',
328
 	    hosId: this.hosId,
334
 	    hosId: this.hosId,
329
 	    dutyId: this.dutyId,
335
 	    dutyId: this.dutyId,
@@ -341,7 +347,7 @@ export class SynthesizeStatisticsComponent implements OnInit {
341
 	toPath(path){
347
 	toPath(path){
342
     let flag = this.tabService.tabs.some(v => v.path === path);
348
     let flag = this.tabService.tabs.some(v => v.path === path);
343
     flag && this.tabService.deleteRouteSnapshot(path);
349
     flag && this.tabService.deleteRouteSnapshot(path);
344
-    this.tabService.setQueryParams('dateRange', this.dateRange);
350
+    this.tabService.setQueryParams('dateRange', [this.customChangeDateComponent.startDate, this.customChangeDateComponent.endDate]);
345
     this.router.navigate([path], { replaceUrl: true });
351
     this.router.navigate([path], { replaceUrl: true });
346
 	}
352
 	}
347
 
353
 
@@ -404,8 +410,8 @@ export class SynthesizeStatisticsComponent implements OnInit {
404
     let postData:any = {
410
     let postData:any = {
405
       idx: this.pageIndex - 1,
411
       idx: this.pageIndex - 1,
406
       sum: this.pageSize,
412
       sum: this.pageSize,
407
-      startDate: this.dateRange[0],
408
-      endDate: this.dateRange[1],
413
+      startDate: this.customChangeDateComponent.startDate || undefined,
414
+      endDate: this.customChangeDateComponent.endDate || undefined,
409
       hosId: this.hosId,
415
       hosId: this.hosId,
410
       dutyId: this.dutyId,
416
       dutyId: this.dutyId,
411
       parentDutyId: this.parentDutyId,
417
       parentDutyId: this.parentDutyId,
@@ -423,8 +429,8 @@ export class SynthesizeStatisticsComponent implements OnInit {
423
 	// 头部工单数据
429
 	// 头部工单数据
424
 	getWorkData() {
430
 	getWorkData() {
425
 	  let postData:any = {
431
 	  let postData:any = {
426
-	    startDate: this.dateRange[0],
427
-	    endDate: this.dateRange[1],
432
+	    startDate: this.customChangeDateComponent.startDate || undefined,
433
+      endDate: this.customChangeDateComponent.endDate || undefined,
428
 			type: 'headerCount',
434
 			type: 'headerCount',
429
 	    hosId: this.hosId,
435
 	    hosId: this.hosId,
430
 	    dutyId: this.dutyId,
436
 	    dutyId: this.dutyId,
@@ -440,8 +446,8 @@ export class SynthesizeStatisticsComponent implements OnInit {
440
 	// 维修处理
446
 	// 维修处理
441
 	getMaintainData() {
447
 	getMaintainData() {
442
 	  let postData:any = {
448
 	  let postData:any = {
443
-	    startDate: this.dateRange[0],
444
-	    endDate: this.dateRange[1],
449
+	    startDate: this.customChangeDateComponent.startDate || undefined,
450
+      endDate: this.customChangeDateComponent.endDate || undefined,
445
 			type: 'userHandleTop5',
451
 			type: 'userHandleTop5',
446
 			groupType: this.activeIndex==0?'user':'group',
452
 			groupType: this.activeIndex==0?'user':'group',
447
 	    hosId: this.hosId,
453
 	    hosId: this.hosId,
@@ -457,8 +463,9 @@ export class SynthesizeStatisticsComponent implements OnInit {
457
 
463
 
458
 	// 重置
464
 	// 重置
459
 	reset(){
465
 	reset(){
460
-		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')];
466
+		this.dateRange = [];
461
 		this.activeIndex = 0;
467
 		this.activeIndex = 0;
468
+    this.customChangeDateComponent.resetByDate();
462
 		this.search();
469
 		this.search();
463
 	}
470
 	}
464
 
471
 
@@ -468,23 +475,5 @@ export class SynthesizeStatisticsComponent implements OnInit {
468
   }
475
   }
469
 
476
 
470
   // 日期选择 日
477
   // 日期选择 日
471
-  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')]; //发起时间区间 天
472
-  changeDate(result?): void {
473
-    result[0] = format(result[0], 'yyyy-MM-dd') + ' ' + '00:00:00';
474
-    result[1] = format(result[1], 'yyyy-MM-dd') + ' ' + '23:59:59';
475
-    this.dateRange = result;
476
-    // this.search();
477
-		console.log(this.dateRange);
478
-  }
479
-
480
-  onCalendarChangeDate(dateArr){
481
-    // console.log(dateArr)
482
-    // if(dateArr.length == 2){
483
-    //   let dateStart = new Date(dateArr[0]);
484
-    //   let dateEnd = new Date(dateArr[1]);
485
-    //   dateStart.setHours(0,0,0);
486
-    //   dateEnd.setHours(23,59,59);
487
-    //   this.dateRange = [dateStart,dateEnd];
488
-    // }
489
-  }
478
+  dateRange: any = []; //发起时间区间 天
490
 }
479
 }

+ 3 - 1
src/app/views/new-statistics/maintenance-statistics/synthesize-statistics/synthesize-statistics.module.ts

@@ -6,6 +6,7 @@ import { SynthesizeStatisticsRoutingModule } from './synthesize-statistics-routi
6
 import { ShareModule } from 'src/app/share/share.module';
6
 import { ShareModule } from 'src/app/share/share.module';
7
 import { VirtualScrollerModule } from 'ngx-virtual-scroller';
7
 import { VirtualScrollerModule } from 'ngx-virtual-scroller';
8
 import { NgxEchartsModule } from 'ngx-echarts';
8
 import { NgxEchartsModule } from 'ngx-echarts';
9
+import { CustomChangeDateModule } from '../../components/custom-change-date/custom-change-date.module';
9
 
10
 
10
 
11
 
11
 @NgModule({
12
 @NgModule({
@@ -17,7 +18,8 @@ import { NgxEchartsModule } from 'ngx-echarts';
17
     SynthesizeStatisticsRoutingModule,
18
     SynthesizeStatisticsRoutingModule,
18
     ShareModule,
19
     ShareModule,
19
     VirtualScrollerModule,
20
     VirtualScrollerModule,
20
-		NgxEchartsModule
21
+		NgxEchartsModule,
22
+    CustomChangeDateModule,
21
   ]
23
   ]
22
 })
24
 })
23
 export class SynthesizeStatisticsModule { }
25
 export class SynthesizeStatisticsModule { }

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

@@ -1,10 +1,6 @@
1
 <div class="searchDataWrap">
1
 <div class="searchDataWrap">
2
   <div class="searchData">
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
     <div class="searchDataItem">
4
     <div class="searchDataItem">
9
       <span class="label">维修分组</span>:
5
       <span class="label">维修分组</span>:
10
       <nz-select class="selectItem" [nzDropdownMatchSelectWidth]="false" nzServerSearch nzShowSearch (nzOnSearch)="changeGroupInp($event)" nzAllowClear nzPlaceHolder="请选择维修分组" [(ngModel)]="groupId" (nzOpenChange)="openChangeGroup($event)">
6
       <nz-select class="selectItem" [nzDropdownMatchSelectWidth]="false" nzServerSearch nzShowSearch (nzOnSearch)="changeGroupInp($event)" nzAllowClear nzPlaceHolder="请选择维修分组" [(ngModel)]="groupId" (nzOpenChange)="openChangeGroup($event)">

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

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

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

@@ -1,17 +1,18 @@
1
 import { debounceTime } from 'rxjs/operators';
1
 import { debounceTime } from 'rxjs/operators';
2
 import { Subject } from 'rxjs';
2
 import { Subject } from 'rxjs';
3
 import { NzMessageService } from 'ng-zorro-antd/message';
3
 import { NzMessageService } from 'ng-zorro-antd/message';
4
-import { format, addMonths, startOfMonth, endOfMonth, startOfDay, endOfDay } from 'date-fns';
5
-import { Component, OnInit, HostListener, AfterViewInit } from "@angular/core";
4
+import { Component, OnInit, HostListener, AfterViewInit, ViewChild } from "@angular/core";
6
 import { MainService } from 'src/app/services/main.service';
5
 import { MainService } from 'src/app/services/main.service';
7
 import { ActivatedRoute } from '@angular/router';
6
 import { ActivatedRoute } from '@angular/router';
8
 import { TabService } from '../../services/tab.service';
7
 import { TabService } from '../../services/tab.service';
8
+import { CustomChangeDateComponent } from '../../components/custom-change-date/custom-change-date.component';
9
 @Component({
9
 @Component({
10
   selector: "app-user-statistics",
10
   selector: "app-user-statistics",
11
   templateUrl: "./user-statistics.component.html",
11
   templateUrl: "./user-statistics.component.html",
12
   styleUrls: ["./user-statistics.component.less"],
12
   styleUrls: ["./user-statistics.component.less"],
13
 })
13
 })
14
 export class UserStatisticsComponent implements OnInit, AfterViewInit {
14
 export class UserStatisticsComponent implements OnInit, AfterViewInit {
15
+  @ViewChild('customChangeDate', { static: false }) customChangeDateComponent!: CustomChangeDateComponent;
15
   constructor(
16
   constructor(
16
     private mainService: MainService,
17
     private mainService: MainService,
17
     private message: NzMessageService,
18
     private message: NzMessageService,
@@ -34,12 +35,14 @@ export class UserStatisticsComponent implements OnInit, AfterViewInit {
34
       let fun = v[0];
35
       let fun = v[0];
35
       fun.call(this, v[1]);
36
       fun.call(this, v[1]);
36
     });
37
     });
37
-    this.initSessionData();
38
-    this.getQueryParams();
39
-    this.search();
40
   }
38
   }
41
 
39
 
42
   ngAfterViewInit(){
40
   ngAfterViewInit(){
41
+    this.initSessionData();
42
+    this.getQueryParams();
43
+    setTimeout(() => {
44
+      this.search();
45
+    }, 0)
43
     this.onResize();
46
     this.onResize();
44
   }
47
   }
45
 
48
 
@@ -57,6 +60,7 @@ export class UserStatisticsComponent implements OnInit, AfterViewInit {
57
     this.tabService.clearQueryParams();
60
     this.tabService.clearQueryParams();
58
     if(queryParams.dateRange){
61
     if(queryParams.dateRange){
59
       this.dateRange = queryParams.dateRange;
62
       this.dateRange = queryParams.dateRange;
63
+      this.customChangeDateComponent.initByDate(this.dateRange);
60
     }
64
     }
61
   }
65
   }
62
 
66
 
@@ -113,8 +117,8 @@ export class UserStatisticsComponent implements OnInit, AfterViewInit {
113
     let postData:any = {
117
     let postData:any = {
114
       idx: this.pageIndex - 1,
118
       idx: this.pageIndex - 1,
115
       sum: this.pageSize,
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
       hosId: this.hosId || undefined,
122
       hosId: this.hosId || undefined,
119
       dutyId: this.dutyId || undefined,
123
       dutyId: this.dutyId || undefined,
120
       parentDutyId: this.parentDutyId || undefined,
124
       parentDutyId: this.parentDutyId || undefined,
@@ -155,19 +159,7 @@ export class UserStatisticsComponent implements OnInit, AfterViewInit {
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
   excelExportLoading:any = false;
165
   excelExportLoading:any = false;
@@ -176,8 +168,8 @@ export class UserStatisticsComponent implements OnInit, AfterViewInit {
176
       nzDuration: 0,
168
       nzDuration: 0,
177
     }).messageId;
169
     }).messageId;
178
     let postData:any = {
170
     let postData:any = {
179
-      startDate: this.dateRange[0] || undefined,
180
-      endDate: this.dateRange[1] || undefined,
171
+      startDate: this.customChangeDateComponent.startDate || undefined,
172
+      endDate: this.customChangeDateComponent.endDate || undefined,
181
       hosId: this.hosId || undefined,
173
       hosId: this.hosId || undefined,
182
       dutyId: this.dutyId || undefined,
174
       dutyId: this.dutyId || undefined,
183
       parentDutyId: this.parentDutyId || undefined,
175
       parentDutyId: this.parentDutyId || undefined,
@@ -218,9 +210,10 @@ export class UserStatisticsComponent implements OnInit, AfterViewInit {
218
     this.sortCurrentKey = "";
210
     this.sortCurrentKey = "";
219
 		this.sortCurrentValue = "";
211
 		this.sortCurrentValue = "";
220
 		this.sortCurrent = {};
212
 		this.sortCurrent = {};
221
-    this.dateRange = [format(startOfMonth(addMonths(new Date(), -1)), 'yyyy-MM-dd HH:mm:ss'), format(endOfMonth(addMonths(new Date(), -1)), 'yyyy-MM-dd HH:mm:ss')]
213
+    this.dateRange = []
222
     this.groupId = undefined;
214
     this.groupId = undefined;
223
     this.fieldConfig.fields = {buildingId: undefined, floorId: undefined, categoryId: undefined};
215
     this.fieldConfig.fields = {buildingId: undefined, floorId: undefined, categoryId: undefined};
216
+    this.customChangeDateComponent.resetByDate();
224
     this.search();
217
     this.search();
225
   }
218
   }
226
 
219
 

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

@@ -5,6 +5,7 @@ import { CommonModule } from '@angular/common';
5
 import { UserStatisticsRoutingModule } from './user-statistics-routing.module';
5
 import { UserStatisticsRoutingModule } from './user-statistics-routing.module';
6
 import { ShareModule } from 'src/app/share/share.module';
6
 import { ShareModule } from 'src/app/share/share.module';
7
 import { SearchMoreModule } from '../../components/search-more/search-more.module';
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
 @NgModule({
11
 @NgModule({
@@ -16,6 +17,7 @@ import { SearchMoreModule } from '../../components/search-more/search-more.modul
16
     UserStatisticsRoutingModule,
17
     UserStatisticsRoutingModule,
17
     ShareModule,
18
     ShareModule,
18
     SearchMoreModule,
19
     SearchMoreModule,
20
+    CustomChangeDateModule,
19
   ]
21
   ]
20
 })
22
 })
21
 export class UserStatisticsModule { }
23
 export class UserStatisticsModule { }

+ 6 - 7
src/app/views/new-statistics/phone-statistics/date-phone-statistics/date-phone-statistics.component.ts

@@ -1,6 +1,5 @@
1
 import { TabService } from './../../services/tab.service';
1
 import { TabService } from './../../services/tab.service';
2
 import { NzMessageService } from 'ng-zorro-antd/message';
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, ViewChild } from "@angular/core";
3
 import { Component, OnInit, HostListener, AfterViewInit, ViewChild } from "@angular/core";
5
 import { MainService } from 'src/app/services/main.service';
4
 import { MainService } from 'src/app/services/main.service';
6
 import { ActivatedRoute } from '@angular/router';
5
 import { ActivatedRoute } from '@angular/router';
@@ -52,7 +51,7 @@ export class DatePhoneStatisticsComponent implements OnInit, AfterViewInit {
52
     this.tabService.clearQueryParams();
51
     this.tabService.clearQueryParams();
53
     if(queryParams.dateRange){
52
     if(queryParams.dateRange){
54
       this.dateRange = queryParams.dateRange;
53
       this.dateRange = queryParams.dateRange;
55
-      this.customChangeDateComponent.reset(this.dateRange);
54
+      this.customChangeDateComponent.initByDate(this.dateRange);
56
     }
55
     }
57
   }
56
   }
58
 
57
 
@@ -150,7 +149,7 @@ export class DatePhoneStatisticsComponent implements OnInit, AfterViewInit {
150
   }
149
   }
151
 
150
 
152
   // 日期选择
151
   // 日期选择
153
-  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')];
152
+  dateRange: any = [];
154
 
153
 
155
   // 导出
154
   // 导出
156
   excelExportLoading:any = false;
155
   excelExportLoading:any = false;
@@ -159,8 +158,8 @@ export class DatePhoneStatisticsComponent implements OnInit, AfterViewInit {
159
       nzDuration: 0,
158
       nzDuration: 0,
160
     }).messageId;
159
     }).messageId;
161
     let postData:any = {
160
     let postData:any = {
162
-      startDate: this.dateRange[0] || undefined,
163
-      endDate: this.dateRange[1] || undefined,
161
+      startDate: this.customChangeDateComponent.startDate || undefined,
162
+      endDate: this.customChangeDateComponent.endDate || undefined,
164
       hosId: this.getHosId,
163
       hosId: this.getHosId,
165
       statisticsTypeId: this.statisticsTypeId || undefined,
164
       statisticsTypeId: this.statisticsTypeId || undefined,
166
       groupId: this.fieldConfig.fields.userId ? undefined : (this.fieldConfig.fields.groupId || undefined),
165
       groupId: this.fieldConfig.fields.userId ? undefined : (this.fieldConfig.fields.groupId || undefined),
@@ -200,10 +199,10 @@ export class DatePhoneStatisticsComponent implements OnInit, AfterViewInit {
200
     this.sortCurrentKey = "";
199
     this.sortCurrentKey = "";
201
 		this.sortCurrentValue = "";
200
 		this.sortCurrentValue = "";
202
 		this.sortCurrent = {};
201
 		this.sortCurrent = {};
203
-    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')]
202
+    this.dateRange = []
204
     this.statisticsTypeId = undefined;
203
     this.statisticsTypeId = undefined;
205
     this.fieldConfig.fields = {groupId: undefined, userId: undefined, taskTypeId: undefined, buildingId: undefined, deptId: undefined};
204
     this.fieldConfig.fields = {groupId: undefined, userId: undefined, taskTypeId: undefined, buildingId: undefined, deptId: undefined};
206
-    this.customChangeDateComponent.reset(this.dateRange);
205
+    this.customChangeDateComponent.resetByDate();
207
     this.search();
206
     this.search();
208
   }
207
   }
209
 
208