liuyg
2021-12-25 ef46e4b78e81418a831d4f7f21eb24d2fd4d35e1
src/views/securityGuard/securityGuard.vue
@@ -33,6 +33,7 @@
          @row-update="rowUpdate"
          :before-open="beforeOpen"
          :page.sync="page"
          @sort-change="sortChange"
          @search-change="searchChange"
          @search-reset="searchReset"
          @selection-change="selectionChange"
@@ -40,6 +41,7 @@
          @size-change="sizeChange"
          @refresh-change="refreshChange"
          @on-load="onLoad"
          :upload-before="uploadBefore"
          :defaults.sync="defaults"
          :before-close="beforeClose"
        >
@@ -427,31 +429,26 @@
  remove,
  update,
  updatePlatform,
  add,
  securitySave,
  grant,
  resetPassword,
  getUserPractitionersInfo,
  updatePaperTime,
  saveOrUpdateUserPractitionersInfo,
  getzhiwen, //指纹
} from "@/api/system/user";
import { securityApply } from "@/api/accreditationRecords/accreditationRecords";
import { getList } from "@/api/securityGuard/securityGuard";
import { getDeptLazyTree } from "@/api/system/dept";
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";
import Qs from "qs";
import { MessageBox } from "element-ui";
//加载指纹类
import Client from "./Client";
import doneVue from "../work/done.vue";
// import func from "vue-editor-bridge";
export default {
  data() {
@@ -605,6 +602,8 @@
      }
    };
    return {
      sort: "",
      sortName: "",
      nowCell: "", //空为手动,2为身份证设备读取
      // 表格数据
      defaults: {},
@@ -775,7 +774,7 @@
        align: "center",
        index: true,
        delBtnText: "注销",
        menuWidth: 327,
        menuWidth: 280,
        selection: true,
        viewBtn: true,
        defaultExpandAll: true,
@@ -919,10 +918,10 @@
                },
                canvasOption: {
                  text: " ",
                  ratio: 0.1,
                  ratio: 1.0,
                },
                action: "/api/blade-resource/oss/endpoint/put-files",
                tip: "上传身份证一寸近期彩色正面免冠图象, (358像素(宽) × 441像素(高)、分辨率350dpi)且不超过500kb",
                tip: "上传近期一寸彩色正面免冠图象, (358像素(宽) × 441像素(高)、分辨率350dpi)且不小于30kb,不超过500kb",
                span: 12,
                // row: true,
                prop: "avatar",
@@ -989,7 +988,7 @@
                rules: [
                  {
                    required: true,
                    message: "请选择",
                    message: "请选择是否有持证",
                    trigger: "blur",
                  },
                ],
@@ -998,6 +997,12 @@
                label: "保安员证编号",
                prop: "securitynumber",
                hide: true,
                display:true,
                rules: [{
                    required: false,
                    message: "请输入保安员证编号",
                    trigger: "blur",
                  }],
              },
              // {
              //   label: "发证日期",
@@ -1008,8 +1013,21 @@
              //   valueFormat: "yyyy-MM-dd",
              // },
              {
                label: "电子邮箱",
                label: "保安证书照片",
                prop: "email",
                type: "upload",
                listType: "picture-img",
                propsHttp: {
                  res: "data",
                  url: "url",
                },
                canvasOption: {
                  text: " ",
                  ratio: 1.0,
                },
                action: "/api/blade-resource/oss/endpoint/put-files",
                tip: "上传jpg,png格式图片,大小不超过2M",
                span: 12,
              },
              // {
              //     label: "籍贯",
