yinbangzhong
2024-08-17 344b3c188b059bc857cc594c75ef5527d8a7aeaf
添加校验
4个文件已修改
58 ■■■■ 已修改文件
src/views/authority/organization/index.vue 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/authority/resource/index.vue 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/authority/role/index.vue 48 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/authority/users/index.vue 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/authority/organization/index.vue
@@ -7,7 +7,7 @@
        <a-card
          :title="$t('menu.organization.title')"
          :bordered="false"
          style=" 'width': '100%';   height: calc(100vh - 250px);; 'overflow-y': 'auto' "
          style=" 'width': '100%';   height: calc(100vh - 250px); overflow-y:auto "
        >
          <a-tree
            class="tree-demo"
src/views/authority/resource/index.vue
@@ -6,12 +6,13 @@
        <a-card
          :title="$t('menu.resource.title')"
          :bordered="false"
          style=" 'width': '100%';   height: calc(100vh - 250px); 'overflow-y': 'auto' "
          style=" 'width': '100%';   height: calc(100vh - 250px); overflow-y:auto "
        >
          <a-tree
            class="tree-demo"
            draggable
            blockNode
            :default-expand-all=true
            :data="treeData"
            :show-line="showLine"
            :fieldNames="{
src/views/authority/role/index.vue
@@ -148,7 +148,6 @@
                title: 'menuName',
                children: 'children',
              }"
              :check-strictly="checkStrictlyMenu"
            >
            </a-tree>
          </a-tab-pane>
@@ -214,7 +213,7 @@
            'margin': '1px',
          }"
          class="card-demo"
          title="用户所有权限"
          title="角色所有权限"
          hoverable
        >
          <a-space wrap>
@@ -336,18 +335,51 @@
  let resourcevisible = ref(false);
  let selectRole = ref({});
  const eachChildrenAdd=(node)=>{
    if (node.children?.length > 0) {
      node.children.forEach((child) => {
        checkStrictlyMenu.value.push({ menuId: child.menuId, menuName: child.menuName });
        eachChildrenAdd(child);
      });
    }
  }
  const findChild = (node, val): boolean => {
    let isExist = false;
    if (node.children?.length > 0) {
      node.children.forEach((child) => {
        if (val.menuId == child.menuId) {
          isExist = isExist || true;
        } else {
          isExist = isExist || findChild(child, val);
        }
      });
    }
    return isExist;
  };
  const onCheckMenu = (newCheckedKeys, event) => {
    let o = { menuId: event.node.menuId, menuName: event.node.menuName };
    if (event.checked) {
      checkStrictlyMenu.value.push(o);
      eachChildrenAdd(event.node);
      if (event.halfCheckedNodes?.length > 0) {
        event.halfCheckedNodes.forEach((child) => {
          let e = { menuId: child.menuId, menuName: child.menuName };
          if (checkStrictlyMenu.value.find((item) => item.menuId === e.menuId) == undefined) {
            checkStrictlyMenu.value.push(e);
          }
        });
      }
    } else {
      let menus=[];
      checkStrictlyMenu.value.forEach((val, idx, array) => {
        // val: 当前值
        if (val.menuId == event.node.menuId) {
          checkStrictlyMenu.value.splice(idx, 1);
          return true;
        if (val.menuId != event.node.menuId && !findChild(event.node, val)) {
          menus.push({ menuId: val.menuId, menuName: val.menuName });
        }
      });
      checkStrictlyMenu.value = menus;
    }
  };
  const onCheckKnowledge = (newCheckedKeys, event) => {
@@ -402,9 +434,7 @@
    }
  };
  const handleRemove = (key) => {
    checkStrictly.value = checkStrictly.value.filter((tag) => tag !== key);
  };
  const handleMenuRemove = (key) => {
    checkStrictlyMenu.value = checkStrictlyMenu.value.filter(
      (tag) => tag !== key
src/views/authority/users/index.vue
@@ -195,7 +195,6 @@
              title: 'deptName',
              children: 'children',
            }"
            :check-strictly="checkStrictly"
          >
          </a-tree>
        </a-card>
@@ -238,7 +237,6 @@
            <a-tag
              v-for="(tag, index) of checkStrictlyMenu"
              :key="tag.menuId"
              @close="handleMenuRemove(tag)"
            >
              {{ tag.menuName }}
            </a-tag>
@@ -249,7 +247,6 @@
            <a-tag
              v-for="(tag, index) of checkStrictlyKnowledge"
              :key="tag.knowledgeId"
              @close="handleKnowledgeRemove(tag)"
            >
              {{ tag.knowledgeName }}
            </a-tag>
@@ -260,14 +257,12 @@
            <a-tag
              v-for="(tag, index) of checkStrictlyDialog"
              :key="tag.dialogId"
              @close="handleDialogRemove(tag)"
            >
              {{ tag.dialogName }}
            </a-tag>
            <a-tag
              v-for="(tag, index) of checkStrictlyAgent"
              :key="tag.agentId"
              @close="handleDialogRemove(tag)"
            >
              {{ tag.agentName }}
            </a-tag>