From 752b14d2caa47ccceac328f79389fbf5e2e62ce4 Mon Sep 17 00:00:00 2001
From: gaoluyang <2820782392@qq.com>
Date: 星期三, 24 九月 2025 15:18:39 +0800
Subject: [PATCH] 分析追溯
---
src/pages/equipmentManagement/repair/add.vue | 23 +++++++++++++----------
1 files changed, 13 insertions(+), 10 deletions(-)
diff --git a/src/pages/equipmentManagement/repair/add.vue b/src/pages/equipmentManagement/repair/add.vue
index 9f3cd0e..0940052 100644
--- a/src/pages/equipmentManagement/repair/add.vue
+++ b/src/pages/equipmentManagement/repair/add.vue
@@ -13,6 +13,7 @@
placeholder="璇烽�夋嫨璁惧鍚嶇О"
@click="showDevicePicker"
clearable
+ readonly=""
/>
<template #right>
<u-icon name="scan" @click="startScan" class="scan-icon" />
@@ -215,24 +216,26 @@
}
isScanning.value = true;
- showToast('鎵爜鎴愬姛锛�3绉掑悗鑷姩濉厖璁惧淇℃伅');
+ showToast('鎵爜鎴愬姛');
// 3绉掑悗澶勭悊鎵爜缁撴灉
scanTimer.value = setTimeout(() => {
processScanResult(scanResult);
isScanning.value = false;
- }, 3000);
+ }, 100);
};
+function getDeviceIdByRegExp(url) {
+ // 鍖归厤deviceId=鍚庨潰鐨勬暟瀛�
+ const reg = /deviceId=(\d+)/;
+ const match = url.match(reg);
+ // 濡傛灉鍖归厤鍒扮粨鏋滐紝杩斿洖鏁板瓧绫诲瀷锛屽惁鍒欒繑鍥瀗ull
+ return match ? Number(match[1]) : null;
+}
// 澶勭悊鎵爜缁撴灉骞跺尮閰嶈澶�
const processScanResult = (scanResult) => {
- // 鍦ㄨ澶囧垪琛ㄤ腑鏌ユ壘鍖归厤鐨勮澶�
- // 鍋囪浜岀淮鐮佸唴瀹规槸璁惧鍚嶇О鎴栬澶囩紪鍙�
- const matchedDevice = deviceOptions.value.find(device =>
- device.deviceName === scanResult ||
- device.deviceCode === scanResult ||
- device.id.toString() === scanResult
- );
+ const deviceId = getDeviceIdByRegExp(scanResult);
+ const matchedDevice = deviceOptions.value.find(item => item.id == deviceId);
if (matchedDevice) {
// 鎵惧埌鍖归厤鐨勮澶囷紝鑷姩濉厖
@@ -353,7 +356,7 @@
// 缂栬緫妯″紡锛岃幏鍙栬鎯�
loadForm(id);
// 鍙�夛細鑾峰彇鍚庢竻闄ゅ瓨鍌ㄧ殑id锛岄伩鍏嶅奖鍝嶅悗缁搷浣�
- // uni.removeStorageSync('repairId');
+ uni.removeStorageSync('repairId');
} else {
// 鏂板妯″紡
loadForm();
--
Gitblit v1.9.3