master
xy 3 years ago
parent 93c824e469
commit ef4fcaa691

@ -138,6 +138,9 @@ export default {
cellClick(row, column, cell) { cellClick(row, column, cell) {
this.$emit('cellClick', row, column, cell) this.$emit('cellClick', row, column, cell)
}, },
getSelection(){
return this.$refs.table?.store?.states?.selection ?? []
},
createPage() { createPage() {
if (this.isPage) if (this.isPage)

@ -177,6 +177,7 @@ export default {
this.$refs['timeSelect'].form.nurse_id = this.nurseId this.$refs['timeSelect'].form.nurse_id = this.nurseId
if(data.type === 'current-month'){ if(data.type === 'current-month'){
if(type === 1){ if(type === 1){
this.$refs['timeSelect'].isDelete = false
this.$refs['timeSelect'].form.id = '' this.$refs['timeSelect'].form.id = ''
this.isShowTime = true this.isShowTime = true
} }
@ -186,6 +187,8 @@ export default {
this.$refs['timeSelect'].form.nurse_id = schedule.nurse_id this.$refs['timeSelect'].form.nurse_id = schedule.nurse_id
this.$refs['timeSelect'].form.start_time = schedule.start_time this.$refs['timeSelect'].form.start_time = schedule.start_time
this.$refs['timeSelect'].form.end_time = schedule.end_time this.$refs['timeSelect'].form.end_time = schedule.end_time
this.$refs['timeSelect'].form.status = schedule.status
this.$refs['timeSelect'].form.address_id = schedule.address_id
this.$refs['timeSelect'].form.schedule_list_skus = schedule.sku.map(item => item.sku_id) this.$refs['timeSelect'].form.schedule_list_skus = schedule.sku.map(item => item.sku_id)
this.isShowTime = true this.isShowTime = true
} }
@ -197,11 +200,14 @@ export default {
const res = await customerDetail({ const res = await customerDetail({
id: this.id id: this.id
}) })
this.flag = true
this.detail = res.detail this.detail = res.detail
if(!this.detail?.product_type?.product_skus){
throw new Error('skus is empty')
}
this.flag = true
}catch (err){ }catch (err){
this.flag = false this.flag = false
console.error(err)
} }
}, },

@ -46,6 +46,12 @@
</el-option> </el-option>
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item label="状态" prop="status">
<el-select ref="addressSelect" v-model="form.status" placeholder="请选择状态" style="width: 300px;">
<el-option v-for="(item,index) in [{id:0,value:'待护理'},{id:1,value:'护理中'},{id:2,value:'已完成'}]" :label="item.value" :value="item.id">
</el-option>
</el-select>
</el-form-item>
<el-form-item label="服务项目" prop="schedule_list_skus"> <el-form-item label="服务项目" prop="schedule_list_skus">
<xy-table <xy-table
ref="table" ref="table"
@ -110,6 +116,13 @@ export default {
} }
}, },
data() { data() {
let skuCheck = (rule, value, callback) => {
if (value.length <= 0) {
callback(new Error('请选择护理项目'));
} else {
callback();
}
};
return { return {
nurses:[], nurses:[],
nurseSelect:{ nurseSelect:{
@ -131,6 +144,7 @@ export default {
address: '', address: '',
start_time: '', start_time: '',
end_time: '', end_time: '',
status: 0,
schedule_list_skus: [] schedule_list_skus: []
}, },
rules: { rules: {
@ -144,10 +158,13 @@ export default {
{required: true, message: '请选择结束时间'} {required: true, message: '请选择结束时间'}
], ],
address_id: [ address_id: [
{required: true, message: '请选择护工'} {required: true, message: '请选择地址'}
],
status: [
{required: true, message: '请选择状态'}
], ],
schedule_list_skus: [ schedule_list_skus: [
{required: true, message: '请选择护理项目'} {validator: skuCheck}
] ]
}, },
@ -189,6 +206,7 @@ export default {
address_id:'', address_id:'',
start_time: '', start_time: '',
end_time: '', end_time: '',
status: 0,
schedule_list_skus: [] schedule_list_skus: []
} }
}, },
@ -220,12 +238,6 @@ export default {
this.form.end_time = `${this.date} ${e}` this.form.end_time = `${this.date} ${e}`
}, },
// handleCheckAllChange(val){
// this.form.schedule_list_skus = val ? this.skus.map(item => {
// return item.sku.id
// }) : []
// this.indeterminate =! this.indeterminate
// },
skuSelect(selection){ skuSelect(selection){
this.form.schedule_list_skus = selection.map(item => { this.form.schedule_list_skus = selection.map(item => {
return item.id return item.id
@ -254,10 +266,11 @@ export default {
this.form.customer_id = this.customerId this.form.customer_id = this.customerId
this.form.product_id = this.productId this.form.product_id = this.productId
this.form.order_id = this.orderId this.form.order_id = this.orderId
let temp = this.form.schedule_list_skus.map(item => { this.form.schedule_list_skus = this.$refs['table'].getSelection().map(item => {
return {sku_id: item} return {
sku_id:item.id
}
}) })
this.form.schedule_list_skus = temp
this.$refs['elForm'].validate().then(valid => { this.$refs['elForm'].validate().then(valid => {
if (valid) { if (valid) {
scheduleSave(this.form).then(res => { scheduleSave(this.form).then(res => {
@ -283,21 +296,24 @@ export default {
isShow(val) { isShow(val) {
if (val) { if (val) {
console.log(this.skus) console.log(this.skus)
this.form.address_id = this.addresses.filter(item => {
return item.default === 1
})[0]?.id || ''
// //
if(this.form.schedule_list_skus.length > 0){ if(this.form.schedule_list_skus.length > 0){
this.toggleRow(this.form.schedule_list_skus) this.toggleRow(this.form.schedule_list_skus)
}else{ }else{
this.toggleAll() if(!this.form.id){
this.toggleAll()
this.form.address_id = this.addresses.filter(item => {
return item.default === 1
})[0]?.id || ''
}
} }
} else { } else {
this.$emit('update:date','') this.$emit('update:date','')
this.$refs['table'].clearSelection() this.$refs['table'].clearSelection()
this.initForm() this.initForm()
this.$refs['elForm'].clearValidate()
} }
} }
}, },

Loading…
Cancel
Save