ludc
2024-10-23 f6b9c6c0e930cca51e049e1f446c03499ee8f29a
Source/plt-web/plt-web-ui/src/views/authority/ui/uiAuthorization/index.vue
@@ -111,7 +111,6 @@
    this.getTypeList();
  },
  methods: {
    getTreeList() {
      const loading = this.$loading({});
      gridRoles().then(res => {
@@ -173,14 +172,12 @@
      if (obj.checked === true) {
        result.push(obj.oid);
      }
      // 如果有 children,则继续遍历
      if (obj.children && obj.children.length > 0) {
        obj.children.forEach(child => {
          this.findCheckedOids(child, result);
        });
      }
      return result;
    },
@@ -188,7 +185,7 @@
    processChildren(item) {
      if (item.children && item.children.length > 0) {
        item.children = item.children.map(child => {
          if (child.level < 2) {
          if (child.level < 3) {
            // 默认树节点展开两层效果
            this.defaultExpandKeys.push(child.oid)
          }
@@ -243,15 +240,45 @@
    saveHandler() {
      const selectTreeList = this.$refs.uiTree.getCheckedNodes();
      const selectParentList = this.$refs.uiTree.getHalfCheckedNodes();
      if (selectTreeList.length == 0) {
        this.$message.error("请选择功能模块");
        return;
      }
      const selectTreeData = selectTreeList.map(item => {
        return {
          checked: true,
          expanded: true,
          data:item.data,
          parentId:item.parentId,
          level: item.level,
          leaf:item.leaf,
          oid: item.oid,
          text: item.text
        }
      })
      const parentData = selectParentList.map(item => {
        return {
          checked: false,
          expanded: true,
          data:item.data,
          parentId:item.parentId,
          level: item.level,
          leaf:item.leaf,
          oid: item.oid,
          text: item.text
        }
      })
      // 在半选状态中过滤掉顶级节点 oid 为 root
      const filterSelectTreeData = parentData.filter(item => item.oid !== 'root');
      const data = [...selectTreeData,...filterSelectTreeData];
      const formData = {
        roleId: this.nodeRow.oid,
        type: this.type,
        context: this.context,
        selectTreeList: selectTreeList
        selectTreeList: data
      }
      authorizedUI(formData).then(res => {
        if (res.data.success) {