Administrator
2021-08-11 92d0cf73df170131eba84490d875bc954eb7a708
src/views/securityGuard/securityGuard.vue
@@ -1,5 +1,5 @@
<template>
  <el-row>
  <el-row class="securityGuard">
    <el-col :span="0" style="display: none">
      <div class="box">
        <el-scrollbar>
@@ -38,6 +38,14 @@
          @on-load="onLoad"
        >
          <template slot="menuLeft">
            <el-button
              type="success"
              size="small"
              plain
              icon="el-icon-upload2"
              @click="handleImport1"
              >批量导入
            </el-button>
            <el-button
              type="danger"
              style="display: none"
@@ -208,6 +216,24 @@
            </template>
          </avue-crud>
        </el-dialog>
        <el-dialog
          title="保安员导入"
          append-to-body
          :visible.sync="excelBox1"
          width="555px"
        >
          <avue-form
            :option="excelOption1"
            v-model="excelForm1"
            :upload-after="uploadAfter1"
          >
            <template slot="excelTemplate">
              <el-button type="primary" @click="handleTemplate1">
                点击下载<i class="el-icon-download el-icon--right"></i>
              </el-button>
            </template>
          </avue-form>
        </el-dialog>
      </basic-container>
    </el-col>
  </el-row>
@@ -227,7 +253,7 @@
  saveOrUpdateUserPractitionersInfo,
} from "@/api/system/user";
import { getList } from "@/api/securityGuard/securityGuard";
import { getDeptTree, getDeptLazyTree } from "@/api/system/dept";
import { getDeptLazyTree } from "@/api/system/dept";
import { getRoleTree } from "@/api/system/role";
import { getPostList } from "@/api/system/post";
import { mapGetters } from "vuex";
@@ -254,6 +280,34 @@
      }
    };
    return {
      excelBox1: false,
      excelForm1: {},
      excelOption1: {
        submitBtn: false,
        emptyBtn: false,
        column: [
          {
            label: "文件上传",
            prop: "excelFile",
            type: "upload",
            drag: true,
            loadText: "文件上传中,请稍等",
            span: 24,
            propsHttp: {
              res: "data",
            },
            tip: "请上传 .xls,.xlsx 标准格式文件",
            action: "/api/examSubjectChoices/import-examSubject",
          },
          {
            label: "模板下载",
            prop: "excelTemplate",
            formslot: true,
            span: 24,
          },
        ],
      },
      form: {},
      search: {},
      roleBox: false,
@@ -269,6 +323,8 @@
        currentPage: 1,
        total: 0,
      },
      roleId: "1412226235153731586",
      deptId: "1413470343230877697",
      platformPage: {
        pageSize: 10,
        currentPage: 1,
@@ -320,10 +376,12 @@
        searchMenuSpan: 6,
        border: false,
        stripe: true,
        align: "center",
        index: true,
        delBtnText: "注销",
        selection: true,
        viewBtn: true,
        defaultExpandAll: true,
        //dialogType: 'drawer',
        dialogClickModal: false,
        column: securityFormPageColumn,
@@ -335,11 +393,12 @@
            icon: "el-icon-user-solid",
            column: [
              {
                label: "所属组织机构",
                label: "所属保安公司",
                prop: "deptId",
                type: "tree",
                // dicUrl: "/api/blade-system/dept/security_lazy-tree?parentId=1413470343230877697",
                dicUrl: "/api/blade-system/dept/lazy-tree?parentId=0",
                dicUrl:
                  "/api/blade-system/dept/security_lazy-tree?parentId=1413470343230877697",
                // dicUrl: "/api/blade-system/dept/lazy-tree?parentId=0",
                props: {
                  label: "title",
                  value: "id",
@@ -349,7 +408,7 @@
                rules: [
                  {
                    required: true,
                    message: "请选择组织机构",
                    message: "请选择保安公司",
                    trigger: "blur",
                  },
                ],
@@ -387,12 +446,12 @@
                ],
              },
              {
                label: "用户姓名",
                label: "姓名",
                prop: "realName",
                rules: [
                  {
                    required: true,
                    message: "请输入用户姓名",
                    message: "请输入姓名",
                    trigger: "blur",
                  },
                  {
@@ -403,15 +462,33 @@
                ],
              },
              {
                label: "用户编号",
                label: "个人照片",
                type: "upload",
                listType: "picture-img",
                propsHttp: {
                  res: "data",
                  url: "link",
                },
                canvasOption: {
                  text: " ",
                  ratio: 0.1,
                },
                action: "/api/blade-resource/oss/endpoint/put-file",
                tip: "只能上传jpg/png个人头像,且不超过500kb",
                span: 12,
                row: true,
                prop: "myPicture",
              },
              {
                label: "编号",
                prop: "code",
              },
              {
                label: "用户昵称",
                label: "昵称",
                prop: "name",
              },
              {
                label: "所属行政区",
                label: "所属辖区",
                prop: "jurisdiction",
                // multiple: true,
                type: "tree",
@@ -425,7 +502,7 @@
                rules: [
                  {
                    required: true,
                    message: "请选择所属行政区",
                    message: "请选择所属辖区",
                    trigger: "click",
                  },
                ],
@@ -466,6 +543,28 @@
                    trigger: "click",
                  },
                ],
              },
              {
                label: "是否持证",
                prop: "hold",
                dicUrl: "/api/blade-system/dict-biz/dictionary?code=equipage",
                props: {
                  label: "dictValue",
                  value: "dictKey",
                },
                type: "select",
                rules: [
                  {
                    required: true,
                    message: "请选择",
                    trigger: "blur",
                  },
                ],
              },
              {
                label: "保安员证编号",
                prop: "securitynumber",
                hide: true,
              },
              {
                label: "手机号码",
@@ -541,7 +640,7 @@
                valueFormat: "yyyy-MM-dd",
              },
              {
                label: "用户性别",
                label: "性别",
                prop: "sex",
                type: "select",
                slot: true,
@@ -561,9 +660,11 @@
                ],
              },
              {
                label: "用户生日",
                label: "生日",
                type: "date",
                prop: "birthday",
                format: "yyyy-MM-dd",
                valueFormat: "yyyy-MM-dd",
              },
            ],
          },
