From 349b0453c8b5f4a08ef5020c58830b4e905fa9c6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=85=B3=E7=BE=BD?= <关羽@gentronhealth.com> Date: Sun, 10 May 2026 17:13:43 +0800 Subject: [PATCH] =?UTF-8?q?Fix=20Bug=20#480:=20[=E4=BD=8F=E9=99=A2?= =?UTF-8?q?=E6=8A=A4=E5=A3=AB=E7=AB=99-=E5=8C=BB=E5=98=B1=E6=89=A7?= =?UTF-8?q?=E8=A1=8C]=20=E9=9D=9E=E8=80=97=E6=9D=90=E7=B1=BB=E5=8C=BB?= =?UTF-8?q?=E5=98=B1=E6=89=A7=E8=A1=8C=E6=8A=A5"=E8=80=97=E6=9D=90?= =?UTF-8?q?=E5=BA=93=E5=AD=98"=E9=94=99=E8=AF=AF=E4=B8=94=E5=85=A8?= =?UTF-8?q?=E9=80=89=E9=80=BB=E8=BE=91=E8=81=94=E5=8A=A8=E5=BC=82=E5=B8=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 1. 修复模板结构错误:删除premature的和多余的标签,确保el-table正确渲染 2. 新增selectedRowIds独立维护选中行ID集合,不再依赖el-table内部selection状态,避免执行选中时联动触发全选 3. 更新所有选择事件处理器同步维护selectedRowIds 4. 补充index.vue缺失的ref/nextTick/provide导入 Co-Authored-By: Claude Opus 4.7 --- .../components/prescriptionList.vue | 47 ++++++++++++------- .../medicalOrderExecution/index.vue | 2 +- 2 files changed, 30 insertions(+), 19 deletions(-) diff --git a/openhis-ui-vue3/src/views/inpatientNurse/medicalOrderExecution/components/prescriptionList.vue b/openhis-ui-vue3/src/views/inpatientNurse/medicalOrderExecution/components/prescriptionList.vue index 99b7bbbd..05d74322 100755 --- a/openhis-ui-vue3/src/views/inpatientNurse/medicalOrderExecution/components/prescriptionList.vue +++ b/openhis-ui-vue3/src/views/inpatientNurse/medicalOrderExecution/components/prescriptionList.vue @@ -68,9 +68,7 @@ - - -
@@ -232,7 +230,7 @@ import {adviceCancel, adviceExecute, adviceNoExecute, getPrescriptionList} from import {patientInfoList} from '../../components/store/patient.js'; import {lotNumberMatch} from '@/api/public'; import {formatDateStr} from '@/utils/index'; -import {getCurrentInstance, nextTick, ref} from 'vue'; +import {getCurrentInstance, nextTick, ref, provide} from 'vue'; const activeNames = ref([]); const prescriptionList = ref([]); @@ -242,6 +240,8 @@ const therapyEnum = ref(undefined); const { proxy } = getCurrentInstance(); const loading = ref(false); const chooseAll = ref(false); +// 独立维护选中行ID集合,避免el-table内部selection状态异常导致联动全选 +const selectedRowIds = ref(new Set()); const props = defineProps({ exeStatus: { type: Number, @@ -442,6 +442,7 @@ function handleGetPrescription() { chooseAll.value = false; } else { prescriptionList.value = []; + selectedRowIds.value.clear(); // proxy.$message.warning('请选择患者'); } } @@ -530,10 +531,14 @@ function handleCancel() { } function getSelectRows() { - // 获取选中的医嘱信息 - let list = []; - prescriptionList.value.forEach((item, index) => { - list = [...list, ...proxy.$refs['tableRef' + index][0].getSelectionRows()]; + // 优先从独立维护的selectedRowIds集合中获取选中行,避免el-table内部selection状态异常 + const list = []; + prescriptionList.value.forEach((item) => { + item.forEach((row) => { + if (selectedRowIds.value.has(row.requestId)) { + list.push(row); + } + }); }); return list; } @@ -609,12 +614,14 @@ function handelSwicthChange(value) { if (value) { // 全选:选中所有行并联动checkbox item.forEach((row) => { + selectedRowIds.value.add(row.requestId); tableRef[0].toggleRowSelection(row, true); selectAllCheckboxesInRow(row); }); } else { // 取消全选:取消选中所有行并联动checkbox item.forEach((row) => { + selectedRowIds.value.delete(row.requestId); tableRef[0].toggleRowSelection(row, false); unselectAllCheckboxesInRow(row); }); @@ -625,11 +632,14 @@ function handelSwicthChange(value) { // 默认选中全部行 function defaultSelectAllRows() { + // 清空并重建选中集合 + selectedRowIds.value.clear(); prescriptionList.value.forEach((item, index) => { const tableRef = proxy.$refs['tableRef' + index]; if (tableRef && tableRef[0]) { // 选中该表格的所有行 item.forEach((row) => { + selectedRowIds.value.add(row.requestId); tableRef[0].toggleRowSelection(row, true); // 同时选中该行内部的所有checkbox selectAllCheckboxesInRow(row); @@ -709,13 +719,14 @@ function checkAndToggleRowSelection(row) { const tableRef = proxy.$refs['tableRef' + tableIndex]; if (tableRef && tableRef[0]) { const isAllSelected = isAllCheckboxesSelected(row); - const selectedRows = tableRef[0].getSelectionRows(); - const isCurrentlySelected = selectedRows.some((r) => r.requestId === row.requestId); + const isCurrentlySelected = selectedRowIds.value.has(row.requestId); // 根据checkbox状态更新表格行选中状态 if (isAllSelected && !isCurrentlySelected) { + selectedRowIds.value.add(row.requestId); tableRef[0].toggleRowSelection(row, true); } else if (!isAllSelected && isCurrentlySelected) { + selectedRowIds.value.delete(row.requestId); tableRef[0].toggleRowSelection(row, false); } } @@ -728,9 +739,11 @@ function handleRowSelect(selection, row, tableIndex) { const isSelected = selection.some((item) => item.requestId === row.requestId); if (isSelected) { + selectedRowIds.value.add(row.requestId); // 选中行时,选中该行内部的所有checkbox selectAllCheckboxesInRow(row); } else { + selectedRowIds.value.delete(row.requestId); // 取消选中行时,取消选中该行内部的所有checkbox unselectAllCheckboxesInRow(row); } @@ -747,11 +760,13 @@ function handleSelectAll(selection, tableIndex) { if (selection.length > 0) { // 全选时,选中所有行内部的所有checkbox tableData.forEach((row) => { + selectedRowIds.value.add(row.requestId); selectAllCheckboxesInRow(row); }); } else { // 取消全选时,取消选中所有行内部的所有checkbox tableData.forEach((row) => { + selectedRowIds.value.delete(row.requestId); unselectAllCheckboxesInRow(row); }); } @@ -763,16 +778,12 @@ function handleSelectAll(selection, tableIndex) { // 更新全选开关状态 function updateChooseAllStatus() { let allSelected = true; - prescriptionList.value.forEach((item, index) => { - const tableRef = proxy.$refs['tableRef' + index]; - if (tableRef && tableRef[0]) { - const selectedRows = tableRef[0].getSelectionRows(); - if (selectedRows.length !== item.length) { + prescriptionList.value.forEach((item) => { + item.forEach((row) => { + if (!selectedRowIds.value.has(row.requestId)) { allSelected = false; } - } else { - allSelected = false; - } + }); }); chooseAll.value = allSelected; } diff --git a/openhis-ui-vue3/src/views/inpatientNurse/medicalOrderExecution/index.vue b/openhis-ui-vue3/src/views/inpatientNurse/medicalOrderExecution/index.vue index 54c36670..905890e4 100755 --- a/openhis-ui-vue3/src/views/inpatientNurse/medicalOrderExecution/index.vue +++ b/openhis-ui-vue3/src/views/inpatientNurse/medicalOrderExecution/index.vue @@ -51,7 +51,7 @@