Browse Source

表格修改

xiaoming_global 5 years ago
parent
commit
6fc19d2c6f
1 changed files with 116 additions and 122 deletions
  1. 116 122
      src/pages/advice/DialysisAdviceTable.vue

+ 116 - 122
src/pages/advice/DialysisAdviceTable.vue View File

163
       </div>
163
       </div>
164
       <el-table :data="date" border style="width: 100%">
164
       <el-table :data="date" border style="width: 100%">
165
         <el-table-column fixed prop="date" label="姓名" width="100" align="center">
165
         <el-table-column fixed prop="date" label="姓名" width="100" align="center">
166
-<<<<<<< .mine
167
             <template slot-scope="scope">
166
             <template slot-scope="scope">
168
                {{ scope.row.advice_name }}
167
                {{ scope.row.advice_name }}
169
             </template>
168
             </template>
170
-=======
171
-          <template slot-scope="scope"></template>
172
-
173
-
174
->>>>>>> .theirs
175
         </el-table-column>
169
         </el-table-column>
176
         <el-table-column prop="name" label="透析号" width="100" align="center"></el-table-column>
170
         <el-table-column prop="name" label="透析号" width="100" align="center"></el-table-column>
177
         <el-table-column prop="province" label="期效" width="100" align="center"></el-table-column>
171
         <el-table-column prop="province" label="期效" width="100" align="center"></el-table-column>
199
 </template>
193
 </template>
200
 
194
 
201
 <script>
195
 <script>
202
-import SideBar from "@/pages/layout/SideBar";
203
-import { parseTime } from "@/utils";
204
-import { getSchedualDoctors } from "@/api/advice";
196
+import SideBar from '@/pages/layout/SideBar';
197
+import { parseTime } from '@/utils';
198
+import { getSchedualDoctors } from '@/api/advice';
205
 
199
 
