From 7f6bd37fc8c692a0a60cd1481ea71045850dade2 Mon Sep 17 00:00:00 2001 From: liwenxuan <1298531568@qq.com> Date: Wed, 8 May 2024 16:31:02 +0800 Subject: [PATCH] =?UTF-8?q?=E5=85=B3=E8=81=94=E9=80=89=E9=A1=B9=E8=AE=BE?= =?UTF-8?q?=E7=BD=AE=E9=85=8D=E7=BD=AE-=E5=A4=9A=E9=80=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/DesignForm/assembly/index.ts | 3 +- src/components/DesignForm/formControlAttr.vue | 98 ++++++++++++++++--- .../DesignForm/public/form/form.vue | 2 +- 3 files changed, 86 insertions(+), 17 deletions(-) diff --git a/src/components/DesignForm/assembly/index.ts b/src/components/DesignForm/assembly/index.ts index dd32b14a2..7d739262f 100644 --- a/src/components/DesignForm/assembly/index.ts +++ b/src/components/DesignForm/assembly/index.ts @@ -1,3 +1,4 @@ +import { v4 as uuidv4 } from "uuid"; const selectOption: any = [ /*{ label: '标签1', @@ -98,7 +99,7 @@ const selectOption: any = [ iconFont: 'fa-check-square-o', control: { modelValue: [], - glxxsz:[], + glxxszForCheckBox:[], }, options: selectOption, config: config, diff --git a/src/components/DesignForm/formControlAttr.vue b/src/components/DesignForm/formControlAttr.vue index 7376339b6..5b5634bda 100644 --- a/src/components/DesignForm/formControlAttr.vue +++ b/src/components/DesignForm/formControlAttr.vue @@ -1134,11 +1134,52 @@ // 属性设置相关结束 // 多选固定选项删除 const delSelectOption = (index: number, type?: string) => { - if (type === 'tabs') { - controlData.value.columns.splice(index, 1) - } else { - controlData.value.options.splice(index, 1) + //liwenxuan 20240508 checkbox 删除选项时提醒 start + let delflag = true + let breakFlag = 0 + if(controlData.value.type === 'checkbox'){ + for(var i = 0;i < controlData.value.control.glxxszForCheckBox.length;i ++){ + if(breakFlag>0){ + break + } + for(var j = 0; j < controlData.value.control.glxxszForCheckBox[i].selectedOptions.length; j++){ + if(controlData.value.control.glxxszForCheckBox[i].selectedOptions[j] === controlData.value.options[index].value){ + let del =confirm("您本次删除的选项已在关联选项设置中有所配置,相关关联选项设置将被删除,是否确定删除?"); + if (del==true){ + breakFlag++ + break + }else{ + delflag = false + breakFlag++ + break + } + } + } + + + } + } + if(delflag === true){ + //删除相关关联选项设置 + const todelArr:any = [] + for(var i = 0;i < controlData.value.control.glxxszForCheckBox.length;i ++){ + for(var j = 0; j < controlData.value.control.glxxszForCheckBox[i].selectedOptions.length; j++){ + if(controlData.value.control.glxxszForCheckBox[i].selectedOptions[j] === controlData.value.options[index].value){ + todelArr.push(controlData.value.control.glxxszForCheckBox[i].id) + } + } + } + for(var i = 0;i < todelArr.length;i++){ + controlData.value.control.glxxszForCheckBox = controlData.value.control.glxxszForCheckBox.filter((item: { id: any }) => item.id != todelArr[i]) + } + //liwenxuan 20240508 checkbox 删除选项时提醒 end + if (type === 'tabs' ) { + controlData.value.columns.splice(index, 1) + } else { + controlData.value.options.splice(index, 1) + } } + } // 多选固定选项增加 const addSelectOption = (type: any) => { @@ -2223,10 +2264,26 @@ watch(()=>controlData.value.options, (changedOptions:any) => { } } } + }else if(controlData.value.type === "checkbox"){ + } },{ deep: true }) +function createRowForGlxxsz(){ + controlData.value.control.glxxszForCheckBox.push( + { + selectedOptions:[], + showFields:[], + id: uuidv4().replaceAll('-','').toString(), + } + ) +} + +function deleteRowForGlxxsz(row: { id: any }){ + controlData.value.control.glxxszForCheckBox = controlData.value.control.glxxszForCheckBox.filter((item: { id: any }) => item.id!=row.id) +} + //liwenxuan20240426 单选多选下拉 关联选项设置 end @@ -3744,23 +3801,34 @@ const loadNextPage = () => {