+
liuyg
2021-12-07 dd41acdbf309b303727de6f36efac12d535da61a
+
1 files modified
82 ■■■■ changed files
src/views/securityGuard/securityGuard.vue 82 ●●●● patch | view | raw | blame | history
src/views/securityGuard/securityGuard.vue
@@ -394,17 +394,26 @@
      </basic-container>
    </el-col>
    <div
      v-show="haveSEL == 'noDrive'"
      :class="[
        $store.state.control.windowWidth >= 1024
          ? 'downSFZqudong'
          : 'downSFZqudongS',
      ]"
    >
      <a
        href="http://223.82.109.183:2081/zhba/upload/20211201/64d8b76f3aecae93e18d015bbca89aba.rar"
        >未安装身份证驱动,点击下载</a
      <el-checkbox v-model="radio" :disabled="SFZloding"
        >使用身份证设备</el-checkbox
      >
      <el-button
        type="text"
        v-show="haveSEL == 'noDrive' || haveSEL == 'noEquipment'"
        @click="SFZopens"
        :loading="SFZloding"
        >{{ sfzButTitle }}</el-button
      >
      <!-- <div style="font-size: 14px">连接身份证设备失败</div> -->
      <!-- v-show="haveSEL == 'noDrive'" -->
      <!-- href="http://223.82.109.183:2081/zhba/upload/20211201/64d8b76f3aecae93e18d015bbca89aba.rar" -->
      <!-- <a href="javascript;">未安装身份证驱动,点击下载</a> -->
    </div>
  </el-row>
</template>
@@ -600,10 +609,13 @@
      // 表格数据
      defaults: {},
      // 身份证设备数据
      SFZloding: false,
      sfzButTitle: "",
      radio: false, //选择状态
      haveSEL: "", //设备状态
      cardShebei: "",
      intTime: "", //自动获取身份证;
      haveCardid: true, //读卡开关
      haveCardid: false, //读卡开关
      // 指纹数据
      isopen: false, //识别是否需要传指纹进去(解决异步传递后指纹DOM不存在的问题)
      zhiwenImg: "",
@@ -1248,6 +1260,19 @@
    };
  },
  watch: {
    radio() {
      if (this.radio) {
        this.SFZloding = true;
        this.olondSFZ();
      } else {
        if (this.haveSEL != "noDrive" && this.haveSEL != "noEquipment") {
          this.$message({
            type: "warning",
            message: "关闭身份证设备识别!",
          });
        }
      }
    },
    "form.tenantId"() {
      if (this.form.tenantId !== "" && this.initFlag) {
        this.initData(this.form.tenantId);
@@ -1407,7 +1432,7 @@
    this.deptIds = this.userInfo.dept_id;
    // this.beginzhiwen();
    this.olondSFZ(); //检查身份证设备是否存在
    // this.olondSFZ(); //检查身份证设备是否存在
  },
  methods: {
    openccc() {
@@ -2166,11 +2191,25 @@
        }
      }
    },
    SFZopens() {
      if (this.haveSEL == "noDrive") {
        let url =
          "http://223.82.109.183:2081/zhba/upload/20211201/64d8b76f3aecae93e18d015bbca89aba.rar";
        window.open(url, "_self");
      } else if (this.haveSEL == "noEquipment") {
        this.radio = true;
      }
    },
    olondSFZ() {
      // console.log(123456);
      var that = this;
      //   // 开始连接设备
      //   //调用对应的连接方法,并赋值给result
      let lodings = (val) => {
        setTimeout((res) => {
          that.SFZloding = val;
        }, 1000);
      };
      this.cardShebei = CertCtl.connect((res) => {
        let k = "";
        try {
@@ -2178,18 +2217,37 @@
        } catch (error) {
          k = res;
        }
        // console.log(k);
        // console.log(res);
        if (k == "") {
          that.haveSEL = "noDrive";
          console.log("连接身份证设备失败,请安装驱动");
          // console.log("连接身份证设备失败,请安装驱动");
          that.sfzButTitle = "未安装身份证驱动,点击下载";
          this.$message({
            type: "warning",
            message: "连接身份证设备失败,请重新连接设备!",
          });
          that.radio = false;
          lodings(false);
          return;
        }
        if (k.resultFlag == 0) {
          that.haveSEL = "connectionSucceeded";
          console.log("连接身份证设备成功");
          // console.log("连接身份证设备成功");
          this.$message({
            type: "success",
            message: "连接身份证设备成功!",
          });
          lodings(false);
        } else {
          that.haveSEL = "noEquipment";
          console.log("连接身份证设备失败,请重新连接设备");
          that.sfzButTitle = "连接身份证设备失败,请重试";
          // console.log("连接身份证设备失败,请重新连接设备!");
          this.$message({
            type: "warning",
            message: "连接身份证设备失败,请重新连接设备!",
          });
          that.radio = false;
          lodings(false);
        }
      });
    },
@@ -2245,7 +2303,7 @@
      }, 2000);
    },
    beginSFZ() {
      if (this.haveSEL == "connectionSucceeded") {
      if (this.haveSEL == "connectionSucceeded" && this.radio) {
        this.haveCardid = false;
        if (this.intTime) {
          clearInterval(this.intTime);
@@ -2253,6 +2311,8 @@
        } else {
          this.setIntervals();
        }
      } else {
        clearInterval(this.intTime);
      }
    },
    closeSFZ(val) {