马宇豪
2024-08-01 81e6577d11920a45284936f591bd8d076006a919
src/views/Admin/contactBook/structure.vue
@@ -125,12 +125,24 @@
      const t = this
      const res = await getStructure();
      if(res.data.code == 100){
        t.tableData = res.data.data
        t.tableData = t.filterBranches(res.data.data,['自治区直辖县级行政区划'])
      }else{
        t.$message.warning(res.data.msg);
      }
    },
    filterBranches(branches, targetNames) {
      return branches.filter(branch => {
        if (targetNames.includes(branch.name)) {
          return false; // 过滤掉当前分支
        }
        if (branch.children && branch.children.length > 0) {
          branch.children = this.filterBranches(branch.children, targetNames);
        }
        return true; // 保留当前分支
      });
    },
    openAdd(type,row){
      if(type == 'add'){
        this.editTitle = '新增'