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

View File

@ -69,9 +69,9 @@
<uni-forms-item label="更换配件次数:" name="checkNum">
<text style="height: 100%;display: flex;align-items: center;">{{ codeData.checkNum }}</text>
</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>
</uni-forms-item>
</uni-forms-item> -->
<uni-forms-item label="报废:" name="scrapTime">
<text style="height: 100%;display: flex;align-items: center;">{{ codeData.scrapTime }}</text>
</uni-forms-item>
@ -140,7 +140,8 @@
style="position: fixed; top: -9999px; left: -9999px; width: 1px; height: 1px;"
></canvas>
<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>
</view>
</template>
@ -178,7 +179,8 @@ export default {
autoFocusEnabled: true,
focusTimeout: null,
//
systemInfo: null
systemInfo: null,
isOverToday: false
}
},
onBackPress(options) {
@ -212,6 +214,16 @@ export default {
this.cleanup();
},
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() {
try {
@ -768,6 +780,9 @@ export default {
}));
if (response.data.length === 1) {
this.codeData = response.data[0];
setTimeout(() => {
this.handleIsOverToday()
}, 500)
}
} else {
uni.showToast({
@ -796,6 +811,9 @@ export default {
const response = await getDeviceListAPI({'maId': this.queryCodeParams.maId})
if (response.data && response.data.length !== 0) {
this.codeData = response.data[0]
setTimeout(() => {
this.handleIsOverToday()
}, 500)
}
} catch (error) {
console.error("获取编号信息失败", error);

View File

@ -69,9 +69,9 @@
<uni-forms-item v-if="codeData.jiJuType===2" label="更换配件次数:" name="checkNum">
<text style="height: 100%;display: flex;align-items: center;">{{ codeData.checkNum }}</text>
</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>
</uni-forms-item>
</uni-forms-item> -->
<uni-forms-item v-if="codeData.jiJuType===2" label="报废:" name="scrapTime">
<text style="height: 100%;display: flex;align-items: center;">{{ codeData.scrapTime }}</text>
</uni-forms-item>
@ -140,7 +140,8 @@
style="position: fixed; top: -9999px; left: -9999px; width: 1px; height: 1px;"
></canvas>
<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>
</view>
</template>
@ -178,7 +179,8 @@ export default {
autoFocusEnabled: true,
focusTimeout: null,
//
systemInfo: null
systemInfo: null,
isOverToday: false
}
},
onBackPress(options) {
@ -212,6 +214,17 @@ export default {
this.cleanup();
},
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() {
try {
@ -764,10 +777,14 @@ export default {
if (response.code === 200 && response.data && response.data.length > 0) {
this.optionList = response.data.map(option => ({
value: option.maId,
text: option.maCode
text: option.maCode,
devType: option.devType
}));
if (response.data.length === 1) {
this.codeData = response.data[0];
setTimeout(() => {
this.handleIsOverToday()
}, 500)
}
} else {
uni.showToast({
@ -791,11 +808,16 @@ export default {
//
async changeTag() {
const selectedOption = this.optionList.find(option => option.value === this.queryCodeParams.maId)
console.log('🚀 ~ changeTag ~ selectedOption:', selectedOption)
if (!this.queryCodeParams.maId) return;
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) {
this.codeData = response.data[0]
setTimeout(() => {
this.handleIsOverToday()
}, 500)
}
} catch (error) {
console.error("获取编号信息失败", error);

View File

@ -75,7 +75,8 @@
</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>
</view>
</template>
@ -97,6 +98,7 @@ const queryCodeParams = ref({
})
const qrCodeScan = ref('')
const codeData = ref({})
const isOverToday = ref(false)
//
onLoad((options) => {
// scanStart()
@ -104,6 +106,19 @@ onLoad((options) => {
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 = () => {
// var mpaasScanModule = uni.requireNativePlugin("Mpaas-Scan-Module")
@ -179,6 +194,9 @@ const getMaInfoScan = async () => {
if (res.code == 200) {
if (res.data) {
codeData.value = res.data
setTimeout(() => {
handleIsOverToday()
}, 500)
}else{
uni.showToast({ title: res.data.msg, icon: 'none'})
}

View File

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

View File

@ -51,11 +51,16 @@
codeData.maCode
}}</text>
</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>
</view>
<div style="width: 100%">
<ElectronicSeal :maCode="codeData?.maCode" :maId="codeData?.maId" />
</div>
<!-- <div style="width: 100%">
<ElectronicSeal :maCode="codeData?.maCode" :maId="codeData?.maId" :devType="queryParams?.jiJuType" />
</div> -->
<button type="primary" style="margin-top: 20px" @click="addCode">添加编码</button>
</view>