From e834f352781dc53a50b40971effe7c00af154bba Mon Sep 17 00:00:00 2001 From: liwenxuan <1298531568@qq.com> Date: Tue, 7 May 2024 14:45:36 +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=8D=95=E9=80=89=E4=B8=8B?= =?UTF-8?q?=E6=8B=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/DesignForm/assembly/index.ts | 9 +- src/components/DesignForm/formControlAttr.vue | 181 +++++++++++++++++- 2 files changed, 186 insertions(+), 4 deletions(-) diff --git a/src/components/DesignForm/assembly/index.ts b/src/components/DesignForm/assembly/index.ts index 76d13c258..dd32b14a2 100644 --- a/src/components/DesignForm/assembly/index.ts +++ b/src/components/DesignForm/assembly/index.ts @@ -80,7 +80,8 @@ const selectOption: any = [ icon: 'radio', iconFont: 'fa-dot-circle-o', control: { - modelValue: '' + modelValue: '', + glxxsz:[], }, options: selectOption, // 下拉选项数据集合 config: config, @@ -96,7 +97,8 @@ const selectOption: any = [ icon: 'checkbox', iconFont: 'fa-check-square-o', control: { - modelValue: [] + modelValue: [], + glxxsz:[], }, options: selectOption, config: config, @@ -113,7 +115,8 @@ const selectOption: any = [ iconFont: 'fa-toggle-down', control: { modelValue: '', - appendToBody: true + appendToBody: true, + glxxsz:[], }, options: selectOption, config: config, diff --git a/src/components/DesignForm/formControlAttr.vue b/src/components/DesignForm/formControlAttr.vue index ff9c43e81..7376339b6 100644 --- a/src/components/DesignForm/formControlAttr.vue +++ b/src/components/DesignForm/formControlAttr.vue @@ -1850,6 +1850,7 @@ function formidChanged(){ } const associatedFormsCurrentFormFieldTree = ref() +const associatedFormsCurrentFormFieldTreeForGlxxsz = ref() getAssociatedFormsCurrentFieldTree().then(({ data }) => { if(data.id==="cfid为空"){ @@ -1864,6 +1865,17 @@ getAssociatedFormsCurrentFieldTree().then(({ data }) => { children: [...resData.value], treeAttrs: data.treeAttrs, }] + + let resDataForGlxxsz = ref(data.children.slice(8)) + + + associatedFormsCurrentFormFieldTreeForGlxxsz.value = [{ + id: 'rootid_'+data.label, + //label: '当前表单', + label: '当前表单-'+data.treeAttrs.show, + children: [...resDataForGlxxsz.value], + treeAttrs: data.treeAttrs, + }] } }); @@ -2153,6 +2165,69 @@ function delRole(id:String){ //liwenxuan20240403 associatedForms end +//liwenxuan20240426 单选多选下拉 关联选项设置 start + +const glxxszDialogFlag = ref(false) +const glxxszDialogFlagCheckBox = ref(false) +function handelGlxxszDialog(){ + if(controlData.value.options.length===0){ + alert("无可配置选项,请先添加。") + }else{ + glxxszDialogFlag.value = true + } +} + +function handelGlxxszDialogCheckbox(){ + glxxszDialogFlagCheckBox.value = true +} + +function handleDetermineGlxxszDialog(){ + glxxszDialogFlag.value = false +} +function handleDetermineGlxxszDialogCheckBox(){ + glxxszDialogFlagCheckBox.value = false +} +/* function addShowField(val:string){ + alert('addShowField:'+val) +} */ + + + +//radio,select添加选项时同步配置选项 +watch(()=>controlData.value.options, (changedOptions:any) => { + if(controlData.value.type === "radio" || controlData.value.type === "select"){ + if(changedOptions.length===0){ + //删没了option + controlData.value.control.glxxsz = [] + }else{ + if(changedOptions.length < controlData.value.control.glxxsz.length){ + //删除了某个option + controlData.value.control.glxxsz = controlData.value.control.glxxsz.filter((item: { optionValue: any }) => changedOptions.find((bItem: { value: any }) => item.optionValue == bItem.value)) + }else{ + for(var i = 0; i < changedOptions.length; i++){ + if(controlData.value.control.glxxsz[i]===undefined){ + //新增了某个option + controlData.value.control.glxxsz.push( + { + optionLabel: changedOptions[i].label, + optionValue: changedOptions[i].value, + tableIndex: i, + id: uuidv4().replaceAll('-','').toString(), + } + ) + }else{ + //修改了某个option + controlData.value.control.glxxsz[i].optionLabel = changedOptions[i].label + controlData.value.control.glxxsz[i].optionValue = changedOptions[i].value + } + } + } + } + } +},{ deep: true }) + + +//liwenxuan20240426 单选多选下拉 关联选项设置 end @@ -2774,6 +2849,12 @@ const loadNextPage = () => { +
+ 关联选项设置 +
+
+ 关联选项设置 +
+ + + + + + + + + + + + + + + + +