From 648a42ab1d00a4df3bf5404665de2f27f5b7ddd0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=B5=B5=E9=9C=84?= Date: Wed, 27 Sep 2023 16:05:37 +0800 Subject: [PATCH] =?UTF-8?q?update=20=E5=AF=BC=E5=85=A5=E6=96=87=E4=BB=B6?= =?UTF-8?q?=E6=8F=90=E7=A4=BA=E4=BF=A1=E6=81=AF=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/common/lang/en-us.js | 1 + src/common/lang/zh-cn.js | 1 + src/mixins/ConfigurableTableMixin.js | 56 ++++++++++++++++++++-------- 3 files changed, 43 insertions(+), 15 deletions(-) diff --git a/src/common/lang/en-us.js b/src/common/lang/en-us.js index 8aed69c4..c8009205 100644 --- a/src/common/lang/en-us.js +++ b/src/common/lang/en-us.js @@ -135,6 +135,7 @@ module.exports = { standardNumber: 'Standard Number', standardName: 'Standard Name', standardNumOrName: 'Standard Number Or Standard Name', + fileImportError: 'File import error', // 树右键 treeRight: { addFolder: 'Create New Folder', diff --git a/src/common/lang/zh-cn.js b/src/common/lang/zh-cn.js index 5dfab300..b38b694d 100644 --- a/src/common/lang/zh-cn.js +++ b/src/common/lang/zh-cn.js @@ -135,6 +135,7 @@ module.exports = { standardNumber: '标准编号', standardName: '标准名称', standardNumOrName: '标准编号/标准名称', + fileImportError: '文件导入错误', // 树右键 treeRight: { addFolder: '新增文件夹', diff --git a/src/mixins/ConfigurableTableMixin.js b/src/mixins/ConfigurableTableMixin.js index 38389b82..bd38bfc6 100644 --- a/src/mixins/ConfigurableTableMixin.js +++ b/src/mixins/ConfigurableTableMixin.js @@ -239,23 +239,27 @@ export const ConfigurableTableMixin = { importModalLoading && importModalLoading.destroy() this.loading = false if (info.file.response.success) { - // this.$message.success(`${info.file.name} 文件上传成功`); - if (info.file.response.code === 201) { - const { message, result: { msg, fileUrl, fileName } } = info.file.response - const href = window._CONFIG.domianURL + fileUrl - this.$warning({ - title: message, - content: ( -
- {msg}
- 具体详情请 点击下载 -
- ) - }) + if (Array.isArray(info.file.response.result) && info.file.response.result.length > 0) { + this.messageLineFeed(this.$t('fileImportError'), info.file.response.result) } else { - this.$message.success(info.file.response.message || `${info.file.name} 文件上传成功`) + // this.$message.success(`${info.file.name} 文件上传成功`); + if (info.file.response.code === 201) { + const { message, result: { msg, fileUrl, fileName } } = info.file.response + const href = window._CONFIG.domianURL + fileUrl + this.$warning({ + title: message, + content: ( +
+ {msg}
+ 具体详情请 点击下载 +
+ ) + }) + } else { + this.$message.success(info.file.response.message || `${info.file.name} 文件上传成功`) + } + this.loadData() } - this.loadData() } else { this.$message.error(`${info.file.name} ${info.file.response.message}.`) } @@ -478,6 +482,28 @@ export const ConfigurableTableMixin = { } else { this[operation.clickEvent](record) } + }, + /** + * 对数组形式后端错误信息进行处理 + * @param title + * @param content + */ + messageLineFeed (title, content) { + const htmlDom = [] + content.map(tt => { + if (tt) { + htmlDom.push((
{tt}
)) + } + }) + this.$warning({ + title: title, + content: () =>
+ {htmlDom} +
+ }) + this.$nextTick(() => { + document.getElementsByClassName('ant-modal-confirm-btns')[0].style = 'display: inline-block' + }) } } }