CN-919 fix: 解除remark校验、增加保存时的错误交互

This commit is contained in:
chenjinsong
2023-03-28 15:37:30 +08:00
parent e4549d3670
commit d4ab1d19e6

View File

@@ -190,9 +190,6 @@ export default {
tagType: [ tagType: [
{ required: true, message: this.$t('validate.required'), trigger: 'change' }, { required: true, message: this.$t('validate.required'), trigger: 'change' },
{ validator: typeAndNameValidator, message: this.$t('validate.duplicateRecord', { columns: '(' + this.$t('config.roles.name') + '+' + this.$t('overall.type') + ')' }), trigger: 'change' } { validator: typeAndNameValidator, message: this.$t('validate.duplicateRecord', { columns: '(' + this.$t('config.roles.name') + '+' + this.$t('overall.type') + ')' }), trigger: 'change' }
],
remark: [
{ validator: nameValidator, message: this.$t('validate.onlyAllowNumberLetterChinese-_'), trigger: 'blur' }
] ]
} }
} }
@@ -356,15 +353,11 @@ export default {
t: +new Date() t: +new Date()
}) })
} else { } else {
this.$message.error(response.data.message) this.errorMsgHandler(response)
} }
}).catch(e => { }).catch(e => {
console.error(e) console.error(e)
if (e.response.data && e.response.data.message) { this.errorMsgHandler(e)
this.$message.error(e.response.data.message)
} else {
this.$message.error('Something went wrong...')
}
}).finally(() => { }).finally(() => {
this.blockOperation.save = false this.blockOperation.save = false
}) })
@@ -378,15 +371,11 @@ export default {
t: +new Date() t: +new Date()
}) })
} else { } else {
this.$message.error(response.data.message) this.errorMsgHandler(response)
} }
}).catch(e => { }).catch(e => {
console.error(e) console.error(e)
if (e.response.data && e.response.data.message) { this.errorMsgHandler(e)
this.$message.error(e.response.data.message)
} else {
this.$message.error('Something went wrong...')
}
}).finally(() => { }).finally(() => {
this.blockOperation.save = false this.blockOperation.save = false
}) })
@@ -403,7 +392,10 @@ export default {
return this.importedData.filter(d => d.status !== 1).length > 0 return this.importedData.filter(d => d.status !== 1).length > 0
}, },
async getKnowledgeBaseList () { async getKnowledgeBaseList () {
return await axios.get(this.url, { params: { pageSize: 999 } }) return await axios.get(this.url, { params: { pageSize: 999 } }).catch(e => {
console.error(e)
this.errorMsgHandler(e)
})
} }
}, },
computed: { computed: {
@@ -444,10 +436,12 @@ export default {
this.importedPageObj.total = this.importedData.length this.importedPageObj.total = this.importedData.length
this.importedType = this.editObject.tagType this.importedType = this.editObject.tagType
this.initLoading = false this.initLoading = false
} else {
this.errorMsgHandler(response)
} }
}).catch(e => { }).catch(e => {
console.error(e) console.error(e)
this.$message.error(this.errorMsgHandler(e)) this.errorMsgHandler(e)
this.$router.push({ this.$router.push({
path: '/knowledgeBase', path: '/knowledgeBase',
t: +new Date() t: +new Date()