qinxianzhangyao
2024-07-08 53b7cfd8589201ec728c68a08b4ea07d94e66258
src/views/system/tijian/index.vue
@@ -1320,6 +1320,31 @@
        </el-table>
      </div>
    </el-dialog>
    <el-dialog
      title="提示"
      :visible.sync="cardreader"
      width="30%"
      :close-on-press-escape="false"
      :close-on-click-modal="false"
    >
      <template>
        <el-radio-group v-model="cardreaderradio" @input="changeradio">
          <el-radio :label="3">身份证</el-radio>
          <el-radio :label="6">健康码</el-radio>
        </el-radio-group>
        <div style="margin-top: 10px" v-show="cardreaderradio == 6">
          <el-input
            v-model="inputSSS"
            ref="tableHeadFilterInp"
            placeholder="请输入内容"
          ></el-input>
        </div>
      </template>
      <span slot="footer" class="dialog-footer">
        <el-button @click="cardreader = false">取 消</el-button>
        <el-button type="primary" @click="cardreadercopes">确 定</el-button>
      </span>
    </el-dialog>
    <div style="position: absolute; bottom: 100px; width: 360px; display: none">
      <div
        id="printBill"
@@ -1355,12 +1380,7 @@
      </span> -->
    <!-- </el-dialog> -->
    <historyTj :cusIdCard="form.cusIdcard" ref="historyTj"></historyTj>
    <el-dialog
      title="提示"
      :visible.sync="dialogVisiblese"
      width="30%"
      :before-close="handleClose"
    >
    <el-dialog title="提示" :visible.sync="dialogVisiblese" width="30%">
      <span>是否复制最近一次的体检项目?</span>
      <span slot="footer" class="dialog-footer">
        <el-button @click="dialogVisiblese = false">取 消</el-button>
