|
@@ -69,7 +69,7 @@
|
69
|
69
|
>
|
70
|
70
|
<el-form :model="form" :rules="rules" ref="form" label-width="90px">
|
71
|
71
|
<el-form-item label="班种名称 : " required prop="class_name">
|
72
|
|
- <el-input v-model="form.class_name" placeholder="" ></el-input>
|
|
72
|
+ <el-input v-model.trim="form.class_name" placeholder="" ></el-input>
|
73
|
73
|
</el-form-item>
|
74
|
74
|
<el-form-item label="班种属性 : " required prop="class_attributes">
|
75
|
75
|
<el-select v-model="form.class_attributes" placeholder="请选择">
|
|
@@ -102,6 +102,7 @@
|
102
|
102
|
</el-option>
|
103
|
103
|
</el-select>
|
104
|
104
|
<el-time-select
|
|
105
|
+ @change="changtimeTwo"
|
105
|
106
|
style="width:140px;"
|
106
|
107
|
v-model="form.timeone_end"
|
107
|
108
|
:picker-options="{
|
|
@@ -121,7 +122,7 @@
|
121
|
122
|
style="width:140px;"
|
122
|
123
|
v-model="form.timetwo_start"
|
123
|
124
|
:picker-options="{
|
124
|
|
- start: '08:00',
|
|
125
|
+ start: '01:00',
|
125
|
126
|
step: '00:15',
|
126
|
127
|
end: '24:00'
|
127
|
128
|
}"
|
|
@@ -136,10 +137,11 @@
|
136
|
137
|
</el-option>
|
137
|
138
|
</el-select>
|
138
|
139
|
<el-time-select
|
|
140
|
+ @change="changtime"
|
139
|
141
|
style="width:140px;"
|
140
|
142
|
v-model="form.timetwo_end"
|
141
|
143
|
:picker-options="{
|
142
|
|
- start: '08:00',
|
|
144
|
+ start: '01:00',
|
143
|
145
|
step: '00:15',
|
144
|
146
|
end: '24:00'
|
145
|
147
|
}"
|
|
@@ -206,6 +208,7 @@
|
206
|
208
|
</el-option>
|
207
|
209
|
</el-select>
|
208
|
210
|
<el-time-select
|
|
211
|
+ @change="changtime"
|
209
|
212
|
style="width:140px;"
|
210
|
213
|
v-model="form.timeone_end"
|
211
|
214
|
:picker-options="{
|
|
@@ -240,6 +243,7 @@
|
240
|
243
|
</el-option>
|
241
|
244
|
</el-select>
|
242
|
245
|
<el-time-select
|
|
246
|
+ @change="changtimeTwo"
|
243
|
247
|
style="width:140px;"
|
244
|
248
|
v-model="form.timetwo_end"
|
245
|
249
|
:picker-options="{
|
|
@@ -276,6 +280,7 @@
|
276
|
280
|
<script>
|
277
|
281
|
import {saveDoctorSchedules,getDoctorScheduleList,getScheduleDetail,UpdateSchedule,deleteScheduleById } from '@/api/doctorSchedule'
|
278
|
282
|
import BreadCrumb from '@/xt_pages/components/bread-crumb'
|
|
283
|
+import { parseTime } from '@/utils'
|
279
|
284
|
export default {
|
280
|
285
|
components:{
|
281
|
286
|
BreadCrumb
|
|
@@ -331,6 +336,7 @@ export default {
|
331
|
336
|
this.showError = true
|
332
|
337
|
return false
|
333
|
338
|
}
|
|
339
|
+
|
334
|
340
|
const params = {
|
335
|
341
|
class_name:this.form.class_name,
|
336
|
342
|
class_attributes:this.form.class_attributes,
|
|
@@ -343,7 +349,6 @@ export default {
|
343
|
349
|
work_time:this.form.work_time,
|
344
|
350
|
remarks:this.form.remarks
|
345
|
351
|
}
|
346
|
|
- console.log("params",params)
|
347
|
352
|
saveDoctorSchedules(params).then(response=>{
|
348
|
353
|
if(response.data.state == 1){
|
349
|
354
|
var schedules = response.data.data.schedules
|
|
@@ -360,6 +365,8 @@ export default {
|
360
|
365
|
this.form.timetwo_end=""
|
361
|
366
|
this.form.work_time = ""
|
362
|
367
|
this.form.remarks = ""
|
|
368
|
+ }else{
|
|
369
|
+ this.$message.error("班种名称已存在")
|
363
|
370
|
}
|
364
|
371
|
})
|
365
|
372
|
}
|
|
@@ -479,7 +486,8 @@ export default {
|
479
|
486
|
this.$message.success("修改成功")
|
480
|
487
|
this.EditNewVisible = false
|
481
|
488
|
this.getList()
|
482
|
|
-
|
|
489
|
+ }else{
|
|
490
|
+ this.$message.error("班种名称已存在")
|
483
|
491
|
}
|
484
|
492
|
})
|
485
|
493
|
}
|
|
@@ -501,15 +509,138 @@ export default {
|
501
|
509
|
var msg = response.data.data.msg
|
502
|
510
|
this.$message.success("删除成功")
|
503
|
511
|
this.getList()
|
|
512
|
+ }else{
|
|
513
|
+ this.$message.error("该班种已存在排班,不能删除")
|
504
|
514
|
}
|
505
|
515
|
})
|
506
|
516
|
})
|
507
|
|
- }
|
|
517
|
+ },
|
|
518
|
+ timeDifference(startTime,endTime){
|
|
519
|
+ var start1=startTime.split(":");
|
|
520
|
+ var startAll=parseInt(start1[0]*60)+parseInt(start1[1]);
|
|
521
|
+ var end1=endTime.split(":");
|
|
522
|
+ var endAll=parseInt(end1[0]*60)+parseInt(end1[1]);
|
|
523
|
+ return endAll - startAll
|
|
524
|
+ },
|
|
525
|
+ timeStamp(StatusMinute){
|
|
526
|
+ var day=parseInt(StatusMinute/60/24);
|
|
527
|
+ var hour=parseInt(StatusMinute/60%24);
|
|
528
|
+ var min= parseInt(StatusMinute % 60);
|
|
529
|
+ StatusMinute="";
|
|
530
|
+ if (day > 0)
|
|
531
|
+ {
|
|
532
|
+ StatusMinute= day + "天";
|
|
533
|
+ }
|
|
534
|
+ if (hour>0)
|
|
535
|
+ {
|
|
536
|
+ StatusMinute += hour + "小时";
|
|
537
|
+ }
|
|
538
|
+ // if(hour == 0){
|
|
539
|
+ // StatusMinute += hour + "小时"
|
|
540
|
+ // }
|
|
541
|
+ if (min>0)
|
|
542
|
+ {
|
|
543
|
+ StatusMinute += parseFloat(min) + "分钟";
|
|
544
|
+ }
|
|
545
|
+ return StatusMinute;
|
|
546
|
+ },
|
|
547
|
+ changtime(){
|
|
548
|
+ //计算时长
|
|
549
|
+ console.log("timeone",this.form.timeone_start)
|
|
550
|
+ console.log("timeonend",this.form.timeone_end)
|
|
551
|
+ console.log("timeonetype",this.form.timeone_type)
|
|
552
|
+ var longtime = 0
|
|
553
|
+ var timeone = 0
|
|
554
|
+ var timetwo = 0
|
|
555
|
+ //时间选择1的时间差
|
|
556
|
+ if(this.form.timeone_type == 1){
|
|
557
|
+ var timeone = this.timeDifference(this.form.timeone_start,this.form.timeone_end)
|
|
558
|
+ timeone = timeone
|
|
559
|
+ }
|
|
560
|
+ if(this.form.timeone_type == 2){
|
|
561
|
+ var hour = this.form.timeone_end.split(":")
|
|
562
|
+ var hous = parseInt(hour[0]) + 24
|
|
563
|
+ var oneHours = hous.toString() +":"+ hour[1]
|
|
564
|
+ var timeone = this.timeDifference(this.form.timeone_start,oneHours)
|
|
565
|
+ timeone = timeone
|
|
566
|
+ }
|
|
567
|
+ console.log("时间选择1时长",this.timeStamp(timeone))
|
|
568
|
+
|
|
569
|
+ //时间选择2的时间差
|
|
570
|
+ if(this.form.timetwo_type == 1){
|
|
571
|
+ var timetwo = this.timeDifference(this.form.timetwo_start,this.form.timetwo_end)
|
|
572
|
+ timetwo = timetwo
|
|
573
|
+ }
|
|
574
|
+ if(this.form.timetwo_type == 2){
|
|
575
|
+ var hour = this.form.timetwo_end.split(":")
|
|
576
|
+ var hous = parseInt(hour[0]) + 24
|
|
577
|
+ var oneHours = hous.toString() +":"+ hour[1]
|
|
578
|
+ var timetwo = this.timeDifference(this.form.timetwo_start,oneHours)
|
|
579
|
+ timetwo = timetwo
|
|
580
|
+ }
|
|
581
|
+ console.log("timetwo",timetwo)
|
|
582
|
+ console.log("时间选择2时长",this,this.timeStamp(timetwo))
|
|
583
|
+
|
|
584
|
+ longtime = timeone + timetwo
|
|
585
|
+ console.log("longtime",longtime)
|
|
586
|
+ this.form.work_time = this.timeStamp(longtime)
|
|
587
|
+ },
|
|
588
|
+ changtimeTwo(){
|
|
589
|
+ //计算时长
|
|
590
|
+ console.log("timeone",this.form.timeone_start)
|
|
591
|
+ console.log("timeonend",this.form.timeone_end)
|
|
592
|
+ console.log("timeonetype",this.form.timeone_type)
|
|
593
|
+ var longtime = 0
|
|
594
|
+ var timeone = 0
|
|
595
|
+ var timetwo = 0
|
|
596
|
+ //时间选择1的时间差
|
|
597
|
+ if(this.form.timeone_type == 1){
|
|
598
|
+ var timeone = this.timeDifference(this.form.timeone_start,this.form.timeone_end)
|
|
599
|
+ timeone = timeone
|
|
600
|
+ }
|
|
601
|
+ if(this.form.timeone_type == 2){
|
|
602
|
+ var hour = this.form.timeone_end.split(":")
|
|
603
|
+ var hous = parseInt(hour[0]) + 24
|
|
604
|
+ var oneHours = hous.toString() +":"+ hour[1]
|
|
605
|
+ var timeone = this.timeDifference(this.form.timeone_start,oneHours)
|
|
606
|
+ timeone = timeone
|
|
607
|
+ }
|
|
608
|
+ console.log("时间选择1时长",this.timeStamp(timeone))
|
|
609
|
+
|
|
610
|
+ //时间选择2的时间差
|
|
611
|
+ if(this.form.timetwo_type == 1){
|
|
612
|
+ var timetwo = this.timeDifference(this.form.timetwo_start,this.form.timetwo_end)
|
|
613
|
+ timetwo = timetwo
|
|
614
|
+ }
|
|
615
|
+ if(this.form.timetwo_type == 2){
|
|
616
|
+ var hour = this.form.timetwo_end.split(":")
|
|
617
|
+ var hous = parseInt(hour[0]) + 24
|
|
618
|
+ var oneHours = hous.toString() +":"+ hour[1]
|
|
619
|
+ var timetwo = this.timeDifference(this.form.timetwo_start,oneHours)
|
|
620
|
+ timetwo = timetwo
|
|
621
|
+ }
|
|
622
|
+ console.log("timetwo",timetwo)
|
|
623
|
+ console.log("时间选择2时长",this,this.timeStamp(timetwo))
|
|
624
|
+
|
|
625
|
+ longtime = timeone + timetwo
|
|
626
|
+ console.log("longtime",longtime)
|
|
627
|
+ this.form.work_time = this.timeStamp(longtime)
|
|
628
|
+ }
|
508
|
629
|
},
|
509
|
630
|
created(){
|
510
|
631
|
//获取班种列表
|
511
|
632
|
this.getList()
|
|
633
|
+ },
|
|
634
|
+ watch: {
|
|
635
|
+ // 监听对象数据变化
|
|
636
|
+ work_time: {
|
|
637
|
+ handler(newVal, oldVal) {
|
|
638
|
+ console.log(newVal)
|
|
639
|
+ console,log(oldVal)
|
|
640
|
+ },
|
|
641
|
+ deep: true // 非常非常重要,这个是深度监听,默认是false。true的时候才能监听到对象的变化
|
512
|
642
|
}
|
|
643
|
+ }
|
513
|
644
|
}
|
514
|
645
|
</script>
|
515
|
646
|
<style scoped>
|