|
@@ -6,6 +6,8 @@ import { MainService } from "../../services/main.service";
|
6
|
6
|
import { DateService } from "../../services/date.service";
|
7
|
7
|
import { MyServiceService } from "../../services/my-service.service";
|
8
|
8
|
import { ToolService } from "../../services/tool.service";
|
|
9
|
+import { Subject } from 'rxjs';
|
|
10
|
+import { debounceTime } from 'rxjs/operators';
|
9
|
11
|
|
10
|
12
|
@Component({
|
11
|
13
|
selector: "app-quilt-washing-department-statistics",
|
|
@@ -22,11 +24,22 @@ export class QuiltWashingDepartmentStatisticsComponent implements OnInit {
|
22
|
24
|
private tool: ToolService
|
23
|
25
|
) {}
|
24
|
26
|
|
|
27
|
+ searchTimerSubject = new Subject();
|
|
28
|
+
|
|
29
|
+ searchDto: any = {
|
|
30
|
+ dept: null,
|
|
31
|
+ building: null,
|
|
32
|
+ }
|
|
33
|
+
|
25
|
34
|
ngOnInit() {
|
|
35
|
+ this.searchTimerSubject.pipe(debounceTime(500)).subscribe((v) => {
|
|
36
|
+ let fun = v[0];
|
|
37
|
+ fun.call(this, v[1]);
|
|
38
|
+ });
|
26
|
39
|
this.coopBtns = this.tool.initCoopBtns(this.route);
|
27
|
40
|
this.getAllHos();
|
28
|
41
|
this.changeDateRange(this.defRange);
|
29
|
|
- this.search();
|
|
42
|
+ // this.search();
|
30
|
43
|
}
|
31
|
44
|
|
32
|
45
|
dateType: string = "day"; //选中时间维度
|
|
@@ -116,12 +129,17 @@ export class QuiltWashingDepartmentStatisticsComponent implements OnInit {
|
116
|
129
|
// 导出
|
117
|
130
|
loading2 = false;
|
118
|
131
|
export() {
|
|
132
|
+ this.mapOfCheckedId = {};
|
|
133
|
+ this.checkedDepIds = [];
|
|
134
|
+ this.isAllDisplayDataChecked = false;
|
119
|
135
|
let that = this;
|
120
|
136
|
let postData: any = {
|
121
|
137
|
startTime: this.startDate + " " + "00:00:00",
|
122
|
138
|
endTime: this.endDate + " " + "23:59:59",
|
123
|
139
|
hosId: that.hospital,
|
124
|
140
|
type: this.dateType,
|
|
141
|
+ deptId: this.searchDto.dept || undefined,
|
|
142
|
+ buildingId: this.searchDto.building || undefined,
|
125
|
143
|
};
|
126
|
144
|
if (this.sortCurrentKey && this.sortCurrentValue) {
|
127
|
145
|
postData.sort =
|
|
@@ -152,6 +170,51 @@ export class QuiltWashingDepartmentStatisticsComponent implements OnInit {
|
152
|
170
|
}
|
153
|
171
|
);
|
154
|
172
|
}
|
|
173
|
+ // 批量导出详细科室报表
|
|
174
|
+ loading3 = false;
|
|
175
|
+ exportDetail() {
|
|
176
|
+ let ids = this.checkedDepIds.join(",");
|
|
177
|
+ this.mapOfCheckedId = {};
|
|
178
|
+ this.checkedDepIds = [];
|
|
179
|
+ this.isAllDisplayDataChecked = false;
|
|
180
|
+ let that = this;
|
|
181
|
+ let postData: any = {
|
|
182
|
+ startTime: this.startDate + " " + "00:00:00",
|
|
183
|
+ endTime: this.endDate + " " + "23:59:59",
|
|
184
|
+ hosId: that.hospital,
|
|
185
|
+ type: this.dateType,
|
|
186
|
+ deptId: ids || undefined,
|
|
187
|
+ buildingId: this.searchDto.building || undefined,
|
|
188
|
+ };
|
|
189
|
+ if (this.sortCurrentKey && this.sortCurrentValue) {
|
|
190
|
+ postData.sort =
|
|
191
|
+ this.sortCurrentValue === "ascend"
|
|
192
|
+ ? this.sortCurrentKey
|
|
193
|
+ : `${this.sortCurrentKey} desc`;
|
|
194
|
+ }
|
|
195
|
+ this.loading3 = true;
|
|
196
|
+ that.mainService.exportReport("clothesDeptDetails", postData).subscribe(
|
|
197
|
+ (data) => {
|
|
198
|
+ this.loading3 = false;
|
|
199
|
+ this.showPromptModal("导出", true, "");
|
|
200
|
+ var file = new Blob([data], {
|
|
201
|
+ type: "application/vnd.ms-excel",
|
|
202
|
+ });
|
|
203
|
+ //trick to download store a file having its URL
|
|
204
|
+ var fileURL = URL.createObjectURL(file);
|
|
205
|
+ var a = document.createElement("a");
|
|
206
|
+ a.href = fileURL;
|
|
207
|
+ a.target = "_blank";
|
|
208
|
+ a.download = "详细科室报表.xls";
|
|
209
|
+ document.body.appendChild(a);
|
|
210
|
+ a.click();
|
|
211
|
+ },
|
|
212
|
+ (err) => {
|
|
213
|
+ this.loading3 = false;
|
|
214
|
+ this.showPromptModal("导出", false, "");
|
|
215
|
+ }
|
|
216
|
+ );
|
|
217
|
+ }
|
155
|
218
|
// 重置
|
156
|
219
|
reset() {
|
157
|
220
|
this.changeDateType("day");
|
|
@@ -159,16 +222,52 @@ export class QuiltWashingDepartmentStatisticsComponent implements OnInit {
|
159
|
222
|
this.sortCurrentKey = "";
|
160
|
223
|
this.sortCurrentValue = "";
|
161
|
224
|
this.sortCurrent = {
|
162
|
|
- source1: null,
|
163
|
|
- source2: null,
|
164
|
|
- source3: null,
|
165
|
|
- source4: null,
|
|
225
|
+ clothesTypeNum: null,
|
|
226
|
+ getOrder: null,
|
|
227
|
+ sendOrder: null,
|
|
228
|
+ sendClothesNum: null,
|
|
229
|
+ price: null,
|
166
|
230
|
};
|
|
231
|
+ this.searchDto = {
|
|
232
|
+ dept: null,
|
|
233
|
+ building: null,
|
|
234
|
+ }
|
167
|
235
|
this.search();
|
168
|
236
|
}
|
|
237
|
+ // 选中表格单列
|
|
238
|
+ mapOfCheckedId: { [key: string]: boolean } = {};
|
|
239
|
+ checkedDepIds = []; //已选中单列id
|
|
240
|
+ refreshStatus(): void {
|
|
241
|
+ this.isAllDisplayDataChecked = this.listOfData.every(
|
|
242
|
+ (item) => this.mapOfCheckedId[item.id]
|
|
243
|
+ );
|
|
244
|
+ let arr = [];
|
|
245
|
+ for (var k in this.mapOfCheckedId) {
|
|
246
|
+ if (this.mapOfCheckedId[k]) {
|
|
247
|
+ arr.push(Number(k));
|
|
248
|
+ }
|
|
249
|
+ }
|
|
250
|
+ this.checkedDepIds = arr;
|
|
251
|
+ }
|
|
252
|
+ // 整行操作
|
|
253
|
+ selectedListData(data) {
|
|
254
|
+ this.mapOfCheckedId[data.id] = !this.mapOfCheckedId[data.id];
|
|
255
|
+ this.refreshStatus();
|
|
256
|
+ }
|
|
257
|
+ // 全选
|
|
258
|
+ isAllDisplayDataChecked = false; //当前页是否全选
|
|
259
|
+ checkAll(value: boolean): void {
|
|
260
|
+ this.listOfData.forEach((item) => {
|
|
261
|
+ this.mapOfCheckedId[item.id] = value;
|
|
262
|
+ });
|
|
263
|
+ this.refreshStatus();
|
|
264
|
+ }
|
169
|
265
|
// 表格数据
|
170
|
266
|
loading1 = false;
|
171
|
267
|
getList(num?: number, field?: string, sort?: string) {
|
|
268
|
+ this.mapOfCheckedId = {};
|
|
269
|
+ this.checkedDepIds = [];
|
|
270
|
+ this.isAllDisplayDataChecked = false;
|
172
|
271
|
this.pageIndex = num;
|
173
|
272
|
let postData: any = {
|
174
|
273
|
idx: this.pageIndex - 1,
|
|
@@ -177,6 +276,8 @@ export class QuiltWashingDepartmentStatisticsComponent implements OnInit {
|
177
|
276
|
endTime: this.searchData.dateRange.end,
|
178
|
277
|
hosId: this.searchData.hosId,
|
179
|
278
|
type: this.dateType,
|
|
279
|
+ deptId: this.searchDto.dept || undefined,
|
|
280
|
+ buildingId: this.searchDto.building || undefined,
|
180
|
281
|
};
|
181
|
282
|
if (field && sort) {
|
182
|
283
|
postData.sort = sort === "ascend" ? field : `${field} desc`;
|
|
@@ -194,6 +295,53 @@ export class QuiltWashingDepartmentStatisticsComponent implements OnInit {
|
194
|
295
|
hospital: string; //选中院区
|
195
|
296
|
getAllHos() {
|
196
|
297
|
this.hospital = this.tool.getCurrentHospital().id + "";
|
|
298
|
+ this.getDeptList();
|
|
299
|
+ this.getBuildingList();
|
|
300
|
+ }
|
|
301
|
+
|
|
302
|
+ // 边输边搜节流阀
|
|
303
|
+ changeInp(e, fn) {
|
|
304
|
+ this.searchTimer(this[fn], e);
|
|
305
|
+ }
|
|
306
|
+ // 获取科室
|
|
307
|
+ deptList: any = [];
|
|
308
|
+ getDeptList(keyword = '') {
|
|
309
|
+ let postData = {
|
|
310
|
+ department: {
|
|
311
|
+ searchType: 1,// 简单查询
|
|
312
|
+ cascadeHosId: this.hospital,
|
|
313
|
+ dept: keyword,
|
|
314
|
+ },
|
|
315
|
+ idx: 0,
|
|
316
|
+ sum: 10,
|
|
317
|
+ };
|
|
318
|
+ this.isLoading = true;
|
|
319
|
+ this.mainService
|
|
320
|
+ .getFetchDataList("data", "department", postData)
|
|
321
|
+ .subscribe((result) => {
|
|
322
|
+ this.isLoading = false;
|
|
323
|
+ this.deptList = result.list;
|
|
324
|
+ });
|
|
325
|
+ }
|
|
326
|
+
|
|
327
|
+ // 获取楼栋
|
|
328
|
+ buildingList: any = [];
|
|
329
|
+ getBuildingList(keyword = '') {
|
|
330
|
+ let postData = {
|
|
331
|
+ building: {
|
|
332
|
+ cascadeHosId: this.hospital,
|
|
333
|
+ buildingName: keyword
|
|
334
|
+ },
|
|
335
|
+ idx: 0,
|
|
336
|
+ sum: 10,
|
|
337
|
+ };
|
|
338
|
+ this.isLoading = true;
|
|
339
|
+ this.mainService
|
|
340
|
+ .getFetchDataList("data", "building", postData)
|
|
341
|
+ .subscribe((result) => {
|
|
342
|
+ this.isLoading = false;
|
|
343
|
+ this.buildingList = result.list;
|
|
344
|
+ });
|
197
|
345
|
}
|
198
|
346
|
|
199
|
347
|
// 修改时间展示维度
|
|
@@ -432,17 +580,17 @@ export class QuiltWashingDepartmentStatisticsComponent implements OnInit {
|
432
|
580
|
|
433
|
581
|
// 边输入边搜索节流阀
|
434
|
582
|
isLoading: boolean = false;
|
435
|
|
- searchTimer(fun, e, those) {
|
436
|
|
- let that = this;
|
437
|
|
- that.isLoading = true;
|
438
|
|
- fun(e, those);
|
|
583
|
+ searchTimer(fun, e) {
|
|
584
|
+ this.isLoading = true;
|
|
585
|
+ this.searchTimerSubject.next([fun, e]);
|
439
|
586
|
}
|
440
|
587
|
// 列表排序
|
441
|
588
|
sortCurrent = {
|
442
|
|
- source1: null,
|
443
|
|
- source2: null,
|
444
|
|
- source3: null,
|
445
|
|
- source4: null,
|
|
589
|
+ clothesTypeNum: null,
|
|
590
|
+ getOrder: null,
|
|
591
|
+ sendOrder: null,
|
|
592
|
+ sendClothesNum: null,
|
|
593
|
+ price: null,
|
446
|
594
|
};
|
447
|
595
|
sortCurrentKey: string = "";
|
448
|
596
|
sortCurrentValue: string | null = "";
|