@@ -1382,7 +1402,7 @@
} from "@/api/hosp/customer";
import { getPrintSetUp } from "@/api/system/examcharge";
import axios from "axios";
import { getIp } from '@/utils/auth'
import { getIp } from "@/utils/auth";
import {
  deptTreeSelect,
  projectGetList,
@@ -1441,11 +1461,13 @@
      proIdList: [],
      tableDatas: [],
      dialogVisiblese: false,
      cardreaderradio: 3,
      lishi: false,
      table: false,
      HistoryList: {},
      index: 0,
      names: "",
      inputSSS: "",
      dictType: [
        {
          value: 0,
@@ -1551,6 +1573,7 @@
      ids: [],
      // 非单个禁用
      single: true,
      cardreader: false,
      // 非多个禁用
      multiple: true,
      nodeobj: {},
@@ -1663,7 +1686,6 @@
    this.getList1();
    // this.getData();
  },
  methods: {
    getCurrentDateTime() {
@@ -2356,64 +2378,9 @@
              this.$refs.aaa.getAllList();
              this.$refs.aaa.title = "证件字典";
            } else if (res.msg == "S") {
              var websocket = null;
              var url = this.valueUrls;
              // var url = 'ws://'+ getIp() +':6789/websocket'
              console.log(url)
              if ("WebSocket" in window) {
                websocket = new WebSocket(url);
              } else if ("MozWebSocket" in window) {
                websocket = new MozWebSocket(url);
              } else {
                // console.log("SockJS");
              }
              if (websocket == null) {
                alert("11111");
              }
              websocket.onopen = function () {
                try {
                websocket.send("发送");
              } catch (err) {
                var tryTime = 0;
                // 重试10次,每次之间间隔3秒
                if (tryTime < 1) {
                  var t1 = setTimeout(function () {
                    tryTime++;
                websocket.send("发送");
                  }, 1 * 1000);
                } else {
                  console.error("重连失败.");
                }
              }
              };
              websocket.onclose = function () {
                alert("读卡器连接关闭");
              };
              websocket.onmessage = function (event) {
                var resultObj =JSON.parse(event.data);
               _this.form.cusName = resultObj.data.name;
                    _this.form.cusSex =
                    resultObj.data.sex;
                    _this.form.cusNational =resultObj.data.mz;
                    _this.form.cusBrithday = resultObj.data.csrq;
                    if (_this.form.cusBrithday) {
                      _this.form.cusBrithday = _this.form.cusBrithday.replace(
                        /^(\d{4})(\d{2})(\d{2})$/,
                        "$1-$2-$3"
                      );
                    }
                    _this.form.cusAddr = resultObj.data.addres;
                    _this.form.cusIdcard = resultObj.data.card;
              };
              //连接发生错误的回调方法
              websocket.onerror = function () {
                alert("请检查读卡器连接是否正常");
              };
              this.cardreader = true;
              _this.cardreaderradio = 3;
              _this.inputSSS = "";
              // let url = window.location.protocol + "//" + window.location.host;
              // console.log(url);
              // axios
@@ -2445,6 +2412,166 @@
        });
      }
    },
    changeradio() {
      if (this.cardreaderradio != 3) {
        this.$nextTick(() => {
          this.$refs.tableHeadFilterInp.focus();
        });
      }
    },
    cardreadercopes() {
      let _this = this;
      if (this.cardreaderradio == 3) {
        var websocket = null;
        var url = this.valueUrls;
        // var url = 'ws://'+ getIp() +':6789/websocket'
        if ("WebSocket" in window) {
          websocket = new WebSocket(url);
        } else if ("MozWebSocket" in window) {
          websocket = new MozWebSocket(url);
        } else {
          // console.log("SockJS");
        }
        if (websocket == null) {
          alert("11111");
        }
        websocket.onopen = function () {
          try {
            // 连接设备
            var jsonObjs = {
              type: 1,
              data: {},
            };
            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: 1,
                  data: {},
                };
                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.form.cusName = resultObj.data.name;
          _this.form.cusSex = resultObj.data.sex;
          _this.form.cusNational = resultObj.data.mz;
          _this.form.cusBrithday = resultObj.data.csrq;
          if (_this.form.cusBrithday) {
            _this.form.cusBrithday = _this.form.cusBrithday.replace(
              /^(\d{4})(\d{2})(\d{2})$/,
              "$1-$2-$3"
            );
          }
          _this.form.cusAddr = resultObj.data.addres;
          _this.form.cusIdcard = resultObj.data.card;
          _this.cardreader = false;
        };
        //连接发生错误的回调方法
        websocket.onerror = function () {
          alert("请检查读卡器连接是否正常");
        };
      } else {
        // if (_this.inputSSS.indexOf(":1") != -1) {
        //   var str1 = _this.inputSSS.indexOf(":1");
        //   var result1 = _this.inputSSS.substring(0, str1);
        //   var str2 = _this.inputSSS.indexOf(":1");
        //   var result2 = _this.inputSSS.substring(
        //     str2 + 2,
        //     _this.inputSSS.length
        //   );
        //   _this.inputSSS = result1 + result2;
        // }
        _this.inputSSS = _this.inputSSS.replace(":1","");
        var websocket = null;
        var url = this.valueUrls;
        // var url = 'ws://'+ getIp() +':6789/websocket'
        if ("WebSocket" in window) {
          websocket = new WebSocket(url);
        } else if ("MozWebSocket" in window) {
          websocket = new MozWebSocket(url);
        } else {
          // console.log("SockJS");
        }
        if (websocket == null) {
          alert("11111");
        }
        websocket.onopen = function () {
          try {
            // 连接设备
            var jsonObjs = {
              type: 2,
              data: {
                qrcode: _this.inputSSS,
              },
            };
            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: 2,
                  data: {
                    qrcode: _this.inputSSS,
                  },
                };
                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.form.cusName = resultObj.data.name;
          _this.form.cusSex = resultObj.data.gender;
          _this.form.cusNational = resultObj.data.nation;
          // _this.form.cusBrithday = resultObj.data.csrq;
          // if (_this.form.cusBrithday) {
          //   _this.form.cusBrithday = _this.form.cusBrithday.replace(
          //     /^(\d{4})(\d{2})(\d{2})$/,
          //     "$1-$2-$3"
          //   );
          // }
          _this.form.cusPhone = resultObj.data.phone;
          _this.form.cusIdcard = resultObj.data.idenno;
          _this.cardreader = false;
        };
        //连接发生错误的回调方法
        websocket.onerror = function () {
          alert("请检查读卡器连接是否正常");
        };
      }
    },
    handleChanges(param1) {
      if (this.form.pacCode == "不详") {