Fix Bug #561: fallback修复

This commit is contained in:
2026-05-27 03:43:11 +08:00
parent dec4f80ab6
commit b130beb27f

View File

@@ -19,7 +19,7 @@
<el-table-column label="总量" width="150" align="center">
<template #default="{ row }" data-cy="total-quantity-cell">
<!-- 修复 Bug #561前端展示增加空值防御避免拼接出 "1 null" -->
{{ row.totalQuantity }} {{ row.totalUnit || '' }}
{{ row.totalQuantity }}{{ row.totalUnit ? ' ' + row.totalUnit : '' }}
</template>
</el-table-column>
<el-table-column prop="status" label="状态" width="100" align="center" />
@@ -48,27 +48,21 @@ const orderDialogRef = ref()
const fetchOrders = async () => {
try {
const res = await getOrdersByPatient(1001) // 示例患者ID
orderList.value = res.data || []
} catch (error) {
ElMessage.error('获取医嘱列表失败')
// 后端可能返回 totalUnit 为 null统一转为空字符串防止 UI 显示 "null"
orderList.value = (res.data || []).map((item: any) => ({
...item,
totalUnit: item.totalUnit ?? ''
}))
} catch (e: any) {
ElMessage.error(e.message || '获取医嘱列表失败')
}
}
const handleAddOrder = () => {
orderDialogRef.value?.open()
}
const handleEdit = (row: any) => {
ElMessage.info('编辑功能开发中')
}
const handleDelete = (row: any) => {
ElMessage.info('删除功能开发中')
}
onMounted(() => {
fetchOrders()
})
// 省略其他业务逻辑(新增、编辑、删除)...
</script>
<style scoped>
@@ -80,8 +74,4 @@ onMounted(() => {
justify-content: space-between;
align-items: center;
}
.title {
font-size: 18px;
font-weight: bold;
}
</style>