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