OCR查询问题处理

This commit is contained in:
bb_pan 2025-08-13 19:00:37 +08:00
parent 560f91455c
commit 19938ecd15
6 changed files with 104 additions and 34 deletions

View File

@ -44,7 +44,7 @@
<div <div
style="width: 50%; display: flex; justify-content: end; align-items: center" style="width: 50%; display: flex; justify-content: end; align-items: center"
> >
<span style="color: #ef3e3e; margin-right: 20px; font-size: 14px"> <span style="color: #ef3e3e; margin-right: 20px; font-size: 26px">
{{ tagInfo.inspectStatus }} {{ tagInfo.inspectStatus }}
</span> </span>
</div> </div>
@ -70,14 +70,14 @@
<div style="margin-top: 0px; display: flex"> <div style="margin-top: 0px; display: flex">
<div style="width: 50%; display: flex; align-items: center"> <div style="width: 50%; display: flex; align-items: center">
<span style="color: #4dad7e">检修员</span> <span style="color: #4dad7e">检修员</span>
<span style="margin-left: 40px">{{ tagInfo.inspectMan }}</span> <span style="margin-left: 40px">{{ tagInfo.checkMan }}</span>
</div> </div>
<div <div
style="width: 50%; display: flex; justify-content: end; align-items: center" style="width: 50%; display: flex; justify-content: end; align-items: center"
> >
<span style="color: #4dad7e; font-size: 14px">检验员</span> <span style="color: #4dad7e; font-size: 14px">检验员</span>
<span style="margin-left: 20px; margin-right: 20px; font-size: 14px"> <span style="margin-left: 20px; margin-right: 20px; font-size: 14px">
{{ tagInfo.checkMan }} {{ tagInfo.inspectMan || '高民'}}
</span> </span>
</div> </div>
</div> </div>
@ -89,7 +89,7 @@
</div> </div>
<!-- 检测报告链接 --> <!-- 检测报告链接 -->
<div style="margin-top: 1px; display: flex; align-items: center"> <!-- <div style="margin-top: 1px; display: flex; align-items: center" v-if="tagInfo.exUrl">
<span style="color: #4dad7e">出库检验报告</span> <span style="color: #4dad7e">出库检验报告</span>
<span <span
style=" style="
@ -98,11 +98,11 @@
cursor: pointer; cursor: pointer;
color: #4dad7e; color: #4dad7e;
" "
@click="handleReportClick" @click="handleReportClick(tagInfo.exUrl)"
> >
检测报告 检测报告
</span> </span>
</div> </div> -->
<!-- 印章位置 --> <!-- 印章位置 -->
<canvas <canvas
@ -110,7 +110,7 @@
style=" style="
position: absolute; position: absolute;
bottom: 15px; bottom: 15px;
right: 20px; right: 10px;
width: 200px; width: 200px;
height: 200px; height: 200px;
z-index: 10; z-index: 10;
@ -170,18 +170,18 @@
<div style="margin-top: 0px; display: flex; align-items: center"> <div style="margin-top: 0px; display: flex; align-items: center">
<span>试验人</span> <span>试验人</span>
<span style="margin-left: 40px">{{ tagInfo.checkMan }}</span> <span style="margin-left: 40px">{{ tagInfo.inspectMan || tagInfo.checkMan }}</span>
</div> </div>
<div style="margin-top: 0px; display: flex; align-items: center"> <div style="margin-top: 0px; display: flex; align-items: center">
<span>检验结果</span> <span>检验结果</span>
<span style="margin-left: 40px; color: #ef3e3e"> <span style="margin-left: 40px; color: #ef3e3e; font-size: 22px">
{{ tagInfo.inspectStatus }} {{ tagInfo.inspectStatus }}
</span> </span>
</div> </div>
<!-- 检测报告链接 --> <!-- 检测报告链接 -->
<div style="margin-top: 0px; display: flex; align-items: center"> <!-- <div style="margin-top: 0px; display: flex; align-items: center" v-if="tagInfo.exUrl">
<span>检测报告</span> <span>检测报告</span>
<span <span
style=" style="
@ -190,11 +190,11 @@
cursor: pointer; cursor: pointer;
color: #0055aa; color: #0055aa;
" "
@click="handleReportClick" @click="handleReportClick(tagInfo.exUrl)"
> >
检测报告 检测报告
</span> </span>
</div> </div> -->
<!-- 印章位置 --> <!-- 印章位置 -->
<canvas <canvas
@ -202,7 +202,7 @@
style=" style="
position: absolute; position: absolute;
bottom: 15px; bottom: 15px;
right: 20px; right: 10px;
width: 200px; width: 200px;
height: 200px; height: 200px;
z-index: 10; z-index: 10;
@ -245,6 +245,10 @@ const props = defineProps({
type: [String, Number], type: [String, Number],
default: '', default: '',
}, },
devType: {
type: [String, Number],
default: '',
}
}) })
// props.maId // props.maId
@ -269,7 +273,7 @@ const changeTag = async () => {
if (!maCodeTwo.value) return if (!maCodeTwo.value) return
try { try {
const response = await getListTag({ maCode: maCodeTwo.value, maId: props.maId }) const response = await getListTag({ maCode: maCodeTwo.value, maId: props.maId, devType: props.devType })
if (response.data && response.data.length !== 0) { if (response.data && response.data.length !== 0) {
tagInfo.value = response.data[0] tagInfo.value = response.data[0]
isJj.value = tagInfo.value.isJj isJj.value = tagInfo.value.isJj
@ -388,12 +392,14 @@ const create5star = (
} }
// PDF // PDF
const handleReportClick = async () => { const handleReportClick = async (url) => {
return // url = 'http://sgwpdm.ah.sgcc.com.cn/iws/jiju-api/' + url
// http://sgwpdm.ah.sgcc.com.cn/iws/jiju-api
if (!url.startsWith('http://sgwpdm.ah.sgcc.com.cn/iws/jiju-api')) {
url = 'http://sgwpdm.ah.sgcc.com.cn/iws/jiju-api/' + url
}
try { try {
const pdfUrl = encodeURI( const pdfUrl = encodeURI(url)
'http://192.168.0.244:18583/statics/2025/03/05/清新互联智能事件格式_2021(1)_20250305153249A001.pdf',
)
uni.showLoading({ title: '下载中...', mask: true }) uni.showLoading({ title: '下载中...', mask: true })
uni.downloadFile({ uni.downloadFile({
@ -458,6 +464,7 @@ page {
/* min-width: 100%; */ /* min-width: 100%; */
overflow: visible; overflow: visible;
margin: 0 auto; margin: 0 auto;
color: #333;
/* padding: 10px; */ /* padding: 10px; */
} }

View File

@ -69,9 +69,9 @@
<uni-forms-item label="更换配件次数:" name="checkNum"> <uni-forms-item label="更换配件次数:" name="checkNum">
<text style="height: 100%;display: flex;align-items: center;">{{ codeData.checkNum }}</text> <text style="height: 100%;display: flex;align-items: center;">{{ codeData.checkNum }}</text>
</uni-forms-item> </uni-forms-item>
<uni-forms-item label="检修员:" name="inspectionPerson"> <!-- <uni-forms-item label="检修员:" name="inspectionPerson">
<text style="height: 100%;display: flex;align-items: center;">{{ codeData.inspectionPerson }}</text> <text style="height: 100%;display: flex;align-items: center;">{{ codeData.inspectionPerson }}</text>
</uni-forms-item> </uni-forms-item> -->
<uni-forms-item label="报废:" name="scrapTime"> <uni-forms-item label="报废:" name="scrapTime">
<text style="height: 100%;display: flex;align-items: center;">{{ codeData.scrapTime }}</text> <text style="height: 100%;display: flex;align-items: center;">{{ codeData.scrapTime }}</text>
</uni-forms-item> </uni-forms-item>
@ -140,7 +140,8 @@
style="position: fixed; top: -9999px; left: -9999px; width: 1px; height: 1px;" style="position: fixed; top: -9999px; left: -9999px; width: 1px; height: 1px;"
></canvas> ></canvas>
<div style="width: 100%;"> <div style="width: 100%;">
<ElectronicSeal :maCode="codeData?.maCode" :maId="codeData?.maId" /> <div v-if="isOverToday && codeData.nextCheckTime">该工器具已临近下次检验时间请及时退还至机具物流分公司</div>
<ElectronicSeal v-else :maCode="codeData?.maCode" :maId="codeData?.maId" :devType="2" />
</div> </div>
</view> </view>
</template> </template>
@ -178,7 +179,8 @@ export default {
autoFocusEnabled: true, autoFocusEnabled: true,
focusTimeout: null, focusTimeout: null,
// //
systemInfo: null systemInfo: null,
isOverToday: false
} }
}, },
onBackPress(options) { onBackPress(options) {
@ -212,6 +214,16 @@ export default {
this.cleanup(); this.cleanup();
}, },
methods: { methods: {
handleIsOverToday() {
if (!this.codeData.nextCheckTime) {
this.isOverToday = true
} else {
const now = Date.now()
const nextCheckTimestamp = new Date(this.codeData.nextCheckTime).getTime()
this.isOverToday = nextCheckTimestamp <= now
console.log('🚀 ~ isOverToday ~ :', this.isOverToday)
}
},
// //
getDeviceInfo() { getDeviceInfo() {
try { try {
@ -768,6 +780,9 @@ export default {
})); }));
if (response.data.length === 1) { if (response.data.length === 1) {
this.codeData = response.data[0]; this.codeData = response.data[0];
setTimeout(() => {
this.handleIsOverToday()
}, 500)
} }
} else { } else {
uni.showToast({ uni.showToast({
@ -796,6 +811,9 @@ export default {
const response = await getDeviceListAPI({'maId': this.queryCodeParams.maId}) const response = await getDeviceListAPI({'maId': this.queryCodeParams.maId})
if (response.data && response.data.length !== 0) { if (response.data && response.data.length !== 0) {
this.codeData = response.data[0] this.codeData = response.data[0]
setTimeout(() => {
this.handleIsOverToday()
}, 500)
} }
} catch (error) { } catch (error) {
console.error("获取编号信息失败", error); console.error("获取编号信息失败", error);

View File

@ -69,9 +69,9 @@
<uni-forms-item v-if="codeData.jiJuType===2" label="更换配件次数:" name="checkNum"> <uni-forms-item v-if="codeData.jiJuType===2" label="更换配件次数:" name="checkNum">
<text style="height: 100%;display: flex;align-items: center;">{{ codeData.checkNum }}</text> <text style="height: 100%;display: flex;align-items: center;">{{ codeData.checkNum }}</text>
</uni-forms-item> </uni-forms-item>
<uni-forms-item label="检修员:" name="inspectionPerson"> <!-- <uni-forms-item label="检修员:" name="inspectionPerson">
<text style="height: 100%;display: flex;align-items: center;">{{ codeData.thisCheckTime ? '王鹏' : '' }}</text> <text style="height: 100%;display: flex;align-items: center;">{{ codeData.thisCheckTime ? '王鹏' : '' }}</text>
</uni-forms-item> </uni-forms-item> -->
<uni-forms-item v-if="codeData.jiJuType===2" label="报废:" name="scrapTime"> <uni-forms-item v-if="codeData.jiJuType===2" label="报废:" name="scrapTime">
<text style="height: 100%;display: flex;align-items: center;">{{ codeData.scrapTime }}</text> <text style="height: 100%;display: flex;align-items: center;">{{ codeData.scrapTime }}</text>
</uni-forms-item> </uni-forms-item>
@ -140,7 +140,8 @@
style="position: fixed; top: -9999px; left: -9999px; width: 1px; height: 1px;" style="position: fixed; top: -9999px; left: -9999px; width: 1px; height: 1px;"
></canvas> ></canvas>
<div style="width: 100%;"> <div style="width: 100%;">
<ElectronicSeal :maCode="codeData?.maCode" :maId="codeData?.maId" /> <div v-if="isOverToday && codeData.nextCheckTime">该工器具已临近下次检验时间请及时退还至机具物流分公司</div>
<ElectronicSeal v-else :maCode="codeData?.maCode" :maId="codeData?.maId" :devType="codeData.devType" />
</div> </div>
</view> </view>
</template> </template>
@ -178,7 +179,8 @@ export default {
autoFocusEnabled: true, autoFocusEnabled: true,
focusTimeout: null, focusTimeout: null,
// //
systemInfo: null systemInfo: null,
isOverToday: false
} }
}, },
onBackPress(options) { onBackPress(options) {
@ -212,6 +214,17 @@ export default {
this.cleanup(); this.cleanup();
}, },
methods: { methods: {
handleIsOverToday() {
console.log('🚀 ~ handleIsOverToday ~ this.codeData.nextCheckTime:', this.codeData.nextCheckTime)
if (!this.codeData.nextCheckTime) {
this.isOverToday = true
} else {
const now = Date.now()
const nextCheckTimestamp = new Date(this.codeData.nextCheckTime).getTime()
this.isOverToday = nextCheckTimestamp <= now
console.log('🚀 ~ isOverToday ~ :', this.isOverToday)
}
},
// //
getDeviceInfo() { getDeviceInfo() {
try { try {
@ -764,10 +777,14 @@ export default {
if (response.code === 200 && response.data && response.data.length > 0) { if (response.code === 200 && response.data && response.data.length > 0) {
this.optionList = response.data.map(option => ({ this.optionList = response.data.map(option => ({
value: option.maId, value: option.maId,
text: option.maCode text: option.maCode,
devType: option.devType
})); }));
if (response.data.length === 1) { if (response.data.length === 1) {
this.codeData = response.data[0]; this.codeData = response.data[0];
setTimeout(() => {
this.handleIsOverToday()
}, 500)
} }
} else { } else {
uni.showToast({ uni.showToast({
@ -791,11 +808,16 @@ export default {
// //
async changeTag() { async changeTag() {
const selectedOption = this.optionList.find(option => option.value === this.queryCodeParams.maId)
console.log('🚀 ~ changeTag ~ selectedOption:', selectedOption)
if (!this.queryCodeParams.maId) return; if (!this.queryCodeParams.maId) return;
try { try {
const response = await getDeviceListAPINew({'maId': this.queryCodeParams.maId}) const response = await getDeviceListAPINew({'maId': this.queryCodeParams.maId, devType: selectedOption.devType})
if (response.data && response.data.length !== 0) { if (response.data && response.data.length !== 0) {
this.codeData = response.data[0] this.codeData = response.data[0]
setTimeout(() => {
this.handleIsOverToday()
}, 500)
} }
} catch (error) { } catch (error) {
console.error("获取编号信息失败", error); console.error("获取编号信息失败", error);

View File

@ -75,7 +75,8 @@
</view> </view>
<ElectronicSeal :maCode="codeData?.maCode" :maId="codeData?.maId" /> <div v-if="isOverToday && codeData.nextCheckTime">该工器具已临近下次检验时间请及时退还至机具物流分公司</div>
<ElectronicSeal v-else :maCode="codeData?.maCode" :maId="codeData?.maId" :devType="2" />
</scroll-view> </scroll-view>
</view> </view>
</template> </template>
@ -97,6 +98,7 @@ const queryCodeParams = ref({
}) })
const qrCodeScan = ref('') const qrCodeScan = ref('')
const codeData = ref({}) const codeData = ref({})
const isOverToday = ref(false)
// //
onLoad((options) => { onLoad((options) => {
// scanStart() // scanStart()
@ -104,6 +106,19 @@ onLoad((options) => {
onShow(() => { onShow(() => {
}) })
const handleIsOverToday = () => {
console.log('🚀 ~ .nextCheckTime:', codeData.value.nextCheckTime)
if (!codeData.value.nextCheckTime) {
isOverToday.value = true
} else {
const now = Date.now()
const nextCheckTimestamp = new Date(codeData.value.nextCheckTime).getTime()
isOverToday.value = nextCheckTimestamp <= now
console.log('🚀 ~ isOverToday ~ :', nextCheckDate < today)
}
}
// // // //
// const scanStart = () => { // const scanStart = () => {
// var mpaasScanModule = uni.requireNativePlugin("Mpaas-Scan-Module") // var mpaasScanModule = uni.requireNativePlugin("Mpaas-Scan-Module")
@ -179,6 +194,9 @@ const getMaInfoScan = async () => {
if (res.code == 200) { if (res.code == 200) {
if (res.data) { if (res.data) {
codeData.value = res.data codeData.value = res.data
setTimeout(() => {
handleIsOverToday()
}, 500)
}else{ }else{
uni.showToast({ title: res.data.msg, icon: 'none'}) uni.showToast({ title: res.data.msg, icon: 'none'})
} }

View File

@ -54,7 +54,7 @@
</uni-forms> </uni-forms>
</view> </view>
<div style="width: 100%"> <div style="width: 100%">
<ElectronicSeal :maCode="codeData?.maCode" :maId="codeData?.maId" /> <ElectronicSeal :maCode="codeData?.maCode" :maId="codeData?.maId" :devType="queryParams?.jiJuType" />
</div> </div>
<button type="primary" style="margin-top: 20px" @click="addCode">添加编码</button> <button type="primary" style="margin-top: 20px" @click="addCode">添加编码</button>

View File

@ -51,11 +51,16 @@
codeData.maCode codeData.maCode
}}</text> }}</text>
</uni-forms-item> </uni-forms-item>
<uni-forms-item label="下次检验时间:" name="maCode">
<text style="height: 100%; display: flex; align-items: center">{{
codeData.nextCheckTime
}}</text>
</uni-forms-item>
</uni-forms> </uni-forms>
</view> </view>
<div style="width: 100%"> <!-- <div style="width: 100%">
<ElectronicSeal :maCode="codeData?.maCode" :maId="codeData?.maId" /> <ElectronicSeal :maCode="codeData?.maCode" :maId="codeData?.maId" :devType="queryParams?.jiJuType" />
</div> </div> -->
<button type="primary" style="margin-top: 20px" @click="addCode">添加编码</button> <button type="primary" style="margin-top: 20px" @click="addCode">添加编码</button>
</view> </view>