Fix Bug #477: 住院医生工作站-住院检查申请详情弹窗中"发往科室"字段显示为短横线(-),未正常获取数据

根因:handleViewDetail 为同步方法,点击详情时 getLocationInfo 尚未返回,
orgOptions 为空导致 recursionFun 无法将 targetDepartment ID 解析为科室名称。

修复:
1. 前端(4个申请组件):handleViewDetail 改为 async,解析 descJson 前确保 orgOptions 已加载
2. 前端:watch encounterId 改为 Promise.all 并行加载数据和科室列表
3. 后端:新增 keyword 关键字筛选参数(申请单号/检查项目模糊匹配)

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
关羽
2026-05-11 14:03:40 +08:00
committed by 赵云
parent eaac16769d
commit 256b986c0e
9 changed files with 100 additions and 43 deletions

View File

@@ -181,10 +181,9 @@ const hasMatchedFields = computed(() => {
});
/** 查询科室 */
const getLocationInfo = () => {
getOrgList().then((res) => {
orgOptions.value = res.data.records;
});
const getLocationInfo = async () => {
const res = await getOrgList();
orgOptions.value = res.data.records;
};
const recursionFun = (targetDepartment) => {
@@ -205,7 +204,12 @@ const recursionFun = (targetDepartment) => {
return name;
};
const handleViewDetail = (row) => {
const handleViewDetail = async (row) => {
// 确保科室数据已加载,以便将 ID 解析为名称
if (!orgOptions.value || orgOptions.value.length === 0) {
await getLocationInfo();
}
currentDetail.value = row;
// 解析 descJson
if (row.descJson) {
@@ -226,10 +230,9 @@ const handleViewDetail = (row) => {
watch(
() => patientInfo.value?.encounterId,
(val) => {
async (val) => {
if (val) {
fetchData();
getLocationInfo();
await Promise.all([fetchData(), getLocationInfo()]);
} else {
tableData.value = [];
}