From eb26bcf32680245df5370c4815a2e9723bca7474 Mon Sep 17 00:00:00 2001 From: Harry Yang Date: Tue, 3 Jan 2023 10:01:29 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=9D=E5=AD=98=E6=B5=81=E7=A8=8B=E8=BF=94?= =?UTF-8?q?=E5=9B=9E=E4=B8=8A=E4=B8=80=E7=BA=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../templates/admin/business/process-edit.ftl | 16 ++++++++++--- .../templates/admin/business/process-new.ftl | 23 +++++++++++++------ 2 files changed, 29 insertions(+), 10 deletions(-) diff --git a/src/main/resources/templates/admin/business/process-edit.ftl b/src/main/resources/templates/admin/business/process-edit.ftl index ce74d80..ec05950 100644 --- a/src/main/resources/templates/admin/business/process-edit.ftl +++ b/src/main/resources/templates/admin/business/process-edit.ftl @@ -616,6 +616,16 @@ console.log(obj) }, + resetForm() { + this.initForm({}) + this.fileList = [] + this.rowKeyCounter = 0 + this.incomeDetails = [] + this.projectSelected = false + this.procurementDetails = [] + this.supplierMaterialsForm = [] + }, + initForm(form) { this.processForm = { ...form } }, @@ -751,9 +761,7 @@ .finally(() => loading.close()) }, clearProjectProcess() { - this.projectSelected = false - this.initForm({}) - this.incomeDetails = [] + this.resetForm() }, saveDraft() { @@ -930,6 +938,8 @@ message: processForm.status === 'draft' ? '草稿保存成功' : "提交成功", type: 'success' }) + this.resetForm() + this.backLastPage() }).catch(({ response }) => { const defaultMessage = () => { return processForm.status === 'draft' ? '草稿保存失败' : "项目提交失败" diff --git a/src/main/resources/templates/admin/business/process-new.ftl b/src/main/resources/templates/admin/business/process-new.ftl index 655502d..d153771 100644 --- a/src/main/resources/templates/admin/business/process-new.ftl +++ b/src/main/resources/templates/admin/business/process-new.ftl @@ -727,8 +727,7 @@ cancelButtonText: '取消', type: 'warning' }).then(() => { - this.projectSelected = false - this.initForm({}) + this.resetForm() this.changeMode(BUTTON) }).catch(() => { this.$message({ @@ -811,6 +810,18 @@ initForm(form) { this.processForm = { ...form, sealTypes: [], projectTitle: this.computeProjectTitle(form) } }, + + resetForm() { + this.initForm({}) + this.fileList = [] + this.rowKeyCounter = 0 + this.incomeDetails = [] + this.projectSelected = false + this.procurementDetails = [] + this.supplierMaterialsForm = [] + this.filteredProcurementDetails = [] + }, + /** * 搜索项目 * @param q 用户输入的字符串 @@ -905,11 +916,7 @@ .finally(() => loading.close()) }, clearProjectProcess() { - this.initForm({}) - this.incomeDetails = [] - this.projectSelected = false - this.procurementDetails = [] - + this.resetForm() if (this.isProcurementContractMode) { this.goToHome() // 重新打开对话框选择项目 @@ -1092,6 +1099,8 @@ message: processForm.status === 'draft' ? '草稿保存成功' : "提交成功", type: 'success' }) + this.resetForm() + this.goToHome() }).catch(({ response }) => { const defaultMessage = () => { return processForm.status === 'draft' ? '草稿保存失败' : "项目提交失败"