林火综合应急信息管理系统前端
guoshilong
2023-03-13 9ecc792eb82c7a94f35ea7f2056567202c6efbff
src/views/system/user.vue
@@ -180,7 +180,6 @@
  import {exportBlob} from "@/api/common";
  import {getDeptTree, getDeptLazyTree} from "@/api/system/dept";
  import {getRoleTree} from "@/api/system/role";
  import {getPostList} from "@/api/system/post";
  import {mapGetters} from "vuex";
  import website from '@/config/website';
  import {getToken} from '@/util/auth';
@@ -285,10 +284,33 @@
              display: false
            },
            {
              label: "所属角色",
              prop: "roleId",
              search:true,
              searchOrder:1,
              searchSpan:3,
              multiple: true,
              type: "tree",
              dicData: [],
              props: {
                label: "title"
              },
              checkStrictly: true,
              slot: true,
              hide:true,
              rules: [{
                required: true,
                message: "请选择所属角色",
                trigger: "click"
              }],
              display: false
            },
            {
              label: "用户名",
              prop: "account",
              search: true,
              searchSpan:4,
              searchOrder:10,
              display: false
            },
            {
@@ -296,10 +318,11 @@
              prop: "realName",
              search: true,
              searchSpan:4,
              searchOrder:9,
              display: false
            },
            {
              label: "用户性别",
              label: "性别",
              prop: "sex",
              type: "select",
              dicData: [
@@ -323,12 +346,46 @@
              prop: "phone",
              search: true,
              searchSpan:4,
              searchOrder:8,
              display: false,
            },
            {
              label: "所属单位",
              prop: "deptName",
              slot: true,
              display: false
            },
            {
              label: "所属单位",
              prop: "deptId",
              search: true,
              searchSpan:3,
              searchOrder:7,
              type: "tree",
              // multiple: true,
              dicData: [],
              props: {
                label: "title",
                value:'id'
              },
              checkStrictly: true,
              slot: true,
              rules: [{
                required: true,
                message: "请选择所属单位",
                trigger: "click"
              }],
              display: false
            },
            {
              label: "启用状态",
              prop: "status",
              type: "select",
              dicUrl: '/api/blade-system/dict-biz/dictionary?code=user_status',
              props: {
                label: "dictValue",
                value: "dictKey"
              },
              display: false
            },
          ],
@@ -405,7 +462,7 @@
                  overHidden: true
                },
                {
                  label: "用户性别",
                  label: "性别",
                  prop: "sex",
                  type: "select",
                  dicData: [
@@ -453,7 +510,7 @@
                  label: "所属角色",
                  prop: "roleId",
                  search:true,
                  multiple: true,
                  multiple: false,
                  type: "tree",
                  dicData: [],
                  props: {
@@ -685,15 +742,19 @@
        getRoleTree(tenantId).then(res => {
          const column = this.findObject(this.option.group, "roleId");
          column.dicData = res.data.data;
          const columnRole = this.findObject(this.option.column, "roleId");
          columnRole.dicData = res.data.data;
        });
        getDeptTree(tenantId).then(res => {
          const column = this.findObject(this.option.group, "deptId");
          column.dicData = res.data.data;
          const columnDept = this.findObject(this.option.column, "deptId");
          columnDept.dicData = res.data.data;
        });
        getPostList(tenantId).then(res => {
          const column = this.findObject(this.option.group, "postId");
          column.dicData = res.data.data;
        });
        // getPostList(tenantId).then(res => {
        //   const column = this.findObject(this.option.group, "postId");
        //   column.dicData = res.data.data;
        // });
      },
      submitRole() {
        const roleList = this.$refs.treeRole.getCheckedKeys().join(",");
@@ -707,9 +768,9 @@
        });
      },
      rowSave(row, done, loading) {
        row.deptId = row.deptId.join(",");
        row.roleId = row.roleId.join(",");
        row.postId = row.postId.join(",");
        // row.deptId = row.deptId.join(",");
        // row.roleId = row.roleId.join(",");
        // row.postId = row.postId.join(",");
        add(row).then(() => {
          this.initFlag = false;
          this.onLoad(this.page);
@@ -724,9 +785,9 @@
        });
      },
      rowUpdate(row, index, done, loading) {
        row.deptId = row.deptId.join(",");
        row.roleId = row.roleId.join(",");
        row.postId = row.postId.join(",");
        // row.deptId = row.deptId.join(",");
        // row.roleId = row.roleId.join(",");
        // row.postId = row.postId.join(",");
        update(row).then(() => {
          this.initFlag = false;
          this.onLoad(this.page);
@@ -888,15 +949,16 @@
        if (["edit", "view"].includes(type)) {
          getUser(this.form.id).then(res => {
            this.form = res.data.data;
            if(this.form.hasOwnProperty("deptId")){
              this.form.deptId = this.form.deptId.split(",");
            }
            if(this.form.hasOwnProperty("roleId")){
              this.form.roleId = this.form.roleId.split(",");
            }
            if(this.form.hasOwnProperty("postId")){
              this.form.postId = this.form.postId.split(",");
            }
            //设置为多选时打开
            // if(this.form.hasOwnProperty("deptId")){
            //   this.form.deptId = this.form.deptId.split(",");
            // }
            // if(this.form.hasOwnProperty("roleId")){
            //   this.form.roleId = this.form.roleId.split(",");
            // }
            // if(this.form.hasOwnProperty("postId")){
            //   this.form.postId = this.form.postId.split(",");
            // }
          });
        }
        this.initFlag = true;
@@ -913,14 +975,22 @@
      },
      onLoad(page, params = {}) {
        this.loading = true;
        if (this.query.deptId){
          this.treeDeptId = this.query.deptId
        }
        getList(page.currentPage, page.pageSize, Object.assign(params, this.query), this.treeDeptId).then(res => {
          const data = res.data.data;
          this.page.total = data.total;
          this.data = data.records;
          this.data.forEach(e=>{
            e.status = e.status + ""
          })
          this.loading = false;
          this.selectionClear();
        });
      },
      //下面的方法业务都不需要
      platformRowUpdate(row, index, done, loading) {
        updatePlatform(row.id, row.userType, row.userExt).then(() => {
          this.platformOnLoad(this.platformPage);