yinbangzhong
2024-08-22 3c8070e9f97b42a56564b180bbecf5e54d7709ca
src/views/authority/role/index.vue
@@ -285,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([]);
@@ -667,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