|
|
@ -111,6 +111,8 @@ routeName.value = route.name |
|
|
|
const tableColumns = ref(SelectedSet.allSchemas.tableColumns) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 查询页面返回 |
|
|
|
const searchTableSuccess = (formField, searchField, val, formRef) => { |
|
|
|
nextTick(() => { |
|
|
@ -290,7 +292,11 @@ const handleDeleteTable = (item, index) => { |
|
|
|
|
|
|
|
// 主子数据 提交 |
|
|
|
const submitForm = async (formType, data) => { |
|
|
|
|
|
|
|
if(!validateNotRepetition(tableData.value)){ |
|
|
|
message.alertWarning('选定集名称不能重复') |
|
|
|
basicFormRef.value.formLoading = false |
|
|
|
return |
|
|
|
} |
|
|
|
data.selectedProjectDOList = tableData.value// 拼接子表数据参数 |
|
|
|
data.selectedProjectDOList = data.selectedProjectDOList.map(item => { |
|
|
|
// 按照 '-%%%-'' 拆分 dictionaryCode |
|
|
@ -322,18 +328,56 @@ const submitForm = async (formType, data) => { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
const updateSelections = async (masterId) => { |
|
|
|
let param = { masterId: masterId }; |
|
|
|
SelectedProjectApi.getSelectedProjectNoPage(param).then(res => { |
|
|
|
DictTypeApi.getDictTypeAndData('inspection').then(originalResponse => { |
|
|
|
// 首先对每个element进行映射和过滤 |
|
|
|
const response = originalResponse.map(element => { |
|
|
|
const options = element.dictDataRespVOList.map(item => { |
|
|
|
return { |
|
|
|
value: element.type + "-%%%-" + item.value, |
|
|
|
label: element.name + "-" + item.label |
|
|
|
}; |
|
|
|
}).filter(option => { |
|
|
|
// 过滤掉与res中任何dictionaryTypeAndCode相等的option |
|
|
|
return !res.some(resItem => option.value === resItem.dictionaryTypeAndCode); |
|
|
|
}); |
|
|
|
return { ...element, options }; // 返回新的element,包含过滤后的options |
|
|
|
}).filter(element => element.options.length > 0); // 再次过滤,移除options为空的element |
|
|
|
|
|
|
|
// 更新对应字段的options |
|
|
|
const formSchemaItem = SelectedProject.allSchemas.formSchema.find(item => item.field === 'dictionaryTypeAndCode'); |
|
|
|
if (formSchemaItem) { |
|
|
|
formSchemaItem.componentProps.options = response; |
|
|
|
} |
|
|
|
}); |
|
|
|
}); |
|
|
|
}; |
|
|
|
|
|
|
|
const validateNotRepetition = (data) => { |
|
|
|
// 提取所有的 dictionaryTypeAndCode 值 |
|
|
|
const codes = data.map(item => item.dictionaryTypeAndCode); |
|
|
|
|
|
|
|
// 创建一个 Set 来存储唯一的 dictionaryTypeAndCode 值 |
|
|
|
const uniqueCodes = new Set(codes); |
|
|
|
|
|
|
|
// 如果原始数组的长度大于 Set 集合的大小,则说明有重复 |
|
|
|
if (codes.length > uniqueCodes.size) { |
|
|
|
return false; // 发现重复,返回 false |
|
|
|
} |
|
|
|
|
|
|
|
return true; // 未发现重复,返回 true |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
const detailValidate = (data) => { |
|
|
|
let tag = true; |
|
|
|
return tag |
|
|
|
} |
|
|
|
|
|
|
|
const detailOpenForm = (type, row, masterParmas) => { |
|
|
|
// if(selectDictType.value){ |
|
|
|
|
|
|
|
// } |
|
|
|
if(type='create'){ |
|
|
|
|
|
|
|
} |
|
|
|
updateSelections(masterParmas.masterId) |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|