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) }