From 43a156b5805357e315dff4380d77b6f3ea73f9ad Mon Sep 17 00:00:00 2001 From: zichen1019 <1510748736@qq.com> Date: Mon, 9 Aug 2021 13:50:45 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E5=B1=95=E7=A4=BA=E5=8F=8A?= =?UTF-8?q?=E5=AD=97=E6=AE=B5=EF=BC=8C=E6=B7=BB=E5=8A=A0=E6=9B=B4=E6=96=B0?= =?UTF-8?q?=E4=B8=8A=E4=BC=A0=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/common.js | 13 ++++++++- src/views/document/index.vue | 55 +++++++++++++++++++++++++----------- 2 files changed, 50 insertions(+), 18 deletions(-) diff --git a/src/api/common.js b/src/api/common.js index 61b27ef..77e27d7 100644 --- a/src/api/common.js +++ b/src/api/common.js @@ -209,4 +209,15 @@ export function uploadFileFn(params) { data: params, responseType: 'blob' }) -} +} +export function updateInspectionSystemFile(params) { + return preview({ + url: '/inspectionSystemFile', + method: 'put', + headers: { + 'Content-Type': 'application/x-www-form-urlencoded' + }, + data: params, + responseType: 'blob' + }) +} diff --git a/src/views/document/index.vue b/src/views/document/index.vue index f355d2d..f076b2a 100644 --- a/src/views/document/index.vue +++ b/src/views/document/index.vue @@ -38,18 +38,18 @@ @@ -57,10 +57,10 @@ - + - - + + 1) { + this.$notify.warning('请选择单份体系文件进行更新上传!') + return false + } const fd = new FormData() fd.append('file', file) - uploadFileFn(fd).then(() => { - this.$notify.success('导入数据成功。') - this.crud.toQuery() - }) + if (this.$refs.customTable.$refs.table.selection.length) { + fd.append('id', this.$refs.customTable.$refs.table.selection[0].id) + updateInspectionSystemFile(fd).then(() => { + this.$notify.success('体系更新成功。') + this.crud.toQuery() + }) + } else { + uploadFileFn(fd).then(() => { + this.$notify.success('体系上传成功。') + this.crud.toQuery() + }) + } + return false }, downLoad(item) { downloadFileUrl(this.url + '/' + item.id + item.suffix, item.filename, item.suffix) @@ -188,6 +197,18 @@ export default { }, closeReportDialog() { this.$refs['reportForm'].resetFields() + }, + formatterFlowName(row, column, cellValue) { + switch (cellValue) { + case 0: + return '保存' + case 1: + return '更新' + case 2: + return '删除' + default: + break + } } } }