From cb1f69717eed3b6a61b6c61a8934bac752782b2d Mon Sep 17 00:00:00 2001 From: wwl <xchao828@163.com> Date: 星期三, 05 三月 2025 17:00:38 +0800 Subject: [PATCH] 1 --- src/views/reservation/reservations/index.vue | 78 ++++++++++++++++++++++++++++++++++++-- 1 files changed, 73 insertions(+), 5 deletions(-) diff --git a/src/views/reservation/reservations/index.vue b/src/views/reservation/reservations/index.vue index 8b72ef7..5d3052d 100644 --- a/src/views/reservation/reservations/index.vue +++ b/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(); +}); + } + }); }, -- Gitblit v1.8.0