[update] 修改法规符合性排查流程生成错误提示修改

This commit is contained in:
lideqin
2024-08-01 11:04:35 +08:00
parent 17350207be
commit a469470bdd
3 changed files with 62 additions and 1 deletions
+1
View File
@@ -246,6 +246,7 @@ module.exports = {
autoTakeout: 'Automatic takeout',
goHandle: 'To deal with',
disableInput: 'Inhibit input',
fileUploadError: 'File upload error',
// 标准字段
standardField: {
standardEnglishName: 'Regulation English Name',
+1
View File
@@ -246,6 +246,7 @@ module.exports = {
autoTakeout: '自动带出',
goHandle: '去处理',
disableInput: '禁止输入',
fileUploadError: '文件上传错误',
// 标准字段
standardField: {
standardEnglishName: '标准英文名称',
@@ -700,7 +700,13 @@ export default {
this.dataSource = JSON.parse(JSON.stringify(dataSource))
this.dataList = JSON.parse(JSON.stringify(dataSource))
} else {
this.$message.warning(res.message)
if (Array.isArray(res.message) && res.message.length > 0) {
this.messageLineFeed(this.$t('fileUploadError'), res.message)
} else if (/<br>|<\/br>|<br\/>/.test(res.message)) {
this.messageLineFeedByBr(this.$t('fileUploadError'), res.messagee)
} else {
this.$message.warning(res.message)
}
}
}).finally(() => {
this.$emit('loading', false)
@@ -854,6 +860,59 @@ export default {
handleDownload (id, name) {
// 下载文件
downloadFile(`/sys/common/download/${id}`, name)
},
/**
* 对数组形式后端错误信息进行处理
* @param title
* @param content
*/
messageLineFeed (title, content) {
const htmlDom = []
content.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;'
})
},
/**
* 对包含<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;'
})
}
}
}