From 2d964b4e43ff297c2d4fa2cd6f43ee29ce420b39 Mon Sep 17 00:00:00 2001 From: liwenxuan <1298531568@qq.com> Date: Mon, 14 Apr 2025 10:48:36 +0800 Subject: [PATCH] =?UTF-8?q?=E4=B8=8B=E6=8B=89=E9=80=89=E6=8B=A9=E6=A1=86?= =?UTF-8?q?=E4=B8=BA=E5=A4=9A=E9=80=89=E6=97=B6,=E5=85=B3=E8=81=94?= =?UTF-8?q?=E9=80=89=E9=A1=B9=E8=AE=BE=E7=BD=AE=E7=BC=96=E8=BE=91=E8=A7=84?= =?UTF-8?q?=E5=88=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../DesignForm/formControlPropertiNew.vue | 110 +++++++++++++++++- 1 file changed, 104 insertions(+), 6 deletions(-) diff --git a/src/components/DesignForm/formControlPropertiNew.vue b/src/components/DesignForm/formControlPropertiNew.vue index a5f78d0..1e7b59c 100644 --- a/src/components/DesignForm/formControlPropertiNew.vue +++ b/src/components/DesignForm/formControlPropertiNew.vue @@ -1131,12 +1131,30 @@ const controlChange = (obj: any, val: any) => { // select多选属性, switch (obj.eventName) { case "selectMultiple": + // if (val) { // 多选,将值改为数组 controlData.value.control.modelValue = []; + controlData.value.control.glxxsz = []; } else { // 单选 controlData.value.control.modelValue = ""; + for (var i = 0; i < controlData.value.options.length; i++) { + if (controlData.value.control.glxxsz[i] === undefined) { + //新增了某个option + controlData.value.control.glxxsz.push({ + conditionField: controlData.value.name, + optionLabel: controlData.value.options[i].label, + optionValue: controlData.value.options[i].value, + tableIndex: i, + id: uuidv4().replaceAll("-", "").toString(), + }); + } else { + //修改了某个option + controlData.value.control.glxxsz[i].optionLabel = controlData.value.options[i].label; + controlData.value.control.glxxsz[i].optionValue = controlData.value.options[i].value; + } + } } break; case "tableColumn1": @@ -2010,19 +2028,21 @@ watch( //实现关联表单设置可选字段中没有当前字段效果 start // console.log(controlData.value.name) resDataForGlxxszExceptself1 = JSON.parse(JSON.stringify(resDataForGlxxszExceptself)); - // console.log(resDataForGlxxszExceptself1) + console.log(resDataForGlxxszExceptself1) for (let i = 0; i < resDataForGlxxszExceptself1.length; i++) { let strArr: [string] = resDataForGlxxszExceptself1[i].id.split(":"); - // console.log(strArr) + console.log(strArr) let str = strArr[strArr.length - 1]; - // console.log(str) + console.log(str) + console.log(newVal) if (str == newVal) { + resDataForGlxxszExceptself1.splice(i, 1); // 将使后面的元素依次前移,数组长度减1 i--; // 如果不减,将漏掉一个元素 } } - // console.log(resDataForGlxxszExceptself1) + console.log(resDataForGlxxszExceptself1) if ( getAssociatedFormsCurrentFieldTreeData && getAssociatedFormsCurrentFieldTreeData.treeAttrs && @@ -3317,7 +3337,7 @@ watch( (changedOptions: any) => { // console.log("radio,select添加选项时同步配置选项",changedOptions) // console.log("radio,select添加选项时同步配置选项------>",controlData.value) - if (controlData.value.type === "radio" || controlData.value.type === "select") { + if (controlData.value.type === "radio" || controlData.value.type === "select" && (!controlData.value.multiple)) { if (controlData.value.config.optionsType == 0) { if (changedOptions.length === 0) { //删没了option @@ -3369,6 +3389,17 @@ function createRowForGlxxsz() { }); } } +function createRowForGlxxsz1() { + if (controlData.value.config.optionsType == 0) { + controlData.value.control.glxxsz.push({ + conditionField: controlData.value.name, + selectedOptions: [], + showFields: [], + id: uuidv4().replaceAll("-", "").toString(), + }); + } +} + function deleteRowForGlxxsz(row: { id: any }) { if (controlData.value.config.optionsType == 0) { @@ -3377,6 +3408,14 @@ function deleteRowForGlxxsz(row: { id: any }) { ); } } + +function deleteRowForGlxxsz1(row: { id: any }) { + if (controlData.value.config.optionsType == 0) { + controlData.value.control.glxxsz = controlData.value.control.glxxsz.filter( + (item: { id: any }) => item.id != row.id + ); + } +} /* */ const optionsValue3SettingDialogOpenFlag = ref(false); @@ -5945,7 +5984,7 @@ const updataBase = (val: any) => { + + + + + + + +