Browse Source

动态修改规则重复问题解决

master_hella_20240701
ljlong_2630 7 months ago
parent
commit
4eaea07345
  1. 2
      src/components/Detail/src/DetailQmsCode.vue
  2. 16
      src/views/qms/basicDataManage/dynamicRule/index.vue

2
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)

16
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;
}

Loading…
Cancel
Save