perf: update update

This commit is contained in:
ibuler 2025-02-08 17:28:44 +08:00
parent 731ae82bc5
commit c14970e232
5 changed files with 81 additions and 41 deletions

View File

@ -220,6 +220,7 @@ export default {
})
},
onUpdate({ row, col }) {
this.$route.params.id = row.id
this.$store.dispatch('common/setDrawerActionMeta', {
action: 'update', row: row, col: col, id: row.id
}).then(() => {

View File

@ -224,7 +224,7 @@ export default {
}
</script>
<style scoped>
<style scoped lang="scss">
.table-actions {
::v-deep {
.el-icon-arrow-down {

View File

@ -5,6 +5,7 @@
:header-actions="headerActions"
:table-config="tableConfig"
:tree-setting="treeSetting"
:quick-filters="quickFilter"
/>
<PermBulkUpdateDialog
:visible.sync="updateSelectedDialogSetting.visible"
@ -30,6 +31,36 @@ export default {
data() {
return {
helpMsg: this.$t('AssetPermissionHelpMsg'),
quickFilter: [
{
label: this.$t('QuickFilter'),
options: [
{
label: this.$t('Invalid'),
filter: {
is_valid: false
}
},
{
label: this.$t('Expired'),
filter: {
}
},
{
label: this.$t('Disabled'),
filter: {
is_active: false
}
},
{
label: this.$t('NoResource'),
filter: {
no_resource: true
}
}
]
}
],
treeSetting: {
showMenu: false,
showAssets: true,

View File

@ -137,7 +137,8 @@ export default {
rules: this.$store.getters.currentOrgIsRoot ? [] : [rules.RequiredChange],
helpTextFormatter: () => {
const handleClick = () => {
window.open('/settings/roles', '_blank')
this.$router.push({ name: 'RoleList' })
// window.open('/settings/roles', '_blank')
}
return (
<el-link onClick={handleClick}>
@ -188,6 +189,14 @@ export default {
}
return obj
},
submitMethod() {
const params = this.$route.params
if (params.id) {
return 'put'
} else {
return 'post'
}
},
cleanFormValue(value) {
const method = this.submitMethod()
if (method === 'post' && value.password_strategy === 'email') {
@ -216,33 +225,8 @@ export default {
this.setDefaultRoles()
this.disableMFAFieldIfNeed(null)
this.loading = false
this.initRoleManagementLink()
},
methods: {
initRoleManagementLink() {
const observer = new MutationObserver((mutations) => {
mutations.forEach((mutation) => {
if (mutation.addedNodes.length) {
const gotoRoleElement = document.querySelector('.goto-role')
if (gotoRoleElement) {
const handleClick = () => {
this.$router.push({ path: '/settings/roles' })
}
gotoRoleElement.addEventListener('click', handleClick)
this.$once('hook:beforeDestroy', () => {
gotoRoleElement.removeEventListener('click', handleClick)
observer.disconnect()
})
observer.disconnect()
}
}
})
})
observer.observe(document.body, {
childList: true,
subtree: true
})
},
afterGetUser(user) {
this.user = user
if (this.user.id === this.currentUser.id) {

View File

@ -52,36 +52,60 @@ export default {
detailDrawer: () => import('./UserDetail/index.vue'),
quickFilters: [
{
label: '快速筛选',
label: this.$t('QuickFilter'),
options: [
{
label: '禁用的',
value: ''
label: this.$t('Invalid'),
filter: {
is_valid: false
}
},
{
label: '首次登录的',
value: ''
label: this.$t('Disabled'),
filter: {
is_active: false
}
},
{
label: '没有用户组的',
value: ''
label: this.$t('Expired'),
filter: {
is_expired: true
}
},
{
label: this.$t('NeverLogin'),
filter: {
is_first_login: true
}
}
]
},
{
label: '认证',
label: this.$t('Auth'),
options: [
{
label: '密码过期的',
value: ''
label: this.$t('PasswordExpired'),
filter: {
is_password_expired: true
}
},
{
label: '需要更新密码的',
value: ''
label: this.$t('LongTimeNoLogin'),
filter: {
date_last_login__lte: getDayFuture(-30)
}
},
{
label: '没有开启 MFA',
value: ''
label: this.$t('NoMFA'),
filter: {
mfa_level: 0
}
},
{
label: this.$t('LoginBlocked'),
filter: {
is_blocked: true
}
}
]
}