|
@@ -33,30 +33,28 @@
|
33
|
33
|
:value="item.value">
|
34
|
34
|
</el-option>
|
35
|
35
|
</el-select>
|
36
|
|
- <el-button type="text" style="margin:0 10px;"><上一周(22)</el-button>
|
37
|
|
- <div class="dateBox">2019.11.25-2019.12.01(47)</div>
|
38
|
|
- <el-button type="text" style="margin:0 10px;">下一周(24)></el-button>
|
|
36
|
+ <el-button @click="lastclick" type="text" style="margin:0 10px;"><上一周({{ weekNum - 1 }})</el-button>
|
|
37
|
+ <div class="dateBox">{{ weekDayArr[0] }}-{{ weekDayArr[6] }}({{ weekNum }})</div>
|
|
38
|
+ <el-button @click="nextclick" type="text" style="margin:0 10px;">下一周({{ weekNum + 1 }})></el-button>
|
39
|
39
|
</div>
|
40
|
40
|
<div style="display:flex;justify-content: space-between;">
|
41
|
41
|
<div style="width: 70%">
|
42
|
42
|
<el-table :data="tableData" border :header-cell-style="{backgroundColor: 'rgb(245, 247, 250)', color: '#606266'}" :row-style="{ color: '#303133' }">
|
43
|
|
- <el-table-column prop="name" label="医护姓名" style="width:16%" align="center">
|
44
|
|
- <template slot-scope="scope">
|
45
|
|
- {{scope.row.user_name}}
|
46
|
|
- </template>
|
47
|
|
- </el-table-column>
|
|
43
|
+ <el-table-column prop="name" label="医护姓名" style="width:16%" align="center"></el-table-column>
|
48
|
44
|
<el-table-column label="周一" style="width:14%" align="center">
|
49
|
45
|
<template slot-scope="scope">
|
50
|
46
|
<div @click="hangdleClick(scope.row,scope.$index)">
|
51
|
|
- <el-dropdown trigger="click" @command="changeSchedule(scope.row)">
|
|
47
|
+ <el-dropdown trigger="click" @command="changeSchedule">
|
52
|
48
|
<span class="el-dropdown-link">
|
53
|
|
- aaa<i class="el-icon-arrow-down el-icon--right"></i>
|
|
49
|
+ {{scope.row.class_name}}<i class="el-icon-arrow-down el-icon--right"></i>
|
54
|
50
|
</span>
|
55
|
51
|
<el-dropdown-menu slot="dropdown" >
|
56
|
|
- <el-dropdown-item :command="item.class_name" icon="el-icon-plus" v-for="(item,index) in schedulelist" :key="index">{{item.class_name}}</el-dropdown-item>
|
|
52
|
+ <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
|
53
|
</el-dropdown-menu>
|
58
|
54
|
</el-dropdown>
|
59
|
55
|
</div>
|
|
56
|
+
|
|
57
|
+
|
60
|
58
|
</template>
|
61
|
59
|
</el-table-column>
|
62
|
60
|
<el-table-column prop="name" label="周二" style="width:14%" align="center"></el-table-column>
|
|
@@ -70,11 +68,13 @@
|
70
|
68
|
<div class="classBox">
|
71
|
69
|
<div class="classTitle">班种</div>
|
72
|
70
|
<div class="classMain">
|
73
|
|
- <div v-for="(item,index) in schedulelist" :key="index">
|
74
|
|
- <p>
|
75
|
|
- {{item.class_name}} ({{item.timeone_start}}~{{item.timeone_type}}{{item.timeone_end}} <span v-if="item.timetwo_start!=''">{{item.timetwo_start}}~{{item.timetwo_type}}{{item.timetwo_end}}</span> )
|
76
|
|
- </p>
|
|
71
|
+ <div>
|
|
72
|
+ <p>早班(08:00~12:00)</p>
|
|
73
|
+ <p>中班(12:00~18:00)</p>
|
|
74
|
+ <p>晚班(18:00~24:00)</p>
|
|
75
|
+ <p>全班(08:00~18:00)</p>
|
77
|
76
|
</div>
|
|
77
|
+
|
78
|
78
|
<el-checkbox style="text-align:center" v-model="isChecked">连续排班</el-checkbox>
|
79
|
79
|
</div>
|
80
|
80
|
</div>
|
|
@@ -86,7 +86,7 @@
|
86
|
86
|
|
87
|
87
|
<script>
|
88
|
88
|
import BreadCrumb from '@/xt_pages/components/bread-crumb'
|
89
|
|
-import { getDoctorList,getScheduleList } from '@/api/doctorSchedule'
|
|
89
|
+import { getDoctorList,getScheduleList,addSchedule } from '@/api/doctorSchedule'
|
90
|
90
|
export default {
|
91
|
91
|
components:{
|
92
|
92
|
BreadCrumb
|
|
@@ -109,12 +109,49 @@ export default {
|
109
|
109
|
label: '护士'
|
110
|
110
|
}],
|
111
|
111
|
typeValue:'1',
|
112
|
|
- tableData: [],
|
|
112
|
+ tableData: [{
|
|
113
|
+ date: '2016-05-02',
|
|
114
|
+ name: '王小虎',
|
|
115
|
+ address: '上海市普陀区金沙江路 1518 弄'
|
|
116
|
+ }, {
|
|
117
|
+ date: '2016-05-04',
|
|
118
|
+ name: '王小虎',
|
|
119
|
+ address: '上海市普陀区金沙江路 1517 弄'
|
|
120
|
+ }, {
|
|
121
|
+ date: '2016-05-01',
|
|
122
|
+ name: '王小虎',
|
|
123
|
+ address: '上海市普陀区金沙江路 1519 弄'
|
|
124
|
+ }, {
|
|
125
|
+ date: '2016-05-03',
|
|
126
|
+ name: '王小虎',
|
|
127
|
+ address: '上海市普陀区金沙江路 1516 弄'
|
|
128
|
+ }],
|
113
|
129
|
isChecked:true,
|
114
|
|
- schedulelist:[],
|
115
|
|
-
|
|
130
|
+ weekNum:'',
|
|
131
|
+ weekDayArr:[],
|
|
132
|
+ todayDate:'',
|
|
133
|
+ clen:7,
|
|
134
|
+ nowYear: new Date().getFullYear()
|
|
135
|
+ weekNum:'',
|
|
136
|
+ weekDayArr:[],
|
|
137
|
+ todayDate:'',
|
|
138
|
+ clen:7,
|
|
139
|
+ nowYear: new Date().getFullYear(),
|
|
140
|
+ schedule_week:0,
|
|
141
|
+ docobj:{},
|
|
142
|
+ class_name:""
|
116
|
143
|
}
|
117
|
144
|
},
|
|
145
|
+ created(){
|
|
146
|
+ let year = new Date().getFullYear()
|
|
147
|
+ let month = new Date().getMonth() + 1
|
|
148
|
+ let date = new Date().getDate()
|
|
149
|
+ this.weekNum = this.getYearWeek(year,month,date)
|
|
150
|
+
|
|
151
|
+ this.todayDate=this.formatDate(new Date())
|
|
152
|
+ this.setDate(new Date())
|
|
153
|
+
|
|
154
|
+ },
|
118
|
155
|
methods:{
|
119
|
156
|
search(){},
|
120
|
157
|
toPrint(){
|
|
@@ -127,8 +164,33 @@ export default {
|
127
|
164
|
getDoctorList().then(response=>{
|
128
|
165
|
if(response.data.state == 1){
|
129
|
166
|
var list = response.data.data.list
|
130
|
|
- console.log("list",list)
|
131
|
167
|
this.tableData = list
|
|
168
|
+
|
|
169
|
+
|
|
170
|
+
|
|
171
|
+
|
|
172
|
+
|
|
173
|
+
|
|
174
|
+
|
|
175
|
+
|
|
176
|
+
|
|
177
|
+
|
|
178
|
+
|
|
179
|
+
|
|
180
|
+
|
|
181
|
+
|
|
182
|
+
|
|
183
|
+
|
|
184
|
+
|
|
185
|
+
|
|
186
|
+
|
|
187
|
+
|
|
188
|
+
|
|
189
|
+
|
|
190
|
+
|
|
191
|
+
|
|
192
|
+
|
|
193
|
+
|
132
|
194
|
}
|
133
|
195
|
})
|
134
|
196
|
},
|
|
@@ -151,30 +213,132 @@ export default {
|
151
|
213
|
}
|
152
|
214
|
}
|
153
|
215
|
this.schedulelist = schedulelist
|
154
|
|
- console.log("schedulelist",schedulelist)
|
155
|
216
|
}
|
156
|
217
|
})
|
157
|
218
|
},
|
158
|
|
- changeSchedule(command){
|
159
|
|
- console.log("val",command)
|
|
219
|
+ hangdleClick(val,index){
|
|
220
|
+ this.schedule_week = index
|
|
221
|
+ this.docobj = val
|
|
222
|
+ },
|
|
223
|
+ changeSchedule(id){
|
|
224
|
+ var class_name = ""
|
|
225
|
+ for(let i=0;i<this.schedulelist.length;i++){
|
|
226
|
+ if(id == this.schedulelist[i].id){
|
|
227
|
+ class_name = this.schedulelist[i].class_name
|
|
228
|
+ }
|
|
229
|
+ }
|
|
230
|
+ let arr = [...this.tableData]
|
|
231
|
+ for(let i=0;i<arr.length;i++){
|
|
232
|
+ if(this.docobj.id == arr[i].id){
|
|
233
|
+ arr[i].class_name = class_name
|
|
234
|
+ }
|
|
235
|
+ }
|
|
236
|
+ this.tableData = arr
|
|
237
|
+ const params = {
|
|
238
|
+ doctor_id:this.docobj.admin_user_id,
|
|
239
|
+ doctor_type:this.docobj.user_type,
|
|
240
|
+ schedule_type:id,
|
|
241
|
+ schedule_week:this.schedule_week,
|
|
242
|
+ start_time:this.getTimestamp(this.weekDayArr[0]),
|
|
243
|
+ end_time:this.getTimestamp(this.weekDayArr[6])
|
|
244
|
+ }
|
|
245
|
+ console.log("params",params)
|
|
246
|
+
|
|
247
|
+ addSchedule(params).then(response=>{
|
|
248
|
+ if(response.data.state == 1){
|
|
249
|
+ var schedule = response.data.data.schedule
|
|
250
|
+ console.log("schedule",schedule)
|
|
251
|
+ }
|
|
252
|
+ })
|
|
253
|
+ },
|
|
254
|
+
|
|
255
|
+ formatDate(date){
|
|
256
|
+ var year = date.getFullYear()+'.'
|
|
257
|
+ var month = (date.getMonth()+1)+'.';
|
|
258
|
+ var day = date.getDate();
|
|
259
|
+ return year+month+day
|
|
260
|
+ },
|
|
261
|
+ formatDateTwo(date){
|
|
262
|
+ var year = date.getFullYear()+'.'
|
|
263
|
+ var month = (date.getMonth()+1)+'.';
|
|
264
|
+ var day = date.getDate();
|
|
265
|
+ return year+month+day
|
|
266
|
+ },
|
|
267
|
+ addDate(date,n){
|
|
268
|
+ date.setDate(date.getDate()+n);
|
|
269
|
+ return date;
|
|
270
|
+ },
|
|
271
|
+ //
|
|
272
|
+ setDate(date){
|
|
273
|
+ var week = date.getDay()-1;
|
|
274
|
+ date = this.addDate(date,week*-1);
|
|
275
|
+ this.currentFirstDate = new Date(date);
|
|
276
|
+ for(var i = 0;i<this.clen; i++){
|
|
277
|
+ this.weekDayArr.push(this.formatDate(i==0 ? date : this.addDate(date,1)))
|
|
278
|
+
|
|
279
|
+ }
|
|
280
|
+ },
|
|
281
|
+ //上一周
|
|
282
|
+ lastclick(){
|
|
283
|
+ this.weekDayArr=[]
|
|
284
|
+ this.setDate(this.addDate(this.currentFirstDate,-7));
|
|
285
|
+ this.weekNum = this.weekNum - 1
|
|
286
|
+ if(this.weekNum - 1 == 0){
|
|
287
|
+ let year = this.nowYear - 1
|
|
288
|
+ let month = 12
|
|
289
|
+ let date = 31
|
|
290
|
+ this.weekNum = this.getYearWeek(year,month,date)
|
|
291
|
+ this.nowYear = this.nowYear - 1
|
|
292
|
+ }
|
|
293
|
+ },
|
|
294
|
+ //下一周
|
|
295
|
+ nextclick(){
|
|
296
|
+ this.weekDayArr=[]
|
|
297
|
+ this.setDate(this.addDate(this.currentFirstDate,7));
|
|
298
|
+ this.weekNum = this.weekNum + 1
|
|
299
|
+ if(this.weekNum + 1 == 54){
|
|
300
|
+ let year = this.nowYear + 1
|
|
301
|
+ let month = 1
|
|
302
|
+ let date = 1
|
|
303
|
+ this.weekNum = this.getYearWeek(year,month,date)
|
|
304
|
+ this.nowYear = this.nowYear + 1
|
|
305
|
+ }
|
|
306
|
+ },
|
|
307
|
+
|
|
308
|
+ getYearWeek(year,month,date){
|
|
309
|
+ /*
|
|
310
|
+ dateNow是当前日期
|
|
311
|
+ dateFirst是当年第一天
|
|
312
|
+ dataNumber是当前日期是今年第多少天
|
|
313
|
+ 用dataNumber + 当前年的第一天的周差距的和在除以7就是本年第几周
|
|
314
|
+ */
|
|
315
|
+ let dateNow = new Date(year, parseInt(month) - 1, date);
|
|
316
|
+ let dateFirst = new Date(year, 0, 1);
|
|
317
|
+ let dataNumber = Math.round((dateNow.valueOf() - dateFirst.valueOf()) / 86400000);
|
|
318
|
+ return Math.ceil((dataNumber + ((dateFirst.getDay() + 1) - 1)) / 7);
|
|
319
|
+ },
|
|
320
|
+ getTimestamp(time) { //把时间日期转成时间戳
|
|
321
|
+ return (new Date(time)).getTime() / 1000
|
160
|
322
|
},
|
161
|
323
|
beforeHandleCommand(item,row){
|
162
|
324
|
return {
|
163
|
|
- 'command': item,
|
164
|
|
- 'row': row
|
|
325
|
+ 'command': item,
|
|
326
|
+ 'row': row
|
165
|
327
|
}
|
166
|
|
- },
|
167
|
|
- hangdleClick(val,index){
|
168
|
|
- console.log("点击",val)
|
169
|
|
- console.log("index",index)
|
170
|
|
- this.index =index
|
171
|
|
- }
|
172
|
|
- },
|
|
328
|
+ }
|
|
329
|
+ },
|
173
|
330
|
created(){
|
174
|
331
|
//获取医护人员
|
175
|
332
|
this.getDoctorList()
|
176
|
333
|
//获取班种
|
177
|
334
|
this.getScheduleList()
|
|
335
|
+
|
|
336
|
+ let year = new Date().getFullYear()
|
|
337
|
+ let month = new Date().getMonth() + 1
|
|
338
|
+ let date = new Date().getDate()
|
|
339
|
+ this.weekNum = this.getYearWeek(year,month,date)
|
|
340
|
+ this.todayDate=this.formatDate(new Date())
|
|
341
|
+ this.setDate(new Date())
|
178
|
342
|
}
|
179
|
343
|
}
|
180
|
344
|
</script>
|