diff --git a/src/components/DesignForm/assembly/index.ts b/src/components/DesignForm/assembly/index.ts index 5e88e103c..76d13c258 100644 --- a/src/components/DesignForm/assembly/index.ts +++ b/src/components/DesignForm/assembly/index.ts @@ -609,6 +609,7 @@ const selectOption: any = [ { leftValue:'', rightValue:'', + id:'', } ], }, diff --git a/src/components/DesignForm/formControlAttr.vue b/src/components/DesignForm/formControlAttr.vue index 2f4d7492d..515cad92c 100644 --- a/src/components/DesignForm/formControlAttr.vue +++ b/src/components/DesignForm/formControlAttr.vue @@ -1567,6 +1567,8 @@ element.imgId = onlyNumber; } }); + }else if(controlData.value.type==='associatedForms'){ + controlData.value.control.fillRoles[0].id = uuidv4().replaceAll('-','').toString(); } }) //轮播图图片上传成功钩子 @@ -2128,15 +2130,22 @@ watch(()=>store.activeKey, () => { function addFillRole(){ + let onlyNumber = uuidv4().replaceAll('-','').toString(); //获取唯一编码 controlData.value.control.fillRoles.push({ leftValue:'', rightValue:'', + id:onlyNumber, }) } -function delRole(val:number){ - controlData.value.control.fillRoles.splice(val, 1); - console.log(controlData.value.control.fillRoles) +function delRole(id:String){ + const delRoleData:any = controlData.value.control.fillRoles + for (var i = 0; i < delRoleData.length; i++) { + if(delRoleData[i].id===id){ + delRoleData.splice(i, 1); + i--; // 如果不减,将漏掉一个元素 + } + } } @@ -3554,7 +3563,7 @@ const loadNextPage = () => { - +