1
wwl
2025-03-05 cb1f69717eed3b6a61b6c61a8934bac752782b2d
src/views/reservation/reservations/index.vue
@@ -1137,7 +1137,7 @@
        </el-form-item>
      </el-form>
      <div slot="footer" class="dialog-footer2">
        <el-button type="primary" @click="submitType">确 定</el-button>
        <el-button type="primary" @click="submitType"  >确 定</el-button>
        <el-button @click="cancel">取 消</el-button>
      </div>
    </el-dialog>
@@ -1856,7 +1856,7 @@
import { addComp,
  addPlOrderAndDetail } from "@/api/system/comp";
import Big from "big.js";
import { Loading } from 'element-ui';
import {
  listReservation,
  gettjCancel,
@@ -1921,6 +1921,7 @@
      },
      discount: 10,
      taocan: false,
      webSocket: null,
      defaultKeys: [],
      value1: "",
      pacName: "",
@@ -1933,7 +1934,7 @@
      url: "",
      open2: false,
      forms: {
        tjCategory:null
        tjCategory:"12"
      },
      dialogVisible: false,
      /** 照相机弹窗模块-start */
@@ -2127,6 +2128,7 @@
      reservationList: [],
      // 弹出层标题
      title: "",
      valueUrls: "ws://127.0.0.1:6789/websocket",
      drawer: false,
      drawer1: false,
      // 查询参数
@@ -2686,15 +2688,17 @@
      // this.selectList.forEach((item) => {
      //   cusIds.push(item.idCard);
      // });
      let loadingInstance1 = Loading.service({ fullscreen: true,text:"签到中" });
      let data = {
        cusIds: this.cusIds,
        tjCategory: this.forms.tjCategory,
      };
      this.open2 = false;
      addPlOrderAndDetail(data).then((res) => {
        this.open2 = false;
        if(res.code == 200){
          this.open2 = false;
        this.$modal.msgSuccess("签到成功");
        if (res.file) {
          let base64 = res.file;
          this.base64ToBlob({
            b64data: base64,
@@ -2708,7 +2712,71 @@
              this.url = window.webkitURL.createObjectURL(res.preview);
            }
          });
        }else{
          let _this = this;
          this.$nextTick(() => { // 以服务的方式调用的 Loading 需要异步关闭
            loadingInstance1.close();
});
        var websocket = null;
        var url = _this.valueUrls;
        if ("WebSocket" in window) {
          websocket = new WebSocket(url);
        } else if ("MozWebSocket" in window) {
          websocket = new MozWebSocket(url);
        } else {
        }
        if (websocket == null) {
          alert("11111");
        }
        websocket.onopen = function () {
          try {
            // 连接设备
            var jsonObjs = {
              type: 4,
              data: res,
            };
            var jStrs = JSON.stringify(jsonObjs);
            websocket.send(jStrs);
          } catch (err) {
            var tryTime = 0;
            // 重试10次,每次之间间隔3秒
            if (tryTime < 1) {
              var t1 = setTimeout(function () {
                tryTime++;
                var jsonObjs = {
                  type: 4,
                  data: res,
                };
                var jStrs = JSON.stringify(jsonObjs);
                websocket.send(jStrs);
              }, 1 * 1000);
            } else {
              console.error("重连失败.");
            }
          }
        };
        websocket.onclose = function () {
          alert("连接关闭");
        };
        websocket.onmessage = function (event) {
          var resultObj = JSON.parse(event.data);
          _this.cardreader = false;
        };
        //连接发生错误的回调方法
        websocket.onerror = function () {
          alert("请检查连接是否正常");
        };
          this.getList()
        }
        }else{
          this.$nextTick(() => { // 以服务的方式调用的 Loading 需要异步关闭
            loadingInstance1.close();
});
        }
      });
    },