Browse Source

更新代码

xiaoming_global 5 years ago
parent
commit
6aea2b83b8
1 changed files with 111 additions and 111 deletions
  1. 111 111
      src/pages/monitoring/index.vue

+ 111 - 111
src/pages/monitoring/index.vue View File

@@ -175,24 +175,24 @@
175 175
 </template>
176 176
 
177 177
 <script>
178
-import SideBar from "@/pages/layout/SideBar";
179
-import Divider from "vux/src/components/divider/index";
180
-import { getMonitorList, GetAllZone, getPatientMonitors } from "@/api/monitor";
181
-import { parseTime } from "@/utils";
182
-import { Toast } from "vant";
178
+import SideBar from '@/pages/layout/SideBar'
179
+import Divider from 'vux/src/components/divider/index'
180
+import { getMonitorList, GetAllZone, getPatientMonitors } from '@/api/monitor'
181
+import { parseTime } from '@/utils'
182
+import { Toast } from 'vant'
183 183
 
184 184
 export default {
185
-  name: "MonitoringIndex",
186
-  created() {
185
+  name: 'MonitoringIndex',
186
+  created () {
187 187
     this.queryParams.date = this.parseTime(
188 188
       new Date().getTime() / 1000,
189
-      "{y}-{m}-{d}"
190
-    );
191
-    this.queryParams.partition = this.partition;
192
-    this.getMonitor(this.queryParams);
193
-    this.GetAllZone();
189
+      '{y}-{m}-{d}'
190
+    )
191
+    this.queryParams.partition = this.partition
192
+    this.getMonitor(this.queryParams)
193
+    this.GetAllZone()
194 194
   },
195
-  data() {
195
+  data () {
196 196
     return {
197 197
       loading: false,
198 198
       finished: false,
@@ -205,135 +205,135 @@ export default {
205 205
       partition: 0,
206 206
       queryParams: {
207 207
         date: new Date(),
208
-        partition: ""
208
+        partition: ''
209 209
       },
210
-      patient_keyword: "",
210
+      patient_keyword: '',
211 211
       search_page: 1
212
-    };
212
+    }
213 213
   },
214 214
   methods: {
215
-    clickfunction: function(val) {
215
+    clickfunction: function (val) {
216 216
       this.$router.push({
217
-        path: "/details",
217
+        path: '/details',
218 218
         query: {
219 219
           patient_id: val.patient_id,
220 220
           date: val.schedule_date,
221 221
           patient_name: val.patient.name
222 222
         }
223
-      });
223
+      })
224 224
     },
225
-    getMonitor: function(queryParams) {
226
-      this.search_page = 1;
227
-      this.patient_keyword = "";
225
+    getMonitor: function (queryParams) {
226
+      this.search_page = 1
227
+      this.patient_keyword = ''
228 228
 
229
-      this.loading = true;
230
-      this.finished = false;
231
-      this.dialysis_scheduals = [];
229
+      this.loading = true
230
+      this.finished = false
231
+      this.dialysis_scheduals = []
232 232
       getMonitorList(queryParams).then(response => {
233
-        this.loading = false;
234
-        this.finished = true;
233
+        this.loading = false
234
+        this.finished = true
235 235
         if (response.data.state == 0) {
236
-          return false;
236
+          return false
237 237
         } else {
238
-          var scheduals = response.data.data.monitor;
239
-          var zoneMap = {};
240
-          var schedualMap = {};
238
+          var scheduals = response.data.data.monitor
239
+          var zoneMap = {}
240
+          var schedualMap = {}
241 241
 
242 242
           for (let index = 0; index < scheduals.length; index++) {
243
-            const schedual = scheduals[index];
243
+            const schedual = scheduals[index]
244 244
             if (schedualMap[schedual.device_zone.name] == null) {
245
-              schedualMap[schedual.device_zone.name] = [];
245
+              schedualMap[schedual.device_zone.name] = []
246 246
             }
247
-            schedualMap[schedual.device_zone.name].push(schedual);
247
+            schedualMap[schedual.device_zone.name].push(schedual)
248 248
             if (zoneMap[schedual.device_zone.name] == null) {
249
-              zoneMap[schedual.device_zone.name] = schedual.device_zone;
249
+              zoneMap[schedual.device_zone.name] = schedual.device_zone
250 250
             }
251 251
           }
252 252
 
253
-          var zones = [];
254
-          zones.push({ value: 0, text: "全部分区" });
253
+          var zones = []
254
+          zones.push({ value: 0, text: '全部分区' })
255 255
           for (var zoneName in zoneMap) {
256
-            zones.push({ value: zoneMap[zoneName].id, text: zoneName });
256
+            zones.push({ value: zoneMap[zoneName].id, text: zoneName })
257 257
           }
258
-          zones = zones.sort(function(a, b) {
259
-            return a.value > b.value;
260
-          });
261
-          this.zones = zones;
258
+          zones = zones.sort(function (a, b) {
259
+            return a.value > b.value
260
+          })
261
+          this.zones = zones
262 262
 
263
-          var dialysis_scheduals = [];
263
+          var dialysis_scheduals = []
264 264
           for (let index = 0; index < zones.length; index++) {
265
-            const zone = zones[index];
266
-            var scheduals = schedualMap[zone.text];
265
+            const zone = zones[index]
266
+            var scheduals = schedualMap[zone.text]
267 267
             if (scheduals == null) {
268
-              continue;
268
+              continue
269 269
             }
270 270
             dialysis_scheduals.push({
271 271
               zone_name: zone.text,
272 272
               scheduals: scheduals
273
-            });
273
+            })
274 274
           }
275
-          this.dialysis_scheduals = dialysis_scheduals;
276
-          // console.log(this.dialysis_scheduals);
275
+          this.dialysis_scheduals = dialysis_scheduals
276
+          console.log('数据是什么东西', this.dialysis_scheduals)
277 277
         }
278
-      });
278
+      })
279 279
     },
