修复手术删除临时医嘱删除问题
This commit is contained in:
@@ -1386,12 +1386,46 @@ function handleMedicalAdvice(row) {
|
||||
// 如果没有数据或接口调用失败,初始化空列表
|
||||
temporaryBillingMedicines.value = []
|
||||
}
|
||||
|
||||
// 将计费药品转换为临时医嘱数据
|
||||
temporaryAdvices.value = temporaryBillingMedicines.value.map((medicine, index) => {
|
||||
// 解析规格中的数值和单位
|
||||
const specMatch = medicine.specification ? medicine.specification.match(/(\d+)(\D+)/) : null
|
||||
const specValue = specMatch ? parseInt(specMatch[1]) : 1
|
||||
const specUnit = specMatch ? specMatch[2] : 'ml'
|
||||
|
||||
// 计算剂量 = 规格数值 × 数量
|
||||
const dosage = specValue * (medicine.quantity || 1)
|
||||
|
||||
// 根据药品名称判断用法
|
||||
let usage = '静脉注射'
|
||||
if (medicine.medicineName && medicine.medicineName.includes('注射液')) {
|
||||
usage = '静脉注射'
|
||||
} else if (medicine.medicineName && medicine.medicineName.includes('片')) {
|
||||
usage = '口服'
|
||||
} else if (medicine.medicineName && medicine.medicineName.includes('胶囊')) {
|
||||
usage = '口服'
|
||||
}
|
||||
|
||||
return {
|
||||
id: index + 1,
|
||||
adviceName: medicine.medicineName || '',
|
||||
dosage: dosage,
|
||||
unit: specUnit,
|
||||
usage: usage,
|
||||
frequency: '临时',
|
||||
executeTime: new Date().toLocaleString('zh-CN'),
|
||||
originalMedicine: medicine
|
||||
}
|
||||
})
|
||||
|
||||
// 打开临时医嘱弹窗
|
||||
showTemporaryMedical.value = true
|
||||
}).catch(() => {
|
||||
temporaryBillingMedicines.value = []
|
||||
temporaryAdvices.value = []
|
||||
showTemporaryMedical.value = true
|
||||
})
|
||||
|
||||
// 打开临时医嘱弹窗
|
||||
showTemporaryMedical.value = true
|
||||
}
|
||||
|
||||
// 关闭临时医嘱弹窗
|
||||
|
||||
@@ -265,7 +265,7 @@ const convertedAdvices = computed(() => {
|
||||
|
||||
// 使用转换后的数据或传入的临时医嘱数据
|
||||
const displayAdvices = computed(() => {
|
||||
return props.temporaryAdvices.length > 0 ? props.temporaryAdvices : convertedAdvices.value
|
||||
return props.temporaryAdvices
|
||||
})
|
||||
|
||||
// 方法
|
||||
@@ -369,16 +369,13 @@ const handleDeleteAdvice = (index) => {
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
}).then(() => {
|
||||
// 检查数据来源
|
||||
if (props.temporaryAdvices.length > 0) {
|
||||
// 如果使用的是传入的临时医嘱数据,通知父组件删除
|
||||
emit('delete-advice', index)
|
||||
} else {
|
||||
// 如果使用的是转换的数据,需要构建新的临时医嘱数据并通知父组件
|
||||
const updatedAdvices = [...displayAdvices.value]
|
||||
updatedAdvices.splice(index, 1)
|
||||
emit('update:temporaryAdvices', updatedAdvices)
|
||||
}
|
||||
// 构建新的临时医嘱数据
|
||||
const updatedAdvices = [...props.temporaryAdvices]
|
||||
updatedAdvices.splice(index, 1)
|
||||
|
||||
// 通知父组件更新数据
|
||||
emit('update:temporaryAdvices', updatedAdvices)
|
||||
|
||||
ElMessage.success('删除成功')
|
||||
}).catch(() => {
|
||||
// 用户取消删除
|
||||
|
||||
Reference in New Issue
Block a user