From 8189c098dba177425bcdb24d0a8a827f37b23e79 Mon Sep 17 00:00:00 2001 From: liudong <liudong> Date: 星期六, 24 八月 2024 13:48:43 +0800 Subject: [PATCH] agent名称修改 --- src/views/authority/role/index.vue | 32 ++++++++++++++++++++++++++++++-- 1 files changed, 30 insertions(+), 2 deletions(-) diff --git a/src/views/authority/role/index.vue b/src/views/authority/role/index.vue index fd2223e..f049890 100644 --- a/src/views/authority/role/index.vue +++ b/src/views/authority/role/index.vue @@ -140,6 +140,7 @@ class="tree-demo" v-model:checked-keys="checkedKeysMenu" v-model:expanded-keys="expandKdysMenu" + :only-check-leaf=true :checkable="true" :data="treeDataMenu" @check="onCheckMenu" @@ -284,6 +285,8 @@ import Authheader from '@/views/authority/components/authheader.vue'; import router from "@/router"; import { queryCanvasList } from "@/api/Agent"; + import { getUserResources } from "@/utils/auth"; + import { forEach } from "lodash"; let treeDataMenu = ref([]); let checkedKeysMenu = ref([]); @@ -666,18 +669,43 @@ }; + let userResources = JSON.parse(getUserResources()); + const isExist = (val): boolean => { + let isok = false; + userResources.forEach((r) => { + if (val == r.menuId) { + isok = true; + } + }); + return isok; + }; + const removeChild = (nodes,newT) => { + nodes.forEach((child) => { + if (isExist(child.menuId)){ + newT.push(child); + let nt = []; + if (child.children?.length > 0) { + removeChild(child.children, nt); + child.children = nt; + } + } + }); + }; + const MenuData = async (key) => { await ResourceList(key).then((res) => { + let newTree=[] + removeChild(res.rows,newTree) treeDataMenu.value = [...res.rows]; }); }; KnowledgeList().then((res) => { - knowledgeList.value = res.rows; + knowledgeList.value = res.data; }); DialogList().then((res) => { - DialogsList.value = res.rows; + DialogsList.value = res.data; }); queryCanvasList(null).then((canvas) => { AgentList= canvas.data -- Gitblit v1.8.0