Parcourir la source

Merge branch '2022-10-17_vue_schedule_branch' of http://git.shengws.com/csx/Vue_New into 2022-10-17_vue_schedule_branch

张保健 il y a 1 an
Parent
révision
417a84c786

+ 73 - 47
src/xt_pages/workforce/components/editTableData.vue Voir le fichier

@@ -208,14 +208,14 @@
208 208
           <el-table-column
209 209
               prop="area"
210 210
               label="分区"
211
-              width="60"
211
+              width="50"
212 212
               align="center"
213 213
               fixed
214 214
           ></el-table-column>
215 215
           <el-table-column
216 216
               prop="cut"
217 217
               label="机号"
218
-              width="60"
218
+              width="100"
219 219
               align="center"
220 220
               fixed
221 221
           ></el-table-column>
@@ -251,7 +251,7 @@
251 251
                 >
252 252
                   <schedule-item
253 253
                       :schedule-detail="scope.row.Mon_M"
254
-                      :draggable="scope.row.Mon_M ? 'true' : 'false'"
254
+                      :draggable="isEditForDate('Mon_M')&& scope.row.Mon_M ? 'true' : 'false'"
255 255
                       class="contitem"
256 256
                       :style="{
257 257
                       cursor: scope.row.Mon_M ? 'move' : 'default',
@@ -296,7 +296,7 @@
296 296
                 >
297 297
                   <schedule-item
298 298
                       :schedule-detail="scope.row.Mon_A"
299
-                      :draggable="scope.row.Mon_A ? 'true' : 'false'"
299
+                      :draggable="isEditForDate('Mon_A')&&scope.row.Mon_A ? 'true' : 'false'"
300 300
                       class="contitem"
301 301
                       :style="{
302 302
                       cursor: scope.row.Mon_A ? 'move' : 'default',
@@ -339,7 +339,7 @@
339 339
                 >
340 340
                   <schedule-item
341 341
                       :schedule-detail="scope.row.Mon_N"
342
-                      :draggable="scope.row.Mon_N ? 'true' : 'false'"
342
+                      :draggable="isEditForDate('Mon_N') && scope.row.Mon_N ? 'true' : 'false'"
343 343
                       class="contitem"
344 344
                       :style="{
345 345
                       cursor: scope.row.Mon_N ? 'move' : 'default',
@@ -389,7 +389,7 @@
389 389
                 >
390 390
                   <schedule-item
391 391
                       :schedule-detail="scope.row.Tue_M"
392
-                      :draggable="scope.row.Tue_M ? 'true' : 'false'"
392
+                      :draggable="isEditForDate('Tue_M')&&scope.row.Tue_M ? 'true' : 'false'"
393 393
                       class="contitem"
394 394
                       :style="{
395 395
                       cursor: scope.row.Tue_M ? 'move' : 'default',
@@ -433,7 +433,7 @@
433 433
                 >
434 434
                   <schedule-item
435 435
                       :schedule-detail="scope.row.Tue_A"
436
-                      :draggable="scope.row.Tue_A ? 'true' : 'false'"
436
+                      :draggable="isEditForDate('Tue_A')&&scope.row.Tue_A ? 'true' : 'false'"
437 437
                       class="contitem"
438 438
                       :style="{
439 439
                       cursor: scope.row.Tue_A ? 'move' : 'default',
@@ -476,7 +476,7 @@
476 476
                 >
477 477
                   <schedule-item
478 478
                       :schedule-detail="scope.row.Tue_N"
479
-                      :draggable="scope.row.Tue_N ? 'true' : 'false'"
479
+                      :draggable="isEditForDate('Tue_N')&&scope.row.Tue_N ? 'true' : 'false'"
480 480
                       class="contitem"
481 481
                       :style="{
482 482
                       cursor: scope.row.Tue_N ? 'move' : 'default',
@@ -526,7 +526,7 @@
526 526
                 >
527 527
                   <schedule-item
528 528
                       :schedule-detail="scope.row.Wed_M"
