This commit is contained in:
fuenmao
2025-12-05 14:26:00 +08:00
parent 09c99be903
commit 6be187e9b7
6 changed files with 90 additions and 26 deletions
@@ -17,7 +17,7 @@
<!-- unitPrice 列:只展示单价,不编辑 -->
<template #unitPrice="{ row }">
{{ (row.unitPrice ?? 0).toFixed(2) }}
{{ (row.unitPrice ?? 0).toFixed(5) }}
</template>
<!-- totalPrice 列:查看时显示合计,编辑时可以修改 -->
+36 -12
View File
@@ -5,6 +5,7 @@
<!-- 原有:表格头部按钮(不变) -->
<template #tableHeader>
<s-button suffix="处方" type="success" @click="handleAddPrescription" />
<el-button type="primary" @click="handleViewTotalCost">查看处方总价</el-button>
</template>
<!-- 原有:就诊人类型自定义插槽(不变) -->
@@ -33,12 +34,25 @@
</template>
</ProTable>
<!-- 原有:处方详情/编辑弹窗(不变) -->
<!--处方详情/编辑弹窗 -->
<PrescriptionDetailDialog v-model:visible="showDetailDialog" :prescription-id="currentPrescriptionId"
:is-edit="isEdit" @refresh-list="handleRefresh" />
<!-- 关键改动:引入独立的报告弹窗组件 -->
<!-- 报告弹窗组件 -->
<PrescriptionReportDialog v-model="showReportDialog" :prescription-id="currentReportId" />
<!-- 处方总价弹窗 -->
<el-dialog v-model="showTotalCostDialog" title="查看处方总价" width="400px" :close-on-click-modal="false">
<div style="padding: 20px; text-align: center;">
<div style="font-size: 16px; color: #606266; margin-bottom: 10px;">预估总药材成本</div>
<div style="color: #f56c6c; font-size: 32px; font-weight: bold;">
¥{{ totalCostData || 0 }}
</div>
</div>
<template #footer>
<el-button @click="showTotalCostDialog = false">关闭</el-button>
</template>
</el-dialog>
</div>
</template>
@@ -63,6 +77,10 @@ const isEdit = ref(false);
const showReportDialog = ref(false); // 报告弹窗显隐
const currentReportId = ref<number | undefined>(undefined); // 当前报告对应的处方ID
// 新增:处方总价弹窗相关状态
const showTotalCostDialog = ref(false); // 总价弹窗显隐
const totalCostData = ref<number>(0); // 总价数据
// 原有:就诊人类型选项、表格列配置(不变)
const personTypeOptions = [
{ label: "公司员工", value: 1 },
@@ -79,7 +97,8 @@ const columns: ColumnProps<any>[] = [
search: { el: "select" }
},
{ prop: "visitDate", label: "就诊时间" },
{ prop: "totalMedicineCost", label: "预估处方药材成本(元)" },
{ prop: "createTime", label: "添加时间" },
{ prop: "totalMedicineCost", label: "预估药材成本" },
{ prop: "operation", label: "操作", width: 280, fixed: "right" }
];
const rowKey = "id";
@@ -87,7 +106,7 @@ const getPrescriptionListApi = (params: any) => {
return prescriptionApi.getList(params);
};
// 原有:新增、查看详情、编辑、刷新逻辑(不变)
//新增、查看详情、编辑、刷新
const handleAddPrescription = () => {
currentPrescriptionId.value = undefined;
isEdit.value = false;
@@ -107,16 +126,21 @@ const handleRefresh = () => {
proTable.value?.refresh?.();
};
// 关键改动:新增“打开报告弹窗”方法
// 打开报告弹窗
const handleOpenReport = (id: number) => {
currentReportId.value = id; // 传递当前处方ID给报告组件
showReportDialog.value = true; // 显示报告弹窗
};
</script>
<style lang="scss" scoped>
/* 原有样式(不变):确保操作列按钮不换行 */
.table-box {
padding: 16px;
}
</style>
// 新增:查看处方总价
const handleViewTotalCost = async () => {
showTotalCostDialog.value = true;
try {
const { data } = await prescriptionApi.getTotalCost();
totalCostData.value = data || 0;
} catch (error) {
console.error("获取处方总价失败:", error);
totalCostData.value = 0;
}
};
</script>