From 8e153de91f55b07847225e23c3a9a8ab5d67e83e Mon Sep 17 00:00:00 2001
From: gaoluyang <2820782392@qq.com>
Date: 星期五, 26 九月 2025 13:21:50 +0800
Subject: [PATCH] 生产管控模块
---
src/pages/equipmentManagement/upkeep/add.vue | 38 +++++++++++++++++++-------------------
1 files changed, 19 insertions(+), 19 deletions(-)
diff --git a/src/pages/equipmentManagement/upkeep/add.vue b/src/pages/equipmentManagement/upkeep/add.vue
index c0e7e34..8dedb1b 100644
--- a/src/pages/equipmentManagement/upkeep/add.vue
+++ b/src/pages/equipmentManagement/upkeep/add.vue
@@ -187,24 +187,25 @@
}
isScanning.value = true;
- showToast('鎵爜鎴愬姛锛�3绉掑悗鑷姩濉厖璁惧淇℃伅');
+ showToast('鎵爜鎴愬姛');
// 3绉掑悗澶勭悊鎵爜缁撴灉
scanTimer.value = setTimeout(() => {
processScanResult(scanResult);
isScanning.value = false;
- }, 3000);
+ }, 1000);
};
-
+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) {
// 鎵惧埌鍖归厤鐨勮澶囷紝鑷姩濉厖
@@ -301,19 +302,20 @@
// 杩斿洖涓婁竴椤�
const goBack = () => {
+ // 娓呴櫎瀛樺偍鐨刬d
+ uni.removeStorageSync('repairId');
uni.navigateBack();
};
// 鑾峰彇椤甸潰鍙傛暟
const getPageParams = () => {
- const pages = getCurrentPages();
- const currentPage = pages[pages.length - 1];
- const options = currentPage.options;
+ // 浠庢湰鍦板瓨鍌ㄨ幏鍙杋d
+ const id = uni.getStorageSync('repairId');
// 鏍规嵁鏄惁鏈塱d鍙傛暟鏉ュ垽鏂槸鏂板杩樻槸缂栬緫
- if (options.id) {
+ if (id) {
// 缂栬緫妯″紡锛岃幏鍙栬鎯�
- loadForm(options.id);
+ loadForm(id);
} else {
// 鏂板妯″紡
loadForm();
@@ -322,10 +324,8 @@
// 鑾峰彇椤甸潰ID
const getPageId = () => {
- const pages = getCurrentPages();
- const currentPage = pages[pages.length - 1];
- const options = currentPage.options;
- return options.id;
+ // 浠庢湰鍦板瓨鍌ㄨ幏鍙杋d
+ return uni.getStorageSync('repairId');
};
</script>
--
Gitblit v1.9.3