From 099353bbe598d3df2279ced1a5a43ae883886d8c Mon Sep 17 00:00:00 2001
From: spring <2396852758@qq.com>
Date: 星期一, 24 十一月 2025 09:58:15 +0800
Subject: [PATCH] fix: 巡检扫码bug

---
 src/pages/routingInspection/index.vue |   20 ++++++++++++++------
 1 files changed, 14 insertions(+), 6 deletions(-)

diff --git a/src/pages/routingInspection/index.vue b/src/pages/routingInspection/index.vue
index ddad4be..dfb5a90 100644
--- a/src/pages/routingInspection/index.vue
+++ b/src/pages/routingInspection/index.vue
@@ -32,6 +32,8 @@
       </wd-tab>
     </wd-tabs>
     <wd-toast />
+    <!-- 鎵爜缁勪欢 -->
+    <Scan ref="scanRef" emit-name="scanIndex" />
   </view>
 </template>
 
@@ -44,6 +46,7 @@
 import { useToast } from "wot-design-uni";
 import RoutingInspectionApi from "@/api/routingInspection/routingInspection";
 import { useScanCode } from "@/composables/useScanCode";
+import Scan from "@/components/scan/index.vue";
 
 const userStore = useUserStore();
 const userInfo: any = computed(() => userStore.userInfo);
@@ -52,6 +55,7 @@
 const patrolList = ref<any[]>([]); // 宸℃璁惧鍒楄〃鏁版嵁
 const searchKeyword = ref<string>(""); // 鎼滅储鍏抽敭璇嶏紙鐝粍鍚嶇О锛�
 const searchKey = ref<number>(0); // 鐢ㄤ簬寮哄埗鍒锋柊鍒楄〃
+const scanRef = ref(); // 鎵爜缁勪欢寮曠敤
 
 // 浣跨敤鎵爜绠$悊 composable锛堝叏灞�鐩戝惉鍣紝涓嶉殢椤甸潰鍒囨崲鍏抽棴锛�
 const { deviceUid, deviceModel, hasScanned, displayText, loadFromCache, enableListener } =
@@ -76,12 +80,16 @@
 };
 
 const openScan = () => {
-  console.log("index.vue - 鐐瑰嚮鎵爜鎸夐挳锛堝叏灞�鎵爜妯″紡锛屾棤闇�鎵嬪姩瑙﹀彂锛�");
-  // 鍏ㄥ眬鎵爜妯″紡涓嬶紝纭欢鎵爜浼氳嚜鍔ㄨЕ鍙戯紝鏃犻渶鎵嬪姩璋冪敤
-  uni.showToast({
-    title: "璇蜂娇鐢ㄦ壂鐮佹灙鎵弿",
-    icon: "none",
-  });
+  console.log("index.vue - 鐐瑰嚮鎵爜鎸夐挳锛岃Е鍙戞壂鐮�");
+  // 瑙﹀彂鎵爜
+  if (scanRef.value) {
+    scanRef.value.triggerScan();
+  } else {
+    uni.showToast({
+      title: "鎵爜缁勪欢鏈垵濮嬪寲",
+      icon: "none",
+    });
+  }
 };
 
 // 鑾峰彇宸℃璁惧鍒楄〃

--
Gitblit v1.9.3