From 5dad159c21a4b715fb5256400050205734dbd144 Mon Sep 17 00:00:00 2001
From: zhongwenkai <3478244299@qq.com>
Date: Tue, 16 Jun 2026 17:39:56 +0800
Subject: [PATCH] =?UTF-8?q?style:=20=E4=B8=8A=E6=A8=A1/=E4=B8=8B=E6=A8=A1?=
=?UTF-8?q?=E7=BA=A2=E5=A4=96=E6=89=AB=E7=A0=81=E8=BE=93=E5=85=A5=E6=A1=86?=
=?UTF-8?q?=20&=20=E5=8E=86=E5=8F=B2=E6=8C=89=E9=92=AE=E6=A0=B7=E5=BC=8F?=
=?UTF-8?q?=E7=BB=9F=E4=B8=80?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../pages/moldoperate/dismount.vue | 137 ++++++++++--------
.../pages/moldoperate/index.vue | 136 ++++++++++-------
2 files changed, 166 insertions(+), 107 deletions(-)
diff --git a/src/pages_function/pages/moldoperate/dismount.vue b/src/pages_function/pages/moldoperate/dismount.vue
index 8b11943..ceffcd5 100644
--- a/src/pages_function/pages/moldoperate/dismount.vue
+++ b/src/pages_function/pages/moldoperate/dismount.vue
@@ -4,24 +4,24 @@
-
- {{ t('moldPressureNet.history') }}
+
-
-
-
-
- {{ t('moldOperate.scanDevice') }}
+
+
-
-
-
{{ t('moldOperate.selectDevice') }}
@@ -254,6 +254,7 @@ const tempSelectedMoldId = ref(null)
// ---- 操作人与备注 ----
const remarkText = ref('')
const selectedOperator = ref(null)
+const scanCodeInput = ref('')
// ---- 工具函数 ----
function textValue(v) {
@@ -358,7 +359,30 @@ async function loadLowerMolds(deviceName) {
}
}
-// ---- 扫描设备码 ----
+// ---- 扫描/输入设备码 ----
+function matchDeviceByCode(code) {
+ if (!code) return null
+ let matched = null
+ if (code.toUpperCase().startsWith('EQUIPMENT-')) {
+ const idFromQr = code.replace(/EQUIPMENT-/i, '')
+ matched = deviceOptions.value.find((d) => String(d.raw.id) === idFromQr)
+ }
+ if (!matched) {
+ matched = deviceOptions.value.find((d) =>
+ Object.values(d.raw).some((v) =>
+ typeof v === 'string' && v.trim().toUpperCase() === code.toUpperCase()
+ ) || d.label.toUpperCase().includes(code.toUpperCase())
+ )
+ }
+ if (!matched) {
+ const idMatch = code.match(/(\d+)$/)
+ if (idMatch) {
+ matched = deviceOptions.value.find((d) => String(d.raw.id) === idMatch[1])
+ }
+ }
+ return matched
+}
+
function handleScan() {
uni.scanCode({
onlyFromCamera: false,
@@ -366,24 +390,8 @@ function handleScan() {
success(res) {
const code = (res.result || '').trim()
if (!code) return
- let matched = null
- if (code.toUpperCase().startsWith('EQUIPMENT-')) {
- const idFromQr = code.replace(/EQUIPMENT-/i, '')
- matched = deviceOptions.value.find((d) => String(d.raw.id) === idFromQr)
- }
- if (!matched) {
- matched = deviceOptions.value.find((d) =>
- Object.values(d.raw).some((v) =>
- typeof v === 'string' && v.trim().toUpperCase() === code.toUpperCase()
- ) || d.label.toUpperCase().includes(code.toUpperCase())
- )
- }
- if (!matched) {
- const idMatch = code.match(/(\d+)$/)
- if (idMatch) {
- matched = deviceOptions.value.find((d) => String(d.raw.id) === idMatch[1])
- }
- }
+ scanCodeInput.value = code
+ const matched = matchDeviceByCode(code)
if (matched) {
selectDevice(matched.raw)
} else {
@@ -398,6 +406,17 @@ function handleScan() {
})
}
+function onScanInputConfirm() {
+ const code = scanCodeInput.value.trim()
+ if (!code) return
+ const matched = matchDeviceByCode(code)
+ if (matched) {
+ selectDevice(matched.raw)
+ } else {
+ uni.showToast({ title: t('moldOperate.deviceNotFound'), icon: 'none' })
+ }
+}
+
// ---- 设备选择 ----
function selectDevice(device) {
selectedDevice.value = device || {}
@@ -543,21 +562,16 @@ onShow(async () => {