From fd338a4272404e6b9d1f0c12abd70d284e9de217 Mon Sep 17 00:00:00 2001
From: qx <1084500556@qq.com>
Date: 星期一, 10 二月 2025 17:13:22 +0800
Subject: [PATCH] qx

---
 src/views/reservation/reservations/index.vue |   60 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++--
 1 files changed, 58 insertions(+), 2 deletions(-)

diff --git a/src/views/reservation/reservations/index.vue b/src/views/reservation/reservations/index.vue
index 8b72ef7..15c4e48 100644
--- a/src/views/reservation/reservations/index.vue
+++ b/src/views/reservation/reservations/index.vue
@@ -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,
       // 鏌ヨ鍙傛暟
@@ -2694,7 +2696,6 @@
         this.open2 = false;
         this.$modal.msgSuccess("绛惧埌鎴愬姛");
         if (res.file) {
-          
           let base64 = res.file;
           this.base64ToBlob({
             b64data: base64,
@@ -2708,6 +2709,61 @@
               this.url = window.webkitURL.createObjectURL(res.preview);
             }
           });
+        }else{
+          let _this = this;
+        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()
         }
       });
     },

--
Gitblit v1.8.0