From 4556d3f4fe15342772c60641a5425b7f50f986d8 Mon Sep 17 00:00:00 2001 From: ibuler Date: Sat, 6 May 2023 19:51:10 +0800 Subject: [PATCH] =?UTF-8?q?perf:=20=E4=BF=AE=E6=94=B9=20m2m=20placeholder?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../FormFields/JSONManyToManySelect/index.vue | 8 ++- .../acl/AssetAcl/AssetAclCreateUpdate.vue | 15 +++--- .../CommandFilterAclCreateUpdate.vue | 53 ++----------------- src/views/acl/common.js | 23 -------- src/views/assets/const.js | 47 +++++++++++++++- src/views/users/const.js | 29 ++++++++++ 6 files changed, 91 insertions(+), 84 deletions(-) create mode 100644 src/views/users/const.js diff --git a/src/components/FormFields/JSONManyToManySelect/index.vue b/src/components/FormFields/JSONManyToManySelect/index.vue index 5686b8807..b2c910728 100644 --- a/src/components/FormFields/JSONManyToManySelect/index.vue +++ b/src/components/FormFields/JSONManyToManySelect/index.vue @@ -46,6 +46,10 @@ export default { attrs: { type: Array, default: () => ([]) + }, + resource: { + type: String, + default: '' } }, data() { @@ -86,8 +90,8 @@ export default { iValue: Object.assign({ type: 'all' }, this.value), ids: this.value.ids || [], types: [ - { name: 'all', label: '全部' }, - { name: 'ids', label: '指定' }, + { name: 'all', label: '全部' + this.resource }, + { name: 'ids', label: '指定' + this.resource }, { name: 'attrs', label: '属性选择' } ], tableConfig: { diff --git a/src/views/acl/AssetAcl/AssetAclCreateUpdate.vue b/src/views/acl/AssetAcl/AssetAclCreateUpdate.vue index a987f0d9d..3373c1b66 100644 --- a/src/views/acl/AssetAcl/AssetAclCreateUpdate.vue +++ b/src/views/acl/AssetAcl/AssetAclCreateUpdate.vue @@ -6,6 +6,8 @@ import GenericCreateUpdatePage from '@/layout/components/GenericCreateUpdatePage' import rules from '@/components/DataForm/rules' import { cleanFormValueForHandleUserAssetAccount } from '../common' +import { userJSONSelectMeta } from '@/views/users/const' +import { assetJSONSelectMeta } from '@/views/assets/const' export default { name: 'AclCreateUpdate', @@ -16,24 +18,19 @@ export default { return { initial: {}, fields: [ - [this.$t('common.Basic'), ['name', 'priority']], + [this.$t('common.Basic'), ['name']], [this.$t('acl.users'), ['users']], [this.$t('acl.host'), ['assets']], [this.$t('acl.account'), ['accounts']], [this.$t('acl.action'), ['action', 'reviewers']], - [this.$t('common.Other'), ['is_active', 'comment']] + [this.$t('common.Other'), ['priority', 'is_active', 'comment']] ], fieldsMeta: { priority: { rules: [rules.Required] }, - assets: { - fields: ['name_group', 'address_group'] - }, - users: { - fields: ['username_group'], - fieldsMeta: {} - }, + assets: assetJSONSelectMeta(this), + users: userJSONSelectMeta(this), accounts: { fields: ['username_group'] }, diff --git a/src/views/acl/CommandAcl/CommandFilterAcl/CommandFilterAclCreateUpdate.vue b/src/views/acl/CommandAcl/CommandFilterAcl/CommandFilterAclCreateUpdate.vue index c1dcfa94c..321cccafc 100644 --- a/src/views/acl/CommandAcl/CommandFilterAcl/CommandFilterAclCreateUpdate.vue +++ b/src/views/acl/CommandAcl/CommandFilterAcl/CommandFilterAclCreateUpdate.vue @@ -10,9 +10,10 @@