184 检查项目设置-》检查类型:检查类型的字段下拉选项内容取值位置不对
This commit is contained in:
@@ -872,41 +872,18 @@ onMounted(async () => {
|
|||||||
inspectionTypeDicts.value = typeResponse.data;
|
inspectionTypeDicts.value = typeResponse.data;
|
||||||
// 从数据字典获取检查类型值
|
// 从数据字典获取检查类型值
|
||||||
checkTypes.value = typeResponse.data.map(item => item.dictValue);
|
checkTypes.value = typeResponse.data.map(item => item.dictValue);
|
||||||
|
// 从数据字典获取检查类型下拉选项
|
||||||
|
checkTypeOptions.value = typeResponse.data.map(item => ({
|
||||||
|
value: item.dictValue,
|
||||||
|
label: item.dictLabel,
|
||||||
|
dictValue: item.dictValue,
|
||||||
|
dictLabel: item.dictLabel
|
||||||
|
}));
|
||||||
} else {
|
} else {
|
||||||
checkTypes.value = [];
|
checkTypes.value = [];
|
||||||
inspectionTypeDicts.value = [];
|
inspectionTypeDicts.value = [];
|
||||||
}
|
}
|
||||||
|
|
||||||
// 从检查类型维护界面获取所有检查类型(用于下拉选项)
|
|
||||||
try {
|
|
||||||
const checkTypeListResponse = await getAllCheckTypes();
|
|
||||||
if (checkTypeListResponse && checkTypeListResponse.data) {
|
|
||||||
// 处理返回的数据,提取 name 和 code/type 用于下拉选项
|
|
||||||
const typeList = Array.isArray(checkTypeListResponse.data)
|
|
||||||
? checkTypeListResponse.data
|
|
||||||
: (checkTypeListResponse.data.records || []);
|
|
||||||
checkTypeOptions.value = typeList.map(item => ({
|
|
||||||
value: item.code || item.type || item.id,
|
|
||||||
label: item.name,
|
|
||||||
id: item.id,
|
|
||||||
code: item.code,
|
|
||||||
type: item.type
|
|
||||||
}));
|
|
||||||
}
|
|
||||||
} catch (e) {
|
|
||||||
console.error('获取检查类型列表失败', e);
|
|
||||||
checkTypeOptions.value = [];
|
|
||||||
}
|
|
||||||
|
|
||||||
// 获取服务范围数据(从数据字典获取)
|
|
||||||
const scopeResponse = await getDicts('scope_of_services');
|
|
||||||
if (scopeResponse && scopeResponse.data) {
|
|
||||||
// 保存完整的服务范围字典数据
|
|
||||||
serviceScopeDicts.value = scopeResponse.data;
|
|
||||||
} else {
|
|
||||||
serviceScopeDicts.value = [];
|
|
||||||
}
|
|
||||||
|
|
||||||
// 获取检查类型表格数据(分页获取)
|
// 获取检查类型表格数据(分页获取)
|
||||||
await loadCheckTypeDataWithPagination();
|
await loadCheckTypeDataWithPagination();
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user