fix: 修改授权规则列表 accounts popover 显示优化

This commit is contained in:
Bai
2023-02-15 15:56:25 +08:00
committed by Jiangjie.Bai
parent 1e474b25f3
commit 041801a319
4 changed files with 33 additions and 15 deletions

View File

@@ -13,6 +13,7 @@ import { GenericCreateUpdatePage } from '@/layout/components'
import AssetSelect from '@/components/AssetSelect'
import { getDayFuture } from '@/utils/common'
import AccountFormatter from './components/AccountFormatter'
import { AllAccount } from '../const'
export default {
name: 'AccountFormatter',
@@ -35,7 +36,7 @@ export default {
date_expired: getDayFuture(36500, new Date()).toISOString(),
nodes: nodesInitial,
assets: assetsInitial,
accounts: ['@ALL']
accounts: [AllAccount]
},
fields: [
[this.$t('common.Basic'), ['name']],

View File

@@ -18,7 +18,7 @@ import AssetTreeTable from '@/components/AssetTreeTable'
import PermBulkUpdateDialog from './components/PermBulkUpdateDialog'
import AmountFormatter from '@/components/TableFormatters/AmountFormatter'
import { mapGetters } from 'vuex'
import { AssetPermissionListPageSearchConfigOptions } from '../const'
import { AccountLabelMapper, AssetPermissionListPageSearchConfigOptions } from '../const'
export default {
components: {
@@ -121,7 +121,7 @@ export default {
formatter: AmountFormatter,
formatterArgs: {
getItem(item) {
return item
return AccountLabelMapper[item] || item
},
routeQuery: {
activeTab: 'AssetPermissionAccount'

View File

@@ -20,6 +20,13 @@
<script>
import { TagInput } from '@/components/FormFields'
import {
AllAccount,
SPECAccount,
SameUSER,
ManualINPUT,
AccountLabelMapper
} from '@/views/perms/const'
export default {
components: {
@@ -32,29 +39,27 @@ export default {
}
},
data() {
const ALL = '@ALL'
const SPEC = '@SPEC'
const choices = [
{
label: this.$t('perms.AllAccounts'),
value: ALL
label: AccountLabelMapper[AllAccount],
value: AllAccount
},
{
label: this.$t('perms.SpecifyAccounts'),
value: SPEC
label: AccountLabelMapper[SPECAccount],
value: SPECAccount
},
{
label: this.$t('perms.ManualInput'),
value: '@INPUT'
label: AccountLabelMapper[ManualINPUT],
value: ManualINPUT
},
{
label: this.$t('perms.SameAccount'),
value: '@USER'
label: AccountLabelMapper[SameUSER],
value: SameUSER
}
]
return {
ALL: ALL,
SPEC: SPEC,
ALL: AllAccount,
SPEC: SPECAccount,
choices: choices,
choicesSelected: [],
defaultChoices: [this.ALL],

View File

@@ -40,3 +40,15 @@ export const AssetPermissionListPageSearchConfigOptions = [
]
}
]
export const AllAccount = '@ALL'
export const SPECAccount = '@SPEC'
export const SameUSER = '@USER'
export const ManualINPUT = '@INPUT'
export const AccountLabelMapper = {
[AllAccount]: i18n.t('perms.AllAccounts'),
[SPECAccount]: i18n.t('perms.SpecifyAccounts'),
[SameUSER]: i18n.t('perms.SameAccount'),
[ManualINPUT]: i18n.t('perms.ManualInput')
}