280
-    parseTime(time, layout) {
281
-      return parseTime(time, layout);
280
+    parseTime (time, layout) {
281
+      return parseTime(time, layout)
282 282
     },
283
-    openPicker: function() {
284
-      this.$refs.date_picker.open();
283
+    openPicker: function () {
284
+      this.$refs.date_picker.open()
285 285
     },
286
-    handleDateConfirm: function(val) {
287
-      this.queryParams.date = this.parseTime(this.date / 1000, "{y}-{m}-{d}");
288
-      this.queryParams.partition = this.partition;
286
+    handleDateConfirm: function (val) {
287
+      this.queryParams.date = this.parseTime(this.date / 1000, '{y}-{m}-{d}')
288
+      this.queryParams.partition = this.partition
289 289
 
290
-      this.getMonitor(this.queryParams);
290
+      this.getMonitor(this.queryParams)
291 291
     },
292
-    partitionName: function(val) {
293
-      return typeof this.partitionArr[val] != "undefined" &&
294
-        typeof this.partitionArr[val].name != "undefined"
292
+    partitionName: function (val) {
293
+      return typeof this.partitionArr[val] !== 'undefined' &&
294
+        typeof this.partitionArr[val].name !== 'undefined'
295 295
         ? this.partitionArr[val].name
296
-        : "";
296
+        : ''
297 297
     },
298
-    GetAllZone: function() {
298
+    GetAllZone: function () {
299 299
       GetAllZone().then(response => {
300 300
         if (response.data.state == 0) {
301
-          return false;
301
+          return false
302 302
         } else {
303
-          this.partitionArr = response.data.data.zone;
304
-          this.partitionArr.unshift({ id: 0, name: "全部分区" });
303
+          this.partitionArr = response.data.data.zone
304
+          this.partitionArr.unshift({ id: 0, name: '全部分区' })
305 305
         }
306
-      });
306
+      })
307 307
     },
308
-    itemClick: function(id) {
309
-      this.partition = id;
310
-      this.visible = false;
311
-      this.queryParams.date = this.parseTime(this.date / 1000, "{y}-{m}-{d}");
312
-      this.queryParams.partition = this.partition;
313
-      this.getMonitor(this.queryParams);
308
+    itemClick: function (id) {
309
+      this.partition = id
310
+      this.visible = false
311
+      this.queryParams.date = this.parseTime(this.date / 1000, '{y}-{m}-{d}')
312
+      this.queryParams.partition = this.partition
313
+      this.getMonitor(this.queryParams)
314 314
     },
315
-    monitorBloodPressureStatus: function(val) {
316
-      let status = 0;
315
+    monitorBloodPressureStatus: function (val) {
316
+      let status = 0
317 317
       if (val.length == 0) {
318
-        return 0;
318
+        return 0
319 319
       }
320 320
       for (let i = 0; i < val.length; i++) {
321
-        //舒张压(低压)(diastolic_blood_pressure)    收缩压(高压)(systolic_blood_pressure)
321
+        // 舒张压(低压)(diastolic_blood_pressure)    收缩压(高压)(systolic_blood_pressure)
322 322
         if (
323 323
           val[i].systolic_blood_pressure >= 140 ||
324 324
           val[i].diastolic_blood_pressure >= 90
325 325
         ) {
326
-          status = 3; //高压
326
+          status = 3 // 高压
327 327
         } else if (
328 328
           val[i].diastolic_blood_pressure < 60 ||
329 329
           val[i].systolic_blood_pressure < 90
330 330
         ) {
331
-          status = 1; //低压
331
+          status = 1 // 低压
332 332
         } else if (
333 333
           val[i].diastolic_blood_pressure >= 60 ||
334 334
           val[i].systolic_blood_pressure < 140
335 335
         ) {
336
-          status = 2; //正常
336
+          status = 2 // 正常
337 337
         }
338 338
 
339 339
         // if ( val[i].diastolic_blood_pressure < 60 | val[i].systolic_blood_pressure < 90 ) {
@@ -351,74 +351,74 @@ export default {
351 351
         // }
352 352
       }
353 353
 
354
-      return status;
354
+      return status
355 355
     },
356
-    monitorRateStatus: function(val) {
357
-      let status = 0;
356
+    monitorRateStatus: function (val) {
357
+      let status = 0
358 358
       if (val.length == 0) {
359
-        return 0;
359
+        return 0
360 360
       }
361 361
       for (let i = 0; i < val.length; i++) {
362
-        //舒张压(低压)(diastolic_blood_pressure)    收缩压(高压)(systolic_blood_pressure)
362
+        // 舒张压(低压)(diastolic_blood_pressure)    收缩压(高压)(systolic_blood_pressure)
363 363
         if (val[i].pulse_frequency < 60) {
364
-          status = 1; //心率过缓
364
+          status = 1 // 心率过缓
365 365
         } else if (
366 366
           val[i].pulse_frequency >= 60 &&
367 367
           val[i].pulse_frequency < 100
368 368
         ) {
369
-          status = 2; //心率正常
369
+          status = 2 // 心率正常
370 370
         } else if (val[i].pulse_frequency >= 100) {
371
-          status = 3; //心率过快
371
+          status = 3 // 心率过快
372 372
         }
373 373
       }
374
-      return status;
374
+      return status
375 375
     },
376
-    searchWithKeyword: function(page) {
377
-      this.$refs.search_field.blur();
376
+    searchWithKeyword: function (page) {
377
+      this.$refs.search_field.blur()
378 378
       if (this.patient_keyword.length == 0) {
379
-        this.queryParams.date = this.parseTime(this.date / 1000, "{y}-{m}-{d}");
380
-        this.queryParams.partition = this.partition;
381
-        this.getMonitor(this.queryParams);
382
-        return;
379
+        this.queryParams.date = this.parseTime(this.date / 1000, '{y}-{m}-{d}')
380
+        this.queryParams.partition = this.partition
381
+        this.getMonitor(this.queryParams)
382
+        return
383 383
       }
384 384
 
385
-      this.partition = 0;
385
+      this.partition = 0
386 386
 
387
-      this.search_page = page;
387
+      this.search_page = page
388 388
       if (page == 1) {
389
-        this.dialysis_scheduals = [];
389
+        this.dialysis_scheduals = []
390 390
       }
391
-      this.loading = true;
392
-      this.finished = false;
391
+      this.loading = true
392
+      this.finished = false
393 393
       getPatientMonitors({
394 394
         keyword: this.patient_keyword,
395 395
         page: this.search_page
396 396
       }).then(rs => {
397
-        this.loading = false;
398
-        this.finished = true;
399
-        var resp = rs.data;
397
+        this.loading = false
398
+        this.finished = true
399
+        var resp = rs.data
400 400
         if (resp.state == 1) {
401 401
           if (resp.data.monitor.length > 0) {
402 402
             this.dialysis_scheduals.push({
403
-              zone_name: "",
403
+              zone_name: '',
404 404
               scheduals: resp.data.monitor
405
-            });
406
-            this.finished = false;
405
+            })
406
+            this.finished = false
407 407
           } else {
408
-            this.finished = true;
408
+            this.finished = true
409 409
           }
410 410
         }
411
-      });
411
+      })
412 412
     },
413
-    onLoad: function() {
414
-      this.searchWithKeyword(this.search_page + 1);
413
+    onLoad: function () {
414
+      this.searchWithKeyword(this.search_page + 1)
415 415
     }
416 416
   },
417 417
   components: {
418 418
     Divider,
419 419
     SideBar
420 420
   }
421
-};
421
+}
422 422
 </script>
423 423
 
424 424
 <style style="stylesheet/scss" lang="scss" scoped>