Bläddra i källkod

前端性能优化

张保健 4 år sedan
förälder
incheckning
1c357ce289

+ 42 - 42
src/pages/main/DialysisArea.vue Visa fil

@@ -294,56 +294,56 @@ export default {
294 294
 
295 295
     var storedata = this.$store.getters.scheduals
296 296
     var scheduals = storedata.scheduals
297
-    // if (Object.keys(storedata).length > 0) {
298
-    //   var zoneMap = {}
299
-    //   var schedualMap = {}
300
-    //   for (let index = 0; index < scheduals.length; index++) {
301
-    //     const schedual = scheduals[index]
302
-    //     if (schedual.dialysis_order == null) {
303
-    //       continue
304
-    //     }
305
-    //     if (schedualMap[schedual.device_number.zone.name] == null) {
306
-    //       schedualMap[schedual.device_number.zone.name] = []
307
-    //     }
308
-    //     schedualMap[schedual.device_number.zone.name].push(schedual)
309
-    //     if (zoneMap[schedual.device_number.zone.name] == null) {
310
-    //       zoneMap[schedual.device_number.zone.name] =
311
-    //         schedual.device_number.zone
312
-    //     }
313
-    //   }
297
+    if (Object.keys(storedata).length > 0) {
298
+      var zoneMap = {}
299
+      var schedualMap = {}
300
+      for (let index = 0; index < scheduals.length; index++) {
301
+        const schedual = scheduals[index]
302
+        if (schedual.dialysis_order == null) {
303
+          continue
304
+        }
305
+        if (schedualMap[schedual.device_number.zone.name] == null) {
306
+          schedualMap[schedual.device_number.zone.name] = []
307
+        }
308
+        schedualMap[schedual.device_number.zone.name].push(schedual)
309
+        if (zoneMap[schedual.device_number.zone.name] == null) {
310
+          zoneMap[schedual.device_number.zone.name] =
311
+            schedual.device_number.zone
312
+        }
313
+      }
314 314
 
315
-    //   var zones = []
316
-    //   zones.push({ value: 0, text: '全部分区' })
317
-    //   for (var zoneName in zoneMap) {
318
-    //     zones.push({ value: zoneMap[zoneName].id, text: zoneName })
319
-    //   }
315
+      var zones = []
316
+      zones.push({ value: 0, text: '全部分区' })
317
+      for (var zoneName in zoneMap) {
318
+        zones.push({ value: zoneMap[zoneName].id, text: zoneName })
319
+      }
320 320
 
321
-    //   zones = zones.sort(function (a, b) {
322
-    //     return a.value > b.value
323
-    //   })
324
-    //   this.zones = zones
321
+      zones = zones.sort(function (a, b) {
322
+        return a.value > b.value
323
+      })
324
+      this.zones = zones
325 325
 
326
-    //   var dialysis_scheduals = []
327
-    //   for (let index = 0; index < zones.length; index++) {
328
-    //     const zone = zones[index]
329
-    //     var scheduals = schedualMap[zone.text]
330
-    //     if (scheduals == null) {
331
-    //       continue
332
-    //     }
333
-    //     dialysis_scheduals.push({
334
-    //       zone_name: zone.text,
335
-    //       scheduals: scheduals
336
-    //     })
337
-    //   }
338
-    //   this.dialysis_scheduals = dialysis_scheduals
339
-    // } else {
326
+      var dialysis_scheduals = []
327
+      for (let index = 0; index < zones.length; index++) {
328
+        const zone = zones[index]
329
+        var scheduals = schedualMap[zone.text]
330
+        if (scheduals == null) {
331
+          continue
332
+        }
333
+        dialysis_scheduals.push({
334
+          zone_name: zone.text,
335
+          scheduals: scheduals
336
+        })
337
+      }
338
+      this.dialysis_scheduals = dialysis_scheduals
339
+    } else {
340 340
       this.requestDialysisScheduals()
341
-    // }
341
+    }
342 342
   },
343 343
   mounted () {
344 344
     this.timer = window.setInterval(() => {
345 345
       setTimeout(this.requestDialysisScheduals(), 0)
346
-    }, 120000)
346
+    }, 60000)
347 347
   },
348 348
   beforeDestroy () {
349 349
     clearInterval(this.timer)

+ 2 - 0
src/pages/main/WaitingArea.vue Visa fil

@@ -581,9 +581,11 @@ export default {
581 581
       // getWaitingScheduals({ date: date }).then(rs => {
582 582
       // var resp = rs.data
583 583
       // if (resp.state == 1) {
584
+      
584 585
       this.loading = false
585 586
       var storedata = this.$store.getters.waitscheduals
586 587
       var scheduals = storedata.waitscheduals
588
+  
587 589
 
588 590
       // var scheduals = resp.data.scheduals
589 591
       // this.$store.dispatch('SetWaitScheduals', {

+ 5 - 2
src/pages/main/dialog/ThorougDialog.vue Visa fil

@@ -1416,7 +1416,7 @@ export default {
1416 1416
         }
1417 1417
       }).catch(err => {
1418 1418
         Toast.fail(err)
1419
-      });
1419
+      })
1420 1420
     },
1421 1421
     close: function () {
1422 1422
       this.$emit('close')
@@ -1601,9 +1601,12 @@ export default {
1601 1601
       for (const key in this.formValue) {
1602 1602
         // console.log(key, this.record[key]);
1603 1603
         this.formValue[key] = this.record[key]
1604
-        console.log(key + '----' + this.formValue[key])
1605 1604
       }
1606 1605
     }
1606
+    
1607
+    if ((this.record.id == undefined || this.record.id == '') && this.predialysis.id != undefined) {
1608
+      this.$set(this.formValue, 'additional_weight', this.predialysis['additional_weight'].toString())
1609
+    }
1607 1610
     // else  {
1608 1611
     // if (this.record != null && this.record.id != '' && this.record.assessment_doctor == 0){
1609 1612
     //   this.$set(this.formValue, "actual_ultrafiltration", this.record.actual_ultrafiltration)