mirror of
https://github.com/jumpserver/lina.git
synced 2025-09-20 10:46:35 +00:00
perf:优化RelationCard组件删除之后默认错误处理
This commit is contained in:
@@ -117,6 +117,22 @@ export default {
|
|||||||
that.$message.success(that.$t('common.RemoveSuccessMsg'))
|
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: {
|
performAdd: {
|
||||||
type: Function,
|
type: Function,
|
||||||
default: (objects, that) => {}
|
default: (objects, that) => {}
|
||||||
@@ -248,7 +264,9 @@ export default {
|
|||||||
removeObject(obj) {
|
removeObject(obj) {
|
||||||
this.performDelete(obj, this).then(
|
this.performDelete(obj, this).then(
|
||||||
() => this.onDeleteSuccess(obj, this)
|
() => this.onDeleteSuccess(obj, this)
|
||||||
)
|
).catch(error => {
|
||||||
|
this.onDeleteFail(error, this)
|
||||||
|
})
|
||||||
},
|
},
|
||||||
addObjects() {
|
addObjects() {
|
||||||
const objects = this.$refs.select2.$refs.select.selected.map(item => ({ label: item.label, value: item.value }))
|
const objects = this.$refs.select2.$refs.select.selected.map(item => ({ label: item.label, value: item.value }))
|
||||||
|
Reference in New Issue
Block a user