mirror of
https://github.com/jumpserver/lina.git
synced 2025-09-18 16:32:28 +00:00
perf:优化RelationCard组件删除之后默认错误处理
This commit is contained in:
@@ -117,6 +117,22 @@ export default {
|
||||
that.$message.success(that.$t('common.RemoveSuccessMsg'))
|
||||
}
|
||||
},
|
||||
onDeleteFail: {
|
||||
type: Function,
|
||||
default(error, that) {
|
||||
let msg = ''
|
||||
const data = error.response.data
|
||||
for (const item of Object.keys(data)) {
|
||||
const value = data[item]
|
||||
if (value instanceof Array) {
|
||||
msg = value.join(',')
|
||||
} else {
|
||||
msg = value
|
||||
}
|
||||
}
|
||||
that.$message.error(msg)
|
||||
}
|
||||
},
|
||||
performAdd: {
|
||||
type: Function,
|
||||
default: (objects, that) => {}
|
||||
@@ -248,7 +264,9 @@ export default {
|
||||
removeObject(obj) {
|
||||
this.performDelete(obj, this).then(
|
||||
() => this.onDeleteSuccess(obj, this)
|
||||
)
|
||||
).catch(error => {
|
||||
this.onDeleteFail(error, this)
|
||||
})
|
||||
},
|
||||
addObjects() {
|
||||
const objects = this.$refs.select2.$refs.select.selected.map(item => ({ label: item.label, value: item.value }))
|
||||
|
Reference in New Issue
Block a user