From a200ad7315650f12fe5067b88607e15d93a109bd Mon Sep 17 00:00:00 2001
From: chenyao <1219716595@qq.com>
Date: Fri, 12 Dec 2025 10:48:27 +0800
Subject: [PATCH] Merge branch 'master' into feature/v8.0/8.0.3

---
 src/subPackages/taskDetail/execution/index.vue |    5 +++--
 src/hooks/useGlobalWS.js                       |   30 +++++++++++++++++++++++++++++-
 src/pages/inspectionTask/index.vue             |    2 +-
 3 files changed, 33 insertions(+), 4 deletions(-)

diff --git a/src/hooks/useGlobalWS.js b/src/hooks/useGlobalWS.js
index 303727c..eee6a81 100644
--- a/src/hooks/useGlobalWS.js
+++ b/src/hooks/useGlobalWS.js
@@ -15,7 +15,6 @@
 
 	// 消息处理
 	function messageHandler(payload) {
-    console.log(payload, '767')
 		switch (payload.biz_code) {
 			case 'JOB_ISREFRESH':
         appStore.setJobUpdateKeyAdd()
@@ -70,7 +69,36 @@
 		socketTask.onMessage((result) => {
 			messageHandler(JSON.parse(result.data))
 		})
+    //==================================
+    // 监听连接打开
+    socketTask.onOpen((res) => {
+      console.log('✅ WebSocket连接已建立')
+      // reconnectAttempts = 0 // 连接成功后重置重连次数
+      // 可以在这里发送心跳或订阅消息
+      // startHeartbeat()
+    })
+    // 监听连接关闭
+    socketTask.onClose((res) => {
+      console.log(`WebSocket连接关闭,代码: ${res.code}, 原因: ${res.reason}`)
+
+      // 根据不同的关闭代码处理
+      if (res.code === 1000) { // 正常关闭
+        console.log('连接正常关闭')
+      } else if (res.code === 1006) { // 异常关闭
+        console.log('连接异常关闭,尝试重连...')
+      } else if (res.code === 1011) { // 服务器内部错误
+        console.log('服务器内部错误(1011),延迟重连...')
+      } else {
+        console.log('其他原因关闭,尝试重连...')
+      }
+    })
+
+    // 监听错误
+    socketTask.onError((err) => {
+      console.error('WebSocket发生错误:', err)
+    })
 	}
 
+
 	watch(access_token, initWS, {immediate: true})
 }
diff --git a/src/pages/inspectionTask/index.vue b/src/pages/inspectionTask/index.vue
index 63ef01b..b367621 100644
--- a/src/pages/inspectionTask/index.vue
+++ b/src/pages/inspectionTask/index.vue
@@ -33,7 +33,7 @@
       });
     } else {
       uni.navigateTo({
-        url: `/subPackages/taskDetail/execution/index?wayLineJodInfoId=${data.rowItem.id}`
+        url: `/subPackages/taskDetail/execution/index?wayLineJodInfoId=${data.rowItem.id}&waylineJobId=${data.rowItem.wayline_job_id}&batch_no=${data.rowItem.batch_no}`
       });
     }
   }
diff --git a/src/subPackages/taskDetail/execution/index.vue b/src/subPackages/taskDetail/execution/index.vue
index 212e5d4..41d5b69 100644
--- a/src/subPackages/taskDetail/execution/index.vue
+++ b/src/subPackages/taskDetail/execution/index.vue
@@ -39,7 +39,7 @@
 
 onLoad((options) => {
   wayLineJodInfoId.value = options.wayLineJodInfoId
-  viewUrl.value = getWebViewUrl('/execution', {wayLineJodInfoId: wayLineJodInfoId.value})
+  viewUrl.value = getWebViewUrl('/execution', {wayLineJodInfoId: wayLineJodInfoId.value, waylineJobId: options.waylineJobId, batch_no: options.batch_no})
 })
 const isApp = ref(false)
 onShow(() => {
@@ -47,7 +47,8 @@
 });
 
 onHide(() => {
-  isApp.value = false
+  // 如果工单详情返回任务详情,那么tab栏对应的是关联事件一项
+  // isApp.value = false
 });
 </script>
 

--
Gitblit v1.9.3