From 1d53b6007b6a74bd071d2d01eaca1234367ee7d0 Mon Sep 17 00:00:00 2001 From: liwenxuan <1298531568@qq.com> Date: Sat, 14 Feb 2026 08:50:44 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E4=BF=AE=E5=A4=8D=E5=85=B3?= =?UTF-8?q?=E8=81=94=E8=A1=A8=E5=8D=95=E5=A1=AB=E5=85=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../DesignForm/public/form/formGroup.vue | 2 +- .../DesignForm/public/form/webformGroup.vue | 2 +- .../associatedforms/associatedForms.vue | 2 +- .../associatedFormsForCreate.vue | 25 ++++++++++++++++--- 4 files changed, 24 insertions(+), 7 deletions(-) diff --git a/src/components/DesignForm/public/form/formGroup.vue b/src/components/DesignForm/public/form/formGroup.vue index 1cf7ca1..3b2da00 100644 --- a/src/components/DesignForm/public/form/formGroup.vue +++ b/src/components/DesignForm/public/form/formGroup.vue @@ -480,7 +480,7 @@ function asfValueChanged(val: any) { let masterFillRoleFieldsArray = fillFieldsMaster.split(";"); //console.log(masterFillRoleFieldsArray) masterFillRoleFieldsArray.forEach((item: any) => { - let itemArray = item.split("_"); + let itemArray = item.split(/(? item1.split(":").pop()); diff --git a/src/components/DesignForm/public/form/webformGroup.vue b/src/components/DesignForm/public/form/webformGroup.vue index 5505abc..3524d38 100644 --- a/src/components/DesignForm/public/form/webformGroup.vue +++ b/src/components/DesignForm/public/form/webformGroup.vue @@ -494,7 +494,7 @@ function asfValueChanged(val:any){ let masterFillRoleFieldsArray = fillFieldsMaster.split(";"); //console.log(masterFillRoleFieldsArray) masterFillRoleFieldsArray.forEach((item:any)=>{ - let itemArray = item.split("_"); + let itemArray = item.split(/(? item1.split(':').pop()); diff --git a/src/widget/associatedforms/associatedForms.vue b/src/widget/associatedforms/associatedForms.vue index 3aee2e7..cbcb066 100644 --- a/src/widget/associatedforms/associatedForms.vue +++ b/src/widget/associatedforms/associatedForms.vue @@ -200,7 +200,7 @@ function getAsfDataTitles() { } } - //console.log(fillFieldsMaster) + console.log(fillFieldsMaster) } diff --git a/src/widget/associatedforms/associatedFormsForCreate.vue b/src/widget/associatedforms/associatedFormsForCreate.vue index 3d7a97d..db136d3 100644 --- a/src/widget/associatedforms/associatedFormsForCreate.vue +++ b/src/widget/associatedforms/associatedFormsForCreate.vue @@ -83,6 +83,25 @@ function hasTableProperty(obj: object): boolean { } let asfDataTitlesData: any = [] onMounted(() => { + asfInit() + + +}) + +// 修复后的watch监听逻辑 +watch( + // 1. 使用可选链操作符?. 避免访问不存在的属性时报错 + () => props.data.control?.formid, + (newVal: any) => { + // 2. 只有当newVal存在(非undefined/null)时,才执行初始化逻辑 + if (newVal) { + asfInit() + } + }, + { deep: true } +) + +function asfInit(){ if (props.data.control &&props.data.control.formid != null && props.data.control.formid != "") { getAsfDataTitles().then(({ data }) => { asfDataTitlesData = data @@ -119,9 +138,7 @@ onMounted(() => { }); } - - -}) +} let fillFieldsMaster = ""; let fillFieldsChild: any function asfValueChanged() { @@ -195,7 +212,7 @@ function getAsfDataTitles() { } } - //console.log(fillFieldsMaster) + console.log(fillFieldsMaster) }