|
|
|
@ -652,7 +652,7 @@
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
// 点击 服务项目
|
|
|
|
|
function saveService(data) {
|
|
|
|
|
function saveService(data, flag) {
|
|
|
|
|
if (!props.id) {
|
|
|
|
|
createMessage.warning('请先保存主单')
|
|
|
|
|
return false
|
|
|
|
@ -662,12 +662,23 @@
|
|
|
|
|
projectCodes: [data.projectCode],
|
|
|
|
|
opertType: 0,
|
|
|
|
|
}
|
|
|
|
|
if (flag) obj.projectCodes = data.projectCode
|
|
|
|
|
if (!data.isYield) {
|
|
|
|
|
if (flag) {
|
|
|
|
|
bookingServiceItem.value.forEach((item) => {
|
|
|
|
|
data.projectCode.forEach(o => {
|
|
|
|
|
if (item.projectCode == o) {
|
|
|
|
|
item.isYield = !item.isYield
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
})
|
|
|
|
|
} else {
|
|
|
|
|
bookingServiceItem.value.forEach((item) => {
|
|
|
|
|
if (item.projectCode == data.projectCode) {
|
|
|
|
|
item.isYield = !item.isYield
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
seriveLoading.value = true
|
|
|
|
|
SaveServiceProject(obj).then((res) => {
|
|
|
|
|
seriveLoading.value = false
|
|
|
|
@ -686,12 +697,18 @@
|
|
|
|
|
}).catch(() => {
|
|
|
|
|
seriveLoading.value = false
|
|
|
|
|
})
|
|
|
|
|
} else {
|
|
|
|
|
if (flag) {
|
|
|
|
|
bookingServiceItem.value.forEach((item) => {
|
|
|
|
|
item.isYield = false
|
|
|
|
|
})
|
|
|
|
|
} else {
|
|
|
|
|
bookingServiceItem.value.forEach((item) => {
|
|
|
|
|
if (item.projectCode == data.projectCode) {
|
|
|
|
|
item.isYield = !item.isYield
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
seriveLoading.value = true
|
|
|
|
|
CancelServiceProject(obj).then((res) => {
|
|
|
|
|
seriveLoading.value = false
|
|
|
|
@ -1000,8 +1017,22 @@
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
onMounted(() => {
|
|
|
|
|
emitter.on('customerBack', (v) => {
|
|
|
|
|
// if (v.serviceItem)
|
|
|
|
|
emitter.on('customerBack', async (v) => {
|
|
|
|
|
// 联动带出服务项目(先取消,在添加)
|
|
|
|
|
const pitem = bookingServiceItem.value.filter(item => {
|
|
|
|
|
return item.isYield
|
|
|
|
|
})
|
|
|
|
|
if (pitem.length == 0 && !v.serviceItem) return
|
|
|
|
|
const pcode = pitem.map(row => {
|
|
|
|
|
return row.projectCode
|
|
|
|
|
})
|
|
|
|
|
await saveService({ isYield: true, projectCode: pcode }, true)
|
|
|
|
|
if (v.serviceItem) {
|
|
|
|
|
const projectCode = v.serviceItem.split(',')
|
|
|
|
|
saveService({ isYield: false, projectCode }, true)
|
|
|
|
|
}
|
|
|
|
|
// saveService({ isYield: false, projectCode: [] })
|
|
|
|
|
// console.log(v.serviceItem)
|
|
|
|
|
})
|
|
|
|
|
emitter.on('seaAddNotes', (v) => {
|
|
|
|
|
if (!props.id) return
|
|
|
|
|