From 372a1b35ec2c0b59208255e0f1d7998eb54a81d5 Mon Sep 17 00:00:00 2001
From: gyq <875626088@qq.com>
Date: Fri, 27 Mar 2026 09:32:02 +0800
Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E4=BC=98=E5=8C=96=E6=8D=A2?=
=?UTF-8?q?=E6=A1=8C=E5=8A=9F=E8=83=BD?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
src/store/modules/carts.ts | 12 +-
src/utils/websocket.ts | 29 ++--
.../tool/Instead/components/carts/list.vue | 2 +-
.../Instead/components/popup-rottable.vue | 19 ++-
src/views/tool/Instead/index.vue | 129 ++++--------------
5 files changed, 68 insertions(+), 123 deletions(-)
diff --git a/src/store/modules/carts.ts b/src/store/modules/carts.ts
index b7ec6cc..d820769 100644
--- a/src/store/modules/carts.ts
+++ b/src/store/modules/carts.ts
@@ -670,11 +670,13 @@ export const useCartsStore = defineStore("carts", () => {
}
function rotTable(newVal: string | number, cart_id = []) {
- sendMessage('rottable', {
- new_table_code: newVal,
- table_code: table_code.value,
- cart_id
- });
+ if (cart_id.length) {
+ sendMessage('rottable', {
+ new_table_code: newVal,
+ table_code: table_code.value,
+ cart_id
+ });
+ }
}
function del(data: any) {
diff --git a/src/utils/websocket.ts b/src/utils/websocket.ts
index 408ee57..c5158f4 100644
--- a/src/utils/websocket.ts
+++ b/src/utils/websocket.ts
@@ -3,6 +3,7 @@ import { useUserStoreHook } from "@/store";
import { ElMessage, ElMessageBox } from "element-plus";
const user = useUserStoreHook();
+let isTips = false
export interface ApifoxModel {
account: string;
@@ -143,6 +144,7 @@ class WebSocketManager {
this.autoConnect = false;
}
}
+
// 自动重连机制
private reconnect() {
if (!this.autoConnect) {
@@ -156,19 +158,24 @@ class WebSocketManager {
}, this.reconnectDelay);
} else {
clearTimeout(this.reconnectTimer);
- console.error("达到最大重连次数,停止重连");
- ElMessageBox.confirm('达到最大重连次数' + this.maxReconnectAttempts + '次,已停止重连,是否立即重连?', '提示', {
- confirmButtonText: '确定',
- cancelButtonText: '取消',
+ // window.location.reload();
+ // console.error("达到最大重连次数,停止重连");
+ if (!isTips) {
+ ElMessageBox.confirm('达到最大重连次数' + this.maxReconnectAttempts + '次,已停止重连,是否立即重连?', '提示', {
+ confirmButtonText: '确定',
+ cancelButtonText: '取消',
- callback: (action: string) => {
- console.log(action);
- if (action == 'confirm') {
- this.setupWebSocket();
- this.reconnectAttempts = 0;
+ callback: (action: string) => {
+ console.log(action);
+ if (action == 'confirm') {
+ isTips = false
+ this.setupWebSocket();
+ this.reconnectAttempts = 0;
+ }
}
- }
- });
+ });
+ }
+ isTips = true
}
}
diff --git a/src/views/tool/Instead/components/carts/list.vue b/src/views/tool/Instead/components/carts/list.vue
index 041c37d..f04bb43 100644
--- a/src/views/tool/Instead/components/carts/list.vue
+++ b/src/views/tool/Instead/components/carts/list.vue
@@ -27,7 +27,7 @@