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' ? '草稿保存失败' : "项目提交失败"