Преглед изворни кода

Merge branch '20200710_pc_vue_new_branch' of http://git.shengws.com/csx/Vue_New into 20200710_pc_vue_new_branch

See999 пре 4 година
родитељ
комит
6350b88caa
2 измењених фајлова са 109 додато и 47 уклоњено
  1. 27 26
      src/xt_pages/medicalScheduling/class.vue
  2. 82 21
      src/xt_pages/medicalScheduling/index.vue

+ 27 - 26
src/xt_pages/medicalScheduling/class.vue Прегледај датотеку

@@ -304,11 +304,11 @@ export default {
304 304
                 user_org_id:0,
305 305
             },
306 306
             rules: {
307
-              class_name: [{ required: true, message: "请输入班种名称", trigger: "blur" }],
308
-              class_attributes: [{ required: true, message: "请选择班种属性", trigger: "blur" }],  
309
-              timeone_start: [{ required: true, message: "请选择班种时间1", trigger: "blur" }], 
310
-              timeone_type: [{ required: true, message: "请选择班种时间1类型", trigger: "blur" }], 
311
-              timeone_end: [{ required: true, message: "请选择班种时间1结束时间", trigger: "blur" }], 
307
+              class_name: [{ required: true, message: "请输入班种名称" }],
308
+              class_attributes: [{ required: true, message: "请选择班种属性"}],  
309
+              timeone_start: [{ required: true, message: "请选择班种时间1"}], 
310
+              timeone_type: [{ required: true, message: "请选择班种时间1类型"}], 
311
+              timeone_end: [{ required: true, message: "请选择班种时间1结束时间"}], 
312 312
             },
313 313
             typeOptions:[{ value: 1, label: '出勤'},{ value: 2, label: '缺勤'}],
314 314
             dayOptions:[{ value: 1, label: '当日'},{ value: 2, label: '次日'}],
@@ -320,29 +320,30 @@ export default {
320 320
     },
