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 () => {