|
@@ -1,6 +1,6 @@
|
1
|
1
|
import { Component, OnInit } from "@angular/core";
|
2
|
2
|
import { ActivatedRoute, Router } from "@angular/router";
|
3
|
|
-import { differenceInCalendarDays, endOfMonth, endOfYear, format, startOfMonth, startOfYear } from "date-fns";
|
|
3
|
+import { differenceInCalendarDays, endOfMonth, endOfYear, format, startOfMonth, startOfYear, getQuarter } from "date-fns";
|
4
|
4
|
|
5
|
5
|
import { MainService } from "../../services/main.service";
|
6
|
6
|
import { DateService } from "../../services/date.service";
|
|
@@ -25,11 +25,37 @@ export class QuiltWashingTrendAnalysisComponent implements OnInit {
|
25
|
25
|
ngOnInit() {
|
26
|
26
|
this.coopBtns = this.tool.initCoopBtns(this.route);
|
27
|
27
|
this.getAllHos();
|
28
|
|
- this.changeDateRange(this.defRange);
|
29
|
|
- // this.search();
|
|
28
|
+ this.changeDateType();
|
30
|
29
|
}
|
31
|
30
|
|
32
|
|
- dateType: string = "day"; //选中时间维度
|
|
31
|
+ searchDto = {
|
|
32
|
+ dateType: "day", //选中日期维度
|
|
33
|
+ dateStr: new Date(), //选中日期--天、月、年
|
|
34
|
+ year: +format(new Date(), "yyyy"),//季度-年
|
|
35
|
+ quarter: getQuarter(new Date()),//季度
|
|
36
|
+ tabType: 'YoY',//YoY/同比,MoM/环比
|
|
37
|
+ }
|
|
38
|
+
|
|
39
|
+ tabTypes = [
|
|
40
|
+ {
|
|
41
|
+ name: "同比",
|
|
42
|
+ value: "YoY",
|
|
43
|
+ },
|
|
44
|
+ {
|
|
45
|
+ name: "环比",
|
|
46
|
+ value: "MoM",
|
|
47
|
+ },
|
|
48
|
+ ]
|
|
49
|
+
|
|
50
|
+ quarterList = [
|
|
51
|
+ { name: '第一季度', value: 1, },
|
|
52
|
+ { name: '第二季度', value: 2, },
|
|
53
|
+ { name: '第三季度', value: 3, },
|
|
54
|
+ { name: '第四季度', value: 4, },
|
|
55
|
+ ]
|
|
56
|
+
|
|
57
|
+ yearList = this.generaterYears();
|
|
58
|
+
|
33
|
59
|
dateTypes: any = [
|
34
|
60
|
{
|
35
|
61
|
label: "按天统计",
|
|
@@ -40,37 +66,14 @@ export class QuiltWashingTrendAnalysisComponent implements OnInit {
|
40
|
66
|
value: "month",
|
41
|
67
|
},
|
42
|
68
|
{
|
|
69
|
+ label: "按季度统计",
|
|
70
|
+ value: "quarter",
|
|
71
|
+ },
|
|
72
|
+ {
|
43
|
73
|
label: "按年统计",
|
44
|
74
|
value: "year",
|
45
|
75
|
},
|
46
|
76
|
]; //时间维度
|
47
|
|
- defRange = "1"; //默认上周
|
48
|
|
- defRanges = [
|
49
|
|
- {
|
50
|
|
- label: "上周",
|
51
|
|
- id: 1,
|
52
|
|
- },
|
53
|
|
- {
|
54
|
|
- label: "上月",
|
55
|
|
- id: 2,
|
56
|
|
- },
|
57
|
|
- {
|
58
|
|
- label: "上年",
|
59
|
|
- id: 3,
|
60
|
|
- },
|
61
|
|
- ]; //时间默认区间
|
62
|
|
-
|
63
|
|
- listOfData: any[] = []; //表格数据
|
64
|
|
- pageIndex: number = 1; //表格当前页码
|
65
|
|
- pageSize: number = 10; //表格每页展示条数
|
66
|
|
- listLength: number = 10; //表格总数据量
|
67
|
|
-
|
68
|
|
- alldepart: any = []; //当前院区所属科室
|
69
|
|
- dateRange: any = []; //发起时间区间 天
|
70
|
|
- monthRangeStart: any; //发起时间 月 起
|
71
|
|
- monthRangeEnd: any; //发起时间 月 止
|
72
|
|
- yearRangeStart: any; //发起时间 年 起
|
73
|
|
- yearRangeEnd: any; //发起时间 年 止
|
74
|
77
|
|
75
|
78
|
promptContent: string; //操作提示框提示信息
|
76
|
79
|
ifSuccess: boolean; //操作成功/失败
|
|
@@ -79,346 +82,289 @@ export class QuiltWashingTrendAnalysisComponent implements OnInit {
|
79
|
82
|
|
80
|
83
|
// 初始化增删改按钮
|
81
|
84
|
coopBtns: any = {};
|
82
|
|
- searchData: any = {}; // 综合统计页面带过来的参数
|
83
|
|
- getSearchData() {
|
84
|
|
- let that = this;
|
85
|
|
- let sub = that.myService.getMsg().subscribe((msg) => {
|
86
|
|
- // 从综合报表跳转过来
|
87
|
|
- that.searchData = msg;
|
88
|
|
- console.log(that.searchData);
|
89
|
|
- console.log(66);
|
90
|
|
- sub.unsubscribe(); //取消订阅,否则订阅函数会累加执行
|
91
|
|
- that.hospital = that.searchData["hosId"];
|
92
|
|
- that.changeDate(that.searchData["range"]);
|
93
|
|
- that.defRange = that.searchData["defRange"];
|
94
|
|
- that.search();
|
95
|
|
- });
|
96
|
|
- that.changeDateRange(that.defRange);
|
97
|
|
- that.search();
|
|
85
|
+
|
|
86
|
+ // 切换同比/环比
|
|
87
|
+ changeTabType(value){
|
|
88
|
+ this.searchDto.tabType = value;
|
|
89
|
+ this.search();
|
98
|
90
|
}
|
99
|
|
- // 搜索
|
100
|
|
- search(num?: number) {
|
101
|
|
- if (this.hospital) {
|
102
|
|
- this.searchData["hosId"] = this.hospital;
|
103
|
|
- }
|
104
|
|
- if (this.startDate) {
|
105
|
|
- this.searchData["dateRange"] = {
|
106
|
|
- start: this.startDate + " " + "00:00:00",
|
107
|
|
- end: this.endDate + " " + "23:59:59",
|
108
|
|
- };
|
109
|
|
- }
|
110
|
|
- if (num !== undefined) {
|
111
|
|
- this.getList(num, this.sortCurrentKey, this.sortCurrentValue);
|
112
|
|
- } else {
|
113
|
|
- this.getList(this.pageIndex, this.sortCurrentKey, this.sortCurrentValue);
|
|
91
|
+
|
|
92
|
+ // 生成前5年的年份
|
|
93
|
+ generaterYears(){
|
|
94
|
+ const currentYear = new Date().getFullYear();
|
|
95
|
+ const years = [];
|
|
96
|
+
|
|
97
|
+ for (let i = currentYear - 4; i <= currentYear; i++) {
|
|
98
|
+ years.push(i);
|
114
|
99
|
}
|
|
100
|
+
|
|
101
|
+ return years.map(v => ({
|
|
102
|
+ name: v + '年',
|
|
103
|
+ value: v,
|
|
104
|
+ }));
|
115
|
105
|
}
|
116
|
|
- // 导出
|
117
|
|
- loading2 = false;
|
118
|
|
- export() {
|
119
|
|
- let that = this;
|
120
|
|
- let postData: any = {
|
121
|
|
- startTime: this.startDate + " " + "00:00:00",
|
122
|
|
- endTime: this.endDate + " " + "23:59:59",
|
123
|
|
- hosId: that.hospital,
|
124
|
|
- type: this.dateType,
|
125
|
|
- };
|
126
|
|
- if (this.sortCurrentKey && this.sortCurrentValue) {
|
127
|
|
- postData.sort =
|
128
|
|
- this.sortCurrentValue === "ascend"
|
129
|
|
- ? this.sortCurrentKey
|
130
|
|
- : `${this.sortCurrentKey} desc`;
|
|
106
|
+ // 科室费用差异率TOP10
|
|
107
|
+ deptPriceOption;
|
|
108
|
+ deptPriceChart(datas) {
|
|
109
|
+ console.log(datas)
|
|
110
|
+ let labels = [];
|
|
111
|
+ let nums = [];
|
|
112
|
+ if (datas.length) {
|
|
113
|
+ datas.forEach((e) => {
|
|
114
|
+ labels.push(e.deptName);
|
|
115
|
+ nums.push({
|
|
116
|
+ name: e.deptName,
|
|
117
|
+ value: e.priceRate,
|
|
118
|
+ label: {
|
|
119
|
+ position: e.priceRate >= 0 ? 'top' : 'bottom',
|
|
120
|
+ }
|
|
121
|
+ });
|
|
122
|
+ });
|
131
|
123
|
}
|
132
|
|
- this.loading2 = true;
|
133
|
|
- that.mainService.exportReport("clothesHos", postData).subscribe(
|
134
|
|
- (data) => {
|
135
|
|
- this.loading2 = false;
|
136
|
|
- this.showPromptModal("导出", true, "");
|
137
|
|
- var file = new Blob([data], {
|
138
|
|
- type: "application/vnd.ms-excel",
|
|
124
|
+ this.deptPriceOption = {
|
|
125
|
+ color: ["#3398DB"],
|
|
126
|
+ tooltip: {
|
|
127
|
+ trigger: "axis",
|
|
128
|
+ axisPointer: {
|
|
129
|
+ // 坐标轴指示器,坐标轴触发有效
|
|
130
|
+ type: "shadow", // 默认为直线,可选为:'line' | 'shadow'
|
|
131
|
+ },
|
|
132
|
+ formatter: '{b}: {c}%'
|
|
133
|
+ },
|
|
134
|
+ grid: {
|
|
135
|
+ left: "9px",
|
|
136
|
+ right: "9px",
|
|
137
|
+ bottom: "20px",
|
|
138
|
+ top: "20px",
|
|
139
|
+ containLabel: true,
|
|
140
|
+ },
|
|
141
|
+ xAxis: [
|
|
142
|
+ {
|
|
143
|
+ type: "category",
|
|
144
|
+ data: labels,
|
|
145
|
+ // axisLine: {
|
|
146
|
+ // show: true,
|
|
147
|
+ // onZero: false,
|
|
148
|
+ // },
|
|
149
|
+ axisTick: {
|
|
150
|
+ alignWithLabel: true,
|
|
151
|
+ },
|
|
152
|
+ },
|
|
153
|
+ ],
|
|
154
|
+ yAxis: [
|
|
155
|
+ {
|
|
156
|
+ type: "value",
|
|
157
|
+ interval: 20,
|
|
158
|
+ max: 100,
|
|
159
|
+ min: -100,
|
|
160
|
+ splitLine: {
|
|
161
|
+ // show: false,
|
|
162
|
+ },
|
|
163
|
+ axisLabel: {
|
|
164
|
+ formatter: "{value}%",
|
|
165
|
+ },
|
|
166
|
+ nameTextStyle: {
|
|
167
|
+ align: "left",
|
|
168
|
+ },
|
|
169
|
+ },
|
|
170
|
+ ],
|
|
171
|
+ series: [
|
|
172
|
+ {
|
|
173
|
+ name: "差异率",
|
|
174
|
+ type: "bar",
|
|
175
|
+ barWidth: "35",
|
|
176
|
+ data: nums,
|
|
177
|
+ label: {
|
|
178
|
+ show: true,
|
|
179
|
+ color: '#000',
|
|
180
|
+ formatter: '{c}%'
|
|
181
|
+ },
|
|
182
|
+ itemStyle: {
|
|
183
|
+ normal: {
|
|
184
|
+ //每根柱子颜色设置
|
|
185
|
+ color: function (params) {
|
|
186
|
+ if (params.value > 0) {
|
|
187
|
+ return '#92DCE9'; // 正数颜色
|
|
188
|
+ } else {
|
|
189
|
+ return '#7E8CEB'; // 负数颜色
|
|
190
|
+ }
|
|
191
|
+ },
|
|
192
|
+ },
|
|
193
|
+ },
|
|
194
|
+ },
|
|
195
|
+ ],
|
|
196
|
+ };
|
|
197
|
+ }
|
|
198
|
+ // 科室数量差异率TOP10
|
|
199
|
+ deptCountOption;
|
|
200
|
+ deptCountChart(datas) {
|
|
201
|
+ console.log(datas)
|
|
202
|
+ let labels = [];
|
|
203
|
+ let nums = [];
|
|
204
|
+ if (datas.length) {
|
|
205
|
+ datas.forEach((e) => {
|
|
206
|
+ labels.push(e.deptName);
|
|
207
|
+ nums.push({
|
|
208
|
+ name: e.deptName,
|
|
209
|
+ value: e.countRate,
|
|
210
|
+ label: {
|
|
211
|
+ position: e.countRate >= 0 ? 'top' : 'bottom',
|
|
212
|
+ }
|
139
|
213
|
});
|
140
|
|
- //trick to download store a file having its URL
|
141
|
|
- var fileURL = URL.createObjectURL(file);
|
142
|
|
- var a = document.createElement("a");
|
143
|
|
- a.href = fileURL;
|
144
|
|
- a.target = "_blank";
|
145
|
|
- a.download = "全员统计.xls";
|
146
|
|
- document.body.appendChild(a);
|
147
|
|
- a.click();
|
|
214
|
+ });
|
|
215
|
+ }
|
|
216
|
+ this.deptCountOption = {
|
|
217
|
+ color: ["#3398DB"],
|
|
218
|
+ tooltip: {
|
|
219
|
+ trigger: "axis",
|
|
220
|
+ axisPointer: {
|
|
221
|
+ // 坐标轴指示器,坐标轴触发有效
|
|
222
|
+ type: "shadow", // 默认为直线,可选为:'line' | 'shadow'
|
|
223
|
+ },
|
|
224
|
+ formatter: '{b}: {c}%'
|
148
|
225
|
},
|
149
|
|
- (err) => {
|
150
|
|
- this.loading2 = false;
|
151
|
|
- this.showPromptModal("导出", false, "");
|
152
|
|
- }
|
153
|
|
- );
|
|
226
|
+ grid: {
|
|
227
|
+ left: "9px",
|
|
228
|
+ right: "9px",
|
|
229
|
+ bottom: "20px",
|
|
230
|
+ top: "20px",
|
|
231
|
+ containLabel: true,
|
|
232
|
+ },
|
|
233
|
+ xAxis: [
|
|
234
|
+ {
|
|
235
|
+ type: "category",
|
|
236
|
+ data: labels,
|
|
237
|
+ // axisLine: {
|
|
238
|
+ // show: true,
|
|
239
|
+ // onZero: false,
|
|
240
|
+ // },
|
|
241
|
+ axisTick: {
|
|
242
|
+ alignWithLabel: true,
|
|
243
|
+ },
|
|
244
|
+ },
|
|
245
|
+ ],
|
|
246
|
+ yAxis: [
|
|
247
|
+ {
|
|
248
|
+ type: "value",
|
|
249
|
+ interval: 20,
|
|
250
|
+ max: 100,
|
|
251
|
+ min: -100,
|
|
252
|
+ splitLine: {
|
|
253
|
+ // show: false,
|
|
254
|
+ },
|
|
255
|
+ axisLabel: {
|
|
256
|
+ formatter: "{value}%",
|
|
257
|
+ },
|
|
258
|
+ nameTextStyle: {
|
|
259
|
+ align: "left",
|
|
260
|
+ },
|
|
261
|
+ },
|
|
262
|
+ ],
|
|
263
|
+ series: [
|
|
264
|
+ {
|
|
265
|
+ name: "差异率",
|
|
266
|
+ type: "bar",
|
|
267
|
+ barWidth: "35",
|
|
268
|
+ data: nums,
|
|
269
|
+ label: {
|
|
270
|
+ show: true,
|
|
271
|
+ color: '#000',
|
|
272
|
+ formatter: '{c}%'
|
|
273
|
+ },
|
|
274
|
+ itemStyle: {
|
|
275
|
+ normal: {
|
|
276
|
+ //每根柱子颜色设置
|
|
277
|
+ color: function (params) {
|
|
278
|
+ if (params.value > 0) {
|
|
279
|
+ return '#89C9BD'; // 正数颜色
|
|
280
|
+ } else {
|
|
281
|
+ return '#0694B6'; // 负数颜色
|
|
282
|
+ }
|
|
283
|
+ },
|
|
284
|
+ },
|
|
285
|
+ },
|
|
286
|
+ },
|
|
287
|
+ ],
|
|
288
|
+ };
|
|
289
|
+ }
|
|
290
|
+ // 搜索
|
|
291
|
+ search() {
|
|
292
|
+ this.getData();
|
154
|
293
|
}
|
155
|
294
|
// 重置
|
156
|
295
|
reset() {
|
157
|
|
- this.changeDateType("day");
|
158
|
|
- this.changeDateRange("1");
|
159
|
|
- this.sortCurrentKey = "";
|
160
|
|
- this.sortCurrentValue = "";
|
161
|
|
- this.sortCurrent = {
|
162
|
|
- deptNum: null,
|
163
|
|
- clothesTypeNum: null,
|
164
|
|
- getOrder: null,
|
165
|
|
- sendOrder: null,
|
166
|
|
- sendClothesNum: null,
|
167
|
|
- price: null,
|
168
|
|
- };
|
|
296
|
+ this.searchDto = {
|
|
297
|
+ dateType: "day", //选中日期维度
|
|
298
|
+ dateStr: new Date(), //选中日期--天、月、年
|
|
299
|
+ year: +format(new Date(), "yyyy"),//季度-年
|
|
300
|
+ quarter: getQuarter(new Date()),//季度
|
|
301
|
+ tabType: 'YoY',//YoY/同比,MoM/环比
|
|
302
|
+ }
|
169
|
303
|
this.search();
|
170
|
304
|
}
|
171
|
|
- // 表格数据
|
172
|
|
- loading1 = false;
|
173
|
|
- getList(num?: number, field?: string, sort?: string) {
|
174
|
|
- this.pageIndex = num;
|
|
305
|
+ // 数据
|
|
306
|
+ loading = false;
|
|
307
|
+ headerDate: any = {};
|
|
308
|
+ headerData: any = {};
|
|
309
|
+ priceDeptListTop10: any = [];
|
|
310
|
+ priceCompareDeptListTop10: any = [];
|
|
311
|
+ countDeptListTop10: any = [];
|
|
312
|
+ countCompareDeptListTop10: any = [];
|
|
313
|
+ priceBarTop10: any = [];
|
|
314
|
+ countBarTop10: any = [];
|
|
315
|
+ getData() {
|
175
|
316
|
let postData: any = {
|
176
|
|
- idx: this.pageIndex - 1,
|
177
|
|
- sum: this.pageSize,
|
178
|
|
- startTime: this.searchData.dateRange.start,
|
179
|
|
- endTime: this.searchData.dateRange.end,
|
180
|
|
- hosId: this.searchData.hosId,
|
181
|
|
- type: this.dateType,
|
|
317
|
+ tabType: this.searchDto.tabType,
|
|
318
|
+ hosId: this.hospital,
|
|
319
|
+ type: this.searchDto.dateType,
|
182
|
320
|
};
|
183
|
|
- if (field && sort) {
|
184
|
|
- postData.sort = sort === "ascend" ? field : `${field} desc`;
|
|
321
|
+ switch (postData.type) {
|
|
322
|
+ case "day":
|
|
323
|
+ postData.dateStr = this.searchDto.dateStr ? format(this.searchDto.dateStr, "yyyy-MM-dd") : format(new Date(), "yyyy-MM-dd");
|
|
324
|
+ break;
|
|
325
|
+ case "month":
|
|
326
|
+ postData.dateStr = this.searchDto.dateStr ? format(this.searchDto.dateStr, "yyyy-MM") : format(new Date(), "yyyy-MM");
|
|
327
|
+ break;
|
|
328
|
+ case "quarter":
|
|
329
|
+ postData.year = this.searchDto.year || +format(new Date(), "yyyy");
|
|
330
|
+ postData.quarter = this.searchDto.quarter || getQuarter(new Date());
|
|
331
|
+ break;
|
|
332
|
+ case "year":
|
|
333
|
+ postData.dateStr = format(this.searchDto.dateStr, "yyyy");
|
|
334
|
+ break;
|
185
|
335
|
}
|
186
|
|
- this.loading1 = true;
|
|
336
|
+ this.loading = true;
|
187
|
337
|
this.mainService
|
188
|
|
- .postCustom("report/clothes", "hospital", postData)
|
|
338
|
+ .postCustom("report/trend/analysis", "clothes", postData)
|
189
|
339
|
.subscribe((result) => {
|
190
|
|
- this.loading1 = false;
|
191
|
|
- this.listOfData = result.list || [];
|
192
|
|
- this.listLength = result.totalNum;
|
|
340
|
+ this.loading = false;
|
|
341
|
+ if(result.status == 200){
|
|
342
|
+ this.headerDate = result.list[0] || {};
|
|
343
|
+ this.headerData = result.list[1] || {};
|
|
344
|
+ let bodyData = result.list[2] || {};
|
|
345
|
+ this.priceDeptListTop10 = bodyData.priceDeptListTop10 || [];
|
|
346
|
+ this.priceCompareDeptListTop10 = bodyData.priceCompareDeptListTop10 || [];
|
|
347
|
+ this.countDeptListTop10 = bodyData.countDeptListTop10 || [];
|
|
348
|
+ this.countCompareDeptListTop10 = bodyData.countCompareDeptListTop10 || [];
|
|
349
|
+ this.priceBarTop10 = bodyData.priceBarTop10 || [];
|
|
350
|
+ this.deptPriceChart(this.priceBarTop10);
|
|
351
|
+ this.countBarTop10 = bodyData.countBarTop10 || [];
|
|
352
|
+ this.deptCountChart(this.countBarTop10);
|
|
353
|
+ }
|
193
|
354
|
});
|
194
|
355
|
}
|
195
|
356
|
// 获取院区
|
196
|
357
|
hospital: string; //选中院区
|
197
|
358
|
getAllHos() {
|
198
|
|
- this.hospital = this.tool.getCurrentHospital().id + "";
|
|
359
|
+ this.hospital = this.tool.getCurrentHospital().id;
|
199
|
360
|
}
|
200
|
361
|
|
201
|
362
|
// 修改时间展示维度
|
202
|
|
- changeDateType(res) {
|
203
|
|
- console.log(res, this.dateType);
|
204
|
|
- this.dateType = res;
|
205
|
|
- this.searchData["type"] = res;
|
206
|
|
- console.log(this.searchData);
|
207
|
|
- switch (res) {
|
208
|
|
- case "day":
|
209
|
|
- this.defRanges = [
|
210
|
|
- {
|
211
|
|
- label: "上周",
|
212
|
|
- id: 1,
|
213
|
|
- },
|
214
|
|
- {
|
215
|
|
- label: "上月",
|
216
|
|
- id: 2,
|
217
|
|
- },
|
218
|
|
- {
|
219
|
|
- label: "上年",
|
220
|
|
- id: 3,
|
221
|
|
- },
|
222
|
|
- ]; //时间默认区间
|
223
|
|
- this.defRange = "1"; //默认上周
|
224
|
|
- this.changeDateRange("1");
|
225
|
|
- break;
|
226
|
|
- case "month":
|
227
|
|
- this.defRanges = [
|
228
|
|
- {
|
229
|
|
- label: "上月",
|
230
|
|
- id: 2,
|
231
|
|
- },
|
232
|
|
- {
|
233
|
|
- label: "上年",
|
234
|
|
- id: 3,
|
235
|
|
- },
|
236
|
|
- ]; //时间默认区间
|
237
|
|
- this.defRange = "2"; //上月
|
238
|
|
- this.changeDateRange("2");
|
239
|
|
- break;
|
240
|
|
- case "year":
|
241
|
|
- this.defRanges = [
|
242
|
|
- {
|
243
|
|
- label: "上年",
|
244
|
|
- id: 3,
|
245
|
|
- },
|
246
|
|
- ]; //时间默认区间
|
247
|
|
- this.defRange = "3"; //默认上周
|
248
|
|
- this.changeDateRange("3");
|
249
|
|
- break;
|
|
363
|
+ changeDateType(e?) {
|
|
364
|
+ if(this.searchDto.dateType == 'year' && this.searchDto.tabType == 'MoM'){
|
|
365
|
+ this.searchDto.tabType = 'YoY';
|
250
|
366
|
}
|
251
|
|
- }
|
252
|
|
-
|
253
|
|
- // 禁选日期
|
254
|
|
- disabledDate = (current: Date): boolean => {
|
255
|
|
- // Can not select days before today and today
|
256
|
|
- return differenceInCalendarDays(current, this.today) > 0;
|
257
|
|
- };
|
258
|
|
-
|
259
|
|
- // 禁选月份开始
|
260
|
|
- disabledMonthStart = (current: Date): boolean => {
|
261
|
|
- // Can not select days before today and today
|
262
|
|
- let cur = differenceInCalendarDays(current, endOfMonth(this.today)) > 0;
|
263
|
|
- let staEnd = differenceInCalendarDays(current, this.monthRangeEnd) > 0;
|
264
|
|
- return cur || staEnd;
|
265
|
|
- };
|
266
|
|
- // 禁选月份结束
|
267
|
|
- disabledMonthEnd = (current: Date): boolean => {
|
268
|
|
- // Can not select days before today and today
|
269
|
|
- let cur = differenceInCalendarDays(current, endOfMonth(this.today)) > 0;
|
270
|
|
- let staEnd = differenceInCalendarDays(this.monthRangeStart, current) > 0;
|
271
|
|
- return cur || staEnd;
|
272
|
|
- };
|
273
|
|
-
|
274
|
|
- // 禁选年份开始
|
275
|
|
- disabledYearStart = (current: Date): boolean => {
|
276
|
|
- // Can not select days before today and today
|
277
|
|
- let cur = differenceInCalendarDays(current, endOfYear(this.today)) > 0;
|
278
|
|
- let staEnd = differenceInCalendarDays(current, this.yearRangeEnd) > 0;
|
279
|
|
- return cur || staEnd;
|
280
|
|
- };
|
281
|
|
-
|
282
|
|
- // 禁选年份结束
|
283
|
|
- disabledYearEnd = (current: Date): boolean => {
|
284
|
|
- // Can not select days before today and today
|
285
|
|
- let cur = differenceInCalendarDays(current, endOfYear(this.today)) > 0;
|
286
|
|
- let staEnd = differenceInCalendarDays(this.yearRangeStart, current) > 0;
|
287
|
|
- return cur || staEnd;
|
288
|
|
- };
|
289
|
|
-
|
290
|
|
- // 日期选择 日
|
291
|
|
- startDate: string; //发起时间开始
|
292
|
|
- endDate: string; //发起时间结束
|
293
|
|
- changeDate(result?): void {
|
294
|
|
- console.log(this.dateRange);
|
295
|
|
- console.log(result);
|
296
|
|
- this.dateRange = result;
|
297
|
|
- if (!this.quick) {
|
298
|
|
- // 不是快捷选择
|
299
|
|
- this.defRange = null;
|
300
|
|
- }
|
301
|
|
- if (!result || !result.length) {
|
302
|
|
- this.startDate = this.endDate = "";
|
303
|
|
- return;
|
304
|
|
- }
|
305
|
|
- this.startDate =
|
306
|
|
- result[0].getFullYear() +
|
307
|
|
- "-" +
|
308
|
|
- (result[0].getMonth() + 1) +
|
309
|
|
- "-" +
|
310
|
|
- result[0].getDate();
|
311
|
|
- this.endDate =
|
312
|
|
- result[1].getFullYear() +
|
313
|
|
- "-" +
|
314
|
|
- (result[1].getMonth() + 1) +
|
315
|
|
- "-" +
|
316
|
|
- result[1].getDate();
|
317
|
|
- }
|
318
|
|
-
|
319
|
|
- // 月份选择
|
320
|
|
- changeMonthStart(result?) {
|
321
|
|
- console.log(result);
|
322
|
|
- this.monthRangeStart = result;
|
323
|
|
- if (!this.quick) {
|
324
|
|
- // 不是快捷选择
|
325
|
|
- this.defRange = null;
|
326
|
|
- }
|
327
|
|
- if (!result) {
|
328
|
|
- this.startDate = this.endDate = "";
|
329
|
|
- return;
|
330
|
|
- }
|
331
|
|
- this.startDate = format(startOfMonth(result), 'yyyy-MM-dd');
|
332
|
|
- // this.endDate = result.getFullYear() + '-' + (result.getMonth() + 1) + '-01';
|
333
|
|
- }
|
334
|
|
- changeMonthEnd(result?) {
|
335
|
|
- console.log(result);
|
336
|
|
- this.monthRangeEnd = result;
|
337
|
|
- if (!this.quick) {
|
338
|
|
- // 不是快捷选择
|
339
|
|
- this.defRange = null;
|
340
|
|
- }
|
341
|
|
- if (!result) {
|
342
|
|
- this.startDate = this.endDate = "";
|
343
|
|
- return;
|
344
|
|
- }
|
345
|
|
- // this.startDate = result.getFullYear() + '-' + (result.getMonth() + 1) + '-01';
|
346
|
|
- this.endDate = format(endOfMonth(result), 'yyyy-MM-dd');
|
347
|
|
- }
|
348
|
|
- // 年份选择
|
349
|
|
- changeYearStart(result?) {
|
350
|
|
- console.log(result);
|
351
|
|
- this.yearRangeStart = result;
|
352
|
|
- if (!this.quick) {
|
353
|
|
- // 不是快捷选择
|
354
|
|
- this.defRange = null;
|
355
|
|
- }
|
356
|
|
- if (!result) {
|
357
|
|
- this.startDate = this.endDate = "";
|
358
|
|
- return;
|
359
|
|
- }
|
360
|
|
- this.startDate = format(startOfYear(result), 'yyyy-MM-dd');
|
361
|
|
- // this.endDate = result.getFullYear() + '-01-01';
|
362
|
|
- }
|
363
|
|
- changeYearEnd(result?) {
|
364
|
|
- console.log(result);
|
365
|
|
- this.yearRangeEnd = result;
|
366
|
|
- if (!this.quick) {
|
367
|
|
- // 不是快捷选择
|
368
|
|
- this.defRange = null;
|
369
|
|
- }
|
370
|
|
- if (!result) {
|
371
|
|
- this.startDate = this.endDate = "";
|
372
|
|
- return;
|
373
|
|
- }
|
374
|
|
- this.endDate = format(endOfYear(result), 'yyyy-MM-dd');
|
375
|
|
- }
|
376
|
|
-
|
377
|
|
- // 日期选择 快速修改时间区间
|
378
|
|
- today = new Date();
|
379
|
|
- quick: boolean = false;
|
380
|
|
- changeDateRange(res) {
|
381
|
|
- console.log(res);
|
382
|
|
- this.quick = true;
|
383
|
|
- switch (res) {
|
384
|
|
- case "1":
|
385
|
|
- // 上周
|
386
|
|
- let lastweekstartdate = this.dateService.date().lastWeekStartDate;
|
387
|
|
- let lastweekenddate = this.dateService.date().lastWeekEndDate;
|
388
|
|
- console.log(lastweekstartdate, lastweekenddate);
|
389
|
|
- this.changeDate([lastweekstartdate, lastweekenddate]);
|
390
|
|
- break;
|
391
|
|
- case "2":
|
392
|
|
- // 上月
|
393
|
|
- let lastmonthstartdate = this.dateService.date().lastMonthStartDate;
|
394
|
|
- let lastmonthenddate = this.dateService.date().lastMonthEndDate;
|
395
|
|
- console.log(lastmonthstartdate, lastmonthenddate);
|
396
|
|
- this.changeDate([lastmonthstartdate, lastmonthenddate]);
|
397
|
|
- this.changeMonthStart(lastmonthstartdate);
|
398
|
|
- this.changeMonthEnd(lastmonthenddate);
|
399
|
|
- break;
|
400
|
|
- case "3":
|
401
|
|
- // 上年
|
402
|
|
- let lastyearstartdate = this.dateService.date().lastYearStartDate;
|
403
|
|
- let lastyearenddate = this.dateService.date().lastYearEndDate;
|
404
|
|
- console.log(lastyearstartdate, lastyearenddate);
|
405
|
|
- this.changeDate([lastyearstartdate, lastyearenddate]);
|
406
|
|
- this.changeMonthStart(lastyearstartdate);
|
407
|
|
- this.changeMonthEnd(lastyearenddate);
|
408
|
|
- this.changeYearStart(lastyearstartdate);
|
409
|
|
- this.changeYearEnd(lastyearenddate);
|
410
|
|
- break;
|
411
|
|
- }
|
412
|
|
- this.quick = false;
|
413
|
|
- this.search();
|
414
|
|
- }
|
415
|
|
-
|
416
|
|
- // 更多
|
417
|
|
- toMore(type) {
|
418
|
|
- let sendData = this.searchData;
|
419
|
|
- console.log(sendData);
|
420
|
|
- this.myService.sendMsg(sendData);
|
421
|
|
- this.router.navigateByUrl("/main/" + type);
|
|
367
|
+ this.getData();
|
422
|
368
|
}
|
423
|
369
|
|
424
|
370
|
// 展示信息提示框(con:提示信息,success:操作是否成功,promptInfo:操作结果提示信息)
|
|
@@ -431,29 +377,4 @@ export class QuiltWashingTrendAnalysisComponent implements OnInit {
|
431
|
377
|
this.promptModalShow = true;
|
432
|
378
|
}, 100);
|
433
|
379
|
}
|
434
|
|
-
|
435
|
|
- // 边输入边搜索节流阀
|
436
|
|
- isLoading: boolean = false;
|
437
|
|
- searchTimer(fun, e, those) {
|
438
|
|
- let that = this;
|
439
|
|
- that.isLoading = true;
|
440
|
|
- fun(e, those);
|
441
|
|
- }
|
442
|
|
- // 列表排序
|
443
|
|
- sortCurrent = {
|
444
|
|
- deptNum: null,
|
445
|
|
- clothesTypeNum: null,
|
446
|
|
- getOrder: null,
|
447
|
|
- sendOrder: null,
|
448
|
|
- sendClothesNum: null,
|
449
|
|
- price: null,
|
450
|
|
- };
|
451
|
|
- sortCurrentKey: string = "";
|
452
|
|
- sortCurrentValue: string | null = "";
|
453
|
|
- sort(e) {
|
454
|
|
- const { key, value } = e;
|
455
|
|
- this.sortCurrentKey = key;
|
456
|
|
- this.sortCurrentValue = value;
|
457
|
|
- this.getList(this.pageIndex, this.sortCurrentKey, this.sortCurrentValue);
|
458
|
|
- }
|
459
|
380
|
}
|