pref(permission): 资产授权详情页添加动作字段 (#353)

* pref(permission): 资产授权详情页添加动作字段

* pref(permission): 修改翻译

Co-authored-by: jym503558564 <503558564@qq.com>
This commit is contained in:
fit2bot 2020-09-01 11:14:58 +08:00 committed by GitHub
parent f6a8e5634b
commit 72ee5f60b9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 55 additions and 0 deletions

View File

@ -13,6 +13,7 @@
import DetailCard from '@/components/DetailCard'
import QuickActions from '@/components/QuickActions'
import { toSafeLocalDateStr } from '@/utils/common'
import { ACTIONS_FIELDS_MAP } from './const'
export default {
name: 'AssetPermissionDetail',
@ -78,6 +79,14 @@ export default {
key: this.$t('perms.systemUserCount'),
value: this.object.system_users_amount
},
{
key: this.$t('perms.Actions'),
value: this.object.actions,
formatter(row, value) {
const actionMap = value.map(item => ACTIONS_FIELDS_MAP[item].action).join(',')
return <span>{actionMap}</span>
}
},
{
key: this.$t('perms.dateStart'),
value: toSafeLocalDateStr(this.object.date_start)

View File

@ -0,0 +1,46 @@
import i18n from '@/i18n/i18n'
export const ALL = 'all'
export const CONNECT = 'connect'
export const UPLOAD_FILE = 'upload_file'
export const DOWNLOAD_FILE = 'download_file'
export const UNDOWNLOAD = 'updownload'
export const CLIPBOARD_COPY = 'clipboard_copy'
export const CLIPBOARD_PASTE = 'clipboard_paste'
export const CLIPBOARD_COPY_PASTE = 'clipboard_copy_paste'
export const ACTIONS_FIELDS_MAP = {
[ALL]: {
name: ALL,
action: i18n.t('perms.all')
},
[CONNECT]: {
name: CONNECT,
action: i18n.t('perms.connect')
},
[UPLOAD_FILE]: {
name: UPLOAD_FILE,
action: i18n.t('perms.uploadFile')
},
[DOWNLOAD_FILE]: {
name: DOWNLOAD_FILE,
action: i18n.t('perms.downloadFile')
},
[UNDOWNLOAD]: {
name: UNDOWNLOAD,
action: i18n.t('perms.upDownload')
},
[CLIPBOARD_COPY]: {
name: CLIPBOARD_COPY,
action: i18n.t('perms.clipboardCopy')
},
[CLIPBOARD_PASTE]: {
name: CLIPBOARD_PASTE,
action: i18n.t('perms.clipboardPaste')
},
[CLIPBOARD_COPY_PASTE]: {
name: CLIPBOARD_COPY_PASTE,
action: i18n.t('perms.clipboardCopyPaste')
}
}