From ba0a425359e4b49b4f2dfd07456a080a2b40b5f6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9Chuailei000=E2=80=9D?= <2280131253@qq.com> Date: Wed, 15 Jun 2022 18:40:49 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E5=85=A8=E5=B1=80?= =?UTF-8?q?=E7=BB=84=E7=BB=87=E4=B8=8B=E5=85=8B=E9=9A=86=E6=9D=83=E9=99=90?= =?UTF-8?q?=E5=88=A4=E6=96=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/ListTable/index.vue | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/components/ListTable/index.vue b/src/components/ListTable/index.vue index 5e0edaf03..95ac87698 100644 --- a/src/components/ListTable/index.vue +++ b/src/components/ListTable/index.vue @@ -86,13 +86,21 @@ export default { const formatterArgs = { 'columnsMeta.actions.formatterArgs.canUpdate': 'change', 'columnsMeta.actions.formatterArgs.canDelete': 'delete', - 'columnsMeta.actions.formatterArgs.canClone': 'add', + 'columnsMeta.actions.formatterArgs.canClone': () => { + return this.hasActionPerm('add') && !this.currentOrgIsRoot + }, 'columnsMeta.name.formatterArgs.can': 'view' } + for (const [arg, action] of Object.entries(formatterArgs)) { const notSet = _.get(config, arg) === undefined + const isFunction = typeof action === 'function' if (notSet) { - _.set(config, arg, this.hasActionPerm(action)) + if (isFunction) { + _.set(config, arg, action()) + } else { + _.set(config, arg, this.hasActionPerm(action)) + } } } this.$log.debug('Header actions', this.headerActions)