From 1d24a0047b8043c85d5c27720a6f672bbc4d7238 Mon Sep 17 00:00:00 2001
From: yyb <995253665@qq.com>
Date: 星期二, 21 四月 2026 16:31:52 +0800
Subject: [PATCH] 新增保养项目字段至设备管理表单和详情页,优化设备信息展示
---
src/pages/equipmentManagement/upkeep/add.vue | 31 +++++++++++++++++++++----------
1 files changed, 21 insertions(+), 10 deletions(-)
diff --git a/src/pages/equipmentManagement/upkeep/add.vue b/src/pages/equipmentManagement/upkeep/add.vue
index fbdf304..c89e05a 100644
--- a/src/pages/equipmentManagement/upkeep/add.vue
+++ b/src/pages/equipmentManagement/upkeep/add.vue
@@ -41,6 +41,14 @@
</template>
</u-form-item>
+ <u-form-item label="淇濆吇椤圭洰" prop="maintenanceLocation" border-bottom>
+ <u-input
+ v-model="form.maintenanceLocation"
+ placeholder="璇疯緭鍏ヤ繚鍏婚」鐩�"
+ clearable
+ />
+ </u-form-item>
+
<!-- 鎻愪氦鎸夐挳 -->
<view class="footer-btns">
<u-button class="cancel-btn" @click="goBack">鍙栨秷</u-button>
@@ -122,6 +130,7 @@
deviceLedgerId: undefined, // 璁惧ID
deviceModel: undefined, // 瑙勬牸鍨嬪彿
maintenancePlanTime: dayjs().format("YYYY-MM-DD"), // 璁″垝淇濆吇鏃ユ湡
+ maintenanceLocation: undefined, // 淇濆吇椤圭洰
});
// 鍔犺浇璁惧鍒楄〃
@@ -144,6 +153,7 @@
form.value.deviceLedgerId = data.deviceLedgerId;
form.value.deviceModel = data.deviceModel;
form.value.maintenancePlanTime = dayjs(data.maintenancePlanTime).format("YYYY-MM-DD");
+ form.value.maintenanceLocation = data.maintenanceLocation;
// 璁剧疆璁惧鍚嶇О鏄剧ず
const device = deviceOptions.value.find(item => item.id === data.deviceLedgerId);
if (device) {
@@ -187,24 +197,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) {
// 鎵惧埌鍖归厤鐨勮澶囷紝鑷姩濉厖
--
Gitblit v1.9.3