From 41bea23116aa2a56c46deec7ade8c66c79bea986 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=85=B3=E7=BE=BD?= <关羽@gentronhealth.com> Date: Thu, 14 May 2026 13:11:51 +0800 Subject: [PATCH] =?UTF-8?q?Fix=20Bug=20#469:=20[=E4=BD=8F=E9=99=A2?= =?UTF-8?q?=E5=8C=BB=E7=94=9F=E5=B7=A5=E4=BD=9C=E7=AB=99-=E6=A3=80?= =?UTF-8?q?=E9=AA=8C=E7=94=B3=E8=AF=B7]=20=E5=AE=8C=E5=96=84=E3=80=90?= =?UTF-8?q?=E6=93=8D=E4=BD=9C=E3=80=91=E5=88=97=E4=B8=B4=E5=BA=8A=E4=B8=9A?= =?UTF-8?q?=E5=8A=A1=E9=80=BB=E8=BE=91=EF=BC=9A=E6=94=AF=E6=8C=81=E6=8C=89?= =?UTF-8?q?=E7=8A=B6=E6=80=81=E5=8A=A8=E6=80=81=E5=88=87=E6=8D=A2=E4=BF=AE?= =?UTF-8?q?=E6=94=B9=E3=80=81=E5=88=A0=E9=99=A4=E3=80=81=E6=92=A4=E5=9B=9E?= =?UTF-8?q?=E7=AD=89=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 1. 修复删除/撤回接口参数错误:前端传prescriptionNo但后端期望requestFormId 2. 修改handleEdit从占位提示改为打开编辑弹窗,复用laboratoryTests组件并传入editData 3. laboratoryTests新增editData prop和编辑模式:支持descJson表单回显、已选项目回填、提交时携带requestFormId Co-Authored-By: Claude Opus 4.7 --- .../applicationShow/testApplication.vue | 59 +++++++++++++++++-- .../order/applicationForm/laboratoryTests.vue | 50 +++++++++++++++- 2 files changed, 100 insertions(+), 9 deletions(-) diff --git a/openhis-ui-vue3/src/views/inpatientDoctor/home/components/applicationShow/testApplication.vue b/openhis-ui-vue3/src/views/inpatientDoctor/home/components/applicationShow/testApplication.vue index 5ede68657..3881938f1 100755 --- a/openhis-ui-vue3/src/views/inpatientDoctor/home/components/applicationShow/testApplication.vue +++ b/openhis-ui-vue3/src/views/inpatientDoctor/home/components/applicationShow/testApplication.vue @@ -183,6 +183,26 @@ 关闭 + + + + + + @@ -192,12 +212,17 @@ import {Refresh, Search} from '@element-plus/icons-vue'; import {patientInfo} from '../../store/patient.js'; import {getInspection, deleteRequestForm, withdrawRequestForm} from './api'; import {getDepartmentList} from '@/api/public.js'; +import LaboratoryTests from '../order/applicationForm/laboratoryTests.vue'; +import {saveInspection} from '../order/applicationForm/api.js'; const { proxy } = getCurrentInstance(); const tableData = ref([]); const loading = ref(false); const detailDialogVisible = ref(false); +const editDialogVisible = ref(false); +const editRowData = ref(null); +const editFormRef = ref(null); const currentDetail = ref(null); const descJsonData = ref(null); const orgOptions = ref([]); @@ -433,10 +458,32 @@ const handleViewDetail = async (row) => { /** * 修改检验申请单(待签发状态) */ -const handleEdit = (row) => { - // 复用详情查看逻辑,后续可扩展为打开编辑弹窗 - handleViewDetail(row); - proxy.$modal?.msgInfo?.('修改功能待接入,请通过详情弹窗查看后重新开立'); +const handleEdit = async (row) => { + // 确保科室数据已加载 + if (!orgOptions.value || orgOptions.value.length === 0) { + await getLocationInfo(); + } + editRowData.value = row; + editDialogVisible.value = true; +}; + +/** + * 编辑弹窗提交成功回调 + */ +const handleEditSubmitOk = async () => { + editDialogVisible.value = false; + editRowData.value = null; + proxy.$modal?.msgSuccess?.('修改成功'); + await fetchData(); +}; + +/** + * 编辑弹窗提交按钮 + */ +const submitEditForm = () => { + if (editFormRef.value?.submit) { + editFormRef.value.submit(); + } }; /** @@ -450,7 +497,7 @@ const handleDelete = async (row) => { } try { - const res = await deleteRequestForm({ prescriptionNo: row.prescriptionNo }); + const res = await deleteRequestForm({ requestFormId: row.requestFormId }); if (res?.code === 200) { proxy.$modal?.msgSuccess?.('删除成功'); await fetchData(); @@ -473,7 +520,7 @@ const handleWithdraw = async (row) => { } try { - const res = await withdrawRequestForm({ prescriptionNo: row.prescriptionNo }); + const res = await withdrawRequestForm({ requestFormId: row.requestFormId }); if (res?.code === 200) { proxy.$modal?.msgSuccess?.('撤回成功'); await fetchData(); diff --git a/openhis-ui-vue3/src/views/inpatientDoctor/home/components/order/applicationForm/laboratoryTests.vue b/openhis-ui-vue3/src/views/inpatientDoctor/home/components/order/applicationForm/laboratoryTests.vue index 47e1b591e..617a0a905 100755 --- a/openhis-ui-vue3/src/views/inpatientDoctor/home/components/order/applicationForm/laboratoryTests.vue +++ b/openhis-ui-vue3/src/views/inpatientDoctor/home/components/order/applicationForm/laboratoryTests.vue @@ -155,7 +155,13 @@ const findTreeItem = (list, id) => { return null; }; const emits = defineEmits(['submitOk']); -const props = defineProps({}); +const props = defineProps({ + editData: { + type: Object, + default: null, + }, +}); +const isEditMode = computed(() => !!props.editData?.requestFormId); const state = reactive({}); const applicationListAll = ref([]); const loading = ref(false); @@ -331,6 +337,44 @@ watch( projectWithDepartment(newValue, 1); } ); + +// 编辑模式下,回显已有数据 +watch( + () => props.editData, + (newData) => { + if (!newData || !newData.requestFormId) return; + + // 解析 descJson 回填表单 + if (newData.descJson) { + try { + const obj = JSON.parse(newData.descJson); + Object.keys(form).forEach((key) => { + if (obj[key] !== undefined) { + form[key] = obj[key]; + } + }); + } catch (e) { + console.error('解析 descJson 失败:', e); + } + } + + // 回填已选项目 + if (newData.requestFormDetailList && newData.requestFormDetailList.length > 0) { + // 从全部数据中匹配已选项目 + const selectedIds = []; + newData.requestFormDetailList.forEach((detail) => { + const matched = applicationListAll.value.find( + (item) => item.adviceName === detail.adviceName + ); + if (matched) { + selectedIds.push(matched.adviceDefinitionId); + } + }); + transferValue.value = selectedIds; + } + }, + { immediate: true } +); const submit = () => { if (transferValue.value.length == 0) { return proxy.$message.error('请选择申请单'); @@ -363,14 +407,14 @@ const submit = () => { patientId: patientInfo.value.patientId, //患者ID encounterId: patientInfo.value.encounterId, // 就诊ID organizationId: patientInfo.value.inHospitalOrgId, // 医疗机构ID - requestFormId: '', // 申请单ID + requestFormId: isEditMode.value ? props.editData.requestFormId : '', // 申请单ID(编辑模式传入,新增为空) name: '检验申请单', descJson: JSON.stringify(form), categoryEnum: '21', // 21 检验 22 检查 23 输血 24 手术(避开 adviceType 1-6 碰撞) }; saveInspection(params).then((res) => { if (res.code === 200) { - proxy.$message.success(res.msg); + proxy.$message.success(isEditMode.value ? '修改成功' : res.msg); transferValue.value = []; emits('submitOk'); } else {