From fdbb4d78da141f119dbf7366bb8afb6fed595fd7 Mon Sep 17 00:00:00 2001 From: shanao Date: Fri, 13 Sep 2024 17:18:25 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B5=8B=E8=AF=95=E5=AE=8C=E6=88=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../accident/records/components/addOrEdit.vue | 49 ++++++++++--------- .../accident/records/components/list.vue | 24 ++++++--- 2 files changed, 41 insertions(+), 32 deletions(-) diff --git a/src/views/accident/records/components/addOrEdit.vue b/src/views/accident/records/components/addOrEdit.vue index 03c30f1..9b3f0c1 100644 --- a/src/views/accident/records/components/addOrEdit.vue +++ b/src/views/accident/records/components/addOrEdit.vue @@ -30,13 +30,12 @@ + /> - + @@ -90,11 +89,9 @@ @@ -162,8 +159,7 @@ export default { rules: { incidentNumber: [{ required: true, message: '事故案号不能为空', trigger: 'blur' }], incidentName: [{ required: true, message: '事故名称不能为空', trigger: 'blur' }], - HIDDENTYPE: [{ required: true, message: '事故类型不能为空', trigger: 'blur' }], - incidentType: [{ required: true, message: '隐患类型不能为空', trigger: 'blur' }], + incidentType: [{ required: true, message: '事故类型不能为空', trigger: 'blur' }], incidentLevel: [{ required: true, message: '事故级别不能为空', trigger: 'blur' }], incidentNature: [{ required: true, message: '事故性质不能为空', trigger: 'blur' }], location: [{ required: true, message: '事故发生地点不能为空', trigger: 'blur' }], @@ -339,21 +335,26 @@ export default { * 表单确认按钮 */ confirm() { - const params = { - ...this.infoForm, - photos: this.infoForm.fileList[0].remotePathName - } - delete params.fileList - requestFN('/accident' + (this.tableName === '修改' ? '/update' : '/save'), params) - .then((response) => { - // 删除成功后的处理 - this.$message.success(this.tableName + '成功') - this.infoForm = this.$options.data().infoForm - this.$parent.activeName = 'List' - // eslint-disable-next-line handle-callback-err - }).catch((error) => { - this.$message.error(this.tableName + '失败') - }) + this.$refs.form.validate(valid => { + if (!valid) { + return false + } + const params = { + ...this.infoForm, + photos: this.infoForm.fileList[0].remotePathName + } + delete params.fileList + requestFN('/accident' + (this.tableName === '修改' ? '/update' : '/save'), params) + .then((response) => { + // 删除成功后的处理 + this.$message.success(this.tableName + '成功') + this.infoForm = this.$options.data().infoForm + this.$parent.activeName = 'List' + // eslint-disable-next-line handle-callback-err + }).catch((error) => { + this.$message.error(this.tableName + '失败') + }) + }) }, /** diff --git a/src/views/accident/records/components/list.vue b/src/views/accident/records/components/list.vue index 4bd8c47..b2e52e8 100644 --- a/src/views/accident/records/components/list.vue +++ b/src/views/accident/records/components/list.vue @@ -4,16 +4,16 @@ - + - + - + - + @@ -53,7 +53,6 @@ 新增 全部导出 - 刷新 批量删除 @@ -74,7 +73,11 @@ - + + +