Bläddra i källkod

3月23日杨青

杨青 2 år sedan
förälder
incheckning
44ba77df2a
2 ändrade filer med 1344 tillägg och 1475 borttagningar
  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 Visa fil

1
 <template>
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
   <div id="edit_table_data" v-show="schedulingTableVisible" >
4
   <div id="edit_table_data" v-show="schedulingTableVisible" >
9
     <slot></slot>
5
     <slot></slot>
10
     <div class="table_contain">
6
     <div class="table_contain">
11
       <!-- 左侧 -->
7
       <!-- 左侧 -->
12
       <div class="left_contain">
8
       <div class="left_contain">
13
-        <div
14
-            class="cell clearfix"
9
+        <div class="cell clearfix"
15
             v-if="
10
             v-if="
16
             weekTime == 'thisWeek' ||
11
             weekTime == 'thisWeek' ||
17
             weekTime == 'nextWeek' ||
12
             weekTime == 'nextWeek' ||
18
             weekTime == 'nextTwoWeek'
13
             weekTime == 'nextTwoWeek'
19
           ">
14
           ">
20
-      <!-- 左侧 -->
21
-      <div class="left_contain">
22
-        <div class="cell clearfix">
23
           <el-input
15
           <el-input
24
               size="small"
16
               size="small"
25
               style="width: 160px"
17
               style="width: 160px"
36
               @click="search"
28
               @click="search"
37
           >搜索</el-button>
29
           >搜索</el-button>
38
 
30
 
39
-          >搜索</el-button>
40
-
41
         </div>
31
         </div>
42
         <div style="margin-bottom: 10px; display: flex">
32
         <div style="margin-bottom: 10px; display: flex">
43
           <h3 style="line-height: 45px">
33
           <h3 style="line-height: 45px">
215
                         scope.row.index,
205
                         scope.row.index,
216
                         scope.row.Mon_M,
206
                         scope.row.Mon_M,
217
                         scope.row
207
                         scope.row
218
-                      )"
219
-
220
-                  >
208
+                      )" >
221
                   </schedule-item>
209
                   </schedule-item>
222
                 </div>
210
                 </div>
223
               </template>
211
               </template>
1018
           </el-table-column>
1006
           </el-table-column>
1019
           <el-table-column
1007
           <el-table-column
1020
               :label="'周日 (' + weekTitle[6] + ')'"
1008
               :label="'周日 (' + weekTitle[6] + ')'"
1021
-
1022
               align="center"
1009
               align="center"
1023
               v-if="isShowSeven"
1010
               v-if="isShowSeven"
1024
           >
1011
           >
1064
                         scope.row.index,
1051
                         scope.row.index,
1065
                         scope.row.Sun_M,
1052
                         scope.row.Sun_M,
1066
                         scope.row
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
                     </schedule-item
1055
                     </schedule-item
1075
                   >
1056
                   >
1076
                 </div>
1057
                 </div>
1177
         </el-table>
1158
         </el-table>
1178
       </div>
1159
       </div>
1179
     </div>
1160
     </div>
1180
-
1181
    <!-- 单击排班表格的空白单元格弹窗 -->
1161
    <!-- 单击排班表格的空白单元格弹窗 -->
1182
     <el-dialog
1162
     <el-dialog
1183
         title="排班"
1163
         title="排班"
1186
         :v-model="dialog"
1166
         :v-model="dialog"
1187
         v-loading="creating_schedule"
1167
         v-loading="creating_schedule"
1188
         :modal-append-to-body='false'
1168
         :modal-append-to-body='false'
1189
-
1190
-        :modal-append-to-body='false'
1191
-
1169
+        :close-on-click-modal="false"
1192
     >
1170
     >
1193
       <div>
1171
       <div>
1194
         <div class="cell clearfix">
1172
         <div class="cell clearfix">
1708
         <el-button @click="tipDialogVisibleThree = false">取 消</el-button>
1686
         <el-button @click="tipDialogVisibleThree = false">取 消</el-button>
1709
       </span>
1687
       </span>
1710
     </el-dialog>
1688
     </el-dialog>
1711
-
1712
-
1713
-  </div>
1689
+    
1690
+</div>
1714
 </template>
1691
 </template>
1715
 
1692
 
1716
 <script>
1693
 <script>
1717
 import { uParseTime } from "@/utils/tools";
