From 0a8a22894bfc4650539f31221b81d49f92806f4a Mon Sep 17 00:00:00 2001 From: liwenxuan <1298531568@qq.com> Date: Wed, 29 May 2024 16:11:16 +0800 Subject: [PATCH] =?UTF-8?q?=E5=BC=80=E5=85=B3=E5=85=B3=E8=81=94=E9=80=89?= =?UTF-8?q?=E9=A1=B9=E8=AE=BE=E7=BD=AEv0.1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/DesignForm/assembly/index.ts | 14 ++- src/components/DesignForm/formControlAttr.vue | 76 ++++++++++++++++- .../DesignForm/public/form/form.vue | 85 ++++++++++++++++--- src/types/components.d.ts | 8 ++ 4 files changed, 168 insertions(+), 15 deletions(-) diff --git a/src/components/DesignForm/assembly/index.ts b/src/components/DesignForm/assembly/index.ts index 7d739262f..30f0412d7 100644 --- a/src/components/DesignForm/assembly/index.ts +++ b/src/components/DesignForm/assembly/index.ts @@ -164,7 +164,19 @@ const selectOption: any = [ icon: 'switch', iconFont: 'fa-toggle-on', control: { - modelValue: false + modelValue: "", + glxxszSwitch:[ + { + conditionField:'', + openValue:"", + showFields:[] + }, + { + conditionField:'', + offValue:"", + showFields:[] + }, + ] }, config: {}, styles:{ diff --git a/src/components/DesignForm/formControlAttr.vue b/src/components/DesignForm/formControlAttr.vue index d7e815205..63faee8de 100644 --- a/src/components/DesignForm/formControlAttr.vue +++ b/src/components/DesignForm/formControlAttr.vue @@ -2222,6 +2222,14 @@ function delRole(id:String){ const glxxszDialogFlag = ref(false) const glxxszDialogFlagCheckBox = ref(false) +const glxxszDialogFlagSwitch = ref(false) +function handelGlxxszDialogSwitch(){ + if(controlData.value.control.activeValue==undefined||controlData.value.control.inactiveValue==undefined){ + alert("请先设置开关状态打开/关闭时的值") + }else{ + glxxszDialogFlagSwitch.value = true + } +} function handelGlxxszDialog(){ if(controlData.value.options.length===0){ alert("无可配置选项,请先添加。") @@ -2237,9 +2245,27 @@ function handelGlxxszDialogCheckbox(){ function handleDetermineGlxxszDialog(){ glxxszDialogFlag.value = false } +function handleDetermineGlxxszDialogSwitch(){ + glxxszDialogFlagSwitch.value = false +} function handleDetermineGlxxszDialogCheckBox(){ glxxszDialogFlagCheckBox.value = false } +//同步开关的设置值和开关关联选项设置的值 +watch(()=>controlData.value.control,(newVal) => { + if(typeof(newVal)!="undefined"){ + if(typeof(newVal.glxxszSwitch)!="undefined"){ + if(typeof(controlData.value.control.activeValue)!="undefined"){ + controlData.value.control.glxxszSwitch[0].openValue = controlData.value.control.activeValue + controlData.value.control.glxxszSwitch[0].conditionField = controlData.value.name + } + if(typeof(controlData.value.control.inactiveValue)!="undefined"){ + controlData.value.control.glxxszSwitch[1].offValue = controlData.value.control.inactiveValue + controlData.value.control.glxxszSwitch[1].conditionField = controlData.value.name + } + } + } +},{ deep: true }) @@ -2295,8 +2321,8 @@ function createRowForGlxxsz(){ function deleteRowForGlxxsz(row: { id: any }){ controlData.value.control.glxxszForCheckBox = controlData.value.control.glxxszForCheckBox.filter((item: { id: any }) => item.id!=row.id) } +/* */ -//修复bug:当字段标识改变时,关联选项设置的字段标识未同步更改 //liwenxuan20240426 单选多选下拉 关联选项设置 end @@ -2920,6 +2946,9 @@ const loadNextPage = () => { +