@@ -677,19 +778,19 @@
            display: false,
          },
          {
            label: "用户姓名",
            label: "姓名",
            prop: "realName",
            search: true,
            display: false,
          },
          {
            label: "用户平台",
            label: "平台",
            prop: "userTypeName",
            slot: true,
            display: false,
          },
          {
            label: "用户平台",
            label: "平台",
            type: "select",
            dicUrl: "/api/blade-system/dict/dictionary?code=user_type",
            props: {
@@ -704,13 +805,13 @@
            rules: [
              {
                required: true,
                message: "请选择用户平台",
                message: "请选择平台",
                trigger: "blur",
              },
            ],
          },
          {
            label: "用户拓展",
            label: "拓展",
            prop: "userExt",
            type: "textarea",
            minRows: 8,
@@ -824,6 +925,19 @@
    }
  },
  methods: {
    handleImport1() {
      this.excelBox1 = true;
    },
    uploadAfter1(res, done, loading, column) {
      window.console.log(column);
      this.excelBox1 = false;
      // this.refreshChange();
      done();
    },
    handleTemplate1() {
      window.open(`/api/examSubjectChoices/export-template`);
    },
    //行点击事件
    rowClick(row) {
      this.$router.push({
@@ -841,10 +955,10 @@
        const column = this.findObject(this.option.group, "roleId");
        column.dicData = res.data.data;
      });
      getDeptTree(tenantId).then((res) => {
        const column = this.findObject(this.option.group, "deptId");
        column.dicData = res.data.data;
      });
      // getDeptTree(tenantId).then((res) => {
      //   const column = this.findObject(this.option.group, "deptId");
      //   column.dicData = res.data.data;
      // });
      getPostList(tenantId).then((res) => {
        const column = this.findObject(this.option.group, "postId");
        column.dicData = res.data.data;
@@ -882,18 +996,18 @@
            entryTime: item.entryTime,
            name: row.realName,
            leaving: item.leaving,
            cardid: row.cardid,
            securityid: row.id,
            post: item.post,
            responsibilities: item.responsibilities,
          };
          userPractitionersList.push(info);
        });
      }
      var IdCardNo = row.cardid;
      var IdCardNo = row.id;
      add(row).then(
        () => {
          const experience = {
            cardid: IdCardNo,
            securityid: IdCardNo,
            userPractitionersInfo: userPractitionersList,
          };
          //新增从业信息
@@ -932,20 +1046,20 @@
            entryTime: item.entryTime,
            name: row.realName,
            leaving: item.leaving,
            cardid: row.cardid,
            securityid: row.id,
            post: item.post,
            responsibilities: item.responsibilities,
          };
          userPractitionersList.push(info);
        });
      }
      var IdCardNo = row.cardid;
      var IdCardNo = row.id;
      //值替换,education 放在页面会卡死
      row.education = row.education1;
      update(row).then(
        () => {
          const experience = {
            cardid: IdCardNo,
            securityid: IdCardNo,
            userPractitionersInfo: userPractitionersList,
          };
          //更新从业信息
@@ -970,7 +1084,7 @@
      );
    },
    rowDel(row) {
      this.$confirm("确定将选择用户登记离职?", {
      this.$confirm("确定将选择保安登记离职?", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning",
@@ -1010,7 +1124,7 @@
        this.$message.warning("请选择至少一条数据");
        return;
      }
      this.$confirm("确定将选择用户注销?", {
      this.$confirm("确定将选择保安注销?", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning",
@@ -1075,7 +1189,7 @@
      done();
    },
    handleExport() {
      this.$confirm("是否导出用户数据?", "提示", {
      this.$confirm("是否导出保安数据?", "提示", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning",
@@ -1120,7 +1234,7 @@
          }
          var userInfo = res.data.data;
          //获取用户从业信息
          getUserPractitionersInfo(userInfo.cardid).then((res1) => {
          getUserPractitionersInfo(userInfo.id).then((res1) => {
            that.form.UserPractitionersInfo = res1.data.data;
          });
        });
@@ -1143,8 +1257,14 @@
      };
      values = {
        ...params,
        deptId: this.deptId,
        roleId: this.roleId,
        ...this.query,
      };
      if (this.userInfo.role_id == "1414840172333842433") {
        console.log("是公安add jurisdiction");
        values["jurisdiction"] = this.userInfo.jurisdiction;
      }
      this.loading = true;
      getList(page.currentPage, page.pageSize, values, this.treeDeptId).then(
        (res) => {