1694
 import { uParseTime } from "@/utils/tools";
1718
-import print from "print-js";
1695
+// import print from "print-js";
1719
 import draggable from "vuedraggable";
1696
 import draggable from "vuedraggable";
1720
 const moment = require("moment");
1697
 const moment = require("moment");
1721
 import {
1698
 import {
1792
       type: Array,
1769
       type: Array,
1793
       dafault: [],
1770
       dafault: [],
1794
     },
1771
     },
1795
-    // scheduleZoneProp: {
1796
-    //   type: Array,
1797
-    //   dafault: []
1798
-    // },
1799
     partitionsProp: {
1772
     partitionsProp: {
1800
       type: Object,
1773
       type: Object,
1801
       dafault: {},
1774
       dafault: {},
2221
 
2194
 
2222
           }
2195
           }
2223
         }
2196
         }
2224
-
2225
-
2226
-
2227
       } else {
2197
       } else {
2228
         for (let i = 0; i < this.weeks.length; i++) {
2198
         for (let i = 0; i < this.weeks.length; i++) {
2229
           this.weeks[i].is_edit = true;
2199
           this.weeks[i].is_edit = true;
2764
       }
2734
       }
2765
     },
2735
     },
2766
     getWeekType(date) {
2736
     getWeekType(date) {
2767
-
2768
-
2769
       let index = 0;
2737
       let index = 0;
2770
       for (let i = 0; i < this.days.length; i++) {
2738
       for (let i = 0; i < this.days.length; i++) {
2771
         if (date == this.days[i]) {
2739
         if (date == this.days[i]) {
3068
       }
3036
       }
3069
 
3037
 
3070
       this.current_all_sch = this.editableTabs
3038
       this.current_all_sch = this.editableTabs
3071
-
3072
-
3073
-
3074
-
3075
     },
3039
     },
3076
     // 左侧的拖拽内容
3040
     // 左侧的拖拽内容
3077
     curInfoDragStart(){
3041
     curInfoDragStart(){
3111
       var date = new Date(nowDate + " 00:00:00")
3075
       var date = new Date(nowDate + " 00:00:00")
3112
       this.cur_date = date.getTime()/1000
3076
       this.cur_date = date.getTime()/1000
3113
 
3077
 
3114
-
3115
       this.days = days;
3078
       this.days = days;
3116
       this.all_zones = zones;
3079
       this.all_zones = zones;
3117
       this.patientList = patients;
3080
       this.patientList = patients;
3168
           if(row[key].patient_id > 0){
3131
           if(row[key].patient_id > 0){
3169
             this.cur_drag_obj = 2
3132
             this.cur_drag_obj = 2
3170
             var week = this.weekDay(day);
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
             this.cur_drag_info={
3134
             this.cur_drag_info={
3187
               schedule_date : this.weekDays[week[0] - 1],
3135
               schedule_date : this.weekDays[week[0] - 1],
3188
               schedule_type : week[1],
3136
               schedule_type : week[1],
3199
               id : row[key].schedule_id,
3147
               id : row[key].schedule_id,
3200
               contagions: row[key].patient_contagions,
3148
               contagions: row[key].patient_contagions,
3201
             }
3149
             }
3202
-            console.log( this.cur_drag_info)
3203
-
3204
           }else{
3150
           }else{
3205
             this.cur_drag_obj = 3
3151
             this.cur_drag_obj = 3
3206
             this.cur_drag_info={
3152
             this.cur_drag_info={
3287
         }
3233
         }
3288
         console.log('deletePatientMode',row);
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
     coverSch(){
3237
     coverSch(){
3346
       this.tipDialogVisible=false
3238
       this.tipDialogVisible=false
3378
             this.tipDialogVisible = false
3270
             this.tipDialogVisible = false
3379
             this.tipDialogVisibleThree = false
3271
             this.tipDialogVisibleThree = false
3380
             this.getSchedules();
3272
             this.getSchedules();
3381
-
3382
           }
3273
           }
3383
         });
3274
         });
3384
     },
3275
     },
3388
       this.allowDrop(e)
3279
       this.allowDrop(e)
