[fix 87267] 拆分-导入拆分结果-报错提示改为br换行

This commit is contained in:
danshihao
2024-07-23 11:25:44 +08:00
parent 43fac3287c
commit e6bee4e42e
@@ -133,7 +133,8 @@ export default {
this.$emit('ok')
this.close()
} else {
this.$message.warning(res.message)
this.messageLineFeedByBr(this.$t('fileImportError'), res.message)
// this.$message.warning(res.message)
}
}).finally(() => {
this.confirmLoading = false
@@ -141,6 +142,34 @@ export default {
}
})
},
/**
* 对包含<br/>的后端错误信息进行处理
* @param title
* @param content
*/
messageLineFeedByBr (title, content) {
// 可以用分号和<br> </br> <br/>换行
content = content.replace(/<br>|<\/br>|<br\/>/g, ';')
const messageArr = content.split(';')
const htmlDom = []
messageArr.map(tt => {
if (tt) {
htmlDom.push((<div>{tt}</div>))
}
})
this.$warning({
title: title,
closable: true,
width: 800,
content: () => <div>
{htmlDom}
</div>
})
this.$nextTick(() => {
document.getElementsByClassName('ant-modal-confirm-btns')[0].style = 'display: inline-block'
document.getElementsByClassName('ant-modal-confirm-content')[0].style = 'max-height: calc(100vh - 300px);overflow-y: auto;'
})
},
handleCancel () {
this.close()
},