From a04fa368b148ce1a7c0426a33f708f53b84a8702 Mon Sep 17 00:00:00 2001
From: wangjian963 <15215920+aprilry@user.noreply.gitee.com>
Date: Mon, 8 Jun 2026 14:42:54 +0800
Subject: [PATCH] =?UTF-8?q?fix(clinic):=20=E4=BF=AE=E5=A4=8D=E9=97=A8?=
=?UTF-8?q?=E8=AF=8A=E6=89=8B=E6=9C=AF=E5=AE=89=E6=8E=92=E8=AE=A1=E8=B4=B9?=
=?UTF-8?q?=E5=BC=B9=E7=AA=97vxe-table=E5=B8=83=E5=B1=80=E4=B8=8E=E9=A1=B9?=
=?UTF-8?q?=E7=9B=AE=E9=80=89=E6=8B=A9=E9=97=AE=E9=A2=98?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
问题:
1. vxe-table expand列40px切换格中渲染复杂编辑表单,内容溢出导致表头表体列错位
2. adviceBaseList clickRow未解构vxe-table 4.x cell-click事件对象{row},导致selectAdviceBase数据错误
3. prescriptionList数组元素替换(arr[i]={})不被vxe-table变更检测,选中项目后数据未填入input
4. 保存按钮调用formRef{index}但表单已迁出expand列,运行时抛undefined.validate异常
---
.../bargain/component/adviceBaseList.vue | 5 +-
.../bargain/component/prescriptionlist.vue | 343 +++++++++---------
2 files changed, 178 insertions(+), 170 deletions(-)
diff --git a/healthlink-his-ui/src/views/clinicmanagement/bargain/component/adviceBaseList.vue b/healthlink-his-ui/src/views/clinicmanagement/bargain/component/adviceBaseList.vue
index c37ff46cb..0622b801a 100755
--- a/healthlink-his-ui/src/views/clinicmanagement/bargain/component/adviceBaseList.vue
+++ b/healthlink-his-ui/src/views/clinicmanagement/bargain/component/adviceBaseList.vue
@@ -263,9 +263,8 @@ const handleCurrentChange = (currentRow) => {
currentSelectRow.value = currentRow;
};
-function clickRow(row, column, cell, event) {
- // cell-click 事件会传递 row, column, cell, event 四个参数
- // 确保传递的是完整的行数据
+function clickRow({ row }) {
+ // vxe-table 4.x cell-click 事件参数是 { row, column, ... } 对象,需解构取 row
if (row) {
emit('selectAdviceBase', row);
}
diff --git a/healthlink-his-ui/src/views/clinicmanagement/bargain/component/prescriptionlist.vue b/healthlink-his-ui/src/views/clinicmanagement/bargain/component/prescriptionlist.vue
index a61ad40ac..766ba718f 100755
--- a/healthlink-his-ui/src/views/clinicmanagement/bargain/component/prescriptionlist.vue
+++ b/healthlink-his-ui/src/views/clinicmanagement/bargain/component/prescriptionlist.vue
@@ -38,170 +38,15 @@
max-height="650"
:data="prescriptionList"
:row-config="{ keyField: 'uniqueKey', expandRowKeys: expandOrder }"
+ :column-config="{ resizable: true }"
border
+ auto-resize
@cell-dblclick="clickRowDb"
>
-
-
-
-
-
-
-
- {{
- scope.row.adviceName +
- ' ' +
- (scope.row.volume ? scope.row.volume + ' ' : '') +
- (scope.row.unitPrice ? scope.row.unitPrice + ' 元/' : '') +
- (scope.row.unitCode_dictText || '')
- }}
-
-
-
-
-
-
-
-
- 无可用库存
-
-
-
-
-
-
-
-
-
-
- 总金额:{{ scope.row.totalPrice ? scope.row.totalPrice + ' 元' : '0.00 元' }}
-
-
-
- 保存
-
-
-
-
-
-
- {{
- scope.row.adviceName + ' ' + scope.row.unitPrice
- ? Number(scope.row.unitPrice).toFixed(2)
- : '-' + '元'
- }}
-
-
-
-
-
-
-
- 总金额:{{ scope.row.totalPrice ? scope.row.totalPrice + ' 元' : '0.00 元' }}
-
-
-
-
-
-
- 保存
-
-
-
-
-
-
-
+ />
@@ -383,6 +229,7 @@
align="right"
field=""
header-align="center"
+ width="130"
>
+
+
@@ -444,7 +436,7 @@ import {
getEncounterDiagnosis,
} from './api';
import adviceBaseList from './adviceBaseList';
-import {getCurrentInstance, nextTick, ref, watch} from 'vue';
+import {getCurrentInstance, nextTick, ref, watch, computed} from 'vue';
const emit = defineEmits(['selectDiagnosis']);
const prescriptionList = ref([]);
@@ -493,6 +485,14 @@ const isAdding = ref(false);
const isSaving = ref(false); // #437 防重复提交锁
const prescriptionRef = ref();
const expandOrder = ref([]); //目前的展开行
+const editingRow = computed(() => {
+ if (expandOrder.value.length === 0) return null;
+ return prescriptionList.value.find(r => r.uniqueKey === expandOrder.value[0]) || null;
+});
+const editingRowIndex = computed(() => {
+ if (expandOrder.value.length === 0) return -1;
+ return prescriptionList.value.findIndex(r => r.uniqueKey === expandOrder.value[0]);
+});
const stockList = ref([]);
const groupList = ref([])
const { proxy } = getCurrentInstance();
@@ -546,8 +546,11 @@ watch(
nextTick(() => {
const index = prescriptionList.value.findIndex((row) => row.uniqueKey === newValue[0]);
- const items = proxy.$refs['formRef' + index]?.$el?.querySelectorAll('[data-prop]');
- requiredProps.value = Array.from(items).map((item) => item.dataset.prop);
+ const formEl = proxy.$refs['editFormRef'];
+ if (formEl) {
+ const items = formEl.$el?.querySelectorAll('[data-prop]') || formEl.querySelectorAll?.('[data-prop]');
+ if (items) requiredProps.value = Array.from(items).map((item) => item.dataset.prop);
+ }
});
} else {
requiredProps.value = {};
@@ -831,11 +834,9 @@ async function selectAdviceBase(key, row) {
});
}
- // 将选中的基础项“覆盖”到当前处方行(这是之前正常工作的核心逻辑)
- prescriptionList.value[rowIndex.value] = {
- ...prescriptionList.value[rowIndex.value],
- ...JSON.parse(JSON.stringify(row)),
- };
+ // 将选中的基础项“覆盖”到当前处方行
+ // 用 Object.assign 原地修改,确保 vxe-table 能检测到变更重新渲染
+ Object.assign(prescriptionList.value[rowIndex.value], JSON.parse(JSON.stringify(row)));
// 后续字段处理保持原样
// 🔧 修复执行科室逻辑:诊疗项目优先使用项目维护的所属科室(row.orgId)
@@ -1271,7 +1272,7 @@ function handleSaveSign(row, index) {
return;
}
isSaving.value = true; // #437 立即加锁,消除 TOCTOU 竞态
- proxy.$refs['formRef' + index].validate((valid) => {
+ proxy.$refs['editFormRef'].validate((valid) => {
if (!valid) {
isSaving.value = false; // 验证失败释放锁
return;
@@ -1391,6 +1392,14 @@ defineExpose({ getListInfo, closeAllPopovers });
:deep(.vxe-table--expand-btn) {
display: none !important;
}
+
+// 编辑表单卡片:独立于表格,显示在表格下方
+.edit-form-card {
+ margin-top: 12px;
+ border: 1px solid #e5e7eb;
+ border-radius: 8px;
+ background: #fff;
+}
.medicine-title {
font-size: 16px;
font-weight: 600;