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 = () => { +