Browse Source

解决选定集项重复问题

master_hella_20240701
ljlong_2630 8 months ago
parent
commit
f64ea550fe
  1. 18
      src/views/qms/basicDataManage/selectedSet/index.vue

18
src/views/qms/basicDataManage/selectedSet/index.vue

@ -328,7 +328,7 @@ const submitForm = async (formType, data) => {
} }
} }
const updateSelections = async (masterId) => { const updateSelections = async (masterId,row) => {
let param = { masterId: masterId }; let param = { masterId: masterId };
SelectedProjectApi.getSelectedProjectNoPage(param).then(res => { SelectedProjectApi.getSelectedProjectNoPage(param).then(res => {
DictTypeApi.getDictTypeAndData('inspection').then(originalResponse => { DictTypeApi.getDictTypeAndData('inspection').then(originalResponse => {
@ -341,7 +341,14 @@ const updateSelections = async (masterId) => {
}; };
}).filter(option => { }).filter(option => {
// resdictionaryTypeAndCodeoption // resdictionaryTypeAndCodeoption
return !res.some(resItem => option.value === resItem.dictionaryTypeAndCode); return !res.some(resItem => {
if(row != null){
return option.value === resItem.dictionaryTypeAndCode && option.value != row.dictionaryTypeAndCode
}else{
return option.value === resItem.dictionaryTypeAndCode
}
});
}); });
return { ...element, options }; // elementoptions return { ...element, options }; // elementoptions
}).filter(element => element.options.length > 0); // optionselement }).filter(element => element.options.length > 0); // optionselement
@ -377,7 +384,12 @@ const detailValidate = (data) => {
} }
const detailOpenForm = (type, row, masterParmas) => { const detailOpenForm = (type, row, masterParmas) => {
updateSelections(masterParmas.masterId) if(type == 'create'){
updateSelections(masterParmas.masterId,row)
}else if('update'){
updateSelections(masterParmas.masterId,row)
}
} }

Loading…
Cancel
Save