OCR入库

This commit is contained in:
bb_pan 2025-09-06 12:36:25 +08:00
parent 3dbf5081d7
commit 34a39391b3
2 changed files with 12 additions and 2 deletions

View File

@ -89,6 +89,7 @@ export default {
} catch (error) {
console.error('关闭相机出错:', error)
} finally {
this.$emit('ocrClose', false)
this.showCamera = false
this.cameraStarted = false
this.resetFocusState()
@ -238,6 +239,7 @@ export default {
content: '相机插件未准备好,请确保应用已正确安装相机插件,或尝试重启应用',
showCancel: false,
})
this.$emit('ocrClose', false)
return
}
}
@ -256,6 +258,7 @@ export default {
icon: 'none',
duration: 2000,
})
this.$emit('ocrClose', false)
}
},
@ -327,6 +330,7 @@ export default {
} catch (error) {
console.error('关闭相机出错:', error)
} finally {
this.$emit('ocrClose', false)
this.showCamera = false
this.cameraStarted = false
this.resetFocusState()

View File

@ -1,5 +1,5 @@
<template>
<div class="card">
<div class="card" v-show="!showOCR">
<uni-forms :model="formData" label-width="180rpx" :border="true">
<uni-forms-item label="设备编码:" name="maCode" required>
<uni-easyinput v-model="formData.maCode" placeholder="请输入内容" />
@ -46,7 +46,7 @@
<button type="primary" style="width: 45%" @click="submit"> </button>
</div>
</div>
<OcrSearch ref="ocrSearch" @getMaCode="getMaCode" :jiJuType="formData.jiJuType" />
<OcrSearch ref="ocrSearch" @getMaCode="getMaCode" @ocrClose="handleOCRClose" :jiJuType="formData.jiJuType" />
</template>
<script setup>
@ -57,6 +57,7 @@ import OcrSearch from '@/components/OcrSearch/index.vue'
import { getDeviceTypeTreeApi, getTypeListApi, addMaMachineApi } from '@/services/inStorage'
import { getSupplierList } from '@/services/information'
const showOCR = ref(false)
const ocrSearch = ref(null)
const opts = ref({})
const formData = reactive({
@ -101,6 +102,7 @@ const handleOpenOcr = () => {
})
return
}
showOCR.value = true
ocrSearch.value.openCamera()
}
@ -108,6 +110,10 @@ const getMaCode = (code) => {
console.log('🚀 ~ getMaCode ~ code:', code)
formData.maCode = code
}
const handleOCRClose = (val) => {
console.log('🚀 ~ handleOCRClose ~ val:', val)
showOCR.value = false
}
const getTypeModelList = async () => {
try {