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.

272 lines
7.0 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">
<el-input v-model="detail.name" 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">
<el-input v-model="detail.sex" 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">
<el-input v-model="detail.idcard" 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">
<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">
<el-select v-model="detail.level_id" disabled placeholder="请选择失能等级" style="width: 300px">
<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">
<el-input style="width: 300px;" readonly :value="defaultAddress(detail.customer_address)"></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 style="width: 300px;" v-model="detail.remark" readonly></el-input>
</el-col>
</el-row>
3 years ago
3 years ago
<el-row type="flex" align="middle">
<el-col :span="4" :push="1">
<span style="color: red;font-weight: 600;padding-right: 4px;">*</span>产品
</el-col>
<el-col :span="18">
<el-select style="width: 300px;" v-model="productId">
<el-option v-for="item in products" :label="item.name" :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">
<span style="color: red;font-weight: 600;padding-right: 4px;">*</span>订单
</el-col>
<el-col :span="18">
<el-select style="width: 300px;" v-model="orderId">
<el-option v-for="item in orders" :label="item.no" :value="item.id"></el-option>
3 years ago
</el-select>
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
</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"
:order-id="orderId"
:product-id="productId"
:customer-id="detail.id"></timeSelect>
3 years ago
</div>
</template>
<script>
3 years ago
import {parseTime} from '@/utils'
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
nurses: {
type: Array,
default: () => []
3 years ago
},
3 years ago
levels: {
type: Array,
default: () => []
3 years ago
},
orders:{
type: Array,
default: () => []
3 years ago
},
skus:{
type: Array,
default: () => []
},
3 years ago
},
data() {
return {
productId: '',
3 years ago
orderId:'',
3 years ago
isShow: false,
3 years ago
isShowTime:false,
date:'',
3 years ago
3 years ago
detail: '',
3 years ago
dateStartPick:'',
dateEndPick:'',
pickType:1,
3 years ago
}
},
methods: {
3 years ago
datePick(date,data){
console.log(date,data)
if(data.type === 'current-month'){
this.date = data.day
if(this.orderId && this.productId){
this.isShowTime = true
}else{
this.$message({
type:'warning',
message:'请先选择订单与产品'
})
}
}
},
3 years ago
async getCustomer() {
const res = await customerDetail({
product_id: this.form.product_id,
3 years ago
id: this.form.customer_id,
3 years ago
})
console.log(res)
this.detail = res.detail
},
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.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 || '无地址'
}
},
3 years ago
isInDate(){
return function (day){
let startTimer = new Date(this.dateStartPick).getTime()
let endTimer = new Date(this.dateEndPick).getTime()
let dayTimer = new Date(day).getTime()
return dayTimer >= startTimer && dayTimer <= endTimer
}
3 years ago
},
timeFormat(){
return function (data){
return parseTime(data,'{dd}')
}
},
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
</style>