From 52b3b3304368b5feb63773aae33cbf0daa171fa7 Mon Sep 17 00:00:00 2001 From: vdpAdmin Date: Mon, 20 Feb 2023 15:51:27 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E6=B8=85=E7=A9=BA=E8=AE=BE?= =?UTF-8?q?=E8=AE=A1=E5=99=A8=E7=94=BB=E5=B8=83=E6=97=B6=E6=9C=AA=E5=90=8C?= =?UTF-8?q?=E6=AD=A5=E6=B8=85=E9=99=A4=E7=BB=84=E4=BB=B6refList=E7=9A=84?= =?UTF-8?q?=E9=94=99=E8=AF=AF=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/form-designer/designer.js | 1 + .../form-widget/container-widget/containerMixin.js | 4 ++-- .../form-widget/field-widget/form-item-wrapper.vue | 4 ++-- .../form-widget/field-widget/static-content-wrapper.vue | 4 ++-- src/components/form-designer/form-widget/index.vue | 4 ++++ src/components/form-designer/index.vue | 2 -- src/components/form-designer/toolbar-panel/index.vue | 1 + src/utils/util.js | 2 +- 8 files changed, 13 insertions(+), 9 deletions(-) diff --git a/src/components/form-designer/designer.js b/src/components/form-designer/designer.js index 6921ce6..db89779 100644 --- a/src/components/form-designer/designer.js +++ b/src/components/form-designer/designer.js @@ -92,6 +92,7 @@ export function createDesigner(vueInstance) { let modifiedFlag = false if (!!formJson && !!formJson.widgetList) { + this.formWidget.clearWidgetRefList() this.widgetList = formJson.widgetList modifiedFlag = true } diff --git a/src/components/form-designer/form-widget/container-widget/containerMixin.js b/src/components/form-designer/form-widget/container-widget/containerMixin.js index c9064e4..ae616b0 100644 --- a/src/components/form-designer/form-widget/container-widget/containerMixin.js +++ b/src/components/form-designer/form-widget/container-widget/containerMixin.js @@ -68,6 +68,7 @@ export default { removeWidget() { if (!!this.parentList) { + const widgetRefName = this.designer.selectedWidgetName let nextSelected = null if (this.parentList.length === 1) { if (!!this.parentWidget) { @@ -81,10 +82,9 @@ export default { this.$nextTick(() => { this.parentList.splice(this.indexOfParentList, 1) - //if (!!nextSelected) { this.designer.setSelected(nextSelected) - //} + this.designer.formWidget.deleteWidgetRef(widgetRefName) //删除组件ref!!! this.designer.emitHistoryChange() }) } diff --git a/src/components/form-designer/form-widget/field-widget/form-item-wrapper.vue b/src/components/form-designer/form-widget/field-widget/form-item-wrapper.vue index e4998e2..678791d 100644 --- a/src/components/form-designer/form-widget/field-widget/form-item-wrapper.vue +++ b/src/components/form-designer/form-widget/field-widget/form-item-wrapper.vue @@ -188,6 +188,7 @@ removeFieldWidget() { if (!!this.parentList) { + const fieldRefName = this.designer.selectedWidgetName let nextSelected = null if (this.parentList.length === 1) { if (!!this.parentWidget) { @@ -201,10 +202,9 @@ this.$nextTick(() => { this.parentList.splice(this.indexOfParentList, 1) - //if (!!nextSelected) { this.designer.setSelected(nextSelected) - //} + this.designer.formWidget.deleteWidgetRef(fieldRefName) //删除组件ref!!! this.designer.emitHistoryChange() }) } diff --git a/src/components/form-designer/form-widget/field-widget/static-content-wrapper.vue b/src/components/form-designer/form-widget/field-widget/static-content-wrapper.vue index 6620d31..8f6a039 100644 --- a/src/components/form-designer/form-widget/field-widget/static-content-wrapper.vue +++ b/src/components/form-designer/form-widget/field-widget/static-content-wrapper.vue @@ -107,6 +107,7 @@ removeFieldWidget() { if (!!this.parentList) { + const fieldRefName = this.designer.selectedWidgetName let nextSelected = null if (this.parentList.length === 1) { if (!!this.parentWidget) { @@ -120,10 +121,9 @@ this.$nextTick(() => { this.parentList.splice(this.indexOfParentList, 1) - //if (!!nextSelected) { this.designer.setSelected(nextSelected) - //} + this.designer.formWidget.deleteWidgetRef(fieldRefName) //删除组件ref!!! this.designer.emitHistoryChange() }) } diff --git a/src/components/form-designer/form-widget/index.vue b/src/components/form-designer/form-widget/index.vue index d032bd3..9a2fd7a 100644 --- a/src/components/form-designer/form-widget/index.vue +++ b/src/components/form-designer/form-widget/index.vue @@ -184,6 +184,10 @@ }) }, + deleteWidgetRef(widgetRefName) { + delete this.widgetRefList[widgetRefName] + }, + } } diff --git a/src/components/form-designer/index.vue b/src/components/form-designer/index.vue index 2a8ddf0..3ea0423 100644 --- a/src/components/form-designer/index.vue +++ b/src/components/form-designer/index.vue @@ -290,7 +290,6 @@ } if (modifiedFlag) { - this.$refs.formRef.clearWidgetRefList() this.designer.emitHistoryChange() } } @@ -305,7 +304,6 @@ clearDesigner() { this.$refs.toolbarRef.clearFormWidget() - this.$refs.formRef.clearWidgetRefList() }, diff --git a/src/components/form-designer/toolbar-panel/index.vue b/src/components/form-designer/toolbar-panel/index.vue index 02d26e1..7d86507 100644 --- a/src/components/form-designer/toolbar-panel/index.vue +++ b/src/components/form-designer/toolbar-panel/index.vue @@ -444,6 +444,7 @@ clearFormWidget() { this.designer.clearDesigner() + this.designer.formWidget.clearWidgetRefList() }, previewForm() { diff --git a/src/utils/util.js b/src/utils/util.js index 173ccf5..ad4ff38 100644 --- a/src/utils/util.js +++ b/src/utils/util.js @@ -352,7 +352,7 @@ export function getDefaultFormConfig() { size: '', labelAlign: 'label-left-align', cssCode: '', - customClass: '', + customClass: [], functions: '', //全局函数 layoutType: 'PC', jsonVersion: 3,