529
-                      :draggable="scope.row.Wed_M ? 'true' : 'false'"
529
+                      :draggable="isEditForDate('Wed_M')&&scope.row.Wed_M ? 'true' : 'false'"
530 530
                       class="contitem"
531 531
                       :style="{
532 532
                       cursor: scope.row.Wed_M ? 'move' : 'default',
@@ -569,7 +569,7 @@
569 569
                 >
570 570
                   <schedule-item
571 571
                       :schedule-detail="scope.row.Wed_A"
572
-                      :draggable="scope.row.Wed_A ? 'true' : 'false'"
572
+                      :draggable="isEditForDate('Wed_A')&&scope.row.Wed_A ? 'true' : 'false'"
573 573
                       class="contitem"
574 574
                       :style="{
575 575
                       cursor: scope.row.Wed_A ? 'move' : 'default',
@@ -612,7 +612,7 @@
612 612
                 >
613 613
                   <schedule-item
614 614
                       :schedule-detail="scope.row.Wed_N"
615
-                      :draggable="scope.row.Wed_N ? 'true' : 'false'"
615
+                      :draggable="isEditForDate('Wed_N')&&scope.row.Wed_N ? 'true' : 'false'"
616 616
                       class="contitem"
617 617
                       :style="{
618 618
                       cursor: scope.row.Wed_N ? 'move' : 'default',
@@ -667,7 +667,7 @@
667 667
                 >
668 668
                   <schedule-item
669 669
                       :schedule-detail="scope.row.Thurs_M"
670
-                      :draggable="scope.row.Thurs_M ? 'true' : 'false'"
670
+                      :draggable="isEditForDate('Thurs_M')&&scope.row.Thurs_M ? 'true' : 'false'"
671 671
                       class="contitem"
672 672
                       :style="{
673 673
                       cursor: scope.row.Thurs_M ? 'move' : 'default',
@@ -677,7 +677,8 @@
677 677
                         $event,
678 678
                         'Thurs_M',
679 679
                         scope.row.index,
680
-                        scope.row.Thurs_M
680
+                        scope.row.Thurs_M,
681
+                        scope.row
681 682
                       )
682 683
                     "
683 684
                   ></schedule-item>
@@ -714,7 +715,7 @@
714 715
                 >
715 716
                   <schedule-item
716 717
                       :schedule-detail="scope.row.Thurs_A"
717
-                      :draggable="scope.row.Thurs_A ? 'true' : 'false'"
718
+                      :draggable="isEditForDate('Thurs_A')&&scope.row.Thurs_A ? 'true' : 'false'"
718 719
                       class="contitem"
719 720
                       :style="{
720 721
                       cursor: scope.row.Thurs_A ? 'move' : 'default',
@@ -724,7 +725,9 @@
724 725
                         $event,
725 726
                         'Thurs_A',
726 727
                         scope.row.index,
727
-                        scope.row.Thurs_A
728
+                        scope.row.Thurs_A,
729
+                        scope.row
730
+
728 731
                       )
729 732
                     "
730 733
                   ></schedule-item>
@@ -761,7 +764,7 @@
761 764
                 >
762 765
                   <schedule-item
763 766
                       :schedule-detail="scope.row.Thurs_N"
764
-                      :draggable="scope.row.Thurs_N ? 'true' : 'false'"
767
+                      :draggable="isEditForDate('Thurs_N')&&scope.row.Thurs_N ? 'true' : 'false'"
765 768
                       class="contitem"
766 769
                       :style="{
767 770
                       cursor: scope.row.Thurs_N ? 'move' : 'default',
@@ -771,7 +774,8 @@
771 774
                         $event,
772 775
                         'Thurs_N',
773 776
                         scope.row.index,
774
-                        scope.row.Thurs_N
777
+                        scope.row.Thurs_N,
778
+                           scope.row
775 779
                       )
776 780
                     "
777 781
                   ></schedule-item>
@@ -810,7 +814,7 @@
810 814
                 >
811 815
                   <schedule-item
812 816
                       :schedule-detail="scope.row.Fri_M"
