优化物料编码无需点击
This commit is contained in:
@@ -57,8 +57,9 @@
|
|||||||
<div class="form-item">
|
<div class="form-item">
|
||||||
<a-form-item label="物料编码">
|
<a-form-item label="物料编码">
|
||||||
<a-input
|
<a-input
|
||||||
|
ref="materialCodeInput"
|
||||||
v-model="formData.inputMaterialCode"
|
v-model="formData.inputMaterialCode"
|
||||||
placeholder="请点击此处确保光标闪烁,并使用扫码枪扫描物料编码"
|
placeholder="请点击此处确保光标闪烁,且输入法为英文状态,使用扫码枪扫描物料编码"
|
||||||
@keydown="handleKeyDown"
|
@keydown="handleKeyDown"
|
||||||
@input="handleMaterialCodeChange"
|
@input="handleMaterialCodeChange"
|
||||||
/>
|
/>
|
||||||
@@ -73,7 +74,7 @@
|
|||||||
<div class="camera-section">
|
<div class="camera-section">
|
||||||
<!-- 图片展示 -->
|
<!-- 图片展示 -->
|
||||||
<div class="image-placeholder square-image">
|
<div class="image-placeholder square-image">
|
||||||
<img
|
<img
|
||||||
:src="imgData.imgUrl"
|
:src="imgData.imgUrl"
|
||||||
alt="图片展示"
|
alt="图片展示"
|
||||||
style="width: 100%; height: 100%; object-fit: cover; border-radius: 4px;"
|
style="width: 100%; height: 100%; object-fit: cover; border-radius: 4px;"
|
||||||
@@ -309,6 +310,8 @@ const cameraStatus = ref<'connected' | 'connecting' | 'disconnected' | 'error'>(
|
|||||||
|
|
||||||
// 视频元素引用
|
// 视频元素引用
|
||||||
const cameraVideo = ref<HTMLVideoElement | null>(null)
|
const cameraVideo = ref<HTMLVideoElement | null>(null)
|
||||||
|
// 物料编码输入框引用
|
||||||
|
const materialCodeInput = ref<any>(null)
|
||||||
|
|
||||||
// FLV播放器实例
|
// FLV播放器实例
|
||||||
let player: any = null
|
let player: any = null
|
||||||
@@ -546,12 +549,19 @@ let imageRefreshTimer: any = null
|
|||||||
// 组件挂载时
|
// 组件挂载时
|
||||||
onMounted(async () => {
|
onMounted(async () => {
|
||||||
await loadFlvJs()
|
await loadFlvJs()
|
||||||
|
|
||||||
// 启动图片自动刷新,每秒更新一次
|
// 启动图片自动刷新,每秒更新一次
|
||||||
imageRefreshTimer = setInterval(() => {
|
imageRefreshTimer = setInterval(() => {
|
||||||
// 添加时间戳参数,避免浏览器缓存
|
// 添加时间戳参数,避免浏览器缓存
|
||||||
imgData.imgUrl = `${imgData.baseUrl}?t=${Date.now()}`
|
imgData.imgUrl = `${imgData.baseUrl}?t=${Date.now()}`
|
||||||
}, 1000)
|
}, 1000)
|
||||||
|
|
||||||
|
// 页面加载后自动聚焦到物料编码输入框
|
||||||
|
nextTick(() => {
|
||||||
|
if (materialCodeInput.value) {
|
||||||
|
materialCodeInput.value.focus()
|
||||||
|
}
|
||||||
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
// 组件卸载时
|
// 组件卸载时
|
||||||
@@ -714,7 +724,7 @@ const handleKeyDown = (event: KeyboardEvent) => {
|
|||||||
isScanning = true
|
isScanning = true
|
||||||
// }
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
// 更新上次输入时间
|
// 更新上次输入时间
|
||||||
lastInputTime = currentTime
|
lastInputTime = currentTime
|
||||||
}
|
}
|
||||||
@@ -872,6 +882,13 @@ const handleBackToFirst = () => {
|
|||||||
|
|
||||||
// 离开称重页面时关闭WebSocket连接
|
// 离开称重页面时关闭WebSocket连接
|
||||||
closeWebSocket()
|
closeWebSocket()
|
||||||
|
|
||||||
|
// 回到第一步后自动聚焦到物料编码输入框
|
||||||
|
nextTick(() => {
|
||||||
|
if (materialCodeInput.value) {
|
||||||
|
materialCodeInput.value.focus()
|
||||||
|
}
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
// 计算重量
|
// 计算重量
|
||||||
|
|||||||
Reference in New Issue
Block a user