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.

294 lines
7.7 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
<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(addresses)"></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 style="display:flex;flex-direction: column;justify-content: center;align-items: center;width: 100%;height: 100%">
3 years ago
<div>{{timeFormat(date)}}</div>
<template v-if="data.type === 'current-month'">
3 years ago
<template v-if="scheduleCount(data.day)">
3 years ago
<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>
3 years ago
</template>
<template v-else>
<i class="el-icon-plus" style="padding:10px;" @click="datePick(date,data,1)"></i>
</template>
3 years ago
</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
3 years ago
ref="timeSelect"
3 years ago
@refresh="()=>{getCustomer();$emit('refresh')}"
3 years ago
:flag="flag"
3 years ago
:is-show.sync="isShowTime"
3 years ago
:skus="detail.product_type.product_skus"
3 years ago
:addresses="addresses"
3 years ago
: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 moment from 'moment'
3 years ago
import {parseTime,getAgeByIdcard} from '@/utils'
3 years ago
import {customerDetail} 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
levels: {
type: Array,
default: () => []
3 years ago
},
3 years ago
},
data() {
return {
3 years ago
flag:false,//确认获取到数据后提交
3 years ago
nurseId:'',
3 years ago
productId: '',
isShow: false,
3 years ago
isShowTime:false,
date:'',
3 years ago
3 years ago
id:'',
3 years ago
detail: '',
3 years ago
addresses:[],
3 years ago
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,type,schedule){
3 years ago
this.date = data.day
3 years ago
this.$refs['timeSelect'].form.nurse_id = this.nurseId
3 years ago
if(data.type === 'current-month'){
3 years ago
if(type === 1){
3 years ago
this.$refs['timeSelect'].form.id = ''
3 years ago
this.isShowTime = true
}
if(type === 2){
3 years ago
this.$refs['timeSelect'].isDelete = schedule.status == 0
3 years ago
this.$refs['timeSelect'].form.id = schedule.id
this.$refs['timeSelect'].form.nurse_id = schedule.nurse_id
this.$refs['timeSelect'].form.start_time = schedule.start_time
this.$refs['timeSelect'].form.end_time = schedule.end_time
3 years ago
this.$refs['timeSelect'].form.schedule_list_skus = schedule.sku.map(item => item.sku_id)
3 years ago
this.isShowTime = true
}
3 years ago
}
},
3 years ago
async getCustomer() {
3 years ago
try{
const res = await customerDetail({
id: this.id
})
this.flag = true
this.detail = res.detail
if(this.detail.product?.service_rule === 2 && this.detail.schedule && this.detail.schedule.length > 0){
this.nurseId = this.detail.schedule.at(-1)?.nurse_id
}
}catch (err){
this.flag = false
3 years ago
}
3 years ago
},
},
3 years ago
computed: {
ageComputed() {
3 years ago
return getAgeByIdcard(this.detail.customer.idcard)
//return moment().diff(moment(this.detail.customer.birthday).format(),'year')
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){
3 years ago
let arr = this.detail.schedule.filter(item => {
3 years ago
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.nurseId = ''
3 years ago
this.orderId = ''
this.productId = ''
this.date = ''
3 years ago
this.$emit('close')
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
.schedule-time{
color: #fff;
font-size: 13px;
border-radius: 18px;
background: $primaryColor;
filter: drop-shadow( 0 1px 3px #c93731);
padding: 4px 8px;
margin-top: 6px;
}
3 years ago
</style>