master
xy 3 years ago
parent e0f71ee939
commit 1fdad84858

@ -82,7 +82,9 @@
<div>{{timeFormat(date)}}</div>
<template v-if="data.type === 'current-month'">
<template v-if="scheduleCount(data.day)">
<div class="schedule-time" @click="datePick(date,data,2,scheduleCount(data.day)[0])">{{scheduleCount(data.day)[0].nurse.name}} {{timeFormat(scheduleCount(data.day)[0].start_time,'{h}:{i}')}}~{{timeFormat(scheduleCount(data.day)[0].end_time,'{h}:{i}')}}</div>
<div class="schedule-time" @click="datePick(date,data,2,scheduleCount(data.day))">
{{ getNurseName(data) }} {{ getStartTime(data) }}~{{ getEndTime(data) }}
</div>
</template>
<template v-else>
<i class="el-icon-plus" style="padding:10px;" @click="datePick(date,data,1)"></i>
@ -210,7 +212,9 @@ export default {
console.error(err)
}
},
scheduleCount(day){
return this.detail.schedule.find(i => i.date === day)
},
},
computed: {
ageComputed() {
@ -232,13 +236,25 @@ export default {
return parseTime(data,format)
}
},
scheduleCount(){
return function (day){
let arr = this.detail.schedule.filter(item => {
return day === item.date
})
if(arr.length > 0){
return arr
getNurseName() {
return function (data){
return this.scheduleCount(data.day)?.nurse?.name
}
},
getStartTime() {
return function (data){
let time = this.scheduleCount(data.day)?.start_time
if(time) {
return this.timeFormat(this.scheduleCount(data.day)?.start_time,'{h}:{i}')
}
}
},
getEndTime() {
return function (data){
let time = this.scheduleCount(data.day)?.end_time
if(time) {
return this.timeFormat(this.scheduleCount(data.day)?.end_time,'{h}:{i}')
}
}
}

Loading…
Cancel
Save