[Update] 修改资产授权的显示字段

This commit is contained in:
jym503558564
2020-05-09 18:46:26 +08:00
parent c21e761d1a
commit be48d53d20
4 changed files with 31 additions and 38 deletions

View File

@@ -11,7 +11,7 @@
<script> <script>
import { DetailCard, ActiveCard } from '@/components' import { DetailCard, ActiveCard } from '@/components'
import { toSafeLocalDateStr } from '@/utils/common' // import { toSafeLocalDateStr } from '@/utils/common'
export default { export default {
name: 'AssetPermissionDetail', name: 'AssetPermissionDetail',
@@ -52,43 +52,44 @@ export default {
}, },
{ {
key: this.$t('perms.UserCount'), key: this.$t('perms.UserCount'),
value: this.getDataLength(this.object.users) // value: this.getDataLength(this.object.users)
value: JSON.stringify(this.object.users_amount)
}, },
{ {
key: this.$t('perms.UserGroupCount'), key: this.$t('perms.UserGroupCount'),
value: this.getDataLength(this.object.user_groups) value: JSON.stringify(this.object.assets_amount)
}, },
{ {
key: this.$t('perms.AssetCount'), key: this.$t('perms.AssetCount'),
value: this.getDataLength(this.object.assets) value: JSON.stringify(this.object.users_amount)
}, },
{ {
key: this.$t('perms.NodeCount'), key: this.$t('perms.NodeCount'),
value: this.getDataLength(this.object.nodes) value: JSON.stringify(this.object.nodes_amount)
}, },
{ {
key: this.$t('perms.SystemUserCount'), key: this.$t('perms.SystemUserCount'),
value: this.getDataLength(this.object.system_users) value: JSON.stringify(this.object.system_users_amount)
}, },
{ {
key: this.$t('perms.DateStart'), key: this.$t('perms.DateStart'),
value: toSafeLocalDateStr(this.object.date_start) value: 'api没有这个字段'
}, },
{ {
key: this.$t('perms.DateExpired'), key: this.$t('perms.DateExpired'),
value: toSafeLocalDateStr(this.object.date_expired) value: 'api没有这个字段'
}, },
{ {
key: this.$t('perms.DateCreated'), key: this.$t('perms.DateCreated'),
value: '没有这个字段' value: this.object.date_created
}, },
{ {
key: this.$t('perms.CreatedBy'), key: this.$t('perms.CreatedBy'),
value: '没有这个字段' value: this.object.created_by
}, },
{ {
key: this.$t('common.Comment'), key: this.$t('common.Comment'),
value: this.object.comment value: 'api没有这个字段'
} }
] ]
} }

View File

@@ -21,7 +21,7 @@ export default {
data() { data() {
return { return {
AssetPermission: { AssetPermission: {
name: '', users: '', user_groups: '', assets: '', nodes: '', system_users: '', name: '', users_amount: 0, user_groups_amount: 0, assets_amount: 0, nodes_amount: 0, system_users_amount: 0,
date_start: '', date_expired: '' date_start: '', date_expired: ''
}, },
config: { config: {

View File

@@ -4,7 +4,7 @@
<script> <script>
import GenericTreeListPage from '@/layout/components/GenericTreeListPage' import GenericTreeListPage from '@/layout/components/GenericTreeListPage'
import { LengthFormatter, ExpandAssetPermissionFormatter } from '@/components/ListTable/formatters/index' import { ExpandAssetPermissionFormatter } from '@/components/ListTable/formatters/index'
export default { export default {
components: { components: {
@@ -35,35 +35,31 @@ export default {
{ label: this.$t('perms.SystemUser'), key: 'system_user' }, { label: this.$t('perms.SystemUser'), key: 'system_user' },
{ label: '继承(先占位)', key: 'all=0' } { label: '继承(先占位)', key: 'all=0' }
], ],
columns: ['expand', 'name', 'users', 'user_groups', 'assets', 'nodes', 'system_users', 'is_active', 'actions'], columns: ['expand', 'name', 'users_amount', 'user_groups_amount', 'assets_amount', 'nodes_amount', 'system_users_amount', 'is_active', 'actions'],
columnsMeta: { columnsMeta: {
expand: { expand: {
type: 'expand', type: 'expand',
formatter: ExpandAssetPermissionFormatter formatter: ExpandAssetPermissionFormatter
}, },
users: { users_amount: {
formatter: LengthFormatter,
label: this.$t('perms.User') label: this.$t('perms.User')
}, },
user_groups: { user_groups_amount: {
formatter: LengthFormatter,
label: this.$t('perms.UserGroups') label: this.$t('perms.UserGroups')
}, },
assets: { assets_amount: {
formatter: LengthFormatter,
label: this.$t('perms.Asset') label: this.$t('perms.Asset')
}, },
nodes: { nodes_amount: {
formatter: LengthFormatter,
label: this.$t('perms.Node') label: this.$t('perms.Node')
}, },
system_users: { system_users_amount: {
formatter: LengthFormatter,
label: this.$t('perms.SystemUser') label: this.$t('perms.SystemUser')
} }
}, },
actions: { actions: {
updateRoute: 'AssetPermissionUpdate' updateRoute: 'AssetPermissionUpdate',
detailRoute: 'AssetPermissionDetail'
} }
}, },
headerActions: { headerActions: {

View File

@@ -7,7 +7,7 @@
<script> <script>
import AssetPermissionTree from './AssetPermissionTree' import AssetPermissionTree from './AssetPermissionTree'
import AssetPermissionList from './AssetPermissionList' import AssetPermissionList from './AssetPermissionList'
import { LengthFormatter, ExpandAssetPermissionFormatter } from '@/components/ListTable/formatters/index' import { ExpandAssetPermissionFormatter } from '@/components/ListTable/formatters/index'
export default { export default {
components: { components: {
@@ -39,35 +39,31 @@ export default {
{ label: this.$t('perms.SystemUser'), key: 'system_user' }, { label: this.$t('perms.SystemUser'), key: 'system_user' },
{ label: '继承(先占位)', key: 'all=0' } { label: '继承(先占位)', key: 'all=0' }
], ],
columns: ['expand', 'name', 'users', 'user_groups', 'assets', 'nodes', 'system_users', 'is_active', 'actions'], columns: ['expand', 'name', 'users_amount', 'user_groups_amount', 'assets_amount', 'nodes_amount', 'system_users_amount', 'is_active', 'actions'],
columnsMeta: { columnsMeta: {
expand: { expand: {
type: 'expand', type: 'expand',
formatter: ExpandAssetPermissionFormatter formatter: ExpandAssetPermissionFormatter
}, },
users: { users_amount: {
formatter: LengthFormatter,
label: this.$t('perms.User') label: this.$t('perms.User')
}, },
user_groups: { user_groups_amount: {
formatter: LengthFormatter,
label: this.$t('perms.UserGroups') label: this.$t('perms.UserGroups')
}, },
assets: { assets_amount: {
formatter: LengthFormatter,
label: this.$t('perms.Asset') label: this.$t('perms.Asset')
}, },
nodes: { nodes_amount: {
formatter: LengthFormatter,
label: this.$t('perms.Node') label: this.$t('perms.Node')
}, },
system_users: { system_users_amount: {
formatter: LengthFormatter,
label: this.$t('perms.SystemUser') label: this.$t('perms.SystemUser')
} }
}, },
actions: { actions: {
updateRoute: 'AssetPermissionUpdate' updateRoute: 'AssetPermissionUpdate',
detailRoute: 'AssetPermissionDetail'
} }
}, },
headerActions: { headerActions: {