@@ -1288,6 +1306,32 @@
        this.initData(this.form.tenantId);
      }
    },
    "form.hold":{
      handler(val){
        var securitynumbercolumn =this.findObject(this.option.group,'securitynumber')
        // console.log(val,1234);
        if(val==1){
          securitynumbercolumn.display=true;
          securitynumbercolumn.rules=[
                  {
                    required: true,
                    message: "请输入保安员证编号",
                    trigger: "blur",
                  }
          ];
        }else{
          securitynumbercolumn.display=false;
          securitynumbercolumn.rules=[
                  {
                    required: false,
                    message: "请输入保安员证编号",
                    trigger: "blur",
                  }
          ];
        }
      },
      immediate: true
    },
    "form.fingerprint"() {
      let that = this;
      if (this.form.fingerprint != undefined) {
@@ -1305,9 +1349,7 @@
            isoks: isoks,
          });
        }
        setTimeout(() => {
          // if()
        var doZhiwen = () => {
          if (!this.form.id) {
            sets(false);
            return;
@@ -1328,7 +1370,16 @@
              }
            }
          });
        }, 1800);
        };
        setTimeout(() => {
          // var iframeDom = document.getElementById("zhiwen");
          //   console.log(iframeDom,111111);
          //   iframeDom.onload = function () {
          //     doZhiwen();
          //   };
          doZhiwen();
        }, 2800);
      } else {
        that.isopen = false;
      }
@@ -1802,7 +1853,7 @@
          return securityApply(data);
        })
        .then(() => {
          // this.$refs.crud.toggleSelection();
          this.$refs.crud.toggleSelection();
          this.$message({
            type: "success",
            message: "操作成功!",
@@ -1840,7 +1891,7 @@
          return securityApply(data);
        })
        .then(() => {
          // this.$refs.crud.toggleSelection();
          this.$refs.crud.toggleSelection();
          this.$message({
            type: "success",
            message: "操作成功!",
@@ -1870,6 +1921,9 @@
          status: this.search.status,
          userType: this.search.startTime,
          examinationType: this.search.examinationType,
          dispatch: this.search.dispatch,
          isFingerprint: this.search.isFingerprint,
          isAvatar: this.search.isAvatar,
        };
        // console.log(data,123456);
        //导出
@@ -2099,6 +2153,8 @@
    },
    selectionClear() {
      // this.selectionList = [];
      this.sort = "";
      this.sortName = "";
      // this.$refs.crud.toggleSelection();
    },
    handleDelete() {
@@ -2398,6 +2454,28 @@
    refreshChange() {
      this.onLoad(this.page, this.query);
    },
    //排序
    sortChange(value) {
      // console.log(value, 51151515);
      if (value.order == "ascending") {
        this.sort = "asc";
      }
      if (value.order == "descending") {
        this.sort = "desc";
      }
      this.sortName = value.prop;
      //字段匹配
      if (value.prop == "sexs") {
        this.sortName = "sex";
      }
      if (value.prop == "examinationType") {
        this.sortName = "examination_type";
      }
      if (value.prop == "userType") {
        this.sortName = "user_type";
      }
      this.onLoad(this.page, this.query);
    },
    onLoad(page, params = {}) {
      params = this.search;
      var that = this;
@@ -2473,6 +2551,13 @@
            );
            ColumnDeptUpdate1.dicUrl =
              "/api/blade-system/dept/security_lazy-tree";
          }
          if (this.sort) {
            params["sort"] = this.sort;
          }
          if (this.sortName) {
            params["sortName"] = this.sortName;
          }
          let values = {
@@ -2568,6 +2653,29 @@
        this.selectionClear();
      });
    },
    //照片上传拦截
    uploadBefore(file, done, loading, column) {
      //如果你想修改file文件,由于上传的file是只读文件,必须复制新的file才可以修改名字,完后赋值到done函数里,如果不修改的话直接写done()即可
      if (file.type.indexOf("image/") == -1) {
        MessageBox.alert(
          "上传图片格式错误,请上传图片类型,如:JPG,PNG后缀的文件。"
        );
        loading();
        return false;
      }
      let data = window.URL.createObjectURL(new Blob([file]));
      this.filename = file;
      this.option.img = data;
      //判断文件大小
      const isLt1M = file.size >= 30 * 1024 && file.size <= 500 * 1024;
      if (!isLt1M) {
        MessageBox.alert("上传图片大小必须大于30KB,且小于500KB!");
        loading();
        return false;
      }
      done();
      return isLt1M;
    },
  },
};
</script>