|
@@ -33,7 +33,7 @@
|
33
|
33
|
:value="item.value">
|
34
|
34
|
</el-option>
|
35
|
35
|
</el-select>
|
36
|
|
- <el-button @click="lastclick" type="text" style="margin:0 10px;"><上一周({{ weekNum - 1 }})</el-button>
|
|
36
|
+ <el-button @click="lastclick" type="text" style="margin:0 10px;"><上一周({{ weekNum - 1 }})</el-button>
|
37
|
37
|
<div class="dateBox">{{ weekDayArr[0] }}-{{ weekDayArr[6] }}({{ weekNum }})</div>
|
38
|
38
|
<el-button @click="nextclick" type="text" style="margin:0 10px;">下一周({{ weekNum + 1 }})></el-button>
|
39
|
39
|
</div>
|
|
@@ -43,18 +43,18 @@
|
43
|
43
|
<el-table-column prop="name" label="医护姓名" style="width:16%" align="center"></el-table-column>
|
44
|
44
|
<el-table-column label="周一" style="width:14%" align="center">
|
45
|
45
|
<template slot-scope="scope">
|
46
|
|
- <el-dropdown trigger="click">
|
47
|
|
- <span class="el-dropdown-link">
|
48
|
|
- 下拉菜单<i class="el-icon-arrow-down el-icon--right"></i>
|
49
|
|
- </span>
|
50
|
|
- <el-dropdown-menu slot="dropdown">
|
51
|
|
- <el-dropdown-item icon="el-icon-plus">黄金糕</el-dropdown-item>
|
52
|
|
- <el-dropdown-item icon="el-icon-circle-plus">狮子头</el-dropdown-item>
|
53
|
|
- <el-dropdown-item icon="el-icon-circle-plus-outline">螺蛳粉</el-dropdown-item>
|
54
|
|
- <el-dropdown-item icon="el-icon-check">双皮奶</el-dropdown-item>
|
55
|
|
- <el-dropdown-item icon="el-icon-circle-check">蚵仔煎</el-dropdown-item>
|
56
|
|
- </el-dropdown-menu>
|
57
|
|
- </el-dropdown>
|
|
46
|
+ <div @click="hangdleClick(scope.row,scope.$index)">
|
|
47
|
+ <el-dropdown trigger="click" @command="changeSchedule">
|
|
48
|
+ <span class="el-dropdown-link">
|
|
49
|
+ {{scope.row.class_name}}<i class="el-icon-arrow-down el-icon--right"></i>
|
|
50
|
+ </span>
|
|
51
|
+ <el-dropdown-menu slot="dropdown" >
|
|
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>
|
|
53
|
+ </el-dropdown-menu>
|
|
54
|
+ </el-dropdown>
|
|
55
|
+ </div>
|
|
56
|
+
|
|
57
|
+
|
58
|
58
|
</template>
|
59
|
59
|
</el-table-column>
|
60
|
60
|
<el-table-column prop="name" label="周二" style="width:14%" align="center"></el-table-column>
|
|
@@ -86,6 +86,7 @@
|
86
|
86
|
|
87
|
87
|
<script>
|
88
|
88
|
import BreadCrumb from '@/xt_pages/components/bread-crumb'
|
|
89
|
+import { getDoctorList,getScheduleList,addSchedule } from '@/api/doctorSchedule'
|
89
|
90
|
export default {
|
90
|
91
|
components:{
|
91
|
92
|
BreadCrumb
|
|
@@ -131,7 +132,14 @@ export default {
|
131
|
132
|
todayDate:'',
|
132
|
133
|
clen:7,
|
133
|
134
|
nowYear: new Date().getFullYear()
|
134
|
|
-
|
|
135
|
+ weekNum:'',
|
|
136
|
+ weekDayArr:[],
|
|
137
|
+ todayDate:'',
|
|
138
|
+ clen:7,
|
|
139
|
+ nowYear: new Date().getFullYear(),
|
|
140
|
+ schedule_week:0,
|
|
141
|
+ docobj:{},
|
|
142
|
+ class_name:""
|
135
|
143
|
}
|
136
|
144
|
},
|
137
|
145
|
created(){
|
|
@@ -152,73 +160,186 @@ export default {
|
152
|
160
|
// query: { date: date }
|
153
|
161
|
})
|
154
|
162
|
},
|
155
|
|
- formatDate(date){
|
|
163
|
+ getDoctorList(){
|
|
164
|
+ getDoctorList().then(response=>{
|
|
165
|
+ if(response.data.state == 1){
|
|
166
|
+ var list = response.data.data.list
|
|
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
|
+
|
|
194
|
+ }
|
|
195
|
+ })
|
|
196
|
+ },
|
|
197
|
+ getScheduleList(){
|
|
198
|
+ getScheduleList().then(response=>{
|
|
199
|
+ if(response.data.state == 1){
|
|
200
|
+ var schedulelist = response.data.data.scheduleList
|
|
201
|
+ for(let i=0;i<schedulelist.length;i++){
|
|
202
|
+ if(schedulelist[i].timeone_type == 1){
|
|
203
|
+ schedulelist[i].timeone_type = "当日"
|
|
204
|
+ }
|
|
205
|
+ if(schedulelist[i].timeone_type == 2){
|
|
206
|
+ schedulelist[i].timeone_type = "次日"
|
|
207
|
+ }
|
|
208
|
+ if(schedulelist[i].timetwo_type == 1){
|
|
209
|
+ schedulelist[i].timetwo_type = "当日"
|
|
210
|
+ }
|
|
211
|
+ if(schedulelist[i].timetwo_type == 2){
|
|
212
|
+ schedulelist[i].timetwo_type = "次日"
|
|
213
|
+ }
|
|
214
|
+ }
|
|
215
|
+ this.schedulelist = schedulelist
|
|
216
|
+ }
|
|
217
|
+ })
|
|
218
|
+ },
|
|
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){
|
156
|
256
|
var year = date.getFullYear()+'.'
|
157
|
257
|
var month = (date.getMonth()+1)+'.';
|
158
|
258
|
var day = date.getDate();
|
159
|
259
|
return year+month+day
|
160
|
260
|
},
|
161
|
|
- addDate(date,n){
|
162
|
|
- date.setDate(date.getDate()+n);
|
163
|
|
- return date;
|
164
|
|
- },
|
|
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
|
+ },
|
165
|
271
|
//
|
166
|
|
- setDate(date){
|
167
|
|
- var week = date.getDay()-1;
|
168
|
|
- date = this.addDate(date,week*-1);
|
169
|
|
- this.currentFirstDate = new Date(date);
|
170
|
|
- for(var i = 0;i<this.clen; i++){
|
171
|
|
- this.weekDayArr.push(this.formatDate(i==0 ? date : this.addDate(date,1)))
|
172
|
|
- }
|
173
|
|
- console.log(333333333,this.weekDayArr)
|
174
|
|
- },
|
|
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
|
+ },
|
175
|
281
|
//上一周
|
176
|
|
- lastclick(){
|
177
|
|
- this.weekDayArr=[]
|
178
|
|
- this.setDate(this.addDate(this.currentFirstDate,-7));
|
179
|
|
- this.weekNum = this.weekNum - 1
|
180
|
|
- if(this.weekNum - 1 == 0){
|
181
|
|
- let year = this.nowYear - 1
|
182
|
|
- let month = 12
|
183
|
|
- let date = 31
|
184
|
|
- this.weekNum = this.getYearWeek(year,month,date)
|
185
|
|
- this.nowYear = this.nowYear - 1
|
186
|
|
- }
|
187
|
|
- },
|
|
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
|
+ },
|
188
|
294
|
//下一周
|
189
|
|
- nextclick(){
|
190
|
|
- this.weekDayArr=[]
|
191
|
|
- this.setDate(this.addDate(this.currentFirstDate,7));
|
192
|
|
- this.weekNum = this.weekNum + 1
|
193
|
|
- if(this.weekNum + 1 == 54){
|
194
|
|
- let year = this.nowYear + 1
|
195
|
|
- let month = 1
|
196
|
|
- let date = 1
|
197
|
|
- this.weekNum = this.getYearWeek(year,month,date)
|
198
|
|
- this.nowYear = this.nowYear + 1
|
199
|
|
- console.log('year',year)
|
200
|
|
- console.log('month',month)
|
201
|
|
- console.log('date',date)
|
202
|
|
- console.log(this.weekNum)
|
203
|
|
- console.log('执行')
|
204
|
|
- }
|
205
|
|
- },
|
|
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
|
+ },
|
206
|
307
|
|
207
|
|
- getYearWeek(year,month,date){
|
208
|
|
- /*
|
209
|
|
- dateNow是当前日期
|
210
|
|
- dateFirst是当年第一天
|
211
|
|
- dataNumber是当前日期是今年第多少天
|
212
|
|
- 用dataNumber + 当前年的第一天的周差距的和在除以7就是本年第几周
|
213
|
|
- */
|
214
|
|
- let dateNow = new Date(year, parseInt(month) - 1, date);
|
215
|
|
- let dateFirst = new Date(year, 0, 1);
|
216
|
|
- let dataNumber = Math.round((dateNow.valueOf() - dateFirst.valueOf()) / 86400000);
|
217
|
|
- console.log(222222222222,Math.ceil((dataNumber + ((dateFirst.getDay() + 1) - 1)) / 7))
|
218
|
|
- return Math.ceil((dataNumber + ((dateFirst.getDay() + 1) - 1)) / 7);
|
|
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
|
|
322
|
+ },
|
|
323
|
+ beforeHandleCommand(item,row){
|
|
324
|
+ return {
|
|
325
|
+ 'command': item,
|
|
326
|
+ 'row': row
|
219
|
327
|
}
|
|
328
|
+ }
|
|
329
|
+ },
|
|
330
|
+ created(){
|
|
331
|
+ //获取医护人员
|
|
332
|
+ this.getDoctorList()
|
|
333
|
+ //获取班种
|
|
334
|
+ this.getScheduleList()
|
220
|
335
|
|
221
|
|
- }
|
|
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())
|
|
342
|
+ }
|
222
|
343
|
}
|
223
|
344
|
</script>
|
224
|
345
|
|