|
@@ -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-trend-analysis",
|
|
@@ -21,10 +23,15 @@ export class QuiltWashingTrendAnalysisComponent implements OnInit {
|
21
|
23
|
private myService: MyServiceService,
|
22
|
24
|
private tool: ToolService
|
23
|
25
|
) {}
|
24
|
|
-
|
|
26
|
+ searchTimerSubject = new Subject();
|
25
|
27
|
ngOnInit() {
|
|
28
|
+ this.searchTimerSubject.pipe(debounceTime(500)).subscribe((v) => {
|
|
29
|
+ let fun = v[0];
|
|
30
|
+ fun.call(this, v[1]);
|
|
31
|
+ });
|
26
|
32
|
this.coopBtns = this.tool.initCoopBtns(this.route);
|
27
|
33
|
this.getAllHos();
|
|
34
|
+ this.getAllClothesType();
|
28
|
35
|
this.changeDateType();
|
29
|
36
|
}
|
30
|
37
|
|
|
@@ -34,6 +41,7 @@ export class QuiltWashingTrendAnalysisComponent implements OnInit {
|
34
|
41
|
year: +format(new Date(), "yyyy"),//季度-年
|
35
|
42
|
quarter: getQuarter(new Date()),//季度
|
36
|
43
|
tabType: 'YoY',//YoY/同比,MoM/环比
|
|
44
|
+ clothesTypeId: undefined, //选择被服
|
37
|
45
|
}
|
38
|
46
|
|
39
|
47
|
tabTypes = [
|
|
@@ -291,6 +299,38 @@ export class QuiltWashingTrendAnalysisComponent implements OnInit {
|
291
|
299
|
search() {
|
292
|
300
|
this.getData();
|
293
|
301
|
}
|
|
302
|
+ // 用户输入搜索被服
|
|
303
|
+ isLoading = false;
|
|
304
|
+ changeClothesTypeId(e) {
|
|
305
|
+ this.searchTimer(this.getAllClothesType, e);
|
|
306
|
+ }
|
|
307
|
+ // 边输入边搜索节流阀
|
|
308
|
+ searchTimer(fun, e) {
|
|
309
|
+ this.isLoading = true;
|
|
310
|
+ this.searchTimerSubject.next([fun, e]);
|
|
311
|
+ }
|
|
312
|
+ // 获取被服
|
|
313
|
+ getAllClothesType(e?, those?) {
|
|
314
|
+ let that = those || this;
|
|
315
|
+ let postData: any = {
|
|
316
|
+ idx: 0,
|
|
317
|
+ sum: 10,
|
|
318
|
+ dictionaryTree: {
|
|
319
|
+ name: e || "",
|
|
320
|
+ hosId: that.hospital,
|
|
321
|
+ level: 2,
|
|
322
|
+ key: 'clothes_type',
|
|
323
|
+ deleted: 0,
|
|
324
|
+ },
|
|
325
|
+ };
|
|
326
|
+ that.isLoading = true;
|
|
327
|
+ that.mainService
|
|
328
|
+ .getFetchDataList("simple/data", "dictionaryTree", postData)
|
|
329
|
+ .subscribe((data) => {
|
|
330
|
+ that.allClothesType = data.list;
|
|
331
|
+ that.isLoading = false;
|
|
332
|
+ });
|
|
333
|
+ }
|
294
|
334
|
// 重置
|
295
|
335
|
reset() {
|
296
|
336
|
this.searchDto = {
|
|
@@ -299,6 +339,7 @@ export class QuiltWashingTrendAnalysisComponent implements OnInit {
|
299
|
339
|
year: +format(new Date(), "yyyy"),//季度-年
|
300
|
340
|
quarter: getQuarter(new Date()),//季度
|
301
|
341
|
tabType: 'YoY',//YoY/同比,MoM/环比
|
|
342
|
+ clothesTypeId: undefined, //选择被服
|
302
|
343
|
}
|
303
|
344
|
this.search();
|
304
|
345
|
}
|
|
@@ -317,6 +358,7 @@ export class QuiltWashingTrendAnalysisComponent implements OnInit {
|
317
|
358
|
tabType: this.searchDto.tabType,
|
318
|
359
|
hosId: this.hospital,
|
319
|
360
|
type: this.searchDto.dateType,
|
|
361
|
+ clothesTypeId: this.searchDto.clothesTypeId || undefined,
|
320
|
362
|
};
|
321
|
363
|
switch (postData.type) {
|
322
|
364
|
case "day":
|