813
-                      :draggable="scope.row.Fri_M ? 'true' : 'false'"
817
+                      :draggable="isEditForDate('Fri_M')&&scope.row.Fri_M ? 'true' : 'false'"
814 818
                       class="contitem"
815 819
                       :style="{ cursor: scope.row.Fri_M ? 'move' : 'default' }"
816 820
                       @mouseover.native="
@@ -852,7 +856,7 @@
852 856
                 >
853 857
                   <schedule-item
854 858
                       :schedule-detail="scope.row.Fri_A"
855
-                      :draggable="scope.row.Fri_A ? 'true' : 'false'"
859
+                      :draggable="isEditForDate('Fri_A')&&scope.row.Fri_A ? 'true' : 'false'"
856 860
                       class="contitem"
857 861
                       :style="{ cursor: scope.row.Fri_A ? 'move' : 'default' }"
858 862
                       @mouseover.native="
@@ -894,7 +898,7 @@
894 898
                 >
895 899
                   <schedule-item
896 900
                       :schedule-detail="scope.row.Fri_N"
897
-                      :draggable="scope.row.Fri_N ? 'true' : 'false'"
901
+                      :draggable="isEditForDate('Fri_N')&&scope.row.Fri_N ? 'true' : 'false'"
898 902
                       class="contitem"
899 903
                       :style="{ cursor: scope.row.Fri_N ? 'move' : 'default' }"
900 904
                       @mouseover.native="
@@ -944,7 +948,7 @@
944 948
                 >
945 949
                   <schedule-item
946 950
                       :schedule-detail="scope.row.Sat_M"
947
-                      :draggable="scope.row.Sat_M ? 'true' : 'false'"
951
+                      :draggable="isEditForDate('Sat_M')&&scope.row.Sat_M ? 'true' : 'false'"
948 952
                       class="contitem"
949 953
                       :style="{ cursor: scope.row.Sat_M ? 'move' : 'default' }"
950 954
                       @mouseover.native="
@@ -987,7 +991,7 @@
987 991
                 >
988 992
                   <schedule-item
989 993
                       :schedule-detail="scope.row.Sat_A"
990
-                      :draggable="scope.row.Sat_A ? 'true' : 'false'"
994
+                      :draggable="isEditForDate('Sat_A')&&scope.row.Sat_A ? 'true' : 'false'"
991 995
                       class="contitem"
992 996
                       :style="{ cursor: scope.row.Sat_A ? 'move' : 'default' }"
993 997
                       @mouseover.native="
@@ -1030,7 +1034,7 @@
1030 1034
                 >
1031 1035
                   <schedule-item
1032 1036
                       :schedule-detail="scope.row.Sat_N"
1033
-                      :draggable="scope.row.Sat_N ? 'true' : 'false'"
1037
+                      :draggable="isEditForDate('Sat_N')&&scope.row.Sat_N ? 'true' : 'false'"
1034 1038
                       class="contitem"
1035 1039
                       :style="{ cursor: scope.row.Sat_N ? 'move' : 'default' }"
1036 1040
                       @mouseover.native="
@@ -1134,7 +1138,7 @@
1134 1138
                 >
1135 1139
                   <schedule-item
1136 1140
                       :schedule-detail="scope.row.Sun_A"
1137
-                      :draggable="scope.row.Sun_A ? 'true' : 'false'"
1141
+                      :draggable="isEditForDate('Sun_A')&&scope.row.Sun_A ? 'true' : 'false'"
1138 1142
                       class="contitem"
1139 1143
                       :style="{ cursor: scope.row.Sun_A ? 'move' : 'default' }"
1140 1144
                       @mouseover.native="
@@ -1147,8 +1151,7 @@
1147 1151
                       )
1148 1152
                     "
1149 1153
                   >
1150
-                    </schedule-item
1151
-                  >
1154
+                    </schedule-item>
1152 1155
                 </div>
1153 1156
               </template>
1154 1157
             </el-table-column>
@@ -1182,7 +1185,7 @@
1182 1185
                 >
1183 1186
                   <schedule-item
