From 99ddc3598a20e1b2261d6e86bcd53cecd957c3c3 Mon Sep 17 00:00:00 2001 From: luchanan <398778994@qq.com> Date: Sun, 17 Sep 2023 12:08:17 +0800 Subject: [PATCH] =?UTF-8?q?perf:=20=E6=8C=87=E4=BB=A4=E6=9D=83=E9=99=90v-a?= =?UTF-8?q?uth=E6=94=AF=E6=8C=81=E5=B9=B6=E6=98=BE=E7=A4=BA=E6=8C=89?= =?UTF-8?q?=E9=92=AE=E6=9D=83=E9=99=90=20(#3035)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/hooks/web/usePermission.ts | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/hooks/web/usePermission.ts b/src/hooks/web/usePermission.ts index c367875f1a6..8a82d46a7f7 100644 --- a/src/hooks/web/usePermission.ts +++ b/src/hooks/web/usePermission.ts @@ -75,6 +75,14 @@ export function usePermission() { if (PermissionModeEnum.BACK === permMode) { const allCodeList = permissionStore.getPermCodeList as string[]; if (!isArray(value)) { + const splits = ['||', '&&']; + const splitName = splits.find((item) => value.includes(item)); + if (splitName) { + const splitCodes = value.split(splitName); + return splitName === splits[0] + ? intersection(splitCodes, allCodeList).length > 0 + : intersection(splitCodes, allCodeList).length === splitCodes.length; + } return allCodeList.includes(value); } return (intersection(value, allCodeList) as string[]).length > 0;