From ebc87b12f7b5cce2c828d80ee3410bffb6a2cc2c Mon Sep 17 00:00:00 2001 From: jym503558564 <503558564@qq.com> Date: Thu, 9 Apr 2020 14:41:08 +0800 Subject: [PATCH 1/5] =?UTF-8?q?[Update]=20=E5=A2=9E=E5=8A=A0=E8=B5=84?= =?UTF-8?q?=E4=BA=A7=E6=8E=88=E6=9D=83=E5=88=97=E8=A1=A8=E7=9A=84=E5=88=B7?= =?UTF-8?q?=E6=96=B0=E6=8C=89=E9=92=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/i18n/langs/cn.js | 31 +------------------------ src/views/perms/AssetPermissionList.vue | 21 +++++++++++++++-- 2 files changed, 20 insertions(+), 32 deletions(-) diff --git a/src/i18n/langs/cn.js b/src/i18n/langs/cn.js index 28ec59499..62ffc1208 100644 --- a/src/i18n/langs/cn.js +++ b/src/i18n/langs/cn.js @@ -317,37 +317,8 @@ const cn = { 'app_path': '应用路径' }, perms: { - 'asset_permission': '资产授权', - 'asset_permission_list': '资产授权列表', - 'asset_permission_detail': '资产授权详情', - 'create_asset_permission': '创建资产授权规则', - 'update_asset_permission': '更新资产授权规则', 'Asset permissions': '资产授权', - 'name': '名称', - 'user': '用户', - 'userGroup': '用户组', - 'asset': '资产', - 'node': '节点', - 'systemUser': '系统用户', - 'validity': '有效', - 'action': '动作', - 'update': '更新', - 'delete': '删除', - 'search': '搜索', - 'user_count': '用户数量', - 'user_group_count': '用户组数量', - 'asset_count': '资产数量', - 'node_count': '节点数量', - 'system_user_count': '系统用户数量', - 'date_start': '开始日期', - 'date_expired': '失效日期', - 'date_created': '创建日期', - 'created_by': '创建者', - 'comment': '备注', - 'quick_update': '快速更新', - 'active': '激活中', - 'users_and_user_groups': '用户或用户组', - 'assets_and_node': '资产或节点', + 'RefreshPermissionCache': '刷新授权缓存', 'Basic': '基本', 'User': '用户', 'Asset': '资产', diff --git a/src/views/perms/AssetPermissionList.vue b/src/views/perms/AssetPermissionList.vue index 9a95c2c1e..ad21be88e 100644 --- a/src/views/perms/AssetPermissionList.vue +++ b/src/views/perms/AssetPermissionList.vue @@ -14,8 +14,12 @@ export default { return { tableConfig: { url: '/api/v1/perms/asset-permissions/', - columns: ['name', 'users', 'user_groups', 'assets', 'nodes', 'system_users', 'is_active', 'actions'], + hasSelection: false, + columns: ['expand', 'name', 'users', 'user_groups', 'assets', 'nodes', 'system_users', 'is_active', 'actions'], columnsMeta: { + expand: { + type: 'expand' + }, users: { formatter: LengthFormatter }, @@ -36,7 +40,20 @@ export default { headerActions: { hasDelete: false, hasUpdate: false, - createRoute: 'AssetPermissionCreate' + hasBulkDelete: false, + createRoute: 'AssetPermissionCreate', + extraActions: [ + { + name: 'RefreshPermissionCache', + title: this.$t('perms.RefreshPermissionCache'), + type: 'primary', + has: true, + callback: function() { + const url = '/api/v1/perms/asset-permissions/cache/refresh/' + console.log('刷新请求:', url) + } + } + ] } } } From 5370f6c81b41219e33a74398df3fbac5c4627acc Mon Sep 17 00:00:00 2001 From: jym503558564 <503558564@qq.com> Date: Thu, 9 Apr 2020 16:24:18 +0800 Subject: [PATCH 2/5] =?UTF-8?q?[Update]=20=E4=BF=AE=E6=94=B9=E5=88=9B?= =?UTF-8?q?=E5=BB=BA=E8=B5=84=E4=BA=A7=E6=8E=88=E6=9D=83=E7=BB=84=E4=BB=B6?= =?UTF-8?q?=E4=B8=AD=E7=9A=84actions=E6=98=BE=E7=A4=BA=E4=B8=BAcheckbox-gr?= =?UTF-8?q?oup?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/i18n/langs/cn.js | 5 +++++ src/views/perms/AssetPermissionCreateUpdate.vue | 12 +++++++++++- 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/src/i18n/langs/cn.js b/src/i18n/langs/cn.js index 62ffc1208..5db0fd806 100644 --- a/src/i18n/langs/cn.js +++ b/src/i18n/langs/cn.js @@ -319,6 +319,11 @@ const cn = { perms: { 'Asset permissions': '资产授权', 'RefreshPermissionCache': '刷新授权缓存', + 'All': '全部', + 'Connect': '连接', + 'UpDownload': '上传下载', + 'UploadFile': '上传文件', + 'DownloadFile': '下载文件', 'Basic': '基本', 'User': '用户', 'Asset': '资产', diff --git a/src/views/perms/AssetPermissionCreateUpdate.vue b/src/views/perms/AssetPermissionCreateUpdate.vue index ef50ed92b..61e70687e 100644 --- a/src/views/perms/AssetPermissionCreateUpdate.vue +++ b/src/views/perms/AssetPermissionCreateUpdate.vue @@ -11,6 +11,7 @@ export default { data() { return { form: { + is_active: true, date_expired: '2099-12-31 00:00:00 +0800' }, fields: [ @@ -53,7 +54,16 @@ export default { } }, actions: { - label: this.$t('perms.Actions') + label: this.$t('perms.Actions'), + type: 'checkbox-group', + default: ['all', 'connect', 'updownload', 'upload_file', 'download_file'], + options: [ + { label: 'all' }, + { label: 'connect' }, + { label: 'updownload' }, + { label: 'upload_file' }, + { label: 'download_file' } + ] }, is_active: { type: 'checkbox' From 371ce287be3ffd3b412361e9b87180112eff047c Mon Sep 17 00:00:00 2001 From: jym503558564 <503558564@qq.com> Date: Thu, 9 Apr 2020 17:21:11 +0800 Subject: [PATCH 3/5] =?UTF-8?q?[Update]=20=E5=A2=9E=E5=8A=A0=E5=88=B7?= =?UTF-8?q?=E6=96=B0=E6=8E=88=E6=9D=83=E7=BC=93=E5=AD=98=E8=AF=B7=E6=B1=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/i18n/langs/cn.js | 2 ++ src/views/perms/AssetPermissionList.vue | 15 +++++++++++---- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/src/i18n/langs/cn.js b/src/i18n/langs/cn.js index 5db0fd806..579181c47 100644 --- a/src/i18n/langs/cn.js +++ b/src/i18n/langs/cn.js @@ -319,6 +319,8 @@ const cn = { perms: { 'Asset permissions': '资产授权', 'RefreshPermissionCache': '刷新授权缓存', + 'ReFreshSuccess': '刷新成功', + 'ReFreshFail': '刷新失败', 'All': '全部', 'Connect': '连接', 'UpDownload': '上传下载', diff --git a/src/views/perms/AssetPermissionList.vue b/src/views/perms/AssetPermissionList.vue index ad21be88e..9a876f59d 100644 --- a/src/views/perms/AssetPermissionList.vue +++ b/src/views/perms/AssetPermissionList.vue @@ -48,14 +48,21 @@ export default { title: this.$t('perms.RefreshPermissionCache'), type: 'primary', has: true, - callback: function() { - const url = '/api/v1/perms/asset-permissions/cache/refresh/' - console.log('刷新请求:', url) - } + callback: this.HandleRefreshPermissionCache } ] } } + }, + methods: { + HandleRefreshPermissionCache() { + const url = '/api/v1/perms/asset-permissions/cache/refresh/' + this.$axios.get(url).then(res => { + this.$message.success(this.$t('perms.ReFreshSuccess')) + }).catch(err => { + this.$message.error(this.$t('perms.ReFreshFail') + ':' + err) + }) + } } } From 515964818be4089fb498467cce0d098c40028a42 Mon Sep 17 00:00:00 2001 From: jym503558564 <503558564@qq.com> Date: Thu, 9 Apr 2020 21:00:07 +0800 Subject: [PATCH 4/5] =?UTF-8?q?[Update]=20=E8=B5=84=E4=BA=A7=E6=8E=88?= =?UTF-8?q?=E6=9D=83=E5=88=97=E8=A1=A8=E6=98=BE=E7=A4=BAexpand=E5=80=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ExpandAssetPermissionFormatter.vue | 37 +++++++++++++++++++ src/components/ListTable/formatters/index.js | 1 + src/i18n/langs/cn.js | 3 ++ .../perms/AssetPermissionCreateUpdate.vue | 12 +++--- src/views/perms/AssetPermissionList.vue | 5 ++- 5 files changed, 50 insertions(+), 8 deletions(-) create mode 100644 src/components/ListTable/formatters/ExpandAssetPermissionFormatter.vue diff --git a/src/components/ListTable/formatters/ExpandAssetPermissionFormatter.vue b/src/components/ListTable/formatters/ExpandAssetPermissionFormatter.vue new file mode 100644 index 000000000..bb18ad800 --- /dev/null +++ b/src/components/ListTable/formatters/ExpandAssetPermissionFormatter.vue @@ -0,0 +1,37 @@ + + + + + diff --git a/src/components/ListTable/formatters/index.js b/src/components/ListTable/formatters/index.js index 3af4df17e..54117d71e 100644 --- a/src/components/ListTable/formatters/index.js +++ b/src/components/ListTable/formatters/index.js @@ -6,3 +6,4 @@ export { default as ExpandPreFormatter } from './ExpandPreFormatter' export { default as LengthFormatter } from './LengthFormatter' export { default as RouterFormatter } from './RouterFormatter' export { default as OutputExpandFormatter } from './OutputExpandFormatter' +export { default as ExpandAssetPermissionFormatter } from './ExpandAssetPermissionFormatter' diff --git a/src/i18n/langs/cn.js b/src/i18n/langs/cn.js index b4c32c16f..6f2e0ee7e 100644 --- a/src/i18n/langs/cn.js +++ b/src/i18n/langs/cn.js @@ -331,6 +331,9 @@ const cn = { 'User': '用户', 'Asset': '资产', 'Actions': '动作', + 'UserGroups': '用户组', + 'Node': '节点', + 'SystemUser': '系统用户', // 'RemoteApp': '远程应用', // diff --git a/src/views/perms/AssetPermissionCreateUpdate.vue b/src/views/perms/AssetPermissionCreateUpdate.vue index 61e70687e..d96d96037 100644 --- a/src/views/perms/AssetPermissionCreateUpdate.vue +++ b/src/views/perms/AssetPermissionCreateUpdate.vue @@ -12,6 +12,7 @@ export default { return { form: { is_active: true, + actions: ['all', 'connect', 'updownload', 'upload_file', 'download_file'], date_expired: '2099-12-31 00:00:00 +0800' }, fields: [ @@ -56,13 +57,12 @@ export default { actions: { label: this.$t('perms.Actions'), type: 'checkbox-group', - default: ['all', 'connect', 'updownload', 'upload_file', 'download_file'], options: [ - { label: 'all' }, - { label: 'connect' }, - { label: 'updownload' }, - { label: 'upload_file' }, - { label: 'download_file' } + { label: 'all', value: this.$t('perms.All') }, + { label: 'connect', value: this.$t('perms.Connect') }, + { label: 'updownload', value: this.$t('perms.UpDownload') }, + { label: 'upload_file', value: this.$t('perms.UploadFile') }, + { label: 'download_file', value: this.$t('perms.DownloadFile') } ] }, is_active: { diff --git a/src/views/perms/AssetPermissionList.vue b/src/views/perms/AssetPermissionList.vue index 9a876f59d..ab677c511 100644 --- a/src/views/perms/AssetPermissionList.vue +++ b/src/views/perms/AssetPermissionList.vue @@ -4,7 +4,7 @@