update 导入文件提示信息处理
This commit is contained in:
@@ -135,6 +135,7 @@ module.exports = {
|
|||||||
standardNumber: 'Standard Number',
|
standardNumber: 'Standard Number',
|
||||||
standardName: 'Standard Name',
|
standardName: 'Standard Name',
|
||||||
standardNumOrName: 'Standard Number Or Standard Name',
|
standardNumOrName: 'Standard Number Or Standard Name',
|
||||||
|
fileImportError: 'File import error',
|
||||||
// 树右键
|
// 树右键
|
||||||
treeRight: {
|
treeRight: {
|
||||||
addFolder: 'Create New Folder',
|
addFolder: 'Create New Folder',
|
||||||
|
|||||||
@@ -135,6 +135,7 @@ module.exports = {
|
|||||||
standardNumber: '标准编号',
|
standardNumber: '标准编号',
|
||||||
standardName: '标准名称',
|
standardName: '标准名称',
|
||||||
standardNumOrName: '标准编号/标准名称',
|
standardNumOrName: '标准编号/标准名称',
|
||||||
|
fileImportError: '文件导入错误',
|
||||||
// 树右键
|
// 树右键
|
||||||
treeRight: {
|
treeRight: {
|
||||||
addFolder: '新增文件夹',
|
addFolder: '新增文件夹',
|
||||||
|
|||||||
@@ -239,23 +239,27 @@ export const ConfigurableTableMixin = {
|
|||||||
importModalLoading && importModalLoading.destroy()
|
importModalLoading && importModalLoading.destroy()
|
||||||
this.loading = false
|
this.loading = false
|
||||||
if (info.file.response.success) {
|
if (info.file.response.success) {
|
||||||
// this.$message.success(`${info.file.name} 文件上传成功`);
|
if (Array.isArray(info.file.response.result) && info.file.response.result.length > 0) {
|
||||||
if (info.file.response.code === 201) {
|
this.messageLineFeed(this.$t('fileImportError'), info.file.response.result)
|
||||||
const { message, result: { msg, fileUrl, fileName } } = info.file.response
|
|
||||||
const href = window._CONFIG.domianURL + fileUrl
|
|
||||||
this.$warning({
|
|
||||||
title: message,
|
|
||||||
content: (
|
|
||||||
<div>
|
|
||||||
<span>{msg}</span><br />
|
|
||||||
<span>具体详情请 <a href={href} target="_blank" download={fileName}>点击下载</a> </span>
|
|
||||||
</div>
|
|
||||||
)
|
|
||||||
})
|
|
||||||
} else {
|
} 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: (
|
||||||
|
<div>
|
||||||
|
<span>{msg}</span><br />
|
||||||
|
<span>具体详情请 <a href={href} target="_blank" download={fileName}>点击下载</a> </span>
|
||||||
|
</div>
|
||||||
|
)
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
this.$message.success(info.file.response.message || `${info.file.name} 文件上传成功`)
|
||||||
|
}
|
||||||
|
this.loadData()
|
||||||
}
|
}
|
||||||
this.loadData()
|
|
||||||
} else {
|
} else {
|
||||||
this.$message.error(`${info.file.name} ${info.file.response.message}.`)
|
this.$message.error(`${info.file.name} ${info.file.response.message}.`)
|
||||||
}
|
}
|
||||||
@@ -478,6 +482,28 @@ export const ConfigurableTableMixin = {
|
|||||||
} else {
|
} else {
|
||||||
this[operation.clickEvent](record)
|
this[operation.clickEvent](record)
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
/**
|
||||||
|
* 对数组形式后端错误信息进行处理
|
||||||
|
* @param title
|
||||||
|
* @param content
|
||||||
|
*/
|
||||||
|
messageLineFeed (title, content) {
|
||||||
|
const htmlDom = []
|
||||||
|
content.map(tt => {
|
||||||
|
if (tt) {
|
||||||
|
htmlDom.push((<div>{tt}</div>))
|
||||||
|
}
|
||||||
|
})
|
||||||
|
this.$warning({
|
||||||
|
title: title,
|
||||||
|
content: () => <div>
|
||||||
|
{htmlDom}
|
||||||
|
</div>
|
||||||
|
})
|
||||||
|
this.$nextTick(() => {
|
||||||
|
document.getElementsByClassName('ant-modal-confirm-btns')[0].style = 'display: inline-block'
|
||||||
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user