|
@@ -27,7 +27,7 @@
|
27
|
27
|
<li
|
28
|
28
|
v-for="(option, index) in zone_options"
|
29
|
29
|
:key="index"
|
30
|
|
- @click="handleZoneChange(index)"
|
|
30
|
+ @click="handleZoneChange(index,option)"
|
31
|
31
|
:class="zone_selected == index ? 'tick' : ''"
|
32
|
32
|
>
|
33
|
33
|
{{ option.text }}
|
|
@@ -135,6 +135,7 @@ export default {
|
135
|
135
|
select_index: 0,
|
136
|
136
|
zone_selected: 0,
|
137
|
137
|
time_selected: 0,
|
|
138
|
+ cur_zone_selected: 0,
|
138
|
139
|
networkStates: true,
|
139
|
140
|
scheduals: [],
|
140
|
141
|
|
|
@@ -159,6 +160,7 @@ export default {
|
159
|
160
|
},
|
160
|
161
|
computed: {
|
161
|
162
|
filtedScheduals: function() {
|
|
163
|
+
|
162
|
164
|
var search_keyword = this.search_keyword;
|
163
|
165
|
if (this.search_keyword.length > 0) {
|
164
|
166
|
var scheduals = [];
|
|
@@ -219,40 +221,85 @@ export default {
|
219
|
221
|
// }
|
220
|
222
|
// return schedules
|
221
|
223
|
// }
|
222
|
|
-
|
|
224
|
+
|
223
|
225
|
var zone_selected = this.zone_selected;
|
224
|
226
|
var timetype_selected = this.time_selected;
|
|
227
|
+ var assessment_before_dislysis_count = 0;
|
|
228
|
+ var prescription_count = 0;
|
225
|
229
|
if (zone_selected != 0 || timetype_selected != 0) {
|
226
|
|
- var zone_name =
|
227
|
|
- zone_selected == 0 ? "" : this.zone_options[zone_selected].text;
|
228
|
|
- var schedules = [];
|
229
|
|
- for (let o_i = 0; o_i < this.zone_scheduals.length; o_i++) {
|
230
|
|
- const scheduleInfo = this.zone_scheduals[o_i];
|
231
|
|
- var originSchedules = scheduleInfo.scheduals;
|
232
|
|
- var filtedSchedules = [];
|
233
|
|
- for (let s_i = 0; s_i < originSchedules.length; s_i++) {
|
234
|
|
- const schedule = originSchedules[s_i];
|
235
|
|
- if (
|
236
|
|
- zone_name.length == 0 ||
|
237
|
|
- (zone_name.length > 0 &&
|
238
|
|
- zone_name == schedule.device_number.zone.name)
|
239
|
|
- ) {
|
240
|
|
- if (
|
241
|
|
- timetype_selected == 0 ||
|
242
|
|
- schedule.schedule_type == timetype_selected
|
243
|
|
- ) {
|
244
|
|
- filtedSchedules.push(schedule);
|
|
230
|
+ // var zone_name = zone_selected == 0 ? "" : this.zone_options[zone_selected].text;
|
|
231
|
+ // var schedules = [];
|
|
232
|
+ // for (let o_i = 0; o_i < this.zone_scheduals.length; o_i++) {
|
|
233
|
+ // const scheduleInfo = this.zone_scheduals[o_i];
|
|
234
|
+ // var originSchedules = scheduleInfo.scheduals;
|
|
235
|
+ // var filtedSchedules = [];
|
|
236
|
+ // for (let s_i = 0; s_i < originSchedules.length; s_i++) {
|
|
237
|
+ // const schedule = originSchedules[s_i];
|
|
238
|
+ // if ( zone_name.length == 0 || (zone_name.length > 0 && zone_name == schedule.device_number.zone.name)) {
|
|
239
|
+ // if ( timetype_selected == 0 || schedule.schedule_type == timetype_selected ) {
|
|
240
|
+ // filtedSchedules.push(schedule);
|
|
241
|
+ // }
|
|
242
|
+ // }
|
|
243
|
+ // }
|
|
244
|
+ // if (filtedSchedules.length > 0) {
|
|
245
|
+ // schedules.push({
|
|
246
|
+ // zone_name: scheduleInfo.zone_name,
|
|
247
|
+ // scheduals: filtedSchedules
|
|
248
|
+ // });
|
|
249
|
+ // }
|
|
250
|
+ // }
|
|
251
|
+
|
|
252
|
+ // return schedules;
|
|
253
|
+ if (this.select_index == 2) {
|
|
254
|
+ var scheduals = [];
|
|
255
|
+ for (let index = 0; index < this.scheduals.length; index++) {
|
|
256
|
+ const schedual = this.scheduals[index];
|
|
257
|
+ if (schedual.assessment_before_dislysis == null) {
|
|
258
|
+ if(this.cur_zone_selected > 0 && schedual.device_number.zone.id != this.cur_zone_selected) {
|
|
259
|
+ continue
|
245
|
260
|
}
|
|
261
|
+ if(timetype_selected > 0 && schedual.schedule_type != timetype_selected) {
|
|
262
|
+ continue
|
|
263
|
+ }
|
|
264
|
+ scheduals.push(schedual);
|
246
|
265
|
}
|
247
|
266
|
}
|
248
|
|
- if (filtedSchedules.length > 0) {
|
249
|
|
- schedules.push({
|
250
|
|
- zone_name: scheduleInfo.zone_name,
|
251
|
|
- scheduals: filtedSchedules
|
252
|
|
- });
|
|
267
|
+ return this.processScheduals(scheduals);
|
|
268
|
+ // return scheduals;
|
|
269
|
+ } else if (this.select_index == 1) {
|
|
270
|
+ var scheduals = [];
|
|
271
|
+ for (let index = 0; index < this.scheduals.length; index++) {
|
|
272
|
+ const schedual = this.scheduals[index];
|
|
273
|
+ if (schedual.assessment_before_dislysis == null && schedual.prescription == null) {
|
|
274
|
+ if(this.cur_zone_selected > 0 && schedual.device_number.zone.id != this.cur_zone_selected) {
|
|
275
|
+ continue
|
|
276
|
+ }
|
|
277
|
+ if(timetype_selected > 0 && schedual.schedule_type != timetype_selected) {
|
|
278
|
+ continue
|
|
279
|
+ }
|
|
280
|
+ scheduals.push(schedual);
|
|
281
|
+ }
|
253
|
282
|
}
|
|
283
|
+ // return scheduals;
|
|
284
|
+ return this.processScheduals(scheduals);
|
|
285
|
+ } else {
|
|
286
|
+ // return this.zone_scheduals;
|
|
287
|
+ var scheduals = [];
|
|
288
|
+ for (let index = 0; index < this.scheduals.length; index++) {
|
|
289
|
+ const schedual = this.scheduals[index];
|
|
290
|
+ if (schedual.dialysis_order == null) {
|
|
291
|
+ if(this.cur_zone_selected > 0 && schedual.device_number.zone.id != this.cur_zone_selected) {
|
|
292
|
+ continue
|
|
293
|
+ }
|
|
294
|
+ if(timetype_selected > 0 && schedual.schedule_type != timetype_selected) {
|
|
295
|
+ continue
|
|
296
|
+ }
|
|
297
|
+ scheduals.push(schedual);
|
|
298
|
+ }
|
|
299
|
+ }
|
|
300
|
+ // return scheduals;
|
|
301
|
+ return this.processScheduals(scheduals);
|
254
|
302
|
}
|
255
|
|
- return schedules;
|
256
|
303
|
}
|
257
|
304
|
|
258
|
305
|
if (this.select_index == 2) {
|
|
@@ -269,17 +316,23 @@ export default {
|
269
|
316
|
var scheduals = [];
|
270
|
317
|
for (let index = 0; index < this.scheduals.length; index++) {
|
271
|
318
|
const schedual = this.scheduals[index];
|
272
|
|
- if (
|
273
|
|
- schedual.assessment_before_dislysis == null &&
|
274
|
|
- schedual.prescription == null
|
275
|
|
- ) {
|
|
319
|
+ if (schedual.assessment_before_dislysis == null && schedual.prescription == null) {
|
276
|
320
|
scheduals.push(schedual);
|
277
|
321
|
}
|
278
|
322
|
}
|
279
|
323
|
// return scheduals;
|
280
|
324
|
return this.processScheduals(scheduals);
|
281
|
325
|
} else {
|
282
|
|
- return this.zone_scheduals;
|
|
326
|
+ // return this.zone_scheduals;
|
|
327
|
+ var scheduals = [];
|
|
328
|
+ for (let index = 0; index < this.scheduals.length; index++) {
|
|
329
|
+ const schedual = this.scheduals[index];
|
|
330
|
+ if (schedual.dialysis_order == null) {
|
|
331
|
+ scheduals.push(schedual);
|
|
332
|
+ }
|
|
333
|
+ }
|
|
334
|
+ // return scheduals;
|
|
335
|
+ return this.processScheduals(scheduals);
|
283
|
336
|
}
|
284
|
337
|
}
|
285
|
338
|
},
|
|
@@ -305,9 +358,9 @@ export default {
|
305
|
358
|
this.requestScheduals();
|
306
|
359
|
},
|
307
|
360
|
mounted() {
|
308
|
|
- this.timer = window.setInterval(() => {
|
309
|
|
- setTimeout(this.requestScheduals(), 0);
|
310
|
|
- }, 30000);
|
|
361
|
+ // this.timer = window.setInterval(() => {
|
|
362
|
+ // setTimeout(this.requestScheduals(), 0);
|
|
363
|
+ // }, 30000);
|
311
|
364
|
},
|
312
|
365
|
beforeDestroy() {
|
313
|
366
|
clearInterval(this.timer);
|
|
@@ -317,6 +370,69 @@ export default {
|
317
|
370
|
// })
|
318
|
371
|
},
|
319
|
372
|
methods: {
|
|
373
|
+ processScheduals: function(scheduals) {
|
|
374
|
+ var zoneMap = {};
|
|
375
|
+ var schedualMap = {};
|
|
376
|
+ var assessment_before_dislysis_count = 0;
|
|
377
|
+ var prescription_count = 0;
|
|
378
|
+ for (let index = 0; index < scheduals.length; index++) {
|
|
379
|
+ const schedual = scheduals[index];
|
|
380
|
+ if (schedualMap[schedual.device_number.zone.id] == null) {
|
|
381
|
+ schedualMap[schedual.device_number.zone.id] = [];
|
|
382
|
+ }
|
|
383
|
+ if (this.select_index == 1) {
|
|
384
|
+ if(schedual.assessment_before_dislysis == null && schedual.prescription == null){
|
|
385
|
+ schedualMap[schedual.device_number.zone.id].push(schedual);
|
|
386
|
+ prescription_count++
|
|
387
|
+ }
|
|
388
|
+ } else if (this.select_index == 2){
|
|
389
|
+ if(schedual.assessment_before_dislysis == null ){
|
|
390
|
+ schedualMap[schedual.device_number.zone.id].push(schedual);
|
|
391
|
+ assessment_before_dislysis_count++
|
|
392
|
+ }
|
|
393
|
+ } else {
|
|
394
|
+ if(schedual.dialysis_order == null){
|
|
395
|
+ schedualMap[schedual.device_number.zone.id].push(schedual);
|
|
396
|
+ }
|
|
397
|
+ }
|
|
398
|
+ if (zoneMap[schedual.device_number.zone.id] == null) {
|
|
399
|
+ zoneMap[schedual.device_number.zone.id] = schedual.device_number.zone;
|
|
400
|
+ }
|
|
401
|
+ }
|
|
402
|
+
|
|
403
|
+ if (this.select_index == 1) {
|
|
404
|
+ this.menuList[1].count = prescription_count;
|
|
405
|
+ }
|
|
406
|
+ if (this.select_index == 2) {
|
|
407
|
+ this.menuList[2].count = assessment_before_dislysis_count;
|
|
408
|
+ }
|
|
409
|
+
|
|
410
|
+
|
|
411
|
+ var zones = [];
|
|
412
|
+ // zones.push({ value: 0, text: "全部分区" })
|
|
413
|
+ for (var zoneId in zoneMap) {
|
|
414
|
+ zones.push({ id: zoneMap[zoneId].id, name: zoneMap[zoneId].name });
|
|
415
|
+ }
|
|
416
|
+
|
|
417
|
+ zones = zones.sort(function(a, b) {
|
|
418
|
+ return a.id > b.id;
|
|
419
|
+ });
|
|
420
|
+ // this.zones = zones
|
|
421
|
+
|
|
422
|
+ var zone_scheduals = [];
|
|
423
|
+ for (let index = 0; index < zones.length; index++) {
|
|
424
|
+ const zone = zones[index];
|
|
425
|
+ var scheduals = schedualMap[zone.id];
|
|
426
|
+ zone_scheduals.push({
|
|
427
|
+ zone_id: zone.id,
|
|
428
|
+ zone_name: zone.name,
|
|
429
|
+
|
|
430
|
+ scheduals: scheduals
|
|
431
|
+ });
|
|
432
|
+ }
|
|
433
|
+ // this.zone_scheduals = zone_scheduals;
|
|
434
|
+ return zone_scheduals;
|
|
435
|
+ },
|
320
|
436
|
reloads: function() {
|
321
|
437
|
this.reload();
|
322
|
438
|
},
|
|
@@ -333,15 +449,16 @@ export default {
|
333
|
449
|
setSelectedTimesDataConfigList(this.time_selected);
|
334
|
450
|
setWaitTypeSelectedConfig(tabIndex);
|
335
|
451
|
},
|
336
|
|
- handleZoneChange: function(index) {
|
|
452
|
+ handleZoneChange: function(index,zone) {
|
337
|
453
|
this.zone_options_visible = false;
|
338
|
454
|
this.zone_selected = index;
|
339
|
|
- this.select_index = -1;
|
|
455
|
+ this.cur_zone_selected = zone.value
|
|
456
|
+ // this.select_index = -1;
|
340
|
457
|
setSelectedAreaDataConfigList(index.toString());
|
341
|
458
|
},
|
342
|
459
|
handleTimeChange: function(index) {
|
343
|
460
|
this.time_selected = index;
|
344
|
|
- this.select_index = -1;
|
|
461
|
+ // this.select_index = -1;
|
345
|
462
|
this.time_options_visible = false;
|
346
|
463
|
setSelectedTimesDataConfigList(index.toString());
|
347
|
464
|
},
|
|
@@ -419,45 +536,6 @@ export default {
|
419
|
536
|
// return a.value > b.value
|
420
|
537
|
// })
|
421
|
538
|
return zones;
|
422
|
|
- },
|
423
|
|
- processScheduals: function(scheduals) {
|
424
|
|
- var zoneMap = {};
|
425
|
|
- var schedualMap = {};
|
426
|
|
- for (let index = 0; index < scheduals.length; index++) {
|
427
|
|
- const schedual = scheduals[index];
|
428
|
|
- if (schedualMap[schedual.device_number.zone.id] == null) {
|
429
|
|
- schedualMap[schedual.device_number.zone.id] = [];
|
430
|
|
- }
|
431
|
|
- schedualMap[schedual.device_number.zone.id].push(schedual);
|
432
|
|
- if (zoneMap[schedual.device_number.zone.id] == null) {
|
433
|
|
- zoneMap[schedual.device_number.zone.id] = schedual.device_number.zone;
|
434
|
|
- }
|
435
|
|
- }
|
436
|
|
-
|
437
|
|
- var zones = [];
|
438
|
|
- // zones.push({ value: 0, text: "全部分区" })
|
439
|
|
- for (var zoneId in zoneMap) {
|
440
|
|
- zones.push({ id: zoneMap[zoneId].id, name: zoneMap[zoneId].name });
|
441
|
|
- }
|
442
|
|
-
|
443
|
|
- zones = zones.sort(function(a, b) {
|
444
|
|
- return a.id > b.id;
|
445
|
|
- });
|
446
|
|
- // this.zones = zones
|
447
|
|
-
|
448
|
|
- var zone_scheduals = [];
|
449
|
|
- for (let index = 0; index < zones.length; index++) {
|
450
|
|
- const zone = zones[index];
|
451
|
|
- var scheduals = schedualMap[zone.id];
|
452
|
|
- zone_scheduals.push({
|
453
|
|
- zone_id: zone.id,
|
454
|
|
- zone_name: zone.name,
|
455
|
|
-
|
456
|
|
- scheduals: scheduals
|
457
|
|
- });
|
458
|
|
- }
|
459
|
|
- // this.zone_scheduals = zone_scheduals;
|
460
|
|
- return zone_scheduals;
|
461
|
539
|
}
|
462
|
540
|
}
|
463
|
541
|
};
|