Browse Source

3月23日杨青

杨青 2 years ago
parent
commit
44ba77df2a
2 changed files with 1344 additions and 1475 deletions
  1. 66 192
      src/xt_pages/workforce/components/editTableData.vue
  2. 1278 1283
      src/xt_pages/workforce/components/tableData.vue

+ 66 - 192
src/xt_pages/workforce/components/editTableData.vue View File

@@ -1,25 +1,17 @@
1 1
 <template>
2
-  <!-- 编辑排班 -->
3
-  <div id="edit_table_data" v-show="schedulingTableVisible" >
4
-    <slot></slot>
5
-    <div class="table_contain"
6
-        v-if="
2
+  <!-- <div> -->
7 3
   <!-- 编辑排班 -->
8 4
   <div id="edit_table_data" v-show="schedulingTableVisible" >
9 5
     <slot></slot>
10 6
     <div class="table_contain">
11 7
       <!-- 左侧 -->
12 8
       <div class="left_contain">
13
-        <div
14
-            class="cell clearfix"
9
+        <div class="cell clearfix"
15 10
             v-if="
16 11
             weekTime == 'thisWeek' ||
17 12
             weekTime == 'nextWeek' ||
18 13
             weekTime == 'nextTwoWeek'
19 14
           ">
20
-      <!-- 左侧 -->
21
-      <div class="left_contain">
22
-        <div class="cell clearfix">
23 15
           <el-input
24 16
               size="small"
25 17
               style="width: 160px"
@@ -36,8 +28,6 @@
36 28
               @click="search"
37 29
           >搜索</el-button>
38 30
 
39
-          >搜索</el-button>
40
-
41 31
         </div>
42 32
         <div style="margin-bottom: 10px; display: flex">
43 33
           <h3 style="line-height: 45px">
@@ -215,9 +205,7 @@
215 205
                         scope.row.index,
216 206
                         scope.row.Mon_M,
217 207
                         scope.row
218
-                      )"
219
-
220
-                  >
208
+                      )" >
221 209
                   </schedule-item>
222 210
                 </div>
223 211
               </template>
@@ -1018,7 +1006,6 @@
1018 1006
           </el-table-column>
1019 1007
           <el-table-column
1020 1008
               :label="'周日 (' + weekTitle[6] + ')'"
1021
-
1022 1009
               align="center"
1023 1010
               v-if="isShowSeven"
1024 1011
           >
@@ -1064,13 +1051,7 @@
1064 1051
                         scope.row.index,
1065 1052
                         scope.row.Sun_M,
1066 1053
                         scope.row
1067
-                      )
1068
-                    "
1069
-                    :schedule-detail="scope.row.Sun_M"
1070
-                      class="contitem"
1071
-                      :style="{ cursor: scope.row.Sun_M ? 'move' : 'default' }"
1072
-
1073
-                  >
1054
+                      )">
1074 1055
                     </schedule-item
1075 1056
                   >
1076 1057
                 </div>
@@ -1177,7 +1158,6 @@
1177 1158
         </el-table>
1178 1159
       </div>
1179 1160
     </div>
1180
-
1181 1161
    <!-- 单击排班表格的空白单元格弹窗 -->
1182 1162
     <el-dialog
1183 1163
         title="排班"
@@ -1186,9 +1166,7 @@
1186 1166
         :v-model="dialog"
1187 1167
         v-loading="creating_schedule"
1188 1168
         :modal-append-to-body='false'
1189
-
1190
-        :modal-append-to-body='false'
1191
-
1169
+        :close-on-click-modal="false"
1192 1170
     >
1193 1171
       <div>
1194 1172
         <div class="cell clearfix">
@@ -1708,14 +1686,13 @@
1708 1686
         <el-button @click="tipDialogVisibleThree = false">取 消</el-button>
1709 1687
       </span>
1710 1688
     </el-dialog>
1711
-
1712
-
1713
-  </div>
1689
+    
1690
+</div>
1714 1691
 </template>
1715 1692
 
1716 1693
 <script>
