liudong
2024-08-24 8189c098dba177425bcdb24d0a8a827f37b23e79
src/views/authority/role/index.vue
@@ -93,7 +93,7 @@
              @click="operation(4, record)"
            >角色权限</a-button>
            <a-popconfirm
              content="Are you sure you want to delete?"
              content="请确认是否删除?"
              type="success"
              @ok="operation(3, record)"
            >
@@ -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