liuyg
2021-09-26 b8aa0226aa7b9826a6d8acf249258e475a07c000
src/views/system/user.vue
@@ -220,6 +220,7 @@
        callback();
      }
    };
    return {
      isguanli: true,
@@ -261,19 +262,22 @@
      treeOption: {
        nodeKey: "id",
        lazy: true,
        treeLoad: function (node, resolve) {
          const parentId = node.level === 0 ? 0 : node.data.id;
          getDeptLazyTree(parentId).then((res) => {
            resolve(
              res.data.data.map((item) => {
                return {
                  ...item,
                  leaf: !item.hasChildren,
                };
              })
            );
          });
        },
        treeLoad: "", //处理权限  在created中
        //  function (node, resolve) {
        //   const parentId = node.level === 0 ? 0 : node.data.id;
        //   //公安局进入
        //   getDeptLazyTree(parentId, jurisdiction).then((res) => {
        //     resolve(
        //       res.data.data.map((item) => {
        //         return {
        //           ...item,
        //           leaf: !item.hasChildren,
        //         };
        //       })
        //     );
        //   });
        // },
        addBtn: false,
        menu: false,
        size: "small",
@@ -781,6 +785,39 @@
      this.deptids = null;
      this.sizes = [5, 19];
    }
    //公安局进入
    var jurisdiction = "";
    if (this.userInfo.role_name == "公安管理员") {
      jurisdiction = this.userInfo.jurisdiction;
      this.treeOption.treeLoad = function (node, resolve) {
        const parentId = node.level === 0 ? 0 : node.data.id;
        getDeptLazyTree(parentId, jurisdiction).then((res) => {
          resolve(
            res.data.data.map((item) => {
              return {
                ...item,
                leaf: !item.hasChildren,
              };
            })
          );
        });
      };
    } else {
      this.treeOption.treeLoad = function (node, resolve) {
        const parentId = node.level === 0 ? 0 : node.data.id;
        getDeptLazyTree(parentId).then((res) => {
          resolve(
            res.data.data.map((item) => {
              return {
                ...item,
                leaf: !item.hasChildren,
              };
            })
          );
        });
      };
    }
  },
  mounted() {
    // 非保安单位模式默认加载管理组数据
@@ -1041,6 +1078,11 @@
    onLoad(page, params = {}) {
      this.loading = true;
      var deptid = this.deptids == null ? this.treeDeptId : this.deptids;
      //公安局进入
      if (this.userInfo.role_name == "公安管理员") {
        params["jurisdiction"] = this.userInfo.jurisdiction;
      }
      getList(
        page.currentPage,
        page.pageSize,