diff --git a/src/components/Detail/src/DetailQmsCode.vue b/src/components/Detail/src/DetailQmsCode.vue index e66979512..819a401e1 100644 --- a/src/components/Detail/src/DetailQmsCode.vue +++ b/src/components/Detail/src/DetailQmsCode.vue @@ -701,7 +701,7 @@ const openForm = async (type: string, row?: number) => { const submitForm = async (formType, data) => { try { // 子表新增编辑校验 如果业务需要子表提交校验 需在主页详情组件添加 detailValidate 参数及方法 - const rs = (await props.detailValidate) ? await props.detailValidate(data) : true + const rs = (await props.detailValidate) ? await props.detailValidate(formType,data) : true if (!rs) return if (formType === 'create') { await props.apiCreate(data) diff --git a/src/views/qms/basicDataManage/dynamicRule/index.vue b/src/views/qms/basicDataManage/dynamicRule/index.vue index b9aebe87d..b42b4ca56 100644 --- a/src/views/qms/basicDataManage/dynamicRule/index.vue +++ b/src/views/qms/basicDataManage/dynamicRule/index.vue @@ -289,7 +289,8 @@ const handleDeleteTable = (item, index) => { // 主子数据 提交 const submitForm = async (formType, data) => { - if(!validateNotRepetition(tableData.value)){ + const flag = validateNotRepetition(tableData.value); + if(!flag){ message.alertWarning('动态规则阶段不能重复') basicFormRef.value.formLoading = false return @@ -312,9 +313,9 @@ const submitForm = async (formType, data) => { } } -const detailValidate = (data) => { +const detailValidate = (type,data) => { let tag = true; - if(!validateIfRepeat(data)){ + if(!validateIfRepeat(type,data)){ tag = false message.alertWarning('动态规则阶段不能重复') } @@ -325,8 +326,13 @@ const detailOpenForm = (type, row, masterParmas) => { } -const validateIfRepeat = (data) => { - const mergedArray = [data, ...detailList.value]; +const validateIfRepeat = (type,data) => { + let mergedArray: any[] = []; + if(type == 'create'){ + mergedArray = [data, ...detailList.value]; + }else if(type == 'update'){ + mergedArray = [...detailList.value]; + } const stageSet = new Set(mergedArray.map(item => item.stage)); return stageSet.size === mergedArray.length; }