1717 1694
 import { uParseTime } from "@/utils/tools";
1718
-import print from "print-js";
1695
+// import print from "print-js";
1719 1696
 import draggable from "vuedraggable";
1720 1697
 const moment = require("moment");
1721 1698
 import {
@@ -1792,10 +1769,6 @@ export default {
1792 1769
       type: Array,
1793 1770
       dafault: [],
1794 1771
     },
1795
-    // scheduleZoneProp: {
1796
-    //   type: Array,
1797
-    //   dafault: []
1798
-    // },
1799 1772
     partitionsProp: {
1800 1773
       type: Object,
1801 1774
       dafault: {},
@@ -2221,9 +2194,6 @@ export default {
2221 2194
 
2222 2195
           }
2223 2196
         }
2224
-
2225
-
2226
-
2227 2197
       } else {
2228 2198
         for (let i = 0; i < this.weeks.length; i++) {
2229 2199
           this.weeks[i].is_edit = true;
@@ -2764,8 +2734,6 @@ export default {
2764 2734
       }
2765 2735
     },
2766 2736
     getWeekType(date) {
2767
-
2768
-
2769 2737
       let index = 0;
2770 2738
       for (let i = 0; i < this.days.length; i++) {
2771 2739
         if (date == this.days[i]) {
@@ -3068,10 +3036,6 @@ export default {
3068 3036
       }
3069 3037
 
3070 3038
       this.current_all_sch = this.editableTabs
3071
-
3072
-
3073
-
3074
-
3075 3039
     },
3076 3040
     // 左侧的拖拽内容
3077 3041
     curInfoDragStart(){
@@ -3111,7 +3075,6 @@ export default {
3111 3075
       var date = new Date(nowDate + " 00:00:00")
3112 3076
       this.cur_date = date.getTime()/1000
3113 3077
 
3114
-
3115 3078
       this.days = days;
3116 3079
       this.all_zones = zones;
3117 3080
       this.patientList = patients;
@@ -3168,21 +3131,6 @@ export default {
3168 3131
           if(row[key].patient_id > 0){
3169 3132
             this.cur_drag_obj = 2
3170 3133
             var week = this.weekDay(day);
3171
-            this.cur_drag_info={
3172
-              schedule_date : this.weekDays[week[0] - 1],
3173
-              schedule_type : week[1],
3174
-              bed_id : row.jihao_id,
3175
-              partition_id : row.zone_id,
3176
-              schedule_week : week[0],
3177
-              type_name : this.dayType(week[1]),
3178
-              zone_name : row.area,
3179
-              bed_name : row.cut,
3180
-              mode_id : row[key].mode_id,
3181
-              mode_name : row[key].mode_name,
3182
-              patient_name : row[key].patient,
3183
-              patient_id : row[key].patient_id,
3184
-              id : row[key].schedule_id
3185
-            }
3186 3134
             this.cur_drag_info={
3187 3135
               schedule_date : this.weekDays[week[0] - 1],
3188 3136
               schedule_type : week[1],
@@ -3199,8 +3147,6 @@ export default {
3199 3147
               id : row[key].schedule_id,
3200 3148
               contagions: row[key].patient_contagions,
3201 3149
             }
3202
-            console.log( this.cur_drag_info)
3203
-
3204 3150
           }else{
3205 3151
             this.cur_drag_obj = 3
3206 3152
             this.cur_drag_info={
@@ -3287,60 +3233,6 @@ export default {
3287 3233
         }
3288 3234
         console.log('deletePatientMode',row);
3289 3235
     },
3290
-    // 替换
3291
-     // 取消排班
3292
-     CancelSchedule(id) {
3293
-      this.$confirm("确定要取消当前排班?", "提示", {
3294
-        confirmButtonText: "确定",
3295
-        cancelButtonText: "取消",
3296
-        type: "warning",
3297
-      }).then(() => {
3298
-            CancelSchedule(id).then((response) => {
3299
-              if (response.data.state == 0) {
3300
-                this.$message.error(response.data.msg);
3301
-              } else {
3302
-                this.$message({
3303
-                  type: "success",
3304
-                  message: "排班已取消!",
3305
-                });
3306
-                var that = this;
3307
-                var schedule = response.data.data.schedule;
3308
-                this.scheduleZone.forEach(function (zone, index) {
3309
-                  if (
3310
-                      zone.zone_id == schedule.partition_id &&
3311
-                      zone.jihao_id == schedule.bed_id
3312
-                  ) {
3313
-                    var weekPath = that.weekPath(
3314
-                        schedule.schedule_week,
3315
-                        schedule.schedule_type
3316
-                    );
3317
-                    if (weekPath.length == 2) {
3318
-                      var weekPathKey = weekPath[0] + "_" + weekPath[1];
3319
-                      that.scheduleZone[index][weekPathKey] = {
3320
-                        schedule_id: 0,
3321
-                        mode_id: 0,
3322
-                        patient_id: 0,
3323
-                        patient: "",
3324
-                        mode_name: "",
3325
-                        dialysis_machine_name: "",
3326
-                      };
3327
-
3328
-                      that.scheduleZone[index].total -= 1;
3329
-                    }
3330
-                  }
3331
-                });
3332
-              }
3333
-            });
3334
-          })
3335
-          .catch(() => {});
3336
-    },
3337
-    // 删除某一单元格内的患者透析排班
3338
-    deletePatientMode(row) {
3339
-      if (row.schedule_id > 0) {
3340
-        this.CancelSchedule(row.schedule_id);
3341
-      }
3342
-      console.log('deletePatientMode',row);
3343
-    },
3344 3236
     // 替换
3345 3237
     coverSch(){
3346 3238
       this.tipDialogVisible=false
@@ -3378,7 +3270,6 @@ export default {
3378 3270
             this.tipDialogVisible = false
3379 3271
             this.tipDialogVisibleThree = false
3380 3272
             this.getSchedules();
3381
-
3382 3273
           }
3383 3274
         });
3384 3275
     },
@@ -3388,7 +3279,6 @@ export default {
3388 3279
       this.allowDrop(e)
3389 3280
       for (var key in row) {
3390 3281
         if (key == day) {
3391
-          // console.log(this.cur_drag_obj)
3392 3282
           if(this.cur_drag_obj == 3){
3393 3283
             return
3394 3284
           }
@@ -3407,31 +3297,8 @@ export default {
3407 3297
             partition_type : row.zone_type,
3408 3298
           }
3409 3299
           console.log('this.currentData的数据',this.currentData);
3410
-          // console.log('cur_drag_info的数据',this.cur_drag_info);
3411
-          // console.log('row[key]的数据',row[key]);
3412
-          // row[key].patient.length > 0 || row[key].mode_name.length > 0 ||
3413
-          // 当表格有数据
3414
-          if ( row[key].mode_id > 0 || row[key].patient_id > 0) {
3415
-            console.log('row[key]的数据',row[key],this.cur_drag_obj);
3416
-            // 且是表格数据拖拽
3417
-          this.currentData={
3418
-            schedule_date : this.weekDays[week[0] - 1],
3419
-            schedule_type : week[1],
3420
-            bed_id : row.jihao_id,
3421
-            partition_id : row.zone_id,
3422
-            schedule_week : week[0],
3423
-            type_name : this.dayType(week[1]),
3424
-            zone_name : row.area,
3425
-            bed_name : row.cut,
3426
-            id : row[key].schedule_id,
3427
-            partition_type : row.zone_type,
3428
-          }
3429
-          // console.log('cur_drag_info的数据',this.cur_drag_info);
3430
-          // console.log('row[key]的数据',row[key]);
3431
-          // row[key].patient.length > 0 || row[key].mode_name.length > 0 ||
3432 3300
           // 当表格有数据
3433 3301
           if ( row[key].mode_id > 0 || row[key].patient_id > 0) {
3434
-            // console.log('row[key]的数据',row[key],this.cur_drag_obj);
3435 3302
             // 且是表格数据拖拽
3436 3303
             if (this.cur_drag_obj == 2){
3437 3304
               if(row[key].patient_id != this.cur_drag_info.patient_id){
@@ -3441,11 +3308,6 @@ export default {
3441 3308
               }else{
3442 3309
                 this.tipDialogVisible = false
3443 3310
               }
3444
-              if(row[key].patient_id != this.cur_drag_info.patient_id){
3445
-                this.tipDialogVisible = true
3446
-              }else{
3447
-                this.tipDialogVisible = false
3448
-              }
3449 3311
             }else{
3450 3312
               return this.$message.error("当前机号已有排班");
3451 3313
             }
@@ -3455,49 +3317,18 @@ export default {
3455 3317
              if(this.cur_drag_obj == 2){
3456 3318
               if(this.cur_drag_info.schedule_date == this.currentData.schedule_date){ //同一天
3457 3319
                 if(row[key].patient_id == 0) { //空床位
3458
-                  console.log('this.cur_drag_info.id的数据',this.cur_drag_info.id);
3459
-                  CancelScheduleTwo(this.cur_drag_info.id).then((response) => {
3460
-                    console.log('CancelScheduleTwo的数据',response.data.data);
3461
-                    // var response= await CancelScheduleTwo(this.cur_drag_info.id)
3462
-                    if (response.data.state == 0) {
3463
-                      this.$message.error(response.data.msg)
3464
-                    } else {
3465
-                      var that = this;
3466
-                      var schedule = response.data.data.schedule;
3467
-                      this.scheduleZone.forEach(function (zone, index) {
3468
-                        if (
3469
-                          zone.zone_id == schedule.partition_id &&
3470
-                          zone.jihao_id == schedule.bed_id
3471
-                        ) {
3472
-                          var weekPath = that.weekPath(
3473
-                            schedule.schedule_week,
3474
-                            schedule.schedule_type
3475
-                          );
3476
-                          if (weekPath.length == 2) {
3477
-                            var weekPathKey = weekPath[0] + "_" + weekPath[1];
3478
-                            that.scheduleZone[index][weekPathKey] = {
3479
-                              schedule_id: 0,
3480
-                              mode_id: 0,
3481
-                              patient_id: 0,
3482
-                              patient: "",
3483
-                              mode_name: "",
3484
-                              dialysis_machine_name: "",
3485
-                            };
3486
-                            that.scheduleZone[index].total -= 1;
3487
-                          }
3488
-                        }
3489
-                      });
3320
+                      const that = this;
3490 3321
                       //接口提交排班数据
3491
-                      that.currentData.mode_id = that.cur_drag_info.mode_id,
3492
-                      that.currentData.id = 0,
3493
-                      that.currentData.contagions = [],
3494
-                      that.currentData.patient_id = that.cur_drag_info.patient_id,
3495
-                      that.currentData.patient = that.cur_drag_info.patient_name,
3496
-                      that.setSchedule();
3497
-                    }
3498
-                  });
3322
+                      that.currentData.mode_id = that.cur_drag_info.mode_id
3323
+                      that.currentData.id = 0
3324
+                      that.currentData.patient_id = that.cur_drag_info.patient_id
3325
+                      that.currentData.patient = that.cur_drag_info.patient_name
3326
+                       that.currentData.contagions = that.cur_drag_info.contagions
3327
+                        console.log( that.cur_drag_info.contagions)
3328
+
3329
+                        console.log( that.currentData.contagions)
3330
+                        that.setScheduleTwo(this.cur_drag_info.id);
3499 3331
                 }
3500
-
3501 3332
               }else{ // 非同一天
3502 3333
                 if(row[key].patient_id == 0) { //空床位
3503 3334
                   this.currentData.mode_id = this.cur_drag_info.mode_id;
@@ -3507,10 +3338,8 @@ export default {
3507 3338
                   this.currentData.patient = this.cur_drag_info.patient_name;
3508 3339
                   this.setSchedule();
3509 3340
                 }
3510
-
3511 3341
               }
3512 3342
             }else{
3513
-
3514 3343
               //接口提交排班数据
3515 3344
               this.currentData.mode_id = this.cur_drag_info.mode_id;
3516 3345
               this.currentData.id = 0;
@@ -3523,6 +3352,7 @@ export default {
3523 3352
         }
3524 3353
       }
3525 3354
     },
3355
+    
3526 3356
     // 左边栏选中名字和模式拖动结束后
3527 3357
     taskDraggerEnd(e) {},
3528 3358
     //move回调方法
@@ -3874,9 +3704,8 @@ export default {
3874 3704
           }
3875 3705
         }
3876 3706
       }
3877
-      // return "";
3707
+      return "";
3878 3708
     },
3879
-    // 单击排班表格的空白单元格弹窗搜索
3880 3709
     // 单元格的患者名称的回调方法
3881 3710
     patientClass({row,column, rowIndex,columnIndex}){
3882 3711
       if(this.cur_info.patient_id == row.id){
@@ -4968,7 +4797,50 @@ export default {
4968 4797
       }
4969 4798
       this.creating_schedule = false;
4970 4799
     },
4800
+    async CreateScheduleTwo(id, data,id_two) {
4801
+      this.creating_schedule = true;
4802
+      let response =await CreateScheduleTwo(id, data,id_two)
4971 4803
 
4804
+      if (response.data.state == 0) {
4805
+        this.$message.error(response.data.msg);
4806
+      } else {
4807
+        var that = this;
4808
+        var schedule = response.data.data.schedule;
4809
+        this.creating_schedule=false;
4810
+        this.dialogTableVisible=false
4811
+        this.getSchedules()
4812
+        // this.scheduleZone.forEach(function (zone, index) {
4813
+        //   if (
4814
+        //     zone.zone_id == schedule.partition_id &&
4815
+        //     zone.jihao_id == schedule.bed_id
4816
+        //   ) {
4817
+        //     var weekPath = that.weekPath(
4818
+        //       schedule.schedule_week,
4819
+        //       schedule.schedule_type
4820
+        //     );
4821
+        //     if (weekPath.length == 2) {
4822
+        //       var weekPathKey = weekPath[0] + "_" + weekPath[1];
4823
+        //       that.scheduleZone[index][weekPathKey] = {
4824
+        //         schedule_id: schedule.id,
4825
+        //         mode_id: schedule.mode_id,
4826
+        //         patient_id: schedule.patient_id,
4827
+        //         patient: schedule.patient,
4828
+        //         dialysis_machine_name: schedule.dialysis_machine_name,
4829
+        //
4830
+        //         patient_contagions: that.currentData.contagions,
4831
+        //         mode_name:
4832
+        //           typeof that.modeOptions[schedule.mode_id] === "undefined"
4833
+        //             ? ""
4834
+        //             : that.modeOptions[schedule.mode_id].name,
4835
+        //       };
4836
+        //       that.scheduleZone[index].total += 1;
4837
+        //     }
4838
+        //   }
4839
+        // });
4840
+        // this.closePatientPanel();
4841
+      }
4842
+      this.creating_schedule = false;
4843
+    },
4972 4844
     // 单击选中患者
4973 4845
     clickThis(row, column, cell, event) {
4974 4846
         if (row[column.property].schedule_id > 0) {
@@ -5367,7 +5239,8 @@ export default {
5367 5239
         default:
5368 5240
           break;
5369 5241
       }
5370
-    },    setScheduleTwo(id_two) {
5242
+    },    
5243
+    setScheduleTwo(id_two) {
5371 5244
       console.log("1112222222")
5372 5245
       var that = this;
5373 5246
       // var submitFlag = true;
@@ -5863,6 +5736,7 @@ export default {
5863 5736
       this.weekday = 7;
5864 5737
     }
5865 5738
   },
5739
+
5866 5740
 };
5867 5741
 </script>
5868 5742
 

File diff suppressed because it is too large
+ 1278 - 1283
src/xt_pages/workforce/components/tableData.vue