Administrator
2021-08-14 e83ecb7c6d0ab7662518389092e82fb252bc658f
src/views/securityGuard/securityGuard.vue
@@ -247,6 +247,7 @@
  update,
  updatePlatform,
  add,
  securitySave,
  grant,
  resetPassword,
  getUserPractitionersInfo,
@@ -254,12 +255,13 @@
} from "@/api/system/user";
import { getList } from "@/api/securityGuard/securityGuard";
import { getDeptLazyTree } from "@/api/system/dept";
import { getRoleTree } from "@/api/system/role";
import { getRoleTree,getRoleDetail } from "@/api/system/role";
import { getPostList } from "@/api/system/post";
import { mapGetters } from "vuex";
import website from "@/config/website";
import { getToken } from "@/util/auth";
import { securityFormPageColumn } from "./data";
import { mapState } from 'vuex';
export default {
  data() {
@@ -280,6 +282,7 @@
      }
    };
    return {
      securityid:"",
      excelBox1: false,
      excelForm1: {},
      excelOption1: {
@@ -404,7 +407,6 @@
                  value: "id",
                },
                // disabled: true,
                span: 24,
                rules: [
                  {
                    required: true,
@@ -462,6 +464,10 @@
                ],
              },
              {
                label: "昵称",
                prop: "name",
              },
              {
                label: "个人照片",
                type: "upload",
                listType: "picture-img",
@@ -479,14 +485,12 @@
                row: true,
                prop: "myPicture",
              },
              {
                label: "编号",
                prop: "code",
              },
              {
                label: "昵称",
                prop: "name",
              },
              // {
              //   label: "编号",
              //   prop: "code",
              // },
              {
                label: "所属辖区",
                prop: "jurisdiction",
@@ -501,49 +505,49 @@
                slot: true,
                rules: [
                  {
                    required: true,
                    required: false,
                    message: "请选择所属辖区",
                    trigger: "click",
                  },
                ],
              },
              {
                label: "所属角色",
                prop: "roleId",
                multiple: true,
                type: "tree",
                dicData: [],
                props: {
                  label: "title",
                },
                checkStrictly: true,
                slot: true,
                rules: [
                  {
                    required: true,
                    message: "请选择所属角色",
                    trigger: "click",
                  },
                ],
              },
              {
                label: "所属岗位",
                prop: "postId",
                type: "tree",
                multiple: true,
                dicData: [],
                props: {
                  label: "postName",
                  value: "id",
                },
                rules: [
                  {
                    required: false,
                    message: "请选择所属岗位",
                    trigger: "click",
                  },
                ],
              },
              // {
              //   label: "所属角色",
              //   prop: "roleId",
              //   multiple: true,
              //   type: "tree",
              //   dicData: [],
              //   props: {
              //     label: "title",
              //   },
              //   checkStrictly: true,
              //   slot: true,
              //   rules: [
              //     {
              //       required: true,
              //       message: "请选择所属角色",
              //       trigger: "click",
              //     },
              //   ],
              // },
              // {
              //   label: "所属岗位",
              //   prop: "postId",
              //   type: "tree",
              //   multiple: true,
              //   dicData: [],
              //   props: {
              //     label: "postName",
              //     value: "id",
              //   },
              //   rules: [
              //     {
              //       required: false,
              //       message: "请选择所属岗位",
              //       trigger: "click",
              //     },
              //   ],
              // },
              {
                label: "是否持证",
                prop: "hold",
@@ -917,12 +921,29 @@
      });
      return ids.join(",");
    },
    ...mapState({
            userInfo: state => state.user.userInfo
        })
  },
  mounted() {
    this.option.column[0].hide = true
    // 非保安单位模式默认加载管理组数据
    if (!website.tenantMode) {
      this.initData(website.tenantId);
    }
    //获取当前登录人员的角色信息
    var roleIds = this.userInfo.role_id.split(",");
    roleIds.forEach(roleId =>{
        getRoleDetail(roleId).then((res) => {
          var roleAlias = res.data.data.roleAlias;
          if(roleAlias=="保安公司管理员" || roleAlias=="保安" || roleAlias=="未持证保安"){
              const column = this.findObject(this.option.column, "deptId");
              column.search = false;
          }
        })
    })
  },
  methods: {
    handleImport1() {
@@ -1003,26 +1024,43 @@
          userPractitionersList.push(info);
        });
      }
      var IdCardNo = row.id;
      add(row).then(
        () => {
          const experience = {
            securityid: IdCardNo,
      const user = {
          account: row.account,
          address: row.address,
          birthday: row.birthday,
          cardid: row.cardid,
          deptId: row.deptId,
          education: row.education,
          email: row.email,
          height: row.height,
          hold: row.hold,
          jurisdiction: row.jurisdiction,
          myPicture: row.myPicture,
          name:row.name,
          nation:row.nation,
          nativeplace:row.nativeplace,
          password: row.password,
          password2:row.password2,
          phone: row.phone,
          politicaloutlook:row.politicaloutlook,
          realName: row.realName,
          registered:row.registered,
          rtime: row.rtime,
          securitynumber:row.securitynumber,
          sex: row.sex
      }
      const userMap = {
            user: user,
            userPractitionersInfo: userPractitionersList,
          };
          //新增从业信息
          saveOrUpdateUserPractitionersInfo(experience).then(() => {
            this.$message({
              type: "success",
              message: "操作成功!",
            });
      securitySave(userMap).then(
        () => {
          this.$message({
            type: "success",
            message: "操作成功!",
          });
          this.initFlag = false;
          this.onLoad(this.page);
          // this.$message({
          //   type: "success",
          //   message: "操作成功!",
          // });
          done();
        },
        (error) => {
@@ -1257,10 +1295,22 @@
      };
      values = {
        ...params,
        deptId: this.deptId,
        roleId: this.roleId,
        roleAlias:"111",
        ...this.query,
      };
      //获取当前登录人员的角色信息
      var roleIds = this.userInfo.role_id.split(",");
      roleIds.forEach(roleId =>{
          getRoleDetail(roleId).then((res) => {
            var roleAlias = res.data.data.roleAlias;
            if(roleAlias=="保安公司管理员"){
                values["deptId"] = this.userInfo.dept_id;
            }
          })
      })
      if (this.userInfo.role_id == "1414840172333842433") {
        console.log("是公安add jurisdiction");
        values["jurisdiction"] = this.userInfo.jurisdiction;