From 1949018900f983802d027c4e2e9ffc1805a83ecb Mon Sep 17 00:00:00 2001 From: XieYongHong <18010623010@163.com> Date: Sat, 15 Jul 2023 21:10:10 +0800 Subject: [PATCH] fix: bug#16434 --- src/components/FRuleEditor/Debug/index.vue | 2 ++ src/utils/document.ts | 1 + .../ChildDevice/BindChildDevice/index.vue | 2 +- src/views/link/plugin/UploadFile.vue | 2 +- .../Role/Detail/components/PermissTree.vue | 18 +++++++++++++----- .../system/Role/Detail/components/util.ts | 11 +++++++++++ 6 files changed, 29 insertions(+), 7 deletions(-) diff --git a/src/components/FRuleEditor/Debug/index.vue b/src/components/FRuleEditor/Debug/index.vue index f7a65685..4f000e03 100644 --- a/src/components/FRuleEditor/Debug/index.vue +++ b/src/components/FRuleEditor/Debug/index.vue @@ -274,6 +274,8 @@ const beginAction = () => { }; const stopAction = () => { isBeginning.value = true; + console.log(ws.value) + debugger if (ws.value) { ws.value.unsubscribe?.(); } diff --git a/src/utils/document.ts b/src/utils/document.ts index 6d5cea07..dd79c360 100644 --- a/src/utils/document.ts +++ b/src/utils/document.ts @@ -6,5 +6,6 @@ export const createScript = (src: string) => { } script.setAttribute('type', 'text/javascript') script.setAttribute('src', src) + document.body.appendChild(script) }) } \ No newline at end of file diff --git a/src/views/device/Instance/Detail/ChildDevice/BindChildDevice/index.vue b/src/views/device/Instance/Detail/ChildDevice/BindChildDevice/index.vue index ec9dee23..8a3ee670 100644 --- a/src/views/device/Instance/Detail/ChildDevice/BindChildDevice/index.vue +++ b/src/views/device/Instance/Detail/ChildDevice/BindChildDevice/index.vue @@ -187,7 +187,7 @@ const handleOk = () => { return; } btnLoading.value = true; - queryDeviceMapping(instanceStore.current.id) + queryDeviceMapping(instanceStore.current.id, ) .then(res => { const arr = bindDeviceRef.value?._dataSource.filter(item => { return !res.result?.[0]?.find(val => val.deviceId === item.id) && _selectedRowKeys.value.includes(item.id); diff --git a/src/views/link/plugin/UploadFile.vue b/src/views/link/plugin/UploadFile.vue index 2235ca07..8b94860d 100644 --- a/src/views/link/plugin/UploadFile.vue +++ b/src/views/link/plugin/UploadFile.vue @@ -95,7 +95,7 @@ const handleChange = async (info: UploadChangeParam) => { Notification.error({ // key: '403', message: '系统提示', - description: '系统未知错误,请反馈给管理员', + description: info.file.response?.message, }); // emit('update:modelValue', { err:'file_upload_error'}); loading.value = false; diff --git a/src/views/system/Role/Detail/components/PermissTree.vue b/src/views/system/Role/Detail/components/PermissTree.vue index 9a386026..8071c40a 100644 --- a/src/views/system/Role/Detail/components/PermissTree.vue +++ b/src/views/system/Role/Detail/components/PermissTree.vue @@ -111,7 +111,7 @@ import { USER_CENTER_MENU_CODE } from '@/utils/consts' import { isNoCommunity } from '@/utils/utils' -import {useIndirectMenusMap} from "@/views/system/Role/Detail/components/util"; +import {permissionsGranted, useIndirectMenusMap} from "@/views/system/Role/Detail/components/util"; const emits = defineEmits(['update:selectItems']); const route = useRoute(); @@ -303,12 +303,20 @@ function getAllPermiss() { } const hasIndirectMenus = (data: any) => { + let indirectMenus = [] if (data.children) { - const has = data.children.find(item => item.indirectMenus) - console.log(has) + const item = data.children.find(item => item.indirectMenus) + indirectMenus = item.indirectMenus } else if (data?.indirectMenus) { - console.log(data.indirectMenus) + indirectMenus = data.indirectMenus } + + if (indirectMenus.length) { + const ids = permissionsGranted(tableData.value) + console.log(ids, indirectMenus) + const inMenu = false + } + } /** @@ -322,7 +330,7 @@ function menuChange( ): undefined { console.log('menuChange', row) // 判断是否需要对子菜单及操作权限进行选择 - hasIndirectMenus(row) + // hasIndirectMenus(row) if (setButtonBool) { if (row.buttons && row.buttons.length > 0) row.buttons.forEach((button) => { diff --git a/src/views/system/Role/Detail/components/util.ts b/src/views/system/Role/Detail/components/util.ts index 864d0bf4..300f76df 100644 --- a/src/views/system/Role/Detail/components/util.ts +++ b/src/views/system/Role/Detail/components/util.ts @@ -27,4 +27,15 @@ export const useIndirectMenusMap = (tableData: Ref) => { return { PermissionsMap } +} + +export const permissionsGranted = (data: any[]) => { + return data.reduce((prev,current) => { + let ids = current.granted ? [...prev, current.id] : prev + if (current.children) { + const _ids = permissionsGranted(current.children) + ids = ids.concat(_ids) + } + return ids + }, []) } \ No newline at end of file