|
@@ -21,8 +21,8 @@ export class DisinfectionSupplyComponent implements OnInit, OnDestroy {
|
21
|
21
|
) { }
|
22
|
22
|
|
23
|
23
|
tasktype = null; //任务类型
|
24
|
|
- refreshTime: number = 60; //刷新时间
|
25
|
|
- screenCuttingTime: number = 10; //切屏时间
|
|
24
|
+ refreshTime: number = 6000; //刷新时间
|
|
25
|
+ screenCuttingTime: number = 1000; //切屏时间
|
26
|
26
|
|
27
|
27
|
taskTypeName:string = '';
|
28
|
28
|
buildings: any[] = [];
|
|
@@ -33,14 +33,25 @@ export class DisinfectionSupplyComponent implements OnInit, OnDestroy {
|
33
|
33
|
isMask: boolean = true;
|
34
|
34
|
mySwiper:Swiper;
|
35
|
35
|
timer = null;
|
|
36
|
+ resizeTimer = null;
|
36
|
37
|
activeIndex: number = 0;
|
37
|
38
|
|
38
|
39
|
ngOnDestroy(){
|
39
|
40
|
clearTimeout(this.timer);
|
|
41
|
+ clearTimeout(this.resizeTimer);
|
40
|
42
|
this.mySwiper.destroy();
|
|
43
|
+ window.onresize = null;
|
41
|
44
|
}
|
42
|
45
|
|
43
|
46
|
ngOnInit() {
|
|
47
|
+ let _this = this;
|
|
48
|
+ window.onresize = function(){
|
|
49
|
+ clearTimeout(_this.resizeTimer);
|
|
50
|
+ _this.resizeTimer = setTimeout(() => {
|
|
51
|
+ !_this.isMask && _this.getList();
|
|
52
|
+ }, 200);
|
|
53
|
+ }
|
|
54
|
+
|
44
|
55
|
this.hosId = this.tool.getCurrentHospital().id;
|
45
|
56
|
|
46
|
57
|
this.onSearchOtherTaskTypeSubject.pipe(debounceTime(500)).subscribe((v) => {
|
|
@@ -127,17 +138,20 @@ export class DisinfectionSupplyComponent implements OnInit, OnDestroy {
|
127
|
138
|
}));
|
128
|
139
|
console.log(buildings);
|
129
|
140
|
let oItemH = 80;
|
|
141
|
+ let oItemW = 464;
|
130
|
142
|
let oBodyH = window.innerHeight - 289;
|
|
143
|
+ let oBodyW = window.innerWidth - 46;
|
131
|
144
|
let n = Math.floor(oBodyH / oItemH); //有效个数
|
|
145
|
+ let n_width = Math.floor(oBodyW / oItemW); //有效个数
|
132
|
146
|
if(buildings.length){
|
133
|
147
|
let arr = [];
|
134
|
148
|
buildings.forEach(v => {
|
135
|
149
|
let item = chunk(v.departments, n).map(vv => ({id: v.id, name: v.name, departments: vv}));
|
136
|
150
|
arr.push(item);
|
137
|
151
|
})
|
138
|
|
- arr = chunk((arr as any).flat(), 4);
|
|
152
|
+ arr = chunk((arr as any).flat(), n_width);
|
139
|
153
|
let m = arr[arr.length - 1].length;
|
140
|
|
- for (let index = 0; index < 4 - m; index++) {
|
|
154
|
+ for (let index = 0; index < n_width - m; index++) {
|
141
|
155
|
arr[arr.length - 1].push({});
|
142
|
156
|
}
|
143
|
157
|
this.buildings = arr;
|