lkk
2024-10-24 db8f49a69a6f4e5e91ddc337b7c87d782997c974
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>
@@ -1381,7 +1401,8 @@
  getByTjNum,
} from "@/api/hosp/customer";
import { getPrintSetUp } from "@/api/system/examcharge";
import axios from "axios";
import { getIp } from "@/utils/auth";
import {
  deptTreeSelect,
  projectGetList,
@@ -1398,6 +1419,7 @@
  getIsRequired,
  getconfigKey,
  getHistryTjOrderProByCusIdCard,
  readCertCardInfos,
} from "@/api/system/tijian";
import Packages from "@/components/Packages";
import { MessageBox } from "element-ui";
@@ -1439,11 +1461,13 @@
      proIdList: [],
      tableDatas: [],
      dialogVisiblese: false,
      cardreaderradio: 3,
      lishi: false,
      table: false,
      HistoryList: {},
      index: 0,
      names: "",
      inputSSS: "",
      dictType: [
        {
          value: 0,
@@ -1549,6 +1573,7 @@
      ids: [],
      // 非单个禁用
      single: true,
      cardreader: false,
      // 非多个禁用
      multiple: true,
      nodeobj: {},
@@ -1591,6 +1616,8 @@
        pacRemark: null,
      },
      valueUrl: "ws://127.0.0.1:18890",
      valueUrls: "ws://127.0.0.1:6789/websocket",
      // valueUrls: "ws://"+getIp() +":6789/websocket",
      WebSocket: null,
      // 身份证需要
      // socket: null,
@@ -1655,11 +1682,11 @@
  },
  created() {
    this.getCurrentDateTime();
    this.startTimer();
    this.getList1();
    // this.getData();
  },
  methods: {
    getCurrentDateTime() {
      const currentDate = new Date();
@@ -2350,9 +2377,257 @@
              this.$refs.aaa.open = true;
              this.$refs.aaa.getAllList();
              this.$refs.aaa.title = "证件字典";
            } else if (res.msg == "S") {
              this.cardreader = true;
              _this.cardreaderradio = 3;
              _this.inputSSS = "";
              // let url = window.location.protocol + "//" + window.location.host;
              // console.log(url);
              // axios
              //   .get("http://localhost:81/dev-api/readCertCardInfos")
              //   .then((res) => {
              //     console.log(res);
              //   })
              //   .catch((err) => {
              //     console.log(err);
              //   });
              // readCertCardInfos().then((res) => {
              //   _this.form.cusName = res.data.name;
              //       _this.form.cusSex =
              //       res.data.sex;
              //       _this.form.cusNational = res.data.mz;
              //       _this.form.cusBrithday = res.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 = res.data.addres;
              //       _this.form.cusIdcard = res.data.card;
              // });
            }
          }
        });
      }
    },
    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.cusIdcard = resultObj.data.card;
          if (_this.form.cusIdcard) {
            const reg =
              /^[1-9]\d{5}(18|19|([23]\d))\d{2}((0[1-9])|(10|11|12))(([0-2][1-9])|10|20|30|31)\d{3}[0-9Xx]$/;
            if (reg.test(_this.form.cusIdcard)) {
              var org_birthday = _this.form.cusIdcard.substring(6, 14);
              var birthday =
                org_birthday.substring(0, 4) +
                "-" +
                org_birthday.substring(4, 6) +
                "-" +
                org_birthday.substring(6, 8);
              var birthdays = new Date(birthday.replace(/-/g, "-"));
              let d = new Date();
              let age =
                d.getFullYear() -
                birthdays.getFullYear() -
                (d.getMonth() < birthdays.getMonth() ||
                (d.getMonth() == birthdays.getMonth() &&
                  d.getDate() < birthdays.getDate())
                  ? 1
                  : 0);
              _this.form.age = age;
            }
          }
          _this.form.cusAddr = resultObj.data.addres;
          _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;
          if( resultObj.data.nation == "汉族"){
            _this.form.cusNational ="1";
          }
          if(resultObj.data.gender == "男"){
            _this.form.cusSex = 0;
          }else{
            _this.form.cusSex = 1;
          }
          _this.form.cusBrithday = resultObj.data.birthday;
          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;
          if (_this.form.cusIdcard) {
            const reg =
              /^[1-9]\d{5}(18|19|([23]\d))\d{2}((0[1-9])|(10|11|12))(([0-2][1-9])|10|20|30|31)\d{3}[0-9Xx]$/;
            if (reg.test(_this.form.cusIdcard)) {
              var org_birthday = _this.form.cusIdcard.substring(6, 14);
              var birthday =
                org_birthday.substring(0, 4) +
                "-" +
                org_birthday.substring(4, 6) +
                "-" +
                org_birthday.substring(6, 8);
              var birthdays = new Date(birthday.replace(/-/g, "-"));
              let d = new Date();
              let age =
                d.getFullYear() -
                birthdays.getFullYear() -
                (d.getMonth() < birthdays.getMonth() ||
                (d.getMonth() == birthdays.getMonth() &&
                  d.getDate() < birthdays.getDate())
                  ? 1
                  : 0);
              _this.form.age = age;
            }
          }
          _this.cardreader = false;
        };
        //连接发生错误的回调方法
        websocket.onerror = function () {
          alert("请检查读卡器连接是否正常");
        };
      }
    },
