bug 78470

This commit is contained in:
赵霄
2023-11-15 17:35:23 +08:00
parent 3821af61e3
commit a136513a57
2 changed files with 57 additions and 1 deletions
+30 -1
View File
@@ -256,7 +256,9 @@ export const ConfigurableTableMixin = {
this.loading = true
// 把知道了这个按钮去掉
this.$nextTick(() => {
document.getElementsByClassName('ant-modal-confirm-btns')[0].style = 'display:none'
if (document.getElementsByClassName('ant-modal-confirm-btns')[0]) {
document.getElementsByClassName('ant-modal-confirm-btns')[0].style = 'display:none'
}
})
if (info.file.status !== 'uploading') {
console.log(info.file, info.fileList)
@@ -286,6 +288,8 @@ export const ConfigurableTableMixin = {
} else {
if (Array.isArray(info.file.response.result) && info.file.response.result.length > 0) {
this.messageLineFeed(this.$t('fileImportError'), info.file.response.result)
} else if (info.file.response.message.indexOf('</br>') !== -1) {
this.messageLineFeedByBr(this.$t('fileImportError'), info.file.response.message)
} else {
this.$message.warning(`${info.file.name} ${info.file.response.message}`)
}
@@ -532,6 +536,31 @@ export const ConfigurableTableMixin = {
this.$nextTick(() => {
document.getElementsByClassName('ant-modal-confirm-btns')[0].style = 'display: inline-block'
})
},
/**
* 对包含<br/>的后端错误信息进行处理
* @param title
* @param content
*/
messageLineFeedByBr (title, content) {
// 可以用分号和<br/>换行
content = content.replaceAll(`</br>`, ';')
const messageArr = content.split(';')
const htmlDom = []
messageArr.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'
})
}
}
}
+27
View File
@@ -433,6 +433,8 @@ export const JeroListMixin = {
} else {
if (Array.isArray(info.file.response.result) && info.file.response.result.length > 0) {
this.messageLineFeed(this.$t('fileImportError'), info.file.response.result)
} else if (info.file.response.message.indexOf('</br>') !== -1) {
this.messageLineFeedByBr(this.$t('fileImportError'), info.file.response.message)
} else {
this.$message.warning(`${info.file.name} ${info.file.response.message}`)
}
@@ -531,6 +533,31 @@ export const JeroListMixin = {
filterTreeOption (input, option) {
const text = option.componentOptions.propsData.title || option.componentOptions.propsData.label
return text.toLowerCase().indexOf(input.toLowerCase()) >= 0
},
/**
* 对包含<br/>的后端错误信息进行处理
* @param title
* @param content
*/
messageLineFeedByBr (title, content) {
// 可以用分号和<br/>换行
content = content.replaceAll(`</br>`, ';')
const messageArr = content.split(';')
const htmlDom = []
messageArr.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'
})
}
}
}