3389
       for (var key in row) {
3280
       for (var key in row) {
3390
         if (key == day) {
3281
         if (key == day) {
3391
-          // console.log(this.cur_drag_obj)
3392
           if(this.cur_drag_obj == 3){
3282
           if(this.cur_drag_obj == 3){
3393
             return
3283
             return
3394
           }
3284
           }
3407
             partition_type : row.zone_type,
3297
             partition_type : row.zone_type,
3408
           }
3298
           }
3409
           console.log('this.currentData的数据',this.currentData);
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
           if ( row[key].mode_id > 0 || row[key].patient_id > 0) {
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
             if (this.cur_drag_obj == 2){
3303
             if (this.cur_drag_obj == 2){
3437
               if(row[key].patient_id != this.cur_drag_info.patient_id){
3304
               if(row[key].patient_id != this.cur_drag_info.patient_id){
3441
               }else{
3308
               }else{
3442
                 this.tipDialogVisible = false
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
             }else{
3311
             }else{
3450
               return this.$message.error("当前机号已有排班");
3312
               return this.$message.error("当前机号已有排班");
3451
             }
3313
             }
3455
              if(this.cur_drag_obj == 2){
3317
              if(this.cur_drag_obj == 2){
3456
               if(this.cur_drag_info.schedule_date == this.currentData.schedule_date){ //同一天
3318
               if(this.cur_drag_info.schedule_date == this.currentData.schedule_date){ //同一天
3457
                 if(row[key].patient_id == 0) { //空床位
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
               }else{ // 非同一天
3332
               }else{ // 非同一天
3502
                 if(row[key].patient_id == 0) { //空床位
3333
                 if(row[key].patient_id == 0) { //空床位
3503
                   this.currentData.mode_id = this.cur_drag_info.mode_id;
3334
                   this.currentData.mode_id = this.cur_drag_info.mode_id;
3507
                   this.currentData.patient = this.cur_drag_info.patient_name;
3338
                   this.currentData.patient = this.cur_drag_info.patient_name;
3508
                   this.setSchedule();
3339
                   this.setSchedule();
3509
                 }
3340
                 }
3510
-
3511
               }
3341
               }
3512
             }else{
3342
             }else{
3513
-
3514
               //接口提交排班数据
3343
               //接口提交排班数据
3515
               this.currentData.mode_id = this.cur_drag_info.mode_id;
3344
               this.currentData.mode_id = this.cur_drag_info.mode_id;
3516
               this.currentData.id = 0;
3345
               this.currentData.id = 0;
3523
         }
3352
         }
3524
       }
3353
       }
3525
     },
3354
     },
3355
+    
3526
     // 左边栏选中名字和模式拖动结束后
3356
     // 左边栏选中名字和模式拖动结束后
3527
     taskDraggerEnd(e) {},
3357
     taskDraggerEnd(e) {},
3528
     //move回调方法
3358
     //move回调方法
3874
           }
3704
           }
3875
         }
3705
         }
3876
       }
3706
       }
3877
-      // return "";
3707
+      return "";
3878
     },
3708
     },
3879
-    // 单击排班表格的空白单元格弹窗搜索
3880
     // 单元格的患者名称的回调方法
3709
     // 单元格的患者名称的回调方法
3881
     patientClass({row,column, rowIndex,columnIndex}){
3710
     patientClass({row,column, rowIndex,columnIndex}){
3882
       if(this.cur_info.patient_id == row.id){
3711
       if(this.cur_info.patient_id == row.id){
4968
       }
4797
       }
4969
       this.creating_schedule = false;
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
     clickThis(row, column, cell, event) {
4845
     clickThis(row, column, cell, event) {
4974
         if (row[column.property].schedule_id > 0) {
4846
         if (row[column.property].schedule_id > 0) {
5367
         default:
5239
         default:
5368
           break;
5240
           break;
5369
       }
5241
       }
5370
-    },    setScheduleTwo(id_two) {
5242
+    },    
5243
+    setScheduleTwo(id_two) {
5371
       console.log("1112222222")
5244
       console.log("1112222222")
5372
       var that = this;
5245
       var that = this;
5373
       // var submitFlag = true;
5246
       // var submitFlag = true;
5863
       this.weekday = 7;
5736
       this.weekday = 7;
5864
     }
5737
     }
5865
   },
5738
   },
5739
+
5866
 };
5740
 };
5867
 </script>
5741
 </script>
5868
 
5742
 

Filskillnaden har hållits tillbaka eftersom den är för stor
+ 1278 - 1283
src/xt_pages/workforce/components/tableData.vue