ludc
2023-09-28 432a477d82c052e99e5a0fb3214ce4d990111592
Source/UBCS-WEB/src/views/integration/systemInfo.vue
@@ -59,6 +59,7 @@
    return {
      checkAll: {},
      ParentList: [],
      ParentRemoveList: [],
      //避免缓存
      reload: Math.random(),
      TreeLoading: false,
@@ -146,7 +147,7 @@
    //分类授权多选回调
    checkChange(row, checked) {
      if (checked) {
        if (!row.parentId && row.children) {
        if (!row.parentId) {
          const parentRecord = {
            oid: row.oid,
            classifyId: row.attributes.classifyId,
@@ -178,12 +179,41 @@
              }
            }
          }
          console.log(this.ParentList);
        }
      } else {
        this.ParentList = this.ParentList.filter(res => res.classifyId !== row.classifyId);
        console.log(this.ParentList);
        // 取消勾选的节点是父节点
        if (!row.parentId) {
          // 找到父节点在ParentList中的索引
          const parentIndex = this.ParentList.findIndex(item => item.oid === row.oid);
          if (parentIndex !== -1) {
            const parentOid = this.ParentList[parentIndex].classifyOid;
            // 查找所有需要删除的子节点的索引
            const childIndexes = this.ParentList.reduce((indexes, item, index) => {
              if (item.classParentOid === parentOid && item.classifyOid !== parentOid) {
                indexes.push(index);
              }
              return indexes;
            }, []);
            // 从后往前删除子节点的数据,保证索引的正确性
            for (let i = childIndexes.length - 1; i >= 0; i--) {
              this.ParentList.splice(childIndexes[i], 1);
            }
            // 删除父节点的数据
            this.ParentList.splice(parentIndex, 1);
          }
        } else {
          // 取消勾选的节点是子节点
          const childIndex = this.ParentList.findIndex(item => item.oid === row.oid);
          if (childIndex !== -1) {
            // 删除子节点的数据
            this.ParentList.splice(childIndex, 1);
          }
        }
      }
      console.log(this.ParentList);
    },
    //分类授权
    classifyHandler(row) {