Fix Bug #561: fallback修复
This commit is contained in:
@@ -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>
|
||||
|
||||
Reference in New Issue
Block a user