소스 검색

修改bug

csx 5 년 전
부모
커밋
a2a7821080

+ 1 - 1
build/cdn.json 파일 보기

@@ -1,3 +1,3 @@
1 1
 {
2
-  "version": "1.0.318"
2
+  "version": "1.1.2"
3 3
 }

+ 10 - 0
src/api/dialysis.js 파일 보기

@@ -255,3 +255,13 @@ export function GetSolution(params){
255 255
 
256 256
 
257 257
 
258
+
259
+
260
+export function GetSchedualNumber(params){
261
+  return request({
262
+    url:"/m/api/schedule/get",
263
+    method:'get',
264
+    params:params,
265
+  })
266
+
267
+}

+ 297 - 304
src/pages/main/add_urgent_schedule.vue 파일 보기

@@ -77,24 +77,26 @@
77 77
           </van-col>
78 78
 
79 79
           <van-col :span="24">
80
-            <span class="title">治疗模式:</span>
80
+            <span class="title">床位:</span>
81 81
             <div class="field_panel">
82 82
               <van-field
83
-                ref="mode_field"
84
-                @focus="selectModeAction"
85
-                :value="mode_name"
83
+                ref="bed_field"
84
+                @focus="selectBedAction"
85
+                :value="bed_name"
86 86
                 class="field"
87 87
                 left-icon="arrow-down"
88 88
               ></van-field>
89 89
             </div>
90 90
           </van-col>
91
+
92
+
91 93
           <van-col :span="24">
92
-            <span class="title">床位:</span>
94
+            <span class="title">治疗模式:</span>
93 95
             <div class="field_panel">
94 96
               <van-field
95
-                ref="bed_field"
96
-                @focus="selectBedAction"
97
-                :value="bed_name"
97
+                ref="mode_field"
98
+                @focus="selectModeAction"
99
+                :value="mode_name"
98 100
                 class="field"
99 101
                 left-icon="arrow-down"
100 102
               ></van-field>
@@ -145,238 +147,116 @@
145 147
 </template>
146 148
 
147 149
 <script>
148
-import SideBar from "@/pages/layout/SideBar";
149
-import { parseTime } from "@/utils";
150
-import {
151
-  getUrgentScheduleInitData,
152
-  PostSearch,
153
-  postUrgentSchedule
154
-} from "@/api/dialysis";
155
-import { Dialog, Toast } from "vant";
156
-
157
-export default {
158
-  name: "AddUrgentSchedule",
159
-  components: {
160
-    SideBar
161
-  },
162
-  data() {
163
-    return {
164
-      loading: false,
165
-      value: "",
166
-      date: "2019-09-09",
167
-      patient_id: 0,
168
-      mode_id: 0,
169
-      device_id: 0,
170
-      schedule_type: 1,
171
-      zone_name: "",
172
-
173
-      show_patient_picker: false,
174
-      show_mode_picker: false,
175
-      show_bed_picker: false,
176
-      show_sch_type_picker: false,
177
-
178
-      patients: [],
179
-      modes: [],
180
-      schedule_types: [
181
-        { value: 1, text: "上午" },
182
-        { value: 2, text: "下午" },
183
-        { value: 3, text: "晚上" }
184
-      ],
185
-
186
-      origin_device_numbers: [],
187
-      zone_device_map: {},
188
-      zone_names: [],
189
-      current_devices: [],
190
-      zone_device_options: [],
191
-
192
-      origin_schedules: []
193
-    };
194
-  },
195
-  computed: {
196
-    patient_name: function() {
197
-      for (let index = 0; index < this.patients.length; index++) {
198
-        const patient = this.patients[index];
199
-        if (patient.id == this.patient_id) {
200
-          return patient.name;
201
-        }
202
-      }
203
-      return "";
204
-    },
205
-    mode_name: function() {
206
-      for (let index = 0; index < this.modes.length; index++) {
207
-        const mode = this.modes[index];
208
-        if (mode.id == this.mode_id) {
209
-          return mode.name;
210
-        }
211
-      }
212
-      return "";
213
-    },
214
-    bed_name: function() {
215
-      if (this.zone_name.length > 0 && this.device_id != 0) {
216
-        for (let index = 0; index < this.current_devices.length; index++) {
217
-          const device_number = this.current_devices[index];
218
-          if (device_number.id == this.device_id) {
219
-            return device_number.zone.name + " - " + device_number.number;
220
-          }
221
-        }
222
-      }
223
-      return "";
150
+  import SideBar from "@/pages/layout/SideBar";
151
+  import { parseTime } from "@/utils";
152
+  import {
153
+    getUrgentScheduleInitData,
154
+    PostSearch,
155
+    postUrgentSchedule
156
+  } from "@/api/dialysis";
157
+  import { Dialog, Toast } from "vant";
158
+
159
+  export default {
160
+    name: "AddUrgentSchedule",
161
+    components: {
162
+      SideBar
224 163
     },
225
-    schedule_type_title: function() {
226
-      for (let index = 0; index < this.schedule_types.length; index++) {
227
-        const type = this.schedule_types[index];
228
-        if (type.value == this.schedule_type) {
229
-          return type.text;
230
-        }
231
-      }
232
-      return "";
233
-    }
234
-  },
235
-  mounted() {
236
-    var today = new Date();
237
-    this.date = parseTime(today, "{y}-{m}-{d}");
238
-
239
-    var hour = today.getHours();
240
-    if (hour > 3 && hour < 11) {
241
-      this.schedule_type = 1;
242
-    } else if (hour >= 11 && hour < 18) {
243
-      this.schedule_type = 2;
244
-    } else {
245
-      this.schedule_type = 3;
246
-    }
164
+    data() {
165
+      return {
166
+        loading: false,
167
+        value: "",
168
+        date: "2019-09-09",
169
+        patient_id: 0,
170
+        mode_id: 0,
171
+        device_id: 0,
172
+        schedule_type: 2,
173
+        zone_name: "",
247 174
 
248
-    this.loading = true;
249
-    let params = {
250
-      type: this.schedule_type
251
-    };
252
-    console.log(params);
253
-    getUrgentScheduleInitData(params)
254
-      .then(rs => {
255
-        this.loading = false;
256
-        // console.log(rs.data.data)
257
-        if (rs.data.state == 1) {
258
-          this.origin_schedules = rs.data.data.schedules;
259
-          this.patients = rs.data.data.patients;
260
-          this.modes = rs.data.data.modes;
261
-          this.origin_device_numbers = rs.data.data.device_numbers;
262
-
263
-          for (let i = this.origin_schedules.length - 1; i >= 0; i--) {
264
-            for (let y = this.origin_device_numbers.length - 1; y >= 0; y--) {
265
-              if (
266
-                this.origin_device_numbers[y].id ==
267
-                this.origin_schedules[i].bed_id
268
-              ) {
269
-                this.origin_device_numbers.splice(y, 1);
270
-              }
271
-            }
272
-          }
175
+        show_patient_picker: false,
176
+        show_mode_picker: false,
177
+        show_bed_picker: false,
178
+        show_sch_type_picker: false,
179
+
180
+        patients: [],
181
+        modes: [],
182
+        schedule_types: [
183
+          { value: 1, text: "上午" },
184
+          { value: 2, text: "下午" },
185
+          { value: 3, text: "晚上" }
186
+        ],
187
+
188
+        origin_device_numbers: [],
189
+        zone_device_map: {},
190
+        zone_names: [],
191
+        current_devices: [],
192
+        zone_device_options: [],
273 193
 
274
-          if (this.patients.length > 0) {
275
-            this.patient_id = this.patients[0].id;
194
+        origin_schedules: []
195
+      };
196
+    },
197
+    computed: {
198
+      patient_name: function() {
199
+        for (let index = 0; index < this.patients.length; index++) {
200
+          const patient = this.patients[index];
201
+          if (patient.id == this.patient_id) {
202
+            return patient.name;
276 203
           }
277
-          if (this.modes.length > 0) {
278
-            this.mode_id = this.modes[0].id;
204
+        }
205
+        return "";
206
+      },
207
+      mode_name: function() {
208
+        for (let index = 0; index < this.modes.length; index++) {
209
+          const mode = this.modes[index];
210
+          if (mode.id == this.mode_id) {
211
+            return mode.name;
279 212
           }
280
-
281
-          var zone_device_map = {};
282
-          for (
283
-            let index = 0;
284
-            index < this.origin_device_numbers.length;
285
-            index++
286
-          ) {
287
-            const device_number = this.origin_device_numbers[index];
288
-            if (
289
-              zone_device_map[device_number.zone.name] == null ||
290
-              zone_device_map[device_number.zone.name] == undefined
291
-            ) {
292
-              zone_device_map[device_number.zone.name] = [];
213
+        }
214
+        return "";
215
+      },
216
+      bed_name: function() {
217
+        if (this.zone_name.length > 0 && this.device_id != 0) {
218
+          for (let index = 0; index < this.current_devices.length; index++) {
219
+            const device_number = this.current_devices[index];
220
+            if (device_number.id == this.device_id) {
221
+              return device_number.zone_name + " - " + device_number.number;
293 222
             }
294
-            zone_device_map[device_number.zone.name].push(device_number);
295 223
           }
296
-          this.zone_device_map = zone_device_map;
297
-
298
-          this.zone_names = Object.keys(this.zone_device_map);
299
-          if (this.zone_names.length > 0) {
300
-            this.zone_name = this.zone_names[0];
301
-            this.current_devices = this.zone_device_map[this.zone_name];
302
-            this.device_id = this.current_devices[0].id;
224
+        }
225
+        return "";
226
+      },
227
+      schedule_type_title: function() {
228
+        for (let index = 0; index < this.schedule_types.length; index++) {
229
+          const type = this.schedule_types[index];
230
+          if (type.value == this.schedule_type) {
231
+            return type.text;
303 232
           }
304
-          this.zone_device_options = [
305
-            { values: this.zone_names },
306
-            // { values: this.getDeviceNumberNames(this.current_devices) },
307
-            { values: this.current_devices }
308
-          ];
309
-        } else {
310
-          Toast.fail(rs.data.msg);
311 233
         }
312
-      })
313
-      .catch(err => {
314
-        this.loading = false;
315
-        Toast.fail(err);
316
-      });
317
-  },
318
-  methods: {
319
-    handleSelect(val) {
320
-      this.patient_name = val.name;
321
-      this.patient_id = val.id;
322
-    },
323
-    querySearchAsync(keyword, cb) {
324
-      let key = "";
325
-      if (keyword != undefined) {
326
-        key = keyword;
234
+        return "";
327 235
       }
328
-      let searchArray = [];
329
-      PostSearch(key).then(response => {
330
-        if (response.data.state == 1) {
331
-          searchArray = response.data.data.patient;
332
-          cb(searchArray);
333
-        } else {
334
-          cb([]);
335
-        }
336
-      });
337
-    },
236
+    },created(){
237
+      console.log(this.$refs.schedule_picker)
238
+      var today = new Date();
239
+      this.date = parseTime(today, "{y}-{m}-{d}");
338 240
 
339
-    selectPatientAction: function() {
340
-      this.$refs.patient_field.blur();
341
-      this.show_patient_picker = true;
342
-    },
343
-    selectModeAction: function() {
344
-      this.$refs.mode_field.blur();
345
-      this.show_mode_picker = true;
346
-    },
347
-    selectBedAction: function() {
348
-      this.$refs.bed_field.blur();
349
-      this.show_bed_picker = true;
350
-    },
351
-    selectSchTypeAction: function() {
352
-      this.$refs.sch_type_field.blur();
353
-      this.show_sch_type_picker = true;
354
-    },
355
-
356
-    didChangePatient: function(picker, patient, index) {
357
-      this.patient_id = patient.id;
358
-    },
359
-    didChangeMode: function(picker, mode, index) {
360
-      this.mode_id = mode.id;
361
-    },
362
-    didChangeBed: function(picker, values, col_index) {
363
-      if (col_index == 0) {
364
-        this.zone_name = values[0];
365
-        this.current_devices = this.zone_device_map[this.zone_name];
366
-        this.device_id = this.current_devices[0].id;
367
-
368
-        picker.setColumnValues(1, this.current_devices);
369
-      } else if (col_index == 1) {
370
-        this.device_id = values[1].id;
241
+      var hour = today.getHours();
242
+      if (hour > 3 && hour < 11) {
243
+        this.schedule_type = 1;
244
+      } else if (hour >= 11 && hour < 18) {
245
+        this.schedule_type = 2;
246
+      } else {
247
+        this.schedule_type = 3;
371 248
       }
249
+
250
+
251
+
372 252
     },
373
-    didChangeSchType: function(picker, sch_type, index) {
374
-      this.schedule_type = sch_type.value;
253
+    mounted() {
375 254
 
376 255
       this.loading = true;
377 256
       let params = {
378 257
         type: this.schedule_type
379 258
       };
259
+      console.log(params);
380 260
       getUrgentScheduleInitData(params)
381 261
         .then(rs => {
382 262
           this.loading = false;
@@ -384,26 +264,17 @@ export default {
384 264
           if (rs.data.state == 1) {
385 265
             this.origin_schedules = rs.data.data.schedules;
386 266
             this.patients = rs.data.data.patients;
267
+            console.log(this.patients)
387 268
             this.modes = rs.data.data.modes;
388 269
             this.origin_device_numbers = rs.data.data.device_numbers;
389 270
 
390
-            for (let i = this.origin_schedules.length - 1; i >= 0; i--) {
391
-              for (let y = this.origin_device_numbers.length - 1; y >= 0; y--) {
392
-                if (
393
-                  this.origin_device_numbers[y].id ==
394
-                  this.origin_schedules[i].bed_id
395
-                ) {
396
-                  this.origin_device_numbers.splice(y, 1);
397
-                }
398
-              }
399
-            }
400 271
 
401
-            // if (this.patients.length > 0) {
402
-            //   this.patient_id = this.patients[0].id
403
-            // }
404
-            // if (this.modes.length > 0) {
405
-            //   this.mode_id = this.modes[0].id
406
-            // }
272
+            if (this.patients.length > 0) {
273
+              this.patient_id = this.patients[0].id;
274
+            }
275
+            if (this.modes.length > 0) {
276
+              this.mode_id = this.modes[0].id;
277
+            }
407 278
 
408 279
             var zone_device_map = {};
409 280
             for (
@@ -413,12 +284,12 @@ export default {
413 284
             ) {
414 285
               const device_number = this.origin_device_numbers[index];
415 286
               if (
416
-                zone_device_map[device_number.zone.name] == null ||
417
-                zone_device_map[device_number.zone.name] == undefined
287
+                zone_device_map[device_number.zone_name] == null ||
288
+                zone_device_map[device_number.zone_name] == undefined
418 289
               ) {
419
-                zone_device_map[device_number.zone.name] = [];
290
+                zone_device_map[device_number.zone_name] = [];
420 291
               }
421
-              zone_device_map[device_number.zone.name].push(device_number);
292
+              zone_device_map[device_number.zone_name].push(device_number);
422 293
             }
423 294
             this.zone_device_map = zone_device_map;
424 295
 
@@ -433,6 +304,8 @@ export default {
433 304
               // { values: this.getDeviceNumberNames(this.current_devices) },
434 305
               { values: this.current_devices }
435 306
             ];
307
+            console.log(this.zone_device_options )
308
+
436 309
           } else {
437 310
             Toast.fail(rs.data.msg);
438 311
           }
@@ -442,77 +315,197 @@ export default {
442 315
           Toast.fail(err);
443 316
         });
444 317
     },
318
+    methods: {
319
+      handleSelect(val) {
320
+        this.patient_name = val.name;
321
+        this.patient_id = val.id;
322
+      },
323
+      querySearchAsync(keyword, cb) {
324
+        let key = "";
325
+        if (keyword != undefined) {
326
+          key = keyword;
327
+        }
328
+        let searchArray = [];
329
+        PostSearch(key).then(response => {
330
+          if (response.data.state == 1) {
331
+            searchArray = response.data.data.patient;
332
+            cb(searchArray);
333
+          } else {
334
+            cb([]);
335
+          }
336
+        });
337
+      },
445 338
 
446
-    submitAction: function() {
447
-      if (this.patient_id == 0 || this.mode_id == 0 || this.device_id == 0) {
448
-        Toast.fail("请选择班次、床位等");
449
-        return;
450
-      }
339
+      selectPatientAction: function() {
340
+        this.$refs.patient_field.blur();
341
+        this.show_patient_picker = true;
342
+      },
343
+      selectModeAction: function() {
344
+        this.$refs.mode_field.blur();
345
+        this.show_mode_picker = true;
346
+      },
347
+      selectBedAction: function() {
348
+        this.$refs.bed_field.blur();
349
+        this.show_bed_picker = true;
350
+      },
351
+      selectSchTypeAction: function() {
352
+        this.$refs.sch_type_field.blur();
353
+        this.show_sch_type_picker = true;
354
+      },
355
+
356
+      didChangePatient: function(picker, patient, index) {
357
+        this.patient_id = patient.id;
358
+      },
359
+      didChangeMode: function(picker, mode, index) {
360
+        this.mode_id = mode.id;
361
+      },
362
+      didChangeBed: function(picker, values, col_index) {
363
+        if (col_index == 0) {
364
+          this.zone_name = values[0];
365
+          this.current_devices = this.zone_device_map[this.zone_name];
366
+          this.device_id = this.current_devices[0].id;
451 367
 
452
-      var repeated = false;
453
-      for (let index = 0; index < this.origin_schedules.length; index++) {
454
-        const schedule = this.origin_schedules[index];
455
-        if (
456
-          schedule.bed_id == this.device_id &&
457
-          this.schedule_type == schedule.schedule_type
458
-        ) {
459
-          repeated = true;
460
-          break;
368
+          picker.setColumnValues(1, this.current_devices);
369
+        } else if (col_index == 1) {
370
+          this.device_id = values[1].id;
461 371
         }
462
-      }
463
-      if (repeated) {
464
-        Dialog.confirm({
465
-          title: "提醒",
466
-          message: "你选择的床位已经被排班,确认要替换吗?"
467
-        })
468
-          .then(() => {
469
-            // on confirm
470
-            this.submit();
372
+      },
373
+      didChangeSchType: function(picker, sch_type, index) {
374
+        this.schedule_type = sch_type.value;
375
+        this.loading = true;
376
+        let params = {
377
+          type: this.schedule_type
378
+        };
379
+        getUrgentScheduleInitData(params)
380
+          .then(rs => {
381
+            this.loading = false;
382
+            // console.log(rs.data.data)
383
+            if (rs.data.state == 1) {
384
+              this.zone_device_options = []
385
+              this.origin_schedules = rs.data.data.schedules;
386
+              this.patients = rs.data.data.patients;
387
+              console.log(this.patients)
388
+              this.modes = rs.data.data.modes;
389
+              this.origin_device_numbers = rs.data.data.device_numbers;
390
+
391
+
392
+              if (this.patients.length > 0) {
393
+                this.patient_id = this.patients[0].id;
394
+              }
395
+              if (this.modes.length > 0) {
396
+                this.mode_id = this.modes[0].id;
397
+              }
398
+
399
+              var zone_device_map = {};
400
+              for (
401
+                let index = 0;
402
+                index < this.origin_device_numbers.length;
403
+                index++
404
+              ) {
405
+                const device_number = this.origin_device_numbers[index];
406
+                if (
407
+                  zone_device_map[device_number.zone_name] == null ||
408
+                  zone_device_map[device_number.zone_name] == undefined
409
+                ) {
410
+                  zone_device_map[device_number.zone_name] = [];
411
+                }
412
+                zone_device_map[device_number.zone_name].push(device_number);
413
+              }
414
+              this.zone_device_map = zone_device_map;
415
+
416
+              this.zone_names = Object.keys(this.zone_device_map);
417
+              if (this.zone_names.length > 0) {
418
+                this.zone_name = this.zone_names[0];
419
+                this.current_devices = this.zone_device_map[this.zone_name];
420
+                this.device_id = this.current_devices[0].id;
421
+              }
422
+              this.zone_device_options = [
423
+                { values: this.zone_names },
424
+                // { values: this.getDeviceNumberNames(this.current_devices) },
425
+                { values: this.current_devices }
426
+              ];
427
+              console.log( this.zone_device_options)
428
+            } else {
429
+              Toast.fail(rs.data.msg);
430
+            }
471 431
           })
472
-          .catch(() => {
473
-            // on cancel
432
+          .catch(err => {
433
+            this.loading = false;
434
+            Toast.fail(err);
474 435
           });
475
-      } else {
476
-        this.submit();
477
-      }
478
-    },
479
-    submit: function() {
480
-      var params = {
481
-        patient_id: this.patient_id,
482
-        mode: this.mode_id,
483
-        schedule_type: this.schedule_type,
484
-        bed: this.device_id
485
-      };
486
-      this.loading = true;
487
-      postUrgentSchedule(params)
488
-        .then(rs => {
489
-          this.loading = false;
490
-          var resp = rs.data;
491
-          if (resp.state == 1) {
492
-            console.log(resp.data);
493
-            var patient = resp.data.patient;
494
-            var schedule = resp.data.schedule;
495
-            this.$router.push({
496
-              path: "/details",
497
-              query: {
498
-                patient_id: patient.id,
499
-                date: schedule.schedule_date,
500
-                patient_name: patient.name
501
-              }
502
-            });
503
-          } else {
504
-            Toast.fail(resp.msg);
436
+      },
437
+
438
+      submitAction: function() {
439
+        if (this.patient_id == 0 || this.mode_id == 0 || this.device_id == 0) {
440
+          Toast.fail("请选择班次、床位等");
441
+          return;
442
+        }
443
+
444
+        var repeated = false;
445
+        for (let index = 0; index < this.origin_schedules.length; index++) {
446
+          const schedule = this.origin_schedules[index];
447
+          if (
448
+            schedule.bed_id == this.device_id &&
449
+            this.schedule_type == schedule.schedule_type
450
+          ) {
451
+            repeated = true;
452
+            break;
505 453
           }
506
-        })
507
-        .catch(err => {
508
-          this.loading = false;
509
-          Toast.fail("err");
510
-        });
454
+        }
455
+        if (repeated) {
456
+          Dialog.confirm({
457
+            title: "提醒",
458
+            message: "你选择的床位已经被排班,确认要替换吗?"
459
+          })
460
+            .then(() => {
461
+              // on confirm
462
+              this.submit();
463
+            })
464
+            .catch(() => {
465
+              // on cancel
466
+            });
467
+        } else {
468
+          this.submit();
469
+        }
470
+      },
471
+      submit: function() {
472
+        var params = {
473
+          patient_id: this.patient_id,
474
+          mode: this.mode_id,
475
+          schedule_type: this.schedule_type,
476
+          bed: this.device_id
477
+        };
478
+        this.loading = true;
479
+        postUrgentSchedule(params)
480
+          .then(rs => {
481
+            this.loading = false;
482
+            var resp = rs.data;
483
+            if (resp.state == 1) {
484
+              console.log(resp.data);
485
+              var patient = resp.data.patient;
486
+              var schedule = resp.data.schedule;
487
+              this.$router.push({
488
+                path: "/details",
489
+                query: {
490
+                  patient_id: patient.id,
491
+                  date: schedule.schedule_date,
492
+                  patient_name: patient.name
493
+                }
494
+              });
495
+            } else {
496
+              Toast.fail(resp.msg);
497
+            }
498
+          })
499
+          .catch(err => {
500
+            this.loading = false;
501
+            Toast.fail("err");
502
+          });
503
+      }
511 504
     }
512
-  }
513
-};
505
+  };
514 506
 </script>
515 507
 
508
+
516 509
 <style style="stylesheet/scss" lang="scss" scoped>
517 510
 .mainContent {
518 511
   position: relative;

+ 427 - 395
src/pages/main/dialog/ComputerDialog.vue 파일 보기

@@ -1,42 +1,33 @@
1 1
 <template>
2 2
   <div>
3
+
3 4
     <div class="Dialog" v-show="!selecting">
4 5
       <div class="DialogTit">
5 6
         <span @click="close()" class="iconfont">&#xe6e9;</span>
6 7
         <h1 class="name">透析上机</h1>
7
-        <span
8
-          class="success"
9
-          v-if="
10
-            this.record.id == 0 ||
11
-              this.$store.getters.user.user.id != this.creator
12
-          "
13
-        ></span>
14
-        <span
15
-          class="success"
16
-          @click="modify()"
17
-          v-if="
18
-            isPremission || this.$store.getters.user.user.id == this.creator
19
-          "
20
-          >修改</span
21
-        >
8
+        <span class="success" v-if="this.record.id == 0 || this.$store.getters.user.user.id != this.creator"></span>
9
+        <span class="success" @click="modify()" v-if="isPremission|| this.$store.getters.user.user.id == this.creator">修改</span>
22 10
       </div>
23 11
 
24
-      <div class="DialogContent">
12
+      <div class="DialogContent ">
13
+        <div class="item" @click="select_type">
14
+          <h2 class="name">班次</h2>
15
+          <div class="content">
16
+            <span class="text" style="width: 100px">{{getSchedualType(this.schedual_type)}}</span>
17
+            <span class="iconfont">&#xe6f9;</span>
18
+          </div>
19
+        </div>
25 20
         <div class="item" @click="select_bed">
26 21
           <h2 class="name">上机床位</h2>
27 22
           <div class="content">
28
-            <span class="text" style="width: 100px">{{
29
-              device_number_map[bed_id].number + "床"
30
-            }}</span>
23
+            <span class="text" style="width: 100px">{{ device_number_map[bed_id].number }}</span>
31 24
             <span class="iconfont">&#xe6f9;</span>
32 25
           </div>
33 26
         </div>
34 27
         <div class="item" @click="select_nurse">
35 28
           <h2 class="name">上机护士</h2>
36 29
           <div class="content">
37
-            <span class="text" style="width: 100px">{{
38
-              admin_map[nurse_id].name
39
-            }}</span>
30
+            <span class="text" style="width: 100px">{{ admin_map[nurse_id].name }}</span>
40 31
             <span class="iconfont">&#xe6f9;</span>
41 32
           </div>
42 33
         </div>
@@ -44,12 +35,7 @@
44 35
         <div class="item" @click="select_puncture_nurse">
45 36
           <h2 class="name">穿刺者</h2>
46 37
           <div class="content">
47
-            <span
48
-              class="text"
49
-              style="width: 100px"
50
-              v-if="admin_map[puncture_nurse_id]"
51
-              >{{ admin_map[puncture_nurse_id].name }}</span
52
-            >
38
+            <span class="text" style="width: 100px" v-if="admin_map[puncture_nurse_id]">{{ admin_map[puncture_nurse_id].name}}</span>
53 39
             <span class="iconfont">&#xe6f9;</span>
54 40
           </div>
55 41
         </div>
@@ -57,34 +43,24 @@
57 43
         <div class="item" v-if="template_id == 6">
58 44
           <label class="name" for="xll">引血(ml/min)</label>
59 45
           <div class="content">
60
-            <input
61
-              type="tel"
62
-              @focus="inputFocus"
63
-              id="xll"
64
-              v-model="blood_drawing"
65
-            />
46
+            <input type="tel" @focus="inputFocus"  id="xll" v-model="blood_drawing"/>
66 47
           </div>
67 48
         </div>
68 49
 
69 50
         <div class="item">
70 51
           <h2 class="name">上机时间</h2>
71 52
           <div class="content">
72
-            <span
73
-              class="text"
74
-              style="width: 100px"
75
-              @click="selectStartTimeAction"
76
-              >{{ start_time_str }}</span
77
-            >
53
+            <span class="text" style="width: 100px" @click="selectStartTimeAction">{{ start_time_str }}</span>
78 54
             <span class="iconfont">&#xe6f9;</span>
79 55
           </div>
80 56
         </div>
57
+
58
+
59
+
60
+
81 61
         <div class="perform">
82
-          <button @click="commitInfo" v-if="record == null || record.id == ''">
83
-            执行上机
84
-          </button>
85
-          <button :disabled="true" style="background-color:lightgray;" v-else>
86
-            已上机
87
-          </button>
62
+          <button @click="commitInfo" v-if="(record == null || record.id == '')">执行上机</button>
63
+          <button :disabled="true" style="background-color:lightgray;" v-else>已上机</button>
88 64
         </div>
89 65
       </div>
90 66
     </div>
@@ -99,390 +75,446 @@
99 75
   </div>
100 76
 </template>
101 77
 
78
+
102 79
 <script>
103
-import { startDialysis, PostModifyStartDialysis } from "@/api/dialysis";
104
-import { Toast } from "vant";
105
-import { parseTime } from "@/utils";
106
-
107
-import TwoMenu from "./TwoMenu";
108
-
109
-export default {
110
-  name: "ComputerDialog",
111
-  components: {
112
-    TwoMenu
113
-  },
114
-  data() {
115
-    return {
116
-      start_time: new Date(),
117
-      selecting: false,
118
-      start_time_str: "",
119
-      bed_id: 0,
120
-      nurse_id: 0,
121
-      puncture_nurse_id: 0,
122
-      isPremission: false,
123
-      zone_beds: [], // 该排班的区里的床位
124
-      creator: 0,
125
-      template_id: 0,
126
-      blood_drawing: 100
127
-    };
128
-  },
129
-  props: {
130
-    schedule: {
131
-      type: Object
132
-    },
133
-    patient_prop: {
134
-      type: Object
135
-    },
136
-    record: {
137
-      type: Object
138
-    },
139
-    admins: {
140
-      type: Array
141
-    },
142
-    device_numbers: {
143
-      type: Array
144
-    },
145
-    admin_map: {
146
-      type: Object
80
+  import {startDialysis,PostModifyStartDialysis,GetSchedualNumber} from '@/api/dialysis'
81
+  import {Toast} from 'vant'
82
+  import {parseTime} from '@/utils'
83
+
84
+  import TwoMenu from './TwoMenu'
85
+
86
+  export default {
87
+    name: 'ComputerDialog',
88
+    components: {
89
+      TwoMenu
147 90
     },
148
-    device_number_map: {
149
-      type: Object
91
+    data () {
92
+      return {
93
+        start_time: new Date(),
94
+        selecting: false,
95
+        start_time_str: '',
96
+        bed_id: 0,
97
+        nurse_id: 0,
98
+        puncture_nurse_id: 0,
99
+        isPremission: false,
100
+        zone_beds: [], // 该排班的区里的床位
101
+        creator: 0,
102
+        template_id: 0,
103
+        blood_drawing:100,
104
+        schedual_type:0,
105
+        schedules_type: [
106
+          {id: 1, name:"上午"},
107
+          {id: 2, name:"下午"},
108
+          {id: 3, name:"晚上"},
109
+        ], // 该排班的区里的床位
110
+      }
150 111
     },
151
-    special_premission: {
152
-      type: Array
153
-    }
154
-  },
155
-  mounted() {
156
-    if (this.record.id == 0) {
157
-      this.start_time_str =
158
-        parseTime(this.start_time, "{y}-{m}-{d} {h}:{i}") + ":00";
159
-    } else {
160
-      if (this.record.start_time == 0) {
161
-        this.start_time_str =
162
-          parseTime(this.start_time, "{y}-{m}-{d} {h}:{i}") + ":00";
112
+    props: {
113
+      schedule: {
114
+        type: Object,
115
+      },
116
+      patient_prop: {
117
+        type: Object,
118
+      },
119
+      record: {
120
+        type: Object,
121
+      },
122
+      admins: {
123
+        type: Array,
124
+      },
125
+      device_numbers: {
126
+        type: Array,
127
+      },
128
+      admin_map: {
129
+        type: Object,
130
+      },
131
+      device_number_map: {
132
+        type: Object,
133
+      },
134
+      special_premission: {
135
+        type: Array,
136
+      },
137
+    }, mounted () {
138
+
139
+      if (this.record.id == 0) {
140
+        this.start_time_str = parseTime(this.start_time, '{y}-{m}-{d} {h}:{i}') + ':00'
163 141
       } else {
164
-        this.start_time_str =
165
-          parseTime(this.record.start_time, "{y}-{m}-{d} {h}:{i}") + ":00";
166
-      }
167
-    }
168
-  },
169
-  created() {
170
-    this.template_id = this.$store.getters.user.template_info.template_id;
171
-    var date = this.$route.query && this.$route.query.date;
172
-    date *= 1000;
173
-    var newDate = new Date(date);
174
-    var y = newDate.getFullYear();
175
-    var m = newDate.getMonth() + 1;
176
-    var d = newDate.getDate();
177
-    if (isNaN(y) || isNaN(m) || isNaN(d)) {
178
-      newDate = new Date();
179
-      y = newDate.getFullYear();
180
-      m = newDate.getMonth() + 1;
181
-      d = newDate.getDate();
182
-    }
183
-    this.record_date =
184
-      y + "-" + (m < 10 ? "0" + m : m) + "-" + (d < 10 ? "0" + d : d);
185
-
186
-    this.bed_id =
187
-      this.record == null || this.record.id == ""
188
-        ? this.schedule.bed_id
189
-        : this.record.bed_id;
190
-    this.nurse_id =
191
-      this.record == null || this.record.id == ""
192
-        ? this.$store.getters.user.user.id
193
-        : this.record.start_nurse;
194
-    this.puncture_nurse_id =
195
-      this.record == null || this.record.id == ""
196
-        ? this.$store.getters.user.user.id
197
-        : this.record.puncture_nurse;
198
-
199
-    if (this.puncture_nurse_id == 0) {
200
-      this.puncture_nurse_id = this.$store.getters.user.user.id;
201
-    }
142
+        if (this.record.start_time == 0) {
143
+          this.start_time_str = parseTime(this.start_time, '{y}-{m}-{d} {h}:{i}') + ':00'
202 144
 
203
-    // var beds = []
204
-    // for (let index = 0; index < this.device_numbers.length; index++) {
205
-    //   const device_number = this.device_numbers[index]
206
-    //   if (device_number.zone_id == this.schedule.partition_id) {
207
-    //     beds.push(device_number)
208
-    //   }
209
-    // }
210
-    // this.zone_beds = beds
211
-
212
-    for (let index = 0; index < this.device_numbers.length; index++) {
213
-      const device_number = this.device_numbers[index];
214
-      this.device_numbers[index]["number"] =
215
-        device_number["zone_name"] + "-" + device_number["number"];
216
-    }
217
-    this.zone_beds = this.device_numbers;
218
-
219
-    if (this.record.id > 0) {
220
-      for (let i = 0; i < this.special_premission.length; i++) {
221
-        if (
222
-          this.$store.getters.user.user.id ==
223
-          this.special_premission[i].admin_user_id
224
-        ) {
225
-          this.isPremission = true;
145
+        } else {
146
+          this.start_time_str = parseTime(this.record.start_time, '{y}-{m}-{d} {h}:{i}') + ':00'
226 147
         }
227 148
       }
228
-    }
149
+    },
150
+    created () {
151
+      let now = new Date()
152
+      let hour = now.getHours()
229 153
 
230
-    if (this.record.id > 0) {
231
-      if (this.record.creator == 0) {
232
-        this.creator = this.record.start_nurse;
233
-      } else {
234
-        this.creator = this.record.creator;
154
+      if (hour >= 6 && hour < 12){
155
+        this.schedual_type = 1
156
+
157
+      }else if(hour >= 12 && hour < 18){
158
+
159
+        this.schedual_type = 2
160
+
161
+
162
+      }else if(hour >= 18){
163
+        this.schedual_type = 3
235 164
       }
236
-    }
237
-  },
238
-  methods: {
239
-    inputFocus: function(event) {
240
-      var input = event.target;
241
-      setTimeout(function() {
242
-        input.scrollIntoView();
243
-      }, 0);
244
-
245
-      if (input.setSelectionRange) {
246
-        setTimeout(function() {
247
-          input.setSelectionRange(0, input.value.length);
248
-        }, 0);
249
-      } else if (input.createTextRange) {
250
-        var rng = input.createTextRange();
251
-        rng.move("character", input.value.length);
252
-        rng.select();
165
+
166
+
167
+      this.GetSchedualNumber()
168
+
169
+      this.template_id = this.$store.getters.user.template_info.template_id;
170
+      var date = this.$route.query && this.$route.query.date
171
+      date *= 1000
172
+      var newDate = new Date(date)
173
+      var y = newDate.getFullYear()
174
+      var m = newDate.getMonth() + 1
175
+      var d = newDate.getDate()
176
+      if (isNaN(y) || isNaN(m) || isNaN(d)) {
177
+        newDate = new Date()
178
+        y = newDate.getFullYear()
179
+        m = newDate.getMonth() + 1
180
+        d = newDate.getDate()
253 181
       }
254
-    },
255
-    modify() {
256
-      let ParamsQuery = {};
257
-      ParamsQuery["id"] = this.record.id;
258
-      ParamsQuery["nurse"] = this.nurse_id;
259
-      ParamsQuery["bed"] = this.bed_id;
260
-      ParamsQuery["start_time"] = this.start_time_str;
261
-      ParamsQuery["puncture_nurse"] = this.puncture_nurse_id;
262
-      PostModifyStartDialysis(ParamsQuery).then(response => {
263
-        if (response.data.state == 0) {
264
-          Toast.fail(response.data.msg);
265
-          return false;
266
-        } else {
267
-          Toast.success("修改成功");
268
-          this.$emit("did_start", response.data.data.dialysis_order);
269
-          var record = this.record;
270
-          for (const key in response.data.data.dialysis_order) {
271
-            this.$set(record, key, response.data.data.dialysis_order[key]);
182
+      this.record_date = y + '-' + (m < 10 ? '0' + m : m) + '-' + (d < 10 ? '0' + d : d)
183
+
184
+      this.bed_id = (this.record == null || this.record.id == '') ? this.schedule.bed_id : this.record.bed_id
185
+      this.nurse_id = (this.record == null || this.record.id == '') ? this.$store.getters.user.user.id : this.record.start_nurse
186
+      this.puncture_nurse_id = (this.record == null || this.record.id == '') ? this.$store.getters.user.user.id : this.record.puncture_nurse
187
+
188
+      if (this.puncture_nurse_id == 0) {
189
+        this.puncture_nurse_id = this.$store.getters.user.user.id
190
+      }
191
+
192
+      // var beds = []
193
+      // for (let index = 0; index < this.device_numbers.length; index++) {
194
+      //   const device_number = this.device_numbers[index]
195
+      //   if (device_number.zone_id == this.schedule.partition_id) {
196
+      //     beds.push(device_number)
197
+      //   }
198
+      // }
199
+      // this.zone_beds = beds
200
+
201
+      for (let index = 0; index < this.device_numbers.length; index++) {
202
+        const device_number = this.device_numbers[index]
203
+        this.device_numbers[index]['number'] = device_number['zone_name']+'-'+device_number['number']
204
+      }
205
+      this.zone_beds = this.device_numbers
206
+
207
+      if (this.record.id > 0) {
208
+        for (let i = 0; i < this.special_premission.length; i++) {
209
+          if (this.$store.getters.user.user.id == this.special_premission[i].admin_user_id) {
210
+            this.isPremission = true
272 211
           }
273 212
         }
274
-      });
275
-    },
276
-    didSelectStartTime: function(time) {
277
-      this.start_time_str = parseTime(time, "{y}-{m}-{d} {h}:{i}") + ":00";
278
-    },
279
-    selectStartTimeAction: function() {
280
-      if (this.record.id != 0) {
281
-        var creator = 0;
282
-        if (this.record.creator == 0) {
283
-          creator = this.record.start_nurse;
284
-        } else {
285
-          creator = this.record.creator;
286
-        }
213
+      }
287 214
 
288
-        if (this.$store.getters.user.user.id == creator || this.isPremission) {
289
-          this.$refs.start_time_picker.open();
215
+      if (this.record.id > 0) {
216
+        if (this.record.creator == 0) {
217
+          this.creator = this.record.start_nurse
290 218
         } else {
291
-          return;
219
+          this.creator = this.record.creator
292 220
         }
293 221
       }
294
-      this.$refs.start_time_picker.open();
222
+
223
+
224
+
295 225
     },
296
-    commitInfo: function() {
297
-      Toast.loading({ forbidClick: true, duration: 0 });
298
-      let ParamsQuery = {};
299
-      ParamsQuery["patient_id"] = this.patient_prop.id;
300
-      ParamsQuery["record_date"] = this.record_date;
301
-      ParamsQuery["nurse"] = this.nurse_id;
302
-      ParamsQuery["bed"] = this.bed_id;
303
-      ParamsQuery["start_time"] = this.start_time_str;
304
-      ParamsQuery["puncture_nurse"] = this.puncture_nurse_id;
305
-      ParamsQuery["blood_drawing"] = this.blood_drawing;
306
-
307
-      startDialysis(ParamsQuery).then(response => {
308
-        if (response.data.state == 0) {
309
-          Toast.fail(response.data.msg);
310
-          return false;
311
-        } else {
312
-          Toast.success("上机成功");
313
-          var monitor = response.data.data.monitor;
314
-          this.$emit("did_add_monitor", monitor);
315
-          this.$emit("did_start", response.data.data.dialysis_order);
316
-          var record = this.record;
317
-          for (const key in response.data.data.dialysis_order) {
318
-            this.$set(record, key, response.data.data.dialysis_order[key]);
319
-            // this.record[key] = response.data.data.dialysis_order[key]
226
+    methods: {
227
+      getSchedualType:function(type){
228
+        for (let i = 0; i < this.schedules_type.length; i++){
229
+          if(this.schedules_type[i].id == type){
230
+            return  this.schedules_type[i].name
320 231
           }
321 232
         }
322
-      });
323
-    },
324
-    close: function() {
325
-      this.$emit("close");
326
-    },
327
-    select_bed: function() {
328
-      if (this.record.id != 0) {
329
-        var creator = 0;
330
-        if (this.record.creator == 0) {
331
-          creator = this.record.start_nurse;
332
-        } else {
333
-          creator = this.record.creator;
233
+      },
234
+      select_type:function(){
235
+        if (this.record.id != 0) {
236
+          var creator = 0
237
+          if (this.record.creator == 0) {
238
+            creator = this.record.start_nurse
239
+          } else {
240
+            creator = this.record.creator
241
+          }
242
+
243
+          if (this.$store.getters.user.user.id == creator || this.isPremission) {
244
+            this.selecting = true
245
+            var t = this
246
+            this.$refs.selector.showSingleSelect(this.schedules_type, this.schedual_type, '选择班次', 'name', 'id', function (select_id) {
247
+              t.schedual_type = select_id
248
+
249
+              let ParamsQuery = {}
250
+              ParamsQuery['schedual_type'] = select_id
251
+              GetSchedualNumber(ParamsQuery).then(response => {
252
+                if (response.data.state == 0) {
253
+                  Toast.fail(response.data.msg)
254
+                  return false
255
+                } else {
256
+                  t.device_numbers = response.data.data.number
257
+                  for (let index = 0; index < t.device_numbers.length; index++) {
258
+                    const device_number = t.device_numbers[index]
259
+                    t.device_numbers[index]['number'] = device_number['zone_name']+'-'+device_number['number']
260
+                  }
261
+                  t.zone_beds = t.device_numbers
262
+                  t.bed_id = t.zone_beds[0].id
263
+                }
264
+              })
265
+            }, function () {
266
+              t.selecting = false
267
+            })
268
+          } else {
269
+            return
270
+          }
334 271
         }
272
+        this.selecting = true
273
+        var t = this
274
+        this.$refs.selector.showSingleSelect(this.schedules_type, this.schedual_type, '选择班次', 'name', 'id', function (select_id) {
275
+          t.schedual_type = select_id
276
+          let ParamsQuery = {}
277
+          ParamsQuery['schedual_type'] = select_id
278
+          GetSchedualNumber(ParamsQuery).then(response => {
279
+            if (response.data.state == 0) {
280
+              Toast.fail(response.data.msg)
281
+              return false
282
+            } else {
283
+              t.zone_beds = []
284
+              t.device_numbers = response.data.data.number
285
+              for (let index = 0; index < t.device_numbers.length; index++) {
286
+                const device_number = t.device_numbers[index]
287
+                t.device_numbers[index]['number'] = device_number['zone_name']+'-'+device_number['number']
288
+              }
289
+              t.zone_beds = t.device_numbers
290
+              t.bed_id = t.zone_beds[0].id
291
+
335 292
 
336
-        if (this.$store.getters.user.user.id == creator || this.isPremission) {
337
-          this.selecting = true;
338
-          var t = this;
339
-          this.$refs.selector.showSingleSelect(
340
-            this.zone_beds,
341
-            this.bed_id,
342
-            "选择床位号",
343
-            "number",
344
-            "id",
345
-            function(select_id) {
346
-              t.bed_id = select_id;
347
-            },
348
-            function() {
349
-              t.selecting = false;
350 293
             }
351
-          );
352
-        } else {
353
-          return;
354
-        }
355
-      }
294
+          })
295
+        }, function () {
296
+          t.selecting = false
297
+        })
356 298
 
357
-      this.selecting = true;
358
-      var t = this;
359
-      this.$refs.selector.showSingleSelect(
360
-        this.zone_beds,
361
-        this.bed_id,
362
-        "选择床位号",
363
-        "number",
364
-        "id",
365
-        function(select_id) {
366
-          t.bed_id = select_id;
367
-        },
368
-        function() {
369
-          t.selecting = false;
370
-        }
371
-      );
372
-    },
373
-    select_nurse: function() {
374
-      if (this.record.id != 0) {
375
-        var creator = 0;
376
-        if (this.record.creator == 0) {
377
-          creator = this.record.start_nurse;
378
-        } else {
379
-          creator = this.record.creator;
380
-        }
381
-        if (this.$store.getters.user.user.id == creator || this.isPremission) {
382
-          this.selecting = true;
383
-          var t = this;
384
-          this.$refs.selector.showSingleSelect(
385
-            this.admins,
386
-            this.nurse_id,
387
-            "选择上机护士",
388
-            "name",
389
-            "id",
390
-            function(select_id) {
391
-              t.nurse_id = select_id;
392
-            },
393
-            function() {
394
-              t.selecting = false;
299
+      },
300
+      GetSchedualNumber:function(){
301
+        let ParamsQuery = {}
302
+        ParamsQuery['schedual_type'] = this.schedual_type
303
+        GetSchedualNumber(ParamsQuery).then(response => {
304
+          if (response.data.state == 0) {
305
+            Toast.fail(response.data.msg)
306
+            return false
307
+          } else {
308
+            this.device_numbers = response.data.data.number
309
+            for (let index = 0; index < this.device_numbers.length; index++) {
310
+              const device_number = this.device_numbers[index]
311
+              this.device_numbers[index]['number'] = device_number['zone_name']+'-'+device_number['number']
395 312
             }
396
-          );
397
-        } else {
398
-          return;
399
-        }
400
-      }
401
-      this.selecting = true;
402
-      var t = this;
403
-      this.$refs.selector.showSingleSelect(
404
-        this.admins,
405
-        this.nurse_id,
406
-        "选择上机护士",
407
-        "name",
408
-        "id",
409
-        function(select_id) {
410
-          t.nurse_id = select_id;
411
-        },
412
-        function() {
413
-          t.selecting = false;
313
+            this.zone_beds = this.device_numbers
314
+          }
315
+        })
316
+      },
317
+
318
+      inputFocus: function (event) {
319
+        var input = event.target
320
+        setTimeout(function () {
321
+          input.scrollIntoView()
322
+        }, 0)
323
+
324
+        if (input.setSelectionRange) {
325
+          setTimeout(function () {
326
+            input.setSelectionRange(0, input.value.length)
327
+          }, 0)
328
+        } else if (input.createTextRange) {
329
+          var rng = input.createTextRange()
330
+          rng.move('character', input.value.length)
331
+          rng.select()
414 332
         }
415
-      );
416
-    },
417
-    select_puncture_nurse: function() {
418
-      if (this.record.id != 0) {
419
-        var creator = 0;
420
-        if (this.record.creator == 0) {
421
-          creator = this.record.start_nurse;
422
-        } else {
423
-          creator = this.record.creator;
333
+      },
334
+      modify(){
335
+        let ParamsQuery = {}
336
+        ParamsQuery['schedual_type'] = this.schedual_type
337
+        ParamsQuery['id'] = this.record.id
338
+        ParamsQuery['nurse'] = this.nurse_id
339
+        ParamsQuery['bed'] = this.bed_id
340
+        ParamsQuery['start_time'] = this.start_time_str
341
+        ParamsQuery['puncture_nurse'] = this.puncture_nurse_id
342
+        PostModifyStartDialysis(ParamsQuery).then(response => {
343
+          if (response.data.state == 0) {
344
+            Toast.fail(response.data.msg)
345
+            return false
346
+          } else {
347
+            Toast.success('修改成功')
348
+            this.$emit('did_start', response.data.data.dialysis_order)
349
+            var record = this.record
350
+            for (const key in response.data.data.dialysis_order) {
351
+              this.$set(record, key, response.data.data.dialysis_order[key])
352
+            }
353
+          }
354
+        })
355
+      },
356
+      didSelectStartTime: function (time) {
357
+        this.start_time_str = parseTime(time, '{y}-{m}-{d} {h}:{i}') + ':00'
358
+      },
359
+      selectStartTimeAction: function () {
360
+        if (this.record.id != 0) {
361
+          var creator = 0
362
+          if (this.record.creator == 0) {
363
+            creator = this.record.start_nurse
364
+          } else {
365
+            creator = this.record.creator
366
+          }
367
+
368
+          if (this.$store.getters.user.user.id == creator || this.isPremission) {
369
+            this.$refs.start_time_picker.open()
370
+          } else {
371
+            return
372
+          }
424 373
         }
425
-        if (this.$store.getters.user.user.id == creator || this.isPremission) {
426
-          this.selecting = true;
427
-          var t = this;
428
-          this.$refs.selector.showSingleSelect(
429
-            this.admins,
430
-            this.puncture_nurse_id,
431
-            "选择穿刺护士",
432
-            "name",
433
-            "id",
434
-            function(select_id) {
435
-              t.puncture_nurse_id = select_id;
436
-            },
437
-            function() {
438
-              t.selecting = false;
374
+        this.$refs.start_time_picker.open()
375
+      },
376
+      commitInfo: function () {
377
+        Toast.loading({forbidClick: true, duration: 0})
378
+        let ParamsQuery = {}
379
+        ParamsQuery['schedual_type'] = this.schedual_type
380
+        ParamsQuery['patient_id'] = this.patient_prop.id
381
+        ParamsQuery['record_date'] = this.record_date
382
+        ParamsQuery['nurse'] = this.nurse_id
383
+        ParamsQuery['bed'] = this.bed_id
384
+        ParamsQuery['start_time'] = this.start_time_str
385
+        ParamsQuery['puncture_nurse'] = this.puncture_nurse_id
386
+        ParamsQuery['blood_drawing'] = this.blood_drawing
387
+
388
+        startDialysis(ParamsQuery).then(response => {
389
+          if (response.data.state == 0) {
390
+            Toast.fail(response.data.msg)
391
+            return false
392
+          } else {
393
+            Toast.success('上机成功')
394
+            var monitor = response.data.data.monitor
395
+            this.$emit('did_add_monitor', monitor)
396
+            this.$emit('did_start', response.data.data.dialysis_order)
397
+            var record = this.record
398
+            for (const key in response.data.data.dialysis_order) {
399
+              this.$set(record, key, response.data.data.dialysis_order[key])
400
+              // this.record[key] = response.data.data.dialysis_order[key]
439 401
             }
440
-          );
441
-        } else {
442
-          return;
402
+          }
403
+        })
404
+      },
405
+      close: function () {
406
+        this.$emit('close')
407
+      },
408
+      select_bed: function () {
409
+        if (this.record.id != 0) {
410
+          var creator = 0
411
+          if (this.record.creator == 0) {
412
+            creator = this.record.start_nurse
413
+          } else {
414
+            creator = this.record.creator
415
+          }
416
+
417
+          if (this.$store.getters.user.user.id == creator || this.isPremission) {
418
+            this.selecting = true
419
+            var t = this
420
+            this.$refs.selector.showSingleSelect(this.zone_beds, this.bed_id, '选择床位号', 'number', 'id', function (select_id) {
421
+              t.bed_id = select_id
422
+            }, function () {
423
+              t.selecting = false
424
+            })
425
+          } else {
426
+            return
427
+          }
443 428
         }
444
-      }
445
-      this.selecting = true;
446
-      var t = this;
447
-      this.$refs.selector.showSingleSelect(
448
-        this.admins,
449
-        this.puncture_nurse_id,
450
-        "选择穿刺护士",
451
-        "name",
452
-        "id",
453
-        function(select_id) {
454
-          t.puncture_nurse_id = select_id;
455
-        },
456
-        function() {
457
-          t.selecting = false;
429
+
430
+        this.selecting = true
431
+        var t = this
432
+        this.$refs.selector.showSingleSelect(this.zone_beds, this.bed_id, '选择床位号', 'number', 'id', function (select_id) {
433
+          t.bed_id = select_id
434
+        }, function () {
435
+          t.selecting = false
436
+        })
437
+      },
438
+      select_nurse: function () {
439
+        if (this.record.id != 0) {
440
+          var creator = 0
441
+          if (this.record.creator == 0) {
442
+            creator = this.record.start_nurse
443
+          } else {
444
+            creator = this.record.creator
445
+          }
446
+          if (this.$store.getters.user.user.id == creator || this.isPremission) {
447
+            this.selecting = true
448
+            var t = this
449
+            this.$refs.selector.showSingleSelect(this.admins, this.nurse_id, '选择上机护士', 'name', 'id', function (select_id) {
450
+              t.nurse_id = select_id
451
+            }, function () {
452
+              t.selecting = false
453
+            })
454
+          } else {
455
+            return
456
+          }
458 457
         }
459
-      );
460
-    },
461
-    open: function() {
462
-      this.selecting = false;
463
-      this.$refs.selector.hide();
464
-    }
465
-  },
466
-  watch: {
467
-    "record.id": function(val) {
468
-      if (val > 0) {
469
-        for (let i = 0; i < this.special_premission.length; i++) {
470
-          if (
471
-            this.$store.getters.user.user.id ==
472
-            this.special_premission[i].admin_user_id
473
-          ) {
474
-            this.isPremission = true;
458
+        this.selecting = true
459
+        var t = this
460
+        this.$refs.selector.showSingleSelect(this.admins, this.nurse_id, '选择上机护士', 'name', 'id', function (select_id) {
461
+          t.nurse_id = select_id
462
+        }, function () {
463
+          t.selecting = false
464
+        })
465
+      }, select_puncture_nurse: function () {
466
+        if (this.record.id != 0) {
467
+          var creator = 0
468
+          if (this.record.creator == 0) {
469
+            creator = this.record.start_nurse
470
+          } else {
471
+            creator = this.record.creator
472
+          }
473
+          if (this.$store.getters.user.user.id == creator || this.isPremission) {
474
+            this.selecting = true
475
+            var t = this
476
+            this.$refs.selector.showSingleSelect(this.admins, this.puncture_nurse_id, '选择穿刺护士', 'name', 'id', function (select_id) {
477
+              t.puncture_nurse_id = select_id
478
+            }, function () {
479
+              t.selecting = false
480
+            })
481
+          } else {
482
+            return
475 483
           }
476 484
         }
477
-        if (this.record.creator == 0) {
478
-          this.creator = this.record.start_nurse;
479
-        } else {
480
-          this.creator = this.record.creator;
485
+        this.selecting = true
486
+        var t = this
487
+        this.$refs.selector.showSingleSelect(this.admins, this.puncture_nurse_id, '选择穿刺护士', 'name', 'id', function (select_id) {
488
+          t.puncture_nurse_id = select_id
489
+        }, function () {
490
+          t.selecting = false
491
+        })
492
+      },
493
+      open: function () {
494
+        this.selecting = false
495
+        this.$refs.selector.hide()
496
+      }
497
+    }, watch: {
498
+      'record.id': function (val) {
499
+        if (val > 0) {
500
+          for (let i = 0; i < this.special_premission.length; i++) {
501
+            if (this.$store.getters.user.user.id == this.special_premission[i].admin_user_id) {
502
+              this.isPremission = true
503
+            }
504
+          }
505
+          if (this.record.creator == 0) {
506
+            this.creator = this.record.start_nurse
507
+          } else {
508
+            this.creator = this.record.creator
509
+          }
510
+
511
+
481 512
         }
482 513
       }
514
+
483 515
     }
516
+
484 517
   }
485
-};
486 518
 </script>
487 519
 
488 520
 <style style="stylesheet/scss" lang="scss" scoped>

+ 7 - 1
src/pages/main/dialog/TwoMenu.vue 파일 보기

@@ -86,6 +86,11 @@ export default {
86 86
     };
87 87
   },
88 88
   methods: {
89
+    initSignleSelect(){
90
+
91
+
92
+    },
93
+
89 94
     showSingleSelect(
90 95
       list_options,
91 96
       current_select_id,
@@ -95,6 +100,8 @@ export default {
95 100
       handle_select,
96 101
       handle_hide
97 102
     ) {
103
+      console.log(this.single.cur_id);
104
+
98 105
       this.show = true;
99 106
       this.type = 1;
100 107
       this.title = title;
@@ -104,7 +111,6 @@ export default {
104 111
       this.single.id_key = id_key;
105 112
       this.handle_select = handle_select;
106 113
       this.handle_hide = handle_hide;
107
-      console.log(this.single.cur_id);
108 114
     },
109 115
     // showMutableSelect(list_options, selected_values, title, show_key, id_key, handle_select) {
110 116
     //   this.show = true

+ 1 - 2
src/pages/main/dialog/subMenu/MsgTip.vue 파일 보기

@@ -8,8 +8,7 @@
8 8
         {{ patient_prop.name }} [透析号 {{ patient_prop.dialysis_no }} ]
9 9
       </h1>
10 10
       <span @click="comfirm" class="success" style="visibility: hidden;"
11
-        >确定</span
12
-      >
11
+        >确定</span>
13 12
     </div>
14 13
 
15 14
     <div class="DialogContent">

+ 207 - 5
src/pages/main/today/TodayTab.vue 파일 보기

@@ -73,7 +73,7 @@
73 73
 
74 74
 
75 75
     <accepts-assessment id="accepts_assessment" :record="receiver_treatment_access" title="接诊评估"></accepts-assessment>
76
-    
76
+
77 77
 
78 78
 
79 79
     <div class="blueBorder"></div>
@@ -1143,7 +1143,7 @@ import {parseTime} from '@/utils'
1143 1143
     },
1144 1144
     prescriptionFunc: function (val, advices) {
1145 1145
       this.prescription = val
1146
-      this.requestDialysisRecord()
1146
+      this.newRequestDialysisRecord()
1147 1147
       // if (advices.length > 0){
1148 1148
       //
1149 1149
       //   // if (advices.length > 0) {
@@ -1294,7 +1294,7 @@ import {parseTime} from '@/utils'
1294 1294
     update_evaluation: function (evaluation) {
1295 1295
       this.predialysis_evaluation = evaluation
1296 1296
       this.closeAssessmentBefore()
1297
-      this.requestDialysisRecord()
1297
+      this.newRequestDialysisRecord()
1298 1298
     },
1299 1299
 
1300 1300
     closeStatOrder: function () {
@@ -1305,7 +1305,7 @@ import {parseTime} from '@/utils'
1305 1305
     closeDialysisComputer: function (dialysis_order) {
1306 1306
       this.closeDialog(0)
1307 1307
       this.dialysis_order = dialysis_order
1308
-      this.requestDialysisRecord()
1308
+      this.newRequestDialysisRecord()
1309 1309
       // this.scrollToView('dialysis_computer')
1310 1310
     },
1311 1311
     closeDialysisComputerclose: function (dialysis_order) {
@@ -1434,7 +1434,209 @@ import {parseTime} from '@/utils'
1434 1434
       var diff = Math.abs(firstDate.getTime() - secondDate.getTime())
1435 1435
       var result = parseInt(diff / (1000 * 60 * 60 * 24))
1436 1436
       return result
1437
-    }
1437
+    }, newRequestDialysisRecord () {
1438
+      var dateStr = parseTime(this.date, '{y}-{m}-{d}')
1439
+      var params = {
1440
+        patient_id: this.patient_id,
1441
+        date: dateStr
1442
+      }
1443
+      this.advice_groups = []
1444
+      this.doctor_advices = []
1445
+
1446
+      getDialysisRecord(params).then(rs => {
1447
+        var resp = rs.data
1448
+        console.log(resp)
1449
+
1450
+        if (resp.state == 1) {
1451
+          var waitstoredata = this.$store.getters.waitscheduals
1452
+          var waitscheduals = waitstoredata.waitscheduals
1453
+          var storedata = this.$store.getters.scheduals
1454
+          var scheduals = storedata.scheduals
1455
+
1456
+
1457
+          var patient = resp.data.patient // 患者信息
1458
+          var schedual = resp.data.schedual // 患者排班信息
1459
+          var prescription = resp.data.prescription // 透析处方
1460
+          var solution = resp.data.solution // 透析方案
1461
+          var receiver_treatment_access = resp.data.receiver_treatment_access // 接诊评估
1462
+          var predialysis_evaluation = resp.data.predialysis_evaluation // 透前评估
1463
+          var doctor_advices = resp.data.doctor_advices // 临时医嘱
1464
+          var last_prescription = resp.data.last_prescription
1465
+
1466
+          this.dryWeight = resp.data.dry_weight
1467
+
1468
+          if (prescription == null || prescription.creater == 0) {
1469
+            this.isPullData = 1
1470
+          } else {
1471
+            this.isPullData = 2
1472
+          }
1473
+
1474
+          this.goodInfos = resp.data.goodInfos
1475
+
1476
+          for (let i = 0; i < doctor_advices.length; i++) {
1477
+            doctor_advices[i]['is_selected'] = 0
1478
+          }
1479
+          console.log(doctor_advices)
1480
+
1481
+          var double_check = resp.data.double_check // 双人核对
1482
+          var assessment_after_dislysis = resp.data.assessment_after_dislysis // 透后评估
1483
+          var treatment_summary = resp.data.treatment_summary // 治疗小结
1484
+          var monitor_records = resp.data.monitor_records // 透析监测
1485
+          var dialysis_order = resp.data.dialysis_order // 透析记录
1486
+          var operators = resp.data.operators // 操作人
1487
+
1488
+          var special_premission = resp.data.special_premission // 特殊权限
1489
+
1490
+          var config = resp.data.config // 库存自动扣减配置
1491
+
1492
+          var types = resp.data.types // 所有系统库存商品类型
1493
+
1494
+          var last_predialysis_evaluation = resp.data.last_predialysis_evaluation // 上一次透前评估
1495
+          var last_assessment_after_dislysis = resp.data.last_assessment_after_dislysis // 上一次透前评估
1496
+          var last_monitor_record = resp.data.last_monitor_record
1497
+
1498
+          if (Object.keys(waitstoredata).length > 0) {
1499
+            for (let index = 0; index < waitscheduals.length; index++) {
1500
+              if (waitscheduals[index].patient_id == patient.id) {
1501
+                waitscheduals[index].patient = patient
1502
+                waitscheduals[index].assessment_before_dislysis = predialysis_evaluation
1503
+                waitscheduals[index].prescription = prescription
1504
+                waitscheduals[index].doctor_advice = doctor_advices
1505
+                waitscheduals[index].dialysis_order = dialysis_order
1506
+              }
1507
+            }
1508
+            this.$store.dispatch('SetWaitScheduals', {waitscheduals: waitscheduals})
1509
+          }
1510
+
1511
+          if (Object.keys(storedata).length > 0) {
1512
+            for (let index = 0; index < scheduals.length; index++) {
1513
+              if (scheduals[index].patient_id == patient.id) {
1514
+                scheduals[index].patient = patient
1515
+                scheduals[index].assessment_before_dislysis = predialysis_evaluation
1516
+                scheduals[index].prescription = prescription
1517
+                scheduals[index].doctor_advice = doctor_advices
1518
+                scheduals[index].dialysis_order = dialysis_order
1519
+              }
1520
+            }
1521
+            this.$store.dispatch('SetScheduals', {scheduals: scheduals})
1522
+          }
1523
+
1524
+          this.patient = patient
1525
+          this.schedual = schedual == null ? {} : schedual
1526
+          this.prescription = prescription == null ? {id: ''} : prescription
1527
+          this.solution = solution == null ? {id: ''} : solution
1528
+          this.last_prescription = last_prescription == null ? {id: ''} : last_prescription
1529
+
1530
+
1531
+
1532
+          this.receiver_treatment_access =
1533
+            receiver_treatment_access == null
1534
+              ? {id: ''}
1535
+              : receiver_treatment_access
1536
+          this.predialysis_evaluation =
1537
+            predialysis_evaluation == null ? {} : predialysis_evaluation
1538
+          this.last_predialysis_evaluation =
1539
+            last_predialysis_evaluation == null
1540
+              ? {}
1541
+              : last_predialysis_evaluation
1542
+
1543
+          this.doctor_advices = doctor_advices == null ? [] : doctor_advices
1544
+          this.special_premission = special_premission
1545
+          this.config = config
1546
+          this.goodTypes = types
1547
+
1548
+
1549
+          if (this.doctor_advices.length > 0) {
1550
+            var group = this.newAdviceGroupObject()
1551
+            var initGroupBlock = function (group, advice) {
1552
+              group.group_no = advice.groupno
1553
+              // group.start_time = advice.start_time
1554
+              // group.advice_doctor = advice.advice_doctor
1555
+              // group.exec_staff = advice.execution_staff
1556
+              // group.exec_time = advice.execution_time
1557
+              // group.checker = advice.checker
1558
+            }
1559
+            for (let index = 0; index < this.doctor_advices.length; index++) {
1560
+              const advice = this.doctor_advices[index]
1561
+              if (advice.groupno == 0) {
1562
+                // 老版本的医嘱没有分组的概念,所以这一个 if 是解决这个问题的,将每个无分组的医嘱各自归为一组
1563
+                if (advice.parent_id > 0) {
1564
+                  if (this.advice_groups.length > 0) {
1565
+                    var parent_group = this.advice_groups[
1566
+                    this.advice_groups.length - 1
1567
+                      ]
1568
+                    if (parent_group.advices.length > 0) {
1569
+                      if (parent_group.advices[0].id == advice.parent_id) {
1570
+                        parent_group.advices.push(advice)
1571
+                      }
1572
+                    }
1573
+                  }
1574
+                  continue
1575
+                } else {
1576
+                  if (group.group_no > 0) {
1577
+                    this.advice_groups.push(group)
1578
+                    group = this.newAdviceGroupObject()
1579
+                  }
1580
+
1581
+                  initGroupBlock(group, advice)
1582
+                  group.advices.push(advice)
1583
+                  this.advice_groups.push(group)
1584
+                  group = this.newAdviceGroupObject()
1585
+                  continue
1586
+                }
1587
+              }
1588
+
1589
+              if (group.group_no > 0 && group.group_no != advice.groupno) {
1590
+                this.advice_groups.push(group)
1591
+                group = this.newAdviceGroupObject()
1592
+              }
1593
+              if (group.group_no == 0) {
1594
+                initGroupBlock(group, advice)
1595
+              }
1596
+              if (group.group_no == advice.groupno) {
1597
+                group.advices.push(advice)
1598
+              }
1599
+            }
1600
+            if (group.group_no > 0) {
1601
+              // 上述的算法会导致最后一组没有加到advice_groups,这里要手动加上
1602
+              this.advice_groups.push(group)
1603
+            }
1604
+
1605
+            // console.log(this.advice_groups)
1606
+          }
1607
+
1608
+          this.double_check = double_check == null ? {id: ''} : double_check
1609
+          this.assessment_after_dislysis =
1610
+            assessment_after_dislysis == null
1611
+              ? {id: ''}
1612
+              : assessment_after_dislysis
1613
+          this.last_assessment_after_dislysis =
1614
+            last_assessment_after_dislysis == null
1615
+              ? {id: ''}
1616
+              : last_assessment_after_dislysis
1617
+          this.treatment_summary =
1618
+            treatment_summary == null ? {id: ''} : treatment_summary
1619
+          this.monitor_records = monitor_records == null ? [] : monitor_records
1620
+          this.last_monitor_record =
1621
+            last_monitor_record == null
1622
+              ? this.last_monitor_record
1623
+              : last_monitor_record
1624
+          this.dialysis_order =
1625
+            dialysis_order == null ? {id: ''} : dialysis_order
1626
+          this.operators = operators
1627
+          this.$refs.stat_order.setAdvices(this.doctor_advices)
1628
+          this.$refs.monitoring.setRecords(this.monitor_records)
1629
+
1630
+          this.title = patient.name
1631
+        } else {
1632
+          this.$toast({
1633
+            message: resp.msg
1634
+          })
1635
+          this.loading = false
1636
+        }
1637
+      })
1638
+    },
1639
+
1438 1640
   }
1439 1641
 }
1440 1642
 </script>