206
 export default {
200
 export default {
207
-  name: "DialysisAdviceTable",
201
+  name: 'DialysisAdviceTable',
208
   components: {
202
   components: {
209
     SideBar
203
     SideBar
210
   },
204
   },
211
-  data() {
205
+  data () {
212
     return {
206
     return {
213
       selected_date: new Date(),
207
       selected_date: new Date(),
214
       admin_user: [],
208
       admin_user: [],
216
       show_sch_type_selector: false,
210
       show_sch_type_selector: false,
217
       schedule_type_selected: 0,
211
       schedule_type_selected: 0,
218
       schedule_types: [
212
       schedule_types: [
219
-        { value: 0, text: "全部班次" },
220
-        { value: 1, text: "上午" },
221
-        { value: 2, text: "下午" },
222
-        { value: 3, text: "晚上" }
213
+        { value: 0, text: '全部班次' },
214
+        { value: 1, text: '上午' },
215
+        { value: 2, text: '下午' },
216
+        { value: 3, text: '晚上' }
223
       ],
217
       ],
224
 
218
 
225
       show_zone_selector: false,
219
       show_zone_selector: false,
226
       zone_selected: 0,
220
       zone_selected: 0,
227
       show_patient_type_selector: false,
221
       show_patient_type_selector: false,
228
-      zones: [{ value: 0, text: "全部分区", select: true }],
222
+      zones: [{ value: 0, text: '全部分区', select: true }],
229
 
223
 
230
       show_advice_type_selector: false,
224
       show_advice_type_selector: false,
231
       advice_type_selected: 0,
225
       advice_type_selected: 0,
232
       advice_types: [
226
       advice_types: [
233
-        { value: 0, text: "全部医嘱" },
234
-        { value: 1, text: "长期医嘱" },
235
-        { value: 3, text: "临时医嘱" }
227
+        { value: 0, text: '全部医嘱' },
228
+        { value: 1, text: '长期医嘱' },
229
+        { value: 3, text: '临时医嘱' }
236
       ],
230
       ],
237
 
231
 
238
       patient_types: [
232
       patient_types: [
239
-        { value: 0, text: "全部病人" },
240
-        { value: 1, text: "我的病人" },
241
-        { value: 2, text: "未执行病人" }
233
+        { value: 0, text: '全部病人' },
234
+        { value: 1, text: '我的病人' },
235
+        { value: 2, text: '未执行病人' }
242
       ],
236
       ],
243
       patient_selected: 0,
237
       patient_selected: 0,
244
 
238
 
245
       scheduleMap: {},
239
       scheduleMap: {},
246
       tableData: []
240
       tableData: []
247
-    };
241
+    }
248
   },
242
   },
249
   computed: {
243
   computed: {
250
-    selected_date_str: function() {
251
-      return parseTime(this.selected_date, "{y}-{m}-{d}");
244
+    selected_date_str: function () {
245
+      return parseTime(this.selected_date, '{y}-{m}-{d}')
252
     },
246
     },
253
-    filtedScheduals: function() {
254
-      var scheduleMap = new Object();
247
+    filtedScheduals: function () {
248
+      var scheduleMap = new Object()
255
       if (this.zone_selected == 0) {
249
       if (this.zone_selected == 0) {
256
         for (const key in this.scheduleMap) {
250
         for (const key in this.scheduleMap) {
257
-          scheduleMap[key] = this.scheduleMap[key];
251
+          scheduleMap[key] = this.scheduleMap[key]
258
         }
252
         }
259
       } else {
253
       } else {
260
-        var zone_name = this.zones[this.zone_selected].text;
261
-        scheduleMap[zone_name] = this.scheduleMap[zone_name];
254
+        var zone_name = this.zones[this.zone_selected].text
255
+        scheduleMap[zone_name] = this.scheduleMap[zone_name]
262
       }
256
       }
263
 
257
 
264
       if (this.schedule_type_selected != 0) {
258
       if (this.schedule_type_selected != 0) {
265
-        var _scheduleMap = {};
259
+        var _scheduleMap = {}
266
         for (const key in scheduleMap) {
260
         for (const key in scheduleMap) {
267
-          var origin_schedules = scheduleMap[key];
268
-          var schedules = [];
261
+          var origin_schedules = scheduleMap[key]
262
+          var schedules = []
269
           for (let index = 0; index < origin_schedules.length; index++) {
263
           for (let index = 0; index < origin_schedules.length; index++) {
270
-            const schedule = origin_schedules[index];
264
+            const schedule = origin_schedules[index]
271
             if (schedule.schedule_type == this.schedule_type_selected) {
265
             if (schedule.schedule_type == this.schedule_type_selected) {
272
-              schedules.push(schedule);
266
+              schedules.push(schedule)
273
             }
267
             }
274
           }
268
           }
275
           if (schedules.length > 0) {
269
           if (schedules.length > 0) {
276
-            _scheduleMap[key] = schedules;
270
+            _scheduleMap[key] = schedules
277
           }
271
           }
278
         }
272
         }
279
 
273
 
280
-        scheduleMap = _scheduleMap;
274
+        scheduleMap = _scheduleMap
281
       }
275
       }
282
       for (var key in scheduleMap) {
276
       for (var key in scheduleMap) {
283
-        let mapArr = scheduleMap[key];
277
+        let mapArr = scheduleMap[key]
284
         for (let i = 0; i < mapArr.length; i++) {
278
         for (let i = 0; i < mapArr.length; i++) {
285
-          mapArr[i]["new_advice"] = [];
279
+          mapArr[i]['new_advice'] = []
286
         }
280
         }
287
       }
281
       }
288
 
282
 
289
       for (var key in scheduleMap) {
283
       for (var key in scheduleMap) {
290
-        let mapArr = scheduleMap[key];
284
+        let mapArr = scheduleMap[key]
291
         for (let i = 0; i < mapArr.length; i++) {
285
         for (let i = 0; i < mapArr.length; i++) {
292
-          var maps = mapArr[i];
293
-          var resp_advices = maps.doctor_advice;
286
+          var maps = mapArr[i]
287
+          var resp_advices = maps.doctor_advice
294
           if (resp_advices.length > 0) {
288
           if (resp_advices.length > 0) {
295
-            var newGroupObject = function() {
289
+            var newGroupObject = function () {
296
               return Object.assign(
290
               return Object.assign(
297
                 {},
291
                 {},
298
                 {
292
                 {
299
                   group_no: 0,
293
                   group_no: 0,
300
                   advices: []
294
                   advices: []
301
                 }
295
                 }
302
-              );
296
+              )
303
             };
297
             };
304
-            var initGroupBlock = function(group, advice) {
305
-              group.group_no = advice.groupno;
298
+            var initGroupBlock = function (group, advice) {
299
+              group.group_no = advice.groupno
306
             };
300
             };
307
 
301
 
308
-            var advice_groups = [];
309
-            var group = newGroupObject();
302
+            var advice_groups = []
303
+            var group = newGroupObject()
310
             for (let index = 0; index < resp_advices.length; index++) {
304
             for (let index = 0; index < resp_advices.length; index++) {
311
-              const advice = resp_advices[index];
305
+              const advice = resp_advices[index]
312
               if (advice.groupno == 0) {
306
               if (advice.groupno == 0) {
313
                 // 老版本的医嘱
307
                 // 老版本的医嘱
314
                 if (advice.parent_id > 0) {
308
                 if (advice.parent_id > 0) {
315
                   if (advice_groups.length > 0) {
309
                   if (advice_groups.length > 0) {
316
-                    var parent_group = advice_groups[advice_groups.length - 1];
310
+                    var parent_group = advice_groups[advice_groups.length - 1]
317
                     if (parent_group.advices.length > 0) {
311
                     if (parent_group.advices.length > 0) {
318
                       if (parent_group.advices[0].id == advice.parent_id) {
312
                       if (parent_group.advices[0].id == advice.parent_id) {
319
-                        parent_group.advices.push(advice);
313
+                        parent_group.advices.push(advice)
320
                       }
314
                       }
321
                     }
315
                     }
322
                   }
316
                   }
323
-                  continue;
317
+                  continue
324
                 } else {
318
                 } else {
325
                   if (group.group_no > 0) {
319
                   if (group.group_no > 0) {
326
-                    advice_groups.push(group);
327
-                    group = newGroupObject();
320
+                    advice_groups.push(group)
321
+                    group = newGroupObject()
328
                   }
322
                   }
329
 
323
 
330
-                  initGroupBlock(group, advice);
331
-                  group.advices.push(advice);
332
-                  advice_groups.push(group);
333
-                  group = newGroupObject();
324
+                  initGroupBlock(group, advice)
325
+                  group.advices.push(advice)
326
+                  advice_groups.push(group)
327
+                  group = newGroupObject()
334
                   continue;
328
                   continue;
335
                 }
329
                 }
336
               } else {
330
               } else {
337
                 if (group.group_no > 0 && group.group_no != advice.groupno) {
331
                 if (group.group_no > 0 && group.group_no != advice.groupno) {
338
-                  advice_groups.push(group);
339
-                  group = newGroupObject();
332
+                  advice_groups.push(group)
333
+                  group = newGroupObject()
340
                 }
334
                 }
341
                 if (group.group_no == 0) {
335
                 if (group.group_no == 0) {
342
-                  initGroupBlock(group, advice);
336
+                  initGroupBlock(group, advice)
343
                 }
337
                 }
344
                 if (group.group_no == advice.groupno) {
338
                 if (group.group_no == advice.groupno) {
345
-                  group.advices.push(advice);
339
+                  group.advices.push(advice)
346
                 }
340
                 }
347
               }
341
               }
348
             }
342
             }
349
             if (group.group_no > 0) {
343
             if (group.group_no > 0) {
350
               // 上述的算法会导致最后一组没有加到advice_groups,这里要手动加上
344
               // 上述的算法会导致最后一组没有加到advice_groups,这里要手动加上
351
-              advice_groups.push(group);
345
+              advice_groups.push(group)
352
             }
346
             }
353
-            advice_groups = advice_groups;
347
+            advice_groups = advice_groups
354
           } else {
348
           } else {
355
-            advice_groups = [];
349
+            advice_groups = []
356
           }
350
           }
357
-          maps.new_advice = advice_groups;
351
+          maps.new_advice = advice_groups
358
         }
352
         }
359
       }
353
       }
360
 
354
 
361
-      return scheduleMap;
355
+      return scheduleMap
362
     }
356
     }
363
   },
357
   },
364
-  created() {
365
-    this.requestSchedualDoctors();
358
+  created () {
359
+    this.requestSchedualDoctors()
366
   },
360
   },
367
   methods: {
361
   methods: {
368
     // getNumber: function (advice,schedule) {
362
     // getNumber: function (advice,schedule) {
376
     //   }
370
     //   }
377
     //
371
     //
378
     // },
372
     // },
379
-    clickfunction: function(val) {
373
+    clickfunction: function (val) {
380
       // console.log(val);
374
       // console.log(val);
381
       this.$router.push({
375
       this.$router.push({
382
-        path: "/details",
376
+        path: '/details',
383
         query: {
377
         query: {
384
           patient_id: val.patient.id,
378
           patient_id: val.patient.id,
385
           date: this.selected_date.getTime() / 1000,
379
           date: this.selected_date.getTime() / 1000,
386
           patient_name: val.patient.name
380
           patient_name: val.patient.name
387
         }
381
         }
388
-      });
382
+      })
389
     },
383
     },
390
-    handlePaitentType: function(index) {
391
-      this.patient_selected = index;
392
-      this.show_patient_type_selector = false;
393
-      this.requestSchedualDoctors();
384
+    handlePaitentType: function (index) {
385
+      this.patient_selected = index
386
+      this.show_patient_type_selector = false
387
+      this.requestSchedualDoctors()
394
     },
388
     },
395
-    openPicker() {
396
-      this.$refs.picker.open();
389
+    openPicker () {
390
+      this.$refs.picker.open()
397
     },
391
     },
398
-    getAdaviceType(type, parent_id) {
392
+    getAdaviceType (type, parent_id) {
399
       if (parent_id == 0) {
393
       if (parent_id == 0) {
400
         if (type == 1) {
394
         if (type == 1) {
401
-          return "长嘱";
395
+          return '长嘱';
402
         } else if (type == 2) {
396
         } else if (type == 2) {
403
-          return "临嘱";
397
+          return '临嘱';
404
         } else if (type == 3) {
398
         } else if (type == 3) {
405
-          return "临嘱";
399
+          return '临嘱';
406
         }
400
         }
407
       }
401
       }
408
     },
402
     },
409
-    getName(val) {
410
-      console.log(this.admin_user);
403
+    getName (val) {
404
+      console.log(this.admin_user)
411
 
405
 
412
       for (let i = 0; i < this.admin_user.length; i++) {
406
       for (let i = 0; i < this.admin_user.length; i++) {
413
         if (this.admin_user[i].id == val) {
407
         if (this.admin_user[i].id == val) {
414
-          return this.admin_user[i].name;
408
+          return this.admin_user[i].name
415
         }
409
         }
416
       }
410
       }
417
     },
411
     },
418
-    handletimeType: function(index) {
419
-      this.schedule_type_selected = index;
420
-      this.show_sch_type_selector = false;
412
+    handletimeType: function (index) {
413
+      this.schedule_type_selected = index
414
+      this.show_sch_type_selector = false
421
     },
415
     },
422
-    handleAdviceType: function(index) {
423
-      this.advice_type_selected = index;
424
-      this.show_advice_type_selector = false;
425
-      this.requestSchedualDoctors();
416
+    handleAdviceType: function (index) {
417
+      this.advice_type_selected = index
418
+      this.show_advice_type_selector = false
419
+      this.requestSchedualDoctors()
426
     },
420
     },
427
-    handleZoneChange: function(index) {
428
-      this.zone_selected = index;
429
-      this.show_zone_selector = false;
421
+    handleZoneChange: function (index) {
422
+      this.zone_selected = index
423
+      this.show_zone_selector = false
430
     },
424
     },
431
-    parseTime: function(time, layout) {
425
+    parseTime: function (time, layout) {
432
       // console.log(time);
426
       // console.log(time);
433
       if (time == 0) {
427
       if (time == 0) {
434
-        return "";
428
+        return '';
435
       }
429
       }
436
-      return parseTime(time, layout);
430
+      return parseTime(time, layout)
437
     },
431
     },
438
-    requestSchedualDoctors() {
432
+    requestSchedualDoctors () {
439
       getSchedualDoctors({
433
       getSchedualDoctors({
440
         date: this.selected_date_str,
434
         date: this.selected_date_str,
441
         patient_type: this.patient_selected,
435
         patient_type: this.patient_selected,
442
         advice_type: 2
436
         advice_type: 2
443
       }).then(rs => {
437
       }).then(rs => {
444
-        var resp = rs.data;
438
+        var resp = rs.data
445
         if (resp.state == 1) {
439
         if (resp.state == 1) {
446
-          this.admin_user = resp.data.adminUser;
447
-          var schedules = resp.data.scheduals;
448
-          console.log("schedules", schedules);
449
-          var zoneMap = {};
450
-          var scheduleMap = {};
440
+          this.admin_user = resp.data.adminUser
441
+          var schedules = resp.data.scheduals
442
+          console.log('schedules', schedules)
443
+          var zoneMap = {}
444
+          var scheduleMap = {}
451
           for (let index = 0; index < schedules.length; index++) {
445
           for (let index = 0; index < schedules.length; index++) {
452
-            const schedule = schedules[index];
446
+            const schedule = schedules[index]
453
             if (schedule.doctor_advice.length == 0) {
447
             if (schedule.doctor_advice.length == 0) {
454
-              continue;
448
+              continue
455
             }
449
             }
456
             if (scheduleMap[schedule.device_number.zone.name] == null) {
450
             if (scheduleMap[schedule.device_number.zone.name] == null) {
457
-              scheduleMap[schedule.device_number.zone.name] = [];
451
+              scheduleMap[schedule.device_number.zone.name] = []
458
             }
452
             }
459
-            scheduleMap[schedule.device_number.zone.name].push(schedule);
453
+            scheduleMap[schedule.device_number.zone.name].push(schedule)
460
             if (zoneMap[schedule.device_number.zone.name] == null) {
454
             if (zoneMap[schedule.device_number.zone.name] == null) {
461
               zoneMap[schedule.device_number.zone.name] =
455
               zoneMap[schedule.device_number.zone.name] =
462
-                schedule.device_number.zone;
456
+                schedule.device_number.zone
463
             }
457
             }
464
           }
458
           }
465
 
459
 
466
-          var zones = [];
467
-          zones.push({ value: 0, text: "全部分区" });
460
+          var zones = []
461
+          zones.push({ value: 0, text: '全部分区' })
468
           for (var zoneName in zoneMap) {
462
           for (var zoneName in zoneMap) {
469
-            zones.push({ value: zoneMap[zoneName].id, text: zoneName });
463
+            zones.push({ value: zoneMap[zoneName].id, text: zoneName })
470
           }
464
           }
471
 
465
 
472
-          zones = zones.sort(function(a, b) {
473
-            return a.value > b.value;
474
-          });
475
-          this.zones = zones;
466
+          zones = zones.sort(function (a, b) {
467
+            return a.value > b.value
468
+          })
469
+          this.zones = zones
476
 
470
 
477
-          this.scheduleMap = scheduleMap;
471
+          this.scheduleMap = scheduleMap
478
         } else {
472
         } else {
479
           this.$toast({
473
           this.$toast({
480
             message: resp.msg
474
             message: resp.msg
481
-          });
475
+          })
482
         }
476
         }
483
-      });
477
+      })
484
     },
478
     },
485
-    adviceDesc(advice) {}
479
+    adviceDesc (advice) {}
486
   }
480
   }
487
-};
481
+}
488
 </script>
482
 </script>
489
 
483
 
490
 <style style="stylesheet/scss" lang="scss" scoped>
484
 <style style="stylesheet/scss" lang="scss" scoped>