Fix Bug #461: [系统管理-执行科室配置] 保存项目配置后,项目名称回显为ID码,未显示正确名称
根因:getList() 中 filteredOptions 只取 allImplementDepartmentList 的前100项, 当保存的项目ID不在前100项中时,el-select 找不到匹配选项,直接回显ID值而非名称。 修复:在映射记录时,将后端返回的 activityDefinitionId_dictText(项目名称)补充到 filteredOptions 中,确保 el-select 能正确匹配并显示项目名称。
This commit is contained in:
@@ -226,8 +226,14 @@ function getList() {
|
|||||||
getDiagnosisTreatmentList(queryParams.value).then((res) => {
|
getDiagnosisTreatmentList(queryParams.value).then((res) => {
|
||||||
loading.value = false;
|
loading.value = false;
|
||||||
catagoryList.value = res.data.records.map(record => {
|
catagoryList.value = res.data.records.map(record => {
|
||||||
// 为每一行初始化 filteredOptions,确保显示框能正确显示项目名称
|
|
||||||
const filteredOptions = allImplementDepartmentList.value.slice(0, 100);
|
const filteredOptions = allImplementDepartmentList.value.slice(0, 100);
|
||||||
|
// 确保后端返回的项目名称选项存在于 filteredOptions 中,避免 el-select 因找不到选项而回显为 ID
|
||||||
|
if (record.activityDefinitionId && !filteredOptions.some(o => o.value === record.activityDefinitionId)) {
|
||||||
|
filteredOptions.push({
|
||||||
|
value: record.activityDefinitionId,
|
||||||
|
label: record.activityDefinitionId_dictText || record.activityDefinitionId
|
||||||
|
});
|
||||||
|
}
|
||||||
return {
|
return {
|
||||||
...record,
|
...record,
|
||||||
loading: false,
|
loading: false,
|
||||||
|
|||||||
Reference in New Issue
Block a user