修复手术删除临时医嘱删除问题

This commit is contained in:
chenjinyang
2026-02-10 17:10:34 +08:00
parent 7676f03c96
commit ca9b145d3e
2 changed files with 45 additions and 14 deletions

View File

@@ -1386,12 +1386,46 @@ function handleMedicalAdvice(row) {
// 如果没有数据或接口调用失败,初始化空列表
temporaryBillingMedicines.value = []
}
}).catch(() => {
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
})
}
// 关闭临时医嘱弹窗

View File

@@ -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]
// 构建新的临时医嘱数据
const updatedAdvices = [...props.temporaryAdvices]
updatedAdvices.splice(index, 1)
// 通知父组件更新数据
emit('update:temporaryAdvices', updatedAdvices)
}
ElMessage.success('删除成功')
}).catch(() => {
// 用户取消删除