mirror of
https://github.com/jumpserver/lina.git
synced 2025-09-17 15:52:32 +00:00
perf: 修改 acounts 创建提示
This commit is contained in:
@@ -1,13 +1,13 @@
|
|||||||
<template>
|
<template>
|
||||||
<Dialog
|
<Dialog
|
||||||
:title="$tc('assets.AddAccount')"
|
:close-on-click-modal="false"
|
||||||
:visible.sync="iVisible"
|
|
||||||
:destroy-on-close="true"
|
:destroy-on-close="true"
|
||||||
:show-cancel="false"
|
:show-cancel="false"
|
||||||
:show-confirm="false"
|
:show-confirm="false"
|
||||||
:close-on-click-modal="false"
|
:title="$tc('assets.AddAccount')"
|
||||||
width="70%"
|
:visible.sync="iVisible"
|
||||||
v-bind="$attrs"
|
v-bind="$attrs"
|
||||||
|
width="70%"
|
||||||
v-on="$listeners"
|
v-on="$listeners"
|
||||||
>
|
>
|
||||||
<AccountCreateUpdateForm
|
<AccountCreateUpdateForm
|
||||||
@@ -88,8 +88,6 @@ export default {
|
|||||||
this.iVisible = false
|
this.iVisible = false
|
||||||
this.$emit('add', true)
|
this.$emit('add', true)
|
||||||
this.$message.success(this.$tc('common.createSuccessMsg'))
|
this.$message.success(this.$tc('common.createSuccessMsg'))
|
||||||
}).catch(() => {
|
|
||||||
this.$message.error(this.$tc('common.createErrorMsg'))
|
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
editAccount(form) {
|
editAccount(form) {
|
||||||
|
@@ -234,9 +234,19 @@ export function getDayFuture(days, now) {
|
|||||||
|
|
||||||
export function getErrorResponseMsg(error) {
|
export function getErrorResponseMsg(error) {
|
||||||
let msg = ''
|
let msg = ''
|
||||||
const data = error.response && error.response.data || {}
|
const data = error.response && error.response.data || error
|
||||||
if (data && (data.error || data.msg || data.detail)) {
|
if (data && (data.error || data.msg || data.detail)) {
|
||||||
msg = data.error || data.msg || data.detail
|
msg = data.error || data.msg || data.detail
|
||||||
|
} else if (data && data['non_field_errors']) {
|
||||||
|
msg = data['non_field_errors'].join(', ')
|
||||||
|
} else if (Array.isArray(data)) {
|
||||||
|
msg = data.map((item, i) => {
|
||||||
|
let msg = getErrorResponseMsg(item)
|
||||||
|
if (msg) {
|
||||||
|
msg = `${i + 1}. ${msg}`
|
||||||
|
}
|
||||||
|
return msg
|
||||||
|
}).filter(i => i).join('; ')
|
||||||
}
|
}
|
||||||
return msg
|
return msg
|
||||||
}
|
}
|
||||||
|
@@ -102,6 +102,7 @@ export function flashErrorMsg({ response, error }) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
let timer = null
|
let timer = null
|
||||||
|
|
||||||
function refreshSessionAgeDelay(response) {
|
function refreshSessionAgeDelay(response) {
|
||||||
if (response.request.responseURL.indexOf('/users/profile/') !== -1) {
|
if (response.request.responseURL.indexOf('/users/profile/') !== -1) {
|
||||||
return
|
return
|
||||||
|
Reference in New Issue
Block a user