@@ -2549,8 +2824,6 @@
    // 点击多选框获取选中数据
    handleSelectionChange(selection, row) {
      this.tableData = selection;
      console.log(this.tableData);
      console.log(this.tableData1);
      if (selection.length > 1) {
        let del_row = selection.shift();
        this.$refs.tb.toggleRowSelection(del_row, false); //设置这一行取消选中
@@ -2561,7 +2834,8 @@
        this.tableData.forEach((item) => {
          this.tableData1.forEach((item1) => {
            item.tjProjectList.forEach((item2) => {
              if (item2.proId == item1.proPrantId) {
              console.log(item1);
              if (item2.proId == item1.proPrantId && item1.pacName == "单项") {
                this.$confirm(
                  "该套餐包含了已选单项,是否确认选择该套餐?",
                  "确认信息",
@@ -2573,14 +2847,14 @@
                )
                  .then(() => {
                    this.$message({
                        type: "success",
                        message: "请注意查看价格",
                      });
                      type: "success",
                      message: "请注意查看价格",
                    });
                  })
                  .catch((action) => {
                    if (action === "cancel") {
                      let del_row = selection.shift();
                      this.$refs.tb.toggleRowSelection(del_row, false);
                      this.$refs.tb.toggleRowSelection(del_row, false);
                      this.$message({
                        type: "warning",
                        message: "已取消",
@@ -2633,39 +2907,41 @@
    handleClick(tab, event) {
      if (this.activeNames == "second") {
        this.DataList = [];
        this.checkedkey = [];
        this.getDataList();
      } else if (this.activeNames == "third") {
        this.DataLists = [];
        this.checkedkeys = [];
        getZhList().then((response) => {
          if (response.data) {
            this.packageList = response.data;
            this.checkedkeys.push(this.packageList[0].id);
            let datas = {
              zhId: this.packageList[0].id,
            };
            getlistByZhId(datas).then((res) => {
              this.packagedataList = res.data.tjProjectList;
              for (var i = 0; i < this.packagedataList.length; i++) {
                let proId = this.packagedataList[i].proId;
                getProSonDxList(proId).then((res) => {
                  this.TreedataList = res.data.list;
                  this.TreedataList.forEach((item) => {
                    this.DataLists.push(item);
                    if (this.DataLists.length >= 1) {
                      this.marryalls = 0;
                      this.DataLists.forEach((item1) => {
                        this.marryalls += item1.proPrice;
                        this.packagedataList.forEach((item3) => {
                          if (item1.proParentId == item3.proId) {
                            item1.propinName = item3.proName;
                          }
                        });
                      });
                    }
                  });
                });
              }
            });
            // this.checkedkeys.push(this.packageList[0].id);
            // let datas = {
            //   zhId: this.packageList[0].id,
            // };
            // getlistByZhId(datas).then((res) => {
            //   this.packagedataList = res.data.tjProjectList;
            //   for (var i = 0; i < this.packagedataList.length; i++) {
            //     let proId = this.packagedataList[i].proId;
            //     getProSonDxList(proId).then((res) => {
            //       this.TreedataList = res.data.list;
            //       this.TreedataList.forEach((item) => {
            //         this.DataLists.push(item);
            //         if (this.DataLists.length >= 1) {
            //           this.marryalls = 0;
            //           this.DataLists.forEach((item1) => {
            //             this.marryalls += item1.proPrice;
            //             this.packagedataList.forEach((item3) => {
            //               if (item1.proParentId == item3.proId) {
            //                 item1.propinName = item3.proName;
            //               }
            //             });
            //           });
            //         }
            //       });
            //     });
            //   }
            // });
          }
          this.loading = false;
        });
@@ -2701,27 +2977,27 @@
        //     });
        //   });
        // }
        this.checkedkey.push(this.Treedata[0].proId);
        let proId = this.Treedata[0].proId;
        getProSonDxList(proId).then((res) => {
          this.TreedataList = res.data.list;
          this.TreedataList.forEach((item) => {
            this.checkedListkey.push(item.proId);
            this.DataList.push(item);
            this.DataList.forEach((item) => {
              item.propinName = this.Treedata[0].proName;
            });
          });
          this.TotalPrice1 = 0;
          this.marryall = 0;
          if (this.DataList.length != 0) {
            this.list1 = false;
            this.DataList.forEach((item) => {
              this.TotalPrice1 = item.proPrice + this.TotalPrice1;
              this.marryall += item.proPrice;
            });
          }
        });
        // this.checkedkey.push(this.Treedata[0].proId);
        // let proId = this.Treedata[0].proId;
        // getProSonDxList(proId).then((res) => {
        //   this.TreedataList = res.data.list;
        //   this.TreedataList.forEach((item) => {
        //     this.checkedListkey.push(item.proId);
        //     this.DataList.push(item);
        //     this.DataList.forEach((item) => {
        //       item.propinName = this.Treedata[0].proName;
        //     });
        //   });
        //   this.TotalPrice1 = 0;
        //   this.marryall = 0;
        //   if (this.DataList.length != 0) {
        //     this.list1 = false;
        //     this.DataList.forEach((item) => {
        //       this.TotalPrice1 = item.proPrice + this.TotalPrice1;
        //       this.marryall += item.proPrice;
        //     });
        //   }
        // });
        this.loading = false;
      });
    },
@@ -3414,11 +3690,17 @@
  width: 100%;
  display: flex;
}
.tab3 {
  max-height: 400px;
  border: 1px solid #dcdfe6;
}
.filter-tree {
  /* max-height: 360px;
  overflow-y: auto;
  border: 1px solid #d9d9d9;
  border: 1px solid #d9d9d9; */
  overflow: auto;
  flex: 1;
  height: 350px;
}
.tab2 {