|
|
@ -105,6 +105,8 @@ const routeName = ref() |
|
|
|
const tableData = ref([]) |
|
|
|
routeName.value = route.name |
|
|
|
const tableColumns = ref(DynamicRule.allSchemas.tableColumns) |
|
|
|
const detailMasterId = ref() |
|
|
|
const detailList = ref([]) |
|
|
|
|
|
|
|
// 查询页面返回 |
|
|
|
const searchTableSuccess = (formField, searchField, val, formRef) => { |
|
|
@ -210,6 +212,10 @@ const formsSuccess = async (formType,data) => { |
|
|
|
/** 详情操作 */ |
|
|
|
const detailRef = ref() |
|
|
|
const openDetail = (row: any, titleName: any, titleValue: any) => { |
|
|
|
detailMasterId.value = row.id |
|
|
|
InspectionStageApi.getInspectionStageNoPage({masterId:row.id}).then(res=>{ |
|
|
|
detailList.value = res |
|
|
|
}) |
|
|
|
detailRef.value.openDetail(row, titleName, titleValue, 'basicDynamicRule') |
|
|
|
} |
|
|
|
|
|
|
@ -283,6 +289,11 @@ const handleDeleteTable = (item, index) => { |
|
|
|
|
|
|
|
// 主子数据 提交 |
|
|
|
const submitForm = async (formType, data) => { |
|
|
|
if(!validateNotRepetition(tableData.value)){ |
|
|
|
message.alertWarning('动态规则阶段不能重复') |
|
|
|
basicFormRef.value.formLoading = false |
|
|
|
return |
|
|
|
} |
|
|
|
data.inspectionStageDOList = tableData.value// 拼接子表数据参数 |
|
|
|
console.log(data.subList) |
|
|
|
try { |
|
|
@ -303,15 +314,35 @@ const submitForm = async (formType, data) => { |
|
|
|
|
|
|
|
const detailValidate = (data) => { |
|
|
|
let tag = true; |
|
|
|
if(!validateIfRepeat(data)){ |
|
|
|
tag = false |
|
|
|
message.alertWarning('动态规则阶段不能重复') |
|
|
|
} |
|
|
|
return tag |
|
|
|
} |
|
|
|
|
|
|
|
const detailOpenForm = (type, row, masterParmas) => { |
|
|
|
if(type='create'){ |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
const validateIfRepeat = (data) => { |
|
|
|
const mergedArray = [data, ...detailList.value]; |
|
|
|
const stageSet = new Set(mergedArray.map(item => item.stage)); |
|
|
|
return stageSet.size === mergedArray.length; |
|
|
|
} |
|
|
|
|
|
|
|
const validateNotRepetition = (data) => { |
|
|
|
// 提取所有的 dictionaryTypeAndCode 值 |
|
|
|
const codes = data.map(item => item.stage); |
|
|
|
// 创建一个 Set 来存储唯一的 dictionaryTypeAndCode 值 |
|
|
|
const uniqueCodes = new Set(codes); |
|
|
|
// 如果原始数组的长度大于 Set 集合的大小,则说明有重复 |
|
|
|
if (codes.length > uniqueCodes.size) { |
|
|
|
return false; // 发现重复,返回 false |
|
|
|
} |
|
|
|
return true; // 未发现重复,返回 true |
|
|
|
}; |
|
|
|
|
|
|
|
/** 初始化 **/ |
|
|
|
onMounted(async () => { |
|
|
|
getList() |
|
|
|