diff --git a/src/views/modules/communityParty/members/create.vue b/src/views/modules/communityParty/members/create.vue index 49a2f8a84..938f72f3a 100644 --- a/src/views/modules/communityParty/members/create.vue +++ b/src/views/modules/communityParty/members/create.vue @@ -319,8 +319,30 @@ export default { flowFlagOptions: [{ 'label': '是', 'value': 1 }, { 'label': '否', 'value': 0 }], // 是否流动党员 studyNotNeedOptions: [{ 'label': '是', 'value': 1 }, { 'label': '否', 'value': 0 }], // 免学习 retiredFlagOptions: [{ 'label': '是', 'value': 1 }, { 'label': '否', 'value': 0 }], // 退休 - dataFormClear: null, - dataForm: { + dataForm: this.initForm(), + + partyOrgTreeCascadarProps: { + lazy: true, + lazyLoad: ((node, resolve) => { + this.handleNextOrgTreeClick(node, resolve) + }), + value: 'id', + label: 'partyOrgName', + checkStrictly: true, + multiple: false + } + } + }, + mounted () { + this.epmetResultResolver = new EpmetResultResolver(this); + }, + methods: { + + /** + * 初始化表单 + */ + initForm() { + return { partyOrgId: null, name: null, mobile: null, @@ -344,27 +366,8 @@ export default { joinBranchName: null, joinCommunityTime: null, remark: null, - }, - - partyOrgTreeCascadarProps: { - lazy: true, - lazyLoad: ((node, resolve) => { - this.handleNextOrgTreeClick(node, resolve) - }), - value: 'id', - label: 'partyOrgName', - checkStrictly: true, - multiple: false } - } - }, - mounted () { - this.epmetResultResolver = new EpmetResultResolver(this); - // 备份一下dataForm - // this.dataFormClear = Object.create(this.dataForm); - this.dataFormClear = JSON.parse(JSON.stringify(this.dataForm)); - }, - methods: { + }, /** ● ====================事件列表====================== **/ @@ -443,7 +446,7 @@ export default { * @returns {Promise} */ resetForm() { - this.dataForm = this.dataFormClear; + this.dataForm = this.initForm(); }, /** ● ==================方法列表===================== **/ diff --git a/src/views/modules/communityParty/partyOrg/create.vue b/src/views/modules/communityParty/partyOrg/create.vue index 8121653ba..868c0de27 100644 --- a/src/views/modules/communityParty/partyOrg/create.vue +++ b/src/views/modules/communityParty/partyOrg/create.vue @@ -137,17 +137,7 @@ export default { data () { return { operation: 'create', // 新建createNew ;新建下级createSubOrg - dataForm: { - partyOrgPid: null, - partyOrgName: null, - partyOrgLevel: null, - principalId: null, - orgId: null, // 行政组织id - description: null, - longitude: null, - latitude: null, - address: null - }, + dataForm: this.initForm(), // 党组织类型下拉框 partyOrgLevels: [], // 父级党组织 @@ -238,22 +228,23 @@ export default { /** * 重置 */ - resetForm() { - this.dataForm = { - partyOrgPid: null, - partyOrgName: null, - partyOrgLevel: null, - orgId: null, // 行政组织id - description: null, - longitude: null, - latitude: null, - address: null - }; - + initForm() { this.partyOrgLevels = []; this.parentPartyOrgs = []; this.principals = []; this.xingzhengOrgs = []; + + return { + partyOrgPid: null, + partyOrgName: null, + partyOrgLevel: null, + principalId: null, + orgId: null, // 行政组织id + description: null, + longitude: null, + latitude: null, + address: null + }; }, // 加载党组织类型下拉框 @@ -365,7 +356,7 @@ export default { async handleDlgClose() { this.visible = false; this.$emit("update:visiable", false); - this.resetForm(); + this.initForm(); }, /** diff --git a/src/views/modules/communityParty/partyOrg/update.vue b/src/views/modules/communityParty/partyOrg/update.vue index d2ce794df..b939b7572 100644 --- a/src/views/modules/communityParty/partyOrg/update.vue +++ b/src/views/modules/communityParty/partyOrg/update.vue @@ -104,16 +104,7 @@ import daiMap from "@/utils/dai-map"; export default { data () { return { - dataForm: { - id: null, - partyOrgName: null, - principalId: null, - description: null, - longitude: null, - latitude: null, - address: null - }, - + dataForm: this.initForm(), partyOrgPName: null, partyOrgLevel: null, partyOrgLevelName: null, @@ -209,18 +200,17 @@ export default { /** * 重置 */ - resetForm() { - this.dataForm = { - id: null, - partyOrgName: null, - principalId: null, - description: null, - longitude: null, - latitude: null, - address: null, - }; - + initForm() { this.principals = []; + return { + id: null, + partyOrgName: null, + principalId: null, + description: null, + longitude: null, + latitude: null, + address: null + }; }, /** @@ -248,7 +238,7 @@ export default { async handleDlgClose() { this.visible = false; this.$emit("update:visiable", false); - this.resetForm(); + this.initForm(); }, /**