|
@@ -84,8 +84,8 @@
|
84
|
84
|
</el-button>
|
85
|
85
|
|
86
|
86
|
<el-button type="primary" size="small" icon="el-icon-printer" @click="printScheduleAction">打印</el-button>
|
87
|
|
- <el-button type="primary" size="small" icon="el-icon-setting" @click="setScheduleTemplateAction">排班模板
|
88
|
|
- </el-button>
|
|
87
|
+ <el-button type="primary" size="small" icon="el-icon-setting" @click="setScheduleTemplateAction">排班模板</el-button>
|
|
88
|
+ <el-button type="primary" size="small" @click="copySchedule">复制排班</el-button>
|
89
|
89
|
</div>
|
90
|
90
|
</div>
|
91
|
91
|
<div class="app-container">
|
|
@@ -122,6 +122,27 @@
|
122
|
122
|
|
123
|
123
|
<table-data :week-time="activeName" :partitions-prop="partitions" :schedule-zone-row-prop="scheduleZoneRow"
|
124
|
124
|
:schedule-zone-prop="scheduleZone" title="" @event1="changePartition" @event2="changeSchedule"></table-data>
|
|
125
|
+
|
|
126
|
+
|
|
127
|
+ <el-dialog title="复制排班" width="600px" :visible.sync="newVisible">
|
|
128
|
+ <el-form :model="form" ref="form" label-width="90px" :rules="rules">
|
|
129
|
+ <el-form-item label="复制到 : " required prop="copyWeek">
|
|
130
|
+ <el-select v-model="form.copyWeek" placeholder="请选择">
|
|
131
|
+ <el-option
|
|
132
|
+ v-for="item in typeOptions"
|
|
133
|
+ :key="item.value"
|
|
134
|
+ :label="item.label"
|
|
135
|
+ :value="item.value">
|
|
136
|
+ </el-option>
|
|
137
|
+ </el-select>
|
|
138
|
+ </el-form-item>
|
|
139
|
+
|
|
140
|
+ </el-form>
|
|
141
|
+ <div slot="footer" class="dialog-footer">
|
|
142
|
+ <el-button @click="newVisible=false">取 消</el-button>
|
|
143
|
+ <el-button type="primary" @click="submitAction('form')">保 存</el-button>
|
|
144
|
+ </div>
|
|
145
|
+ </el-dialog>
|
125
|
146
|
</div>
|
126
|
147
|
</div>
|
127
|
148
|
</template>
|
|
@@ -130,7 +151,7 @@
|
130
|
151
|
import moment from 'moment'
|
131
|
152
|
import { parseTime } from '@/utils'
|
132
|
153
|
import tableData from './components/tableData'
|
133
|
|
- import { exportSchedule, getWeekPanels, initDate,getThreeWeekList } from '@/api/schedule'
|
|
154
|
+ import { exportSchedule, getWeekPanels, initDate,getThreeWeekList,copyPatientSchedule } from '@/api/schedule'
|
134
|
155
|
import BreadCrumb from '@/xt_pages/components/bread-crumb'
|
135
|
156
|
import UploadExcel from '@/xt_pages/components/UploadExcel'
|
136
|
157
|
import ScheduleUploadExcel from './components/scheduleUploadExcel/index'
|
|
@@ -169,7 +190,25 @@
|
169
|
190
|
partition_id:0,
|
170
|
191
|
start_time:"",
|
171
|
192
|
end_time:"",
|
172
|
|
- export_type:0
|
|
193
|
+ export_type:0,
|
|
194
|
+ form:{
|
|
195
|
+ copyWeek:"",
|
|
196
|
+ },
|
|
197
|
+ newVisible:false,
|
|
198
|
+ typeOptions:[],
|
|
199
|
+ timeOptions:[],
|
|
200
|
+ copyWeek:'',
|
|
201
|
+ weekList: [],
|
|
202
|
+ currentFirstDate1: '',
|
|
203
|
+ rules: {
|
|
204
|
+ copyWeek: [{ required: true, message: "请选择复制时间段", trigger: "blur" }],
|
|
205
|
+ },
|
|
206
|
+ weekNum:'',
|
|
207
|
+ weekDayArr:[],
|
|
208
|
+ todayDate:'',
|
|
209
|
+ clen:7,
|
|
210
|
+ nowYear: new Date().getFullYear(),
|
|
211
|
+ schedule_week:0,
|
173
|
212
|
}
|
174
|
213
|
},
|
175
|
214
|
components: {
|
|
@@ -998,8 +1037,7 @@
|
998
|
1037
|
return cur
|
999
|
1038
|
}, []) // 设置cur默认类型为数组,并且初始值为空的数组
|
1000
|
1039
|
|
1001
|
|
- console.log("长度11111111111",tempObjArr[i][key].length)
|
1002
|
|
- console.log("长度22222222222",arr.length)
|
|
1040
|
+
|
1003
|
1041
|
if (tempObjArr[i][key].length > arr.length) { //比对原数组和去重后的原数组总数,不同的话则存在重复元素
|
1004
|
1042
|
is_exist_repeat = true
|
1005
|
1043
|
}
|
|
@@ -1012,7 +1050,7 @@
|
1012
|
1050
|
|
1013
|
1051
|
|
1014
|
1052
|
if (headers.length > 65 || !is_system_zone || !is_device_number) {
|
1015
|
|
- console.log("ssssssszzzzzzzqqqqqqqq")
|
|
1053
|
+
|
1016
|
1054
|
|
1017
|
1055
|
this.dialogVisible = true
|
1018
|
1056
|
return
|
|
@@ -2075,7 +2113,7 @@
|
2075
|
2113
|
|
2076
|
2114
|
console.log("end",end)
|
2077
|
2115
|
var scheduleList = response.data.data.list
|
2078
|
|
- console.log("排班列表22222",scheduleList)
|
|
2116
|
+
|
2079
|
2117
|
var week= []
|
2080
|
2118
|
var nextWeek = []
|
2081
|
2119
|
var lastWeek = []
|
|
@@ -2447,8 +2485,101 @@
|
2447
|
2485
|
getTime(val) {
|
2448
|
2486
|
return uParseTime(val, '{y}-{m}-{d}')
|
2449
|
2487
|
},
|
|
2488
|
+
|
|
2489
|
+ copySchedule(){
|
|
2490
|
+ this.newVisible = true
|
|
2491
|
+ },
|
2450
|
2492
|
|
|
2493
|
+ getYearWeek(year,month,date){
|
|
2494
|
+ /*
|
|
2495
|
+ dateNow是当前日期
|
|
2496
|
+ dateFirst是当年第一天
|
|
2497
|
+ dataNumber是当前日期是今年第多少天
|
|
2498
|
+ 用dataNumber + 当前年的第一天的周差距的和在除以7就是本年第几周
|
|
2499
|
+ */
|
|
2500
|
+ let dateNow = new Date(year, parseInt(month) - 1, date);
|
|
2501
|
+ let dateFirst = new Date(year, 0, 1);
|
|
2502
|
+ let dataNumber = Math.round((dateNow.valueOf() - dateFirst.valueOf()) / 86400000);
|
|
2503
|
+ return Math.ceil((dataNumber + ((dateFirst.getDay() + 1) - 1)) / 7);
|
|
2504
|
+ },
|
|
2505
|
+ getTimestamp(time) { //把时间日期转成时间戳
|
|
2506
|
+ return (new Date(time)).getTime() / 1000
|
|
2507
|
+ },
|
2451
|
2508
|
|
|
2509
|
+ formatDate(date){
|
|
2510
|
+ var year = date.getFullYear()+'.'
|
|
2511
|
+ var month = (date.getMonth()+1)+'.';
|
|
2512
|
+ var day = date.getDate();
|
|
2513
|
+ return year+month+day
|
|
2514
|
+ },
|
|
2515
|
+ formatDateTwo(date){
|
|
2516
|
+ var year = date.getFullYear()+'.'
|
|
2517
|
+ var month = (date.getMonth()+1)+'.';
|
|
2518
|
+ var day = date.getDate();
|
|
2519
|
+ return year+month+day
|
|
2520
|
+ },
|
|
2521
|
+ addDate(date,n){
|
|
2522
|
+ date.setDate(date.getDate()+n);
|
|
2523
|
+ return date;
|
|
2524
|
+ },
|
|
2525
|
+ //
|
|
2526
|
+ setDate(date){
|
|
2527
|
+ var week = date.getDay()-1;
|
|
2528
|
+ date = this.addDate(date,week*-1);
|
|
2529
|
+ this.currentFirstDate = new Date(date);
|
|
2530
|
+ this.currentDate = new Date(date)
|
|
2531
|
+ for(var i = 0;i<this.clen; i++){
|
|
2532
|
+ this.weekDayArr.push(this.formatDate(i==0 ? date : this.addDate(date,1)))
|
|
2533
|
+ }
|
|
2534
|
+ },
|
|
2535
|
+ setDate1 (date) {
|
|
2536
|
+ var week = date.getDay() - 1
|
|
2537
|
+ date = this.addDate(date, week * -1)
|
|
2538
|
+ this.currentDate = new Date(date)
|
|
2539
|
+ let arr1 = []
|
|
2540
|
+ for (var i = 0; i < this.clen; i++) {
|
|
2541
|
+ arr1.push(this.formatDate(i == 0 ? date : this.addDate(date, 1)))
|
|
2542
|
+ }
|
|
2543
|
+ this.weekList.push(arr1)
|
|
2544
|
+ let num = this.weekNum
|
|
2545
|
+ this.currentFirstDate1 = num + 1
|
|
2546
|
+ },
|
|
2547
|
+ getTimestamp(time) { //把时间日期转成时间戳
|
|
2548
|
+ return (new Date(time)).getTime() / 1000
|
|
2549
|
+ },
|
|
2550
|
+ submitAction(formName){
|
|
2551
|
+ var label = ""
|
|
2552
|
+ for(let i=0;i<this.timeOptions.length;i++){
|
|
2553
|
+ if(this.form.copyWeek == this.timeOptions[i].value){
|
|
2554
|
+ label = this.timeOptions[i].label
|
|
2555
|
+ }
|
|
2556
|
+ }
|
|
2557
|
+ var start = label.split('~')
|
|
2558
|
+ var copy_startime = this.getTimestamp(start[0])
|
|
2559
|
+ var copy_endtime = this.getTimestamp(start[1])
|
|
2560
|
+
|
|
2561
|
+ const params = {
|
|
2562
|
+ start_time:this.getTimestamp(this.weekDayArr[0]),
|
|
2563
|
+ end_time:this.getTimestamp(this.weekDayArr[6]),
|
|
2564
|
+ copy_startime:copy_startime,
|
|
2565
|
+ copy_endtime:copy_endtime,
|
|
2566
|
+ }
|
|
2567
|
+ console.log("parasm",params)
|
|
2568
|
+
|
|
2569
|
+ this.$refs[formName].validate(valid=>{
|
|
2570
|
+ if(valid){
|
|
2571
|
+ copyPatientSchedule(params).then(response=>{
|
|
2572
|
+ if(response.data.state == 1){
|
|
2573
|
+ var msg = response.data.data.msg
|
|
2574
|
+ this.$message.success("复制成功")
|
|
2575
|
+ this.newVisible = false
|
|
2576
|
+ }else{
|
|
2577
|
+ this.$message.error("复制失败")
|
|
2578
|
+ }
|
|
2579
|
+ })
|
|
2580
|
+ }
|
|
2581
|
+ })
|
|
2582
|
+ },
|
2452
|
2583
|
},
|
2453
|
2584
|
created() {
|
2454
|
2585
|
var start_time = moment().weekday(1).format('YYYY-MM-DD');
|
|
@@ -2460,6 +2591,37 @@
|
2460
|
2591
|
|
2461
|
2592
|
//获取三周排班数据
|
2462
|
2593
|
this.getThreeWeekList()
|
|
2594
|
+
|
|
2595
|
+
|
|
2596
|
+ let year = new Date().getFullYear()
|
|
2597
|
+ let month = new Date().getMonth() + 1
|
|
2598
|
+ let date = new Date().getDate()
|
|
2599
|
+ this.weekNum = this.getYearWeek(year,month,date)
|
|
2600
|
+ this.todayDate=this.formatDate(new Date())
|
|
2601
|
+ this.setDate(new Date())
|
|
2602
|
+
|
|
2603
|
+ for (var i = 0; i <= 9; i++) {
|
|
2604
|
+ this.setDate1(this.addDate(this.currentDate, 7))
|
|
2605
|
+ }
|
|
2606
|
+ let newNum = 0
|
|
2607
|
+ for(let i = 0; i < this.weekList.length; i++){
|
|
2608
|
+ if(this.weekNum + i + 1 <= 53){
|
|
2609
|
+ let num = this.weekNum + i + 1
|
|
2610
|
+ let str = this.weekList[i][0] + '~' + this.weekList[i][6] + '(' + num + ')'
|
|
2611
|
+ this.typeOptions.push({value:i,label:str})
|
|
2612
|
+ let stt = this.weekList[i][0] +"~"+this.weekList[i][6]
|
|
2613
|
+ this.timeOptions.push({value:i,label:stt})
|
|
2614
|
+ }else{
|
|
2615
|
+
|
|
2616
|
+ newNum++
|
|
2617
|
+ let str = this.weekList[i][0] + '~' + this.weekList[i][6] + '(' + newNum + ')'
|
|
2618
|
+ this.typeOptions.push({value:i,label:str})
|
|
2619
|
+ let stt = this.weekList[i][0] +"~"+this.weekList[i][6]
|
|
2620
|
+ this.timeOptions.push({value:i,label:stt})
|
|
2621
|
+ }
|
|
2622
|
+
|
|
2623
|
+ }
|
|
2624
|
+
|
2463
|
2625
|
}
|
2464
|
2626
|
}
|
2465
|
2627
|
</script>
|