You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

302 lines
7.8 KiB

3 years ago
<template>
<div v-if="detail">
<xy-dialog
3 years ago
ref="dialog"
3 years ago
:is-show.sync="isShow"
3 years ago
:width='72'
3 years ago
title="排班"
3 years ago
type="normal"
3 years ago
@reset="pickType = 1,dateStartPick = '',dateEndPick = ''">
3 years ago
<template>
<el-row type="flex" align="middle">
<el-col :span="4" :push="1">
姓名
</el-col>
<el-col :span="18">
3 years ago
<el-input v-model="detail.customer.name" readonly style="width: 300px;">
3 years ago
</el-input>
</el-col>
</el-row>
3 years ago
3 years ago
<el-row type="flex" align="middle">
<el-col :span="4" :push="1">
性别
</el-col>
<el-col :span="18">
3 years ago
<el-input v-model="detail.customer.sex" readonly style="width: 300px;">
3 years ago
</el-input>
</el-col>
</el-row>
3 years ago
3 years ago
<el-row type="flex" align="middle">
<el-col :span="4" :push="1">
身份证号
</el-col>
<el-col :span="18">
3 years ago
<el-input v-model="detail.customer.idcard" readonly style="width: 300px;">
3 years ago
</el-input>
</el-col>
</el-row>
3 years ago
3 years ago
<el-row type="flex" align="middle">
<el-col :span="4" :push="1">
年龄
</el-col>
<el-col :span="18">
<el-input :value="ageComputed" readonly style="width: 300px;">
</el-input>
</el-col>
</el-row>
3 years ago
3 years ago
<el-row type="flex" align="middle">
<el-col :span="4" :push="1">
评估等级
</el-col>
<el-col :span="18">
3 years ago
<el-select v-model="detail.customer.level_id" disabled placeholder="请选择失能等级" style="width: 300px">
3 years ago
<el-option v-for="item in levels" :key="item.id" :label="item.value" :value="item.id"></el-option>
3 years ago
</el-select>
3 years ago
</el-col>
</el-row>
3 years ago
3 years ago
<el-row type="flex" align="middle">
<el-col :span="4" :push="1">
上门地址
</el-col>
<el-col :span="18">
3 years ago
<el-input style="width: 300px;" readonly :value="defaultAddress(detail.customer.customer_address)"></el-input>
3 years ago
</el-col>
</el-row>
3 years ago
3 years ago
<el-row type="flex" align="middle">
<el-col :span="4" :push="1">
备注
</el-col>
<el-col :span="18">
3 years ago
<el-input style="width: 300px;" v-model="detail.customer.remark" readonly></el-input>
3 years ago
</el-col>
</el-row>
3 years ago
3 years ago
<el-calendar>
3 years ago
<template v-slot:dateCell="{date, data}">
3 years ago
<div @click="datePick(date,data)" style="display:flex;flex-direction: column;justify-content: center;align-items: center;width: 100%;height: 100%">
<div>{{timeFormat(date)}}</div>
<template v-if="data.type === 'current-month'">
<i class="el-icon-plus" style="padding:10px;"></i>
</template>
3 years ago
<template v-if="scheduleCount(data.day)">
<Poptip transfer trigger="hover" title="当日排班" width="520" content="content" >
<template v-slot:default>
<div class="schedule-num">{{scheduleCount(data.day).length}}</div>
</template>
<template v-slot:content>
<xy-table :is-page="false" :height="220" :list="scheduleCount(data.day)" :table-item="table">
<template v-slot:btns>
<el-table-column label="操作" width="70">
<template v-slot:default="scope">
<Poptip
:transfer="true"
confirm
title="确认要删除吗?"
@on-ok="destroySchedule(scope.row)">
<Button size="small" type="primary" ghost>删除</Button>
</Poptip>
</template>
</el-table-column>
</template>
</xy-table>
</template>
</Poptip>
</template>
3 years ago
</div>
3 years ago
</template>
3 years ago
</el-calendar>
</template>
3 years ago
<template v-slot:footerContent>
<Button type="primary" @click="isShow = false">确认</Button>
</template>
3 years ago
</xy-dialog>
3 years ago
<timeSelect
:is-show.sync="isShowTime"
:nurses="nurses"
:skus="skus"
:date="date"
3 years ago
:order-id="detail.id"
:product-id="detail.product.id"
:customer-id="detail.customer.id"></timeSelect>
3 years ago
</div>
</template>
<script>
3 years ago
import {parseTime} from '@/utils'
3 years ago
import {customerDetail,scheduleDelete} from '@/api/schedule'
3 years ago
3 years ago
import timeSelect from "@/views/schedule/component/timeSelect";
3 years ago
export default {
3 years ago
components:{
timeSelect
},
3 years ago
props: {
customers: {
type: Array,
default: () => []
3 years ago
},
3 years ago
products: {
type: Array,
default: () => []
3 years ago
},
3 years ago
nurses: {
type: Array,
default: () => []
3 years ago
},
3 years ago
levels: {
type: Array,
default: () => []
3 years ago
},
3 years ago
skus:{
type: Array,
default: () => []
},
3 years ago
},
data() {
return {
productId: '',
isShow: false,
3 years ago
isShowTime:false,
date:'',
3 years ago
3 years ago
detail: '',
3 years ago
schedules:[],
3 years ago
dateStartPick:'',
dateEndPick:'',
pickType:1,
3 years ago
table:[
{
label:'护工',
prop:'nurse_id',
minWidth:120,
sortable:false
},
{
label:'护理时间',
width:310,
sortable: false,
customFn:(row)=>{
return (
<div>{row.start_time} {row.end_time}</div>
)
}
}
]
3 years ago
}
},
methods: {
3 years ago
3 years ago
datePick(date,data){
console.log(date,data)
if(data.type === 'current-month'){
this.date = data.day
3 years ago
this.isShowTime = true
3 years ago
}
},
3 years ago
async getCustomer() {
const res = await customerDetail({
3 years ago
product_id: this.detail.product.id,
id: this.detail.customer.id,
3 years ago
})
console.log(res)
3 years ago
this.schedules = res.detail.schedule
3 years ago
},
3 years ago
destroySchedule(row){
scheduleDelete({id:row.id}).then(res => {
this.$successMessage('destroy','排班')
this.getCustomer()
})
},
3 years ago
datePicked(data,date){
if(this.pickType === 1){
this.dateStartPick = data.day
}
if(this.pickType === 2){
this.dateEndPick = data.day
}
},
3 years ago
},
3 years ago
computed: {
ageComputed() {
3 years ago
return new Date().getFullYear() - new Date(this.detail.customer.birthday).getFullYear()
3 years ago
},
3 years ago
defaultAddress(){
return function (adds){
if(!adds instanceof Array){
return '无地址'
}
return adds.filter(item => {
return item.default === 1
})[0]?.address || adds[0]?.address || '无地址'
}
},
timeFormat(){
3 years ago
return function (data,format='{dd}'){
return parseTime(data,format)
3 years ago
}
},
3 years ago
scheduleCount(){
return function (day){
let arr = this.schedules.filter(item => {
return day === item.date
})
if(arr.length > 0){
return arr
}
}
}
3 years ago
},
watch: {
isShow(val) {
if (val) {
3 years ago
this.getCustomer()
3 years ago
} else {
3 years ago
this.orderId = ''
this.productId = ''
this.date = ''
3 years ago
}
}
}
}
</script>
<style lang="scss" scoped>
3 years ago
@import "../../../styles/index";
.date-select{
background: $primaryColor;
color: #fff;
}
::v-deep .el-calendar-day{
padding: 0 !important;
}
3 years ago
::v-deep .el-row {
margin-bottom: 20px;
&:last-child {
margin-bottom: 0;
}
}
3 years ago
.schedule-num{
width: 18px;
height: 18px;
line-height: 18px;
text-align: center;
color: #fff;
background: $primaryColor;
border-radius: 100%;
}
3 years ago
</style>