1184 1187
                       :schedule-detail="scope.row.Sun_N"
1185
-                      :draggable="scope.row.Sun_N ? 'true' : 'false'"
1188
+                      :draggable="isEditForDate('Sun_N')&&scope.row.Sun_N ? 'true' : 'false'"
1186 1189
                       class="contitem"
1187 1190
                       :style="{ cursor: scope.row.Sun_N ? 'move' : 'default' }"
1188 1191
                       @mouseover.native="
@@ -1927,6 +1930,7 @@ export default {
1927 1930
 
1928 1931
   data() {
1929 1932
     return {
1933
+      cur_date:"",
1930 1934
       dataloading:false,
1931 1935
       current_patient_data:[],
1932 1936
       week_zhongwens: ["周一", "周二", "周三", "周四", "周五", "周六", "周日"],
@@ -3205,6 +3209,7 @@ export default {
3205 3209
 
3206 3210
       this.cur_info.patient_name = row.name;
3207 3211
       this.cur_info.patient_id = row.id;
3212
+      this.patient_id_hover = row.id
3208 3213
     },
3209 3214
     modeClick(row) {
3210 3215
 
@@ -3212,6 +3217,21 @@ export default {
3212 3217
       this.cur_info.mode_id = row.id;
3213 3218
     },
3214 3219
     setEditData(patients, modes, days, zones) {
3220
+      var date = new Date()
3221
+      this.time = date
3222
+      var year = date.getFullYear()
3223
+      var month = date.getMonth() + 1
3224
+      if (month < 10) {
3225
+        month = "0" + month
3226
+      }
3227
+      var day = date.getDate()
3228
+      if (day < 10) {
3229
+        day = "0" + day
3230
+      }
3231
+      var nowDate = year + "-" + month + "-" + day
3232
+      var date = new Date(nowDate + " 00:00:00")
3233
+      this.cur_date = date.getTime()/1000
3234
+
3215 3235
 
3216 3236
       this.days = days;
3217 3237
       this.all_zones = zones;
@@ -3228,6 +3248,7 @@ export default {
3228 3248
       this.cur_info["mode_name"] = this.modes[0].name;
3229 3249
       this.cur_info["patient_id"] = this.patientList[0].id;
3230 3250
       this.cur_info["mode_id"] = this.modes[0].id;
3251
+      this.patient_id_hover =  this.patientList[0].id
3231 3252
       this.$refs.patient_table.setCurrentRow(this.patientList[0]);
3232 3253
       this.$refs.mode_table.setCurrentRow(this.modes[0]);
3233 3254
       for (let i = 0; i < this.weeks.length; i++) {
@@ -3250,12 +3271,26 @@ export default {
3250 3271
     },
3251 3272
     dragstartTwo(event, item) {},
3252 3273
     dragendTwo(event) {},
3274
+    isEditForDate(day){
3275
+      var week = this.weekDay(day);
3276
+      console.log(this.weekDays[week[0] - 1].valueOf())
3277
+      console.log( new Date(this.weekDays[week[0] - 1]).valueOf() /1000 )
3278
+      console.log(this.weekDays[week[0] - 1] >= this.cur_date)
3279
+      if( new Date(this.weekDays[week[0] - 1]).valueOf() /1000 >= this.cur_date){
3280
+        return true
3281
+      }else{
3282
+        return false
3283
+      }
3284
+
3285
+    },
3253 3286
     drag(e, day, index, name, row) {
3254 3287
       e.preventDefault();
3255 3288
       console.log("拖动前")
3256
-
3289
+      console.log(row)
3257 3290
       for (var key in row) {
3258 3291
         if (key == day) {
3292
+          console.log(row[key].patient_id)
3293
+
3259 3294
           if(row[key].patient_id > 0 ) {
3260 3295
             this.cur_drag_obj = 2
3261 3296
             console.log(row)
@@ -3297,6 +3332,8 @@ export default {
3297 3332
           } else {
3298 3333
             this.$message.success("替换成功");
3299 3334
             this.tipDialogVisible = false
3335
+            this.getSchedules();
3336
+
3300 3337
           }
3301 3338
         });
3302 3339
 
@@ -3305,7 +3342,7 @@ export default {
3305 3342
         })
3306 3343
 
3307 3344
     },changeSchTwo(){
3308
-      this.$confirm('是否将此位置排班互换?', '换', {
3345
+      this.$confirm('是否将此位置排班互换?', '换', {
3309 3346
         confirmButtonText: '确 定',
3310 3347
         cancelButtonText: '取 消',
3311 3348
         type: 'warning'
@@ -3319,8 +3356,10 @@ export default {
3319 3356
           if (response.data.state == 0) {
3320 3357
             this.$message.error(response.data.msg);
3321 3358
           } else {
3322
-            this.$message.success("换成功");
3359
+            this.$message.success("换成功");
3323 3360
             this.tipDialogVisible = false
3361
+            this.getSchedules();
3362
+
3324 3363
           }
3325 3364
         });
3326 3365
       })
@@ -3335,11 +3374,14 @@ export default {
3335 3374
     //        |                                 |
3336 3375
     //        -----------------------------------
3337 3376
     drop(e, day, index, name, row) {
3377
+
3338 3378
       e.preventDefault();
3339 3379
       console.log("cnm")
3340 3380
       for (var key in row) {
3341 3381
         if (key == day) {
3342 3382
           console.log("cnm1111111")
3383
+          console.log(this.cur_drag_obj)
3384
+
3343 3385
           var week = this.weekDay(day);
3344 3386
           this.currentData.schedule_date = this.weekDays[week[0] - 1];
3345 3387
           this.currentData.schedule_type = week[1];
@@ -3352,21 +3394,12 @@ export default {
3352 3394
           this.currentData.id = row[key].schedule_id;
3353 3395
 
3354 3396
           this.currentData.partition_type = row.zone_type;
3355
-          if (
3356
-              row[key].patient.length > 0 ||
3357
-              row[key].mode_name.length > 0 ||
3358
-              row[key].mode_id > 0 ||
3359
-              row[key].patient_id > 0
3360
-          ) {
3397
+          if (row[key].patient.length > 0 || row[key].mode_name.length > 0 || row[key].mode_id > 0 || row[key].patient_id > 0) {
3361 3398
             if (this.cur_drag_obj == 2){
3362
-
3363
-
3364 3399
               this.tipDialogVisible = true
3365
-
3366 3400
             }else{
3367 3401
               this.$message.error("当前机号已有排班");
3368 3402
               return;
3369
-
3370 3403
             }
3371 3404
 
3372 3405
           } else {
@@ -3378,10 +3411,6 @@ export default {
3378 3411
                     if (response.data.state == 0) {
3379 3412
                       this.$message.error(response.data.msg);
3380 3413
                     } else {
3381
-                      this.$message({
3382
-                        type: "success",
3383
-                        message: "排班已取消!",
3384
-                      });
3385 3414
                       var that = this;
3386 3415
                       var schedule = response.data.data.schedule;
3387 3416
                       this.scheduleZone.forEach(function (zone, index) {
@@ -3418,10 +3447,7 @@ export default {
3418 3447
                   this.currentData.patient = this.cur_drag_info.patient_name;
3419 3448
                   this.setSchedule();
3420 3449
                 }else{  //非空,替換或者交換位置
3421
-
3422 3450
                   this.tipDialogVisible = true
3423
-
3424
-
3425 3451
                 }
3426 3452
 
3427 3453
               }else{ // 非同一天

+ 2 - 2
src/xt_pages/workforce/components/tableData.vue Voir le fichier

@@ -196,14 +196,14 @@
196 196
       <el-table-column
197 197
         prop="area"
198 198
         label="分区"
199
-        width="80"
199
+        width="50"
200 200
         align="center"
201 201
         fixed
202 202
       ></el-table-column>
203 203
       <el-table-column
204 204
         prop="cut"
205 205
         label="机号"
206
-        width="80"
206
+        width="100"
207 207
         align="center"
208 208
         fixed
209 209
       ></el-table-column>