321 321
     methods:{
322 322
         submitAction(formName){
323
-           if(this.form.timeone_type ==""){
324
-              this.showError = true
325
-              return false
326
-           }
327
-           
328
-           if(this.form.timeone_end == ""){
329
-              this.showError = true
330
-              return false
331
-           }
332
-          const params = {
333
-             class_name:this.form.class_name,
334
-             class_attributes:this.form.class_attributes,
335
-             timeone_start:this.form.timeone_start,
336
-             timeone_type:this.form.timeone_type,
337
-             timeone_end:this.form.timeone_end,
338
-             timetwo_start:this.form.timetwo_start,
339
-             timetwo_type:this.form.timetwo_type,
340
-             timetwo_end:this.form.timetwo_end,
341
-             work_time:this.form.work_time,
342
-             remarks:this.form.remarks
343
-         }
344 323
          this.$refs[formName].validate((valid=>{
345 324
             if(valid){
325
+                if(this.form.timeone_type ==""){
326
+                    this.showError = true
327
+                    return false
328
+                 }
329
+           
330
+                if(this.form.timeone_end == ""){
331
+                     this.showError = true
332
+                     return false
333
+                 }
334
+                 const params = {
335
+                    class_name:this.form.class_name,
336
+                    class_attributes:this.form.class_attributes,
337
+                    timeone_start:this.form.timeone_start,
338
+                    timeone_type:this.form.timeone_type,
339
+                    timeone_end:this.form.timeone_end,
340
+                    timetwo_start:this.form.timetwo_start,
341
+                    timetwo_type:this.form.timetwo_type,
342
+                    timetwo_end:this.form.timetwo_end,
343
+                    work_time:this.form.work_time,
344
+                    remarks:this.form.remarks
345
+                 }
346
+                 console.log("params",params)
346 347
                 saveDoctorSchedules(params).then(response=>{
347 348
                   if(response.data.state == 1){
348 349
                     var schedules = response.data.data.schedules

+ 82 - 21
src/xt_pages/medicalScheduling/index.vue Прегледај датотеку

@@ -54,7 +54,7 @@
54 54
                                         {{ getClass(scope.row.user_name,1) }}<i class="el-icon-arrow-down el-icon--right"></i>
55 55
                                         </span>
56 56
                                         <el-dropdown-menu slot="dropdown" >
57
-                                            <el-dropdown-item  :command="item.id" icon="el-icon-plus" v-for="(item,index) in schedulelist" :key="index">{{item.class_name}}</el-dropdown-item>
57
+                                            <el-dropdown-item  :command="item.id" icon="el-icon-plus" :disabled="getTimestamp(weekDayArr[0])<timeNow?true:false" v-for="(item,index) in schedulelist" :key="index">{{item.class_name}}</el-dropdown-item>
58 58
                                         </el-dropdown-menu>
59 59
                                     </el-dropdown>
60 60
                                 </div>
@@ -68,7 +68,7 @@
68 68
                                         {{ getClass(scope.row.user_name,2) }}<i class="el-icon-arrow-down el-icon--right"></i>
69 69
                                         </span>
70 70
                                         <el-dropdown-menu slot="dropdown" >
71
-                                            <el-dropdown-item  :command="item.id" icon="el-icon-plus" v-for="(item,index) in schedulelist" :key="index">{{item.class_name}}</el-dropdown-item>
71
+                                            <el-dropdown-item  :command="item.id" icon="el-icon-plus" :disabled="getTimestamp(weekDayArr[1])<timeNow?true:false" v-for="(item,index) in schedulelist" :key="index">{{item.class_name}}</el-dropdown-item>
72 72
                                         </el-dropdown-menu>
73 73
                                     </el-dropdown>
74 74
                                 </div>
@@ -82,7 +82,7 @@
82 82
                                         {{ getClass(scope.row.user_name,3) }}<i class="el-icon-arrow-down el-icon--right"></i>
83 83
                                         </span>
84 84
                                         <el-dropdown-menu slot="dropdown" >
85
-                                            <el-dropdown-item  :command="item.id" icon="el-icon-plus" v-for="(item,index) in schedulelist" :key="index">{{item.class_name}}</el-dropdown-item>
85
+                                            <el-dropdown-item  :command="item.id" icon="el-icon-plus" :disabled="getTimestamp(weekDayArr[2])<timeNow?true:false" v-for="(item,index) in schedulelist" :key="index">{{item.class_name}}</el-dropdown-item>
86 86
                                         </el-dropdown-menu>
87 87
                                     </el-dropdown>
88 88
                                 </div>
@@ -96,7 +96,7 @@
96 96
                                         {{ getClass(scope.row.user_name,4) }}<i class="el-icon-arrow-down el-icon--right"></i>
97 97
                                         </span>
98 98
                                         <el-dropdown-menu slot="dropdown" >
99
-                                            <el-dropdown-item  :command="item.id" icon="el-icon-plus" v-for="(item,index) in schedulelist" :key="index">{{item.class_name}}</el-dropdown-item>
99
+                                            <el-dropdown-item  :command="item.id" icon="el-icon-plus" :disabled="getTimestamp(weekDayArr[3])<timeNow?true:false" v-for="(item,index) in schedulelist" :key="index">{{item.class_name}}</el-dropdown-item>
100 100
                                         </el-dropdown-menu>
101 101
                                     </el-dropdown>
102 102
                                 </div>
@@ -110,7 +110,7 @@
110 110
                                         {{ getClass(scope.row.user_name,5) }}<i class="el-icon-arrow-down el-icon--right"></i>
111 111
                                         </span>
112 112
                                         <el-dropdown-menu slot="dropdown" >
113
-                                            <el-dropdown-item  :command="item.id" icon="el-icon-plus" v-for="(item,index) in schedulelist" :key="index">{{item.class_name}}</el-dropdown-item>
113
+                                            <el-dropdown-item  :command="item.id" icon="el-icon-plus" :disabled="getTimestamp(weekDayArr[4])<timeNow?true:false" v-for="(item,index) in schedulelist" :key="index">{{item.class_name}}</el-dropdown-item>
114 114
                                         </el-dropdown-menu>
115 115
                                     </el-dropdown>
116 116
                                 </div>
@@ -124,7 +124,7 @@
124 124
                                         {{ getClass(scope.row.user_name,6) }}<i class="el-icon-arrow-down el-icon--right"></i>
125 125
                                         </span>
126 126
                                         <el-dropdown-menu slot="dropdown" >
127
-                                            <el-dropdown-item  :command="item.id" icon="el-icon-plus" v-for="(item,index) in schedulelist" :key="index">{{item.class_name}}</el-dropdown-item>
127
+                                            <el-dropdown-item  :command="item.id" icon="el-icon-plus" :disabled="getTimestamp(weekDayArr[5])<timeNow?true:false" v-for="(item,index) in schedulelist" :key="index">{{item.class_name}}</el-dropdown-item>
128 128
                                         </el-dropdown-menu>
129 129
                                     </el-dropdown>
130 130
                                 </div>
@@ -135,10 +135,10 @@
135 135
                                 <div @click="hangdleClick(scope.row,scope.$index)">
136 136
                                     <el-dropdown trigger="click" @command="changeSchedule">
137 137
                                         <span class="el-dropdown-link">
138
-                                        {{ getClass(scope.row.user_name,7) }}<i class="el-icon-arrow-down el-icon--right"></i>
138
+                                        {{ getClass(scope.row.user_name,0) }}<i class="el-icon-arrow-down el-icon--right"></i>
139 139
                                         </span>
140 140
                                         <el-dropdown-menu slot="dropdown" >
141
-                                            <el-dropdown-item  :command="item.id" icon="el-icon-plus" v-for="(item,index) in schedulelist" :key="index">{{item.class_name}}</el-dropdown-item>
141
+                                            <el-dropdown-item  :command="item.id" icon="el-icon-plus" :disabled="getTimestamp(weekDayArr[6])<timeNow?true:false" v-for="(item,index) in schedulelist" :key="index">{{item.class_name}}</el-dropdown-item>
142 142
                                         </el-dropdown-menu>
143 143
                                     </el-dropdown>
144 144
                                 </div>
@@ -163,9 +163,9 @@
163 163
                 width="600px"
164 164
                 :visible.sync="newVisible"
165 165
             >
166
-            <el-form :model="form"  ref="form" label-width="90px">
167
-                <el-form-item label="复制到 : " required  prop="class_attributes">
168
-                    <el-select v-model="copyWeek" placeholder="请选择">
166
+            <el-form :model="form"  ref="form" label-width="90px" :rules="rules">
167
+                <el-form-item label="复制到 : " required  prop="copyWeek">
168
+                    <el-select v-model="form.copyWeek" placeholder="请选择">
169 169
                         <el-option
170 170
                         v-for="item in typeOptions"
171 171
                         :key="item.value"
@@ -187,6 +187,7 @@
187 187
 
188 188
 
189 189
 <script>
190
+const moment = require('moment')
190 191
 import BreadCrumb from '@/xt_pages/components/bread-crumb'
191 192
 import { getDoctorList,getScheduleList,addSchedule,getStaffScheduleList,getNextWeekList,getScheduleByDoctorId,toSearchScheduleList,DeleteStaffSchedule,copyStaffSchedule,UpdateContinusSchedule } from '@/api/doctorSchedule'
192 193
 export default {
@@ -218,11 +219,6 @@ export default {
218 219
             weekDayArr:[],
219 220
             todayDate:'',
220 221
             clen:7,
221
-
222
-
223
-
224
-
225
-
226 222
             nowYear: new Date().getFullYear(),
227 223
             schedule_week:0,
228 224
             docobj:{},
@@ -231,10 +227,17 @@ export default {
231 227
             schedule_date:"",
232 228
             newVisible:false,
233 229
             typeOptions:[],
230
+            timeOptions:[],
234 231
             copyWeek:'',
235
-
236 232
             weekList: [],
237 233
             currentFirstDate1: '',
234
+            form:{
235
+              copyWeek:"",
236
+            },
237
+           rules: {
238
+             copyWeek: [{ required: true, message: "请选择复制时间段", trigger: "blur" }],  
239
+           },
240
+           timeNow:0,
238 241
         }
239 242
     },
240 243
     methods:{
@@ -281,7 +284,8 @@ export default {
281 284
             }) 
282 285
         },
283 286
         hangdleClick(val,index){
284
-        this.docobj = val
287
+         console.log("val",val)
288
+         this.docobj = val
285 289
         },
286 290
         clickThis(row, column, cell, event){
287 291
             // console.log("row",row)
@@ -327,6 +331,7 @@ export default {
327 331
             }
328 332
             }
329 333
             let arr = [...this.tableData]
334
+            console.log("arr===",arr)
330 335
             for(let i=0;i<arr.length;i++){
331 336
             if(this.docobj.id == arr[i].id){
332 337
                 arr[i].class_name = class_name
@@ -345,6 +350,7 @@ export default {
345 350
             schedule_date:this.getTimestamp(this.schedule_date)
346 351
             }
347 352
             console.log("params",params)
353
+            
348 354
             addSchedule(params).then(response=>{
349 355
             if(response.data.state == 1){
350 356
                 var schedule = response.data.data.schedule
@@ -440,6 +446,7 @@ export default {
440 446
             getStaffScheduleList(params).then(response=>{
441 447
                 if(response.data.state == 1){
442 448
                     var staffList =  response.data.data.staffList
449
+                    console.log("所有排班数据",staffList)
443 450
                     for(let i=0;i<staffList.length;i++){
444 451
                     if(staffList[i].schedule_week == 0){
445 452
                         staffList[i].class_index = 0
@@ -467,13 +474,16 @@ export default {
467 474
                     let tempArr = [], newArr = []
468 475
                     for (let i = 0; i < staffList.length; i++) {
469 476
                         if (tempArr.indexOf(staffList[i].user_name) === -1) {
477
+                            console.log("触发了没")
470 478
                             newArr.push({
471 479
                                 user_name: staffList[i].user_name,
472 480
                                 admin_user_id:staffList[i].admin_user_id,
481
+                                user_type:staffList[i].doctor_type,
473 482
                                 list: [{class_name:staffList[i].class_name,schedule_week:staffList[i].schedule_week}]
474 483
                             })
475 484
                             tempArr.push(staffList[i].user_name);
476 485
                         } else {
486
+                            console.log("hheh")
477 487
                             for (let j = 0; j < newArr.length; j++) {
478 488
                                 if (newArr[j].user_name == staffList[i].user_name) {
479 489
                                     newArr[j].list.push({class_name:staffList[i].class_name,admin_user_id:staffList[i].admin_user_id,schedule_week:staffList[i].schedule_week})
@@ -482,14 +492,14 @@ export default {
482 492
                         }
483 493
                     }
484 494
                     let arr = [...newArr]
495
+                    console.log("arr=======",arr)
485 496
                     this.doctorlist.map((item,index) => {
486 497
                         if(!(arr[index] && item.admin_user_id == arr[index].admin_user_id)){
487
-                            arr.splice(index,0,{user_name:item.user_name,admin_user_id: item.admin_user_id,list: []})
498
+                            arr.splice(index,0,{user_name:item.user_name,admin_user_id: item.admin_user_id,list: [],user_type:item.user_type})
488 499
                         }
489 500
                     })
490 501
                     
491
-        
492
-                    console.log(arr)
502
+                    console.log("arr",arr)
493 503
                     this.tableData = arr
494 504
         
495 505
                 
@@ -516,6 +526,11 @@ export default {
516 526
             }
517 527
         
518 528
         },
529
+
530
+     unique(arr) { 
531
+        const res = new Map();
532
+        return arr.filter((arr) => !res.has(arr.admin_user_id) && res.set(arr.admin_user_id, 1))
533
+     },
519 534
         
520 535
         //获取上一周下一周的排班数据
521 536
         getNextWeekList(){
@@ -752,6 +767,43 @@ export default {
752 767
             let num = this.weekNum
753 768
             this.currentFirstDate1 = num + 1
754 769
         },
770
+        submitAction(formName){
771
+            console.log("数据",this.typeOptions)
772
+            console.log("2222",this.timeOptions)
773
+            var label = ""
774
+            for(let i=0;i<this.timeOptions.length;i++){
775
+               if(this.form.copyWeek == this.timeOptions[i].value){
776
+                 label = this.timeOptions[i].label
777
+               }
778
+            }
779
+           var start = label.split('~')
780
+           var copy_startime = this.getTimestamp(start[0])   
781
+           console.log("copy_startime",copy_startime)   
782
+           var copy_endtime = this.getTimestamp(start[1]) 
783
+           console.log("copy_endtime",copy_endtime)
784
+
785
+            const params = {
786
+              start_time:this.getTimestamp(this.weekDayArr[0]),
787
+              end_time:this.getTimestamp(this.weekDayArr[6]),
788
+              copy_startime:copy_startime,
789
+              copy_endtime:copy_endtime,
790
+            }
791
+            console.log("params",params)
792
+           this.$refs[formName].validate(valid=>{
793
+              if(valid){
794
+                copyStaffSchedule(params).then(response=>{
795
+                   if(response.data.state == 1){
796
+                     var msg = response.data.data.msg
797
+                     console.log("msg",msg)
798
+                     this.$message.success("复制成功")
799
+                     this.newVisible = false
800
+                   }else{
801
+                    this.$message.error("排班已存在")
802
+                  }
803
+                })
804
+              }
805
+           })
806
+        }
755 807
     },
756 808
     created(){
757 809
         //获取医护人员
@@ -775,14 +827,23 @@ export default {
775 827
                 let num = this.weekNum + i + 1
776 828
                 let str = this.weekList[i][0] + '~' + this.weekList[i][6] + '(' + num + ')'
777 829
                 this.typeOptions.push({value:i,label:str})
830
+                let stt = this.weekList[i][0] +"~"+this.weekList[i][6]
831
+                this.timeOptions.push({value:i,label:stt})
778 832
             }else{
779 833
                 
780 834
                 newNum++
781 835
                 let str = this.weekList[i][0] + '~' + this.weekList[i][6] + '(' + newNum + ')'
782 836
                 this.typeOptions.push({value:i,label:str}) 
837
+                let stt = this.weekList[i][0] +"~"+this.weekList[i][6]
838
+                this.timeOptions.push({value:i,label:stt}) 
783 839
             }
784 840
             
785 841
         }
842
+      var now = moment().locale('zh-cn').format('YYYY-MM-DD 00:00:00')
843
+      console.log('now',now)
844
+      this.timeNow = this.getTimestamp(now)
845
+      console.log("timenow",this.timeNow)
846
+      
786 847
     }
787 848
 }
788 849
 </script>