fix: 修改通用创建更新成功后的Route; 优化用户ACL创建ip_group错误时的信息显示

This commit is contained in:
Bai
2021-07-26 17:02:14 +08:00
parent 6bab31d74c
commit f7d75ca92c
15 changed files with 239 additions and 283 deletions

View File

@@ -1,9 +1,5 @@
<template>
<GenericCreateUpdatePage
v-bind="$data"
:clean-form-value="cleanFormValue"
@getObjectDone="afterGetUser"
/>
<GenericCreateUpdatePage v-bind="$data" @getObjectDone="afterGetUser" />
</template>
<script>
@@ -134,6 +130,27 @@ export default {
value: []
}
}
},
getMethod() {
const params = this.$route.params
if (params.id) {
return 'put'
} else {
return 'post'
}
},
cleanFormValue(value) {
const method = this.getMethod()
if (method === 'post' && value.password_strategy === 'email') {
delete value['password']
if (this.currentOrgIsRoot) {
delete value['groups']
}
}
if (value.update_password !== undefined) {
delete value.update_password
}
return value
}
}
},
@@ -146,27 +163,6 @@ export default {
}
},
methods: {
cleanFormValue(value) {
const method = this.getMethod()
if (method === 'post' && value.password_strategy === 'email') {
delete value['password']
if (this.currentOrgIsRoot) {
delete value['groups']
}
}
if (value.update_password !== undefined) {
delete value.update_password
}
return value
},
getMethod() {
const params = this.$route.params
if (params.id) {
return 'put'
} else {
return 'post'
}
},
afterGetUser(user) {
this.user = user
if (this.$route.query.clone_from) {