From 4fe12506fe879c7b5a5cfe57296668168fb358bb Mon Sep 17 00:00:00 2001 From: hayu <1604366271@qq.com> Date: Sun, 14 Sep 2025 21:04:41 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/ElectronicSeal/index.vue | 10 ++++---- src/pages/devicesSearch/codeSearch.vue | 33 ++++++++++++++++++++++--- src/pages/devicesSearch/ocrSearch.vue | 7 +++++- src/pages/devicesSearch/qrSearch.vue | 8 +++--- 4 files changed, 44 insertions(+), 14 deletions(-) diff --git a/src/components/ElectronicSeal/index.vue b/src/components/ElectronicSeal/index.vue index 0172f58..1c803f4 100644 --- a/src/components/ElectronicSeal/index.vue +++ b/src/components/ElectronicSeal/index.vue @@ -296,11 +296,11 @@ const changeTag = async () => { } } catch (error) { console.error('获取标签信息失败', error) - uni.showToast({ - title: '获取信息失败', - icon: 'none', - duration: 2000, - }) + // uni.showToast({ + // title: '获取信息失败', + // icon: 'none', + // duration: 2000, + // }) } } diff --git a/src/pages/devicesSearch/codeSearch.vue b/src/pages/devicesSearch/codeSearch.vue index 7607abc..64fd5ca 100644 --- a/src/pages/devicesSearch/codeSearch.vue +++ b/src/pages/devicesSearch/codeSearch.vue @@ -100,8 +100,10 @@ - - +
+
该工器具已临近下次检验时间,请及时退还至机具(物流)分公司!
+ +
@@ -133,7 +135,8 @@ const formData = ref({ backUnit: '', backProject: '', backTime: '' -}) +}) +const isOverToday = ref(false); // 编码设备列表查询参数 const queryCodeParams = ref({ maCode: '', @@ -165,20 +168,39 @@ const getCodeDeviceInfoData = async () => { })) if(response.data.length === 1){ formData.value = response.data[0] + setTimeout(() => { + handleIsOverToday() + }, 500) } }else{ uni.showToast({ - title: '未查询到该编号信息', + title: '未查询到该编号信息或非编码追溯管理机具,请到工器具识别页面查询', icon: 'none', duration: 2000 }) } }).catch(error => { console.error("获取设备信息失败", error) + uni.showToast({ + title: '未查询到该编号信息或非编码追溯管理机具,请到工器具识别页面查询', + icon: 'none', + duration: 2000 + }) uni.hideLoading() }) } +const handleIsOverToday = async () => { + if (!formData.value.nextCheckTime) { + isOverToday.value = true + } else { + const now = Date.now() + const nextCheckTimestamp = new Date(formData.value.nextCheckTime).getTime() + isOverToday.value = nextCheckTimestamp <= now + console.log('🚀 ~ isOverToday ~ :', isOverToday.value) + } +} + // 标签变更处理 const changeTag = async () => { if (!maId.value) return @@ -187,6 +209,9 @@ const changeTag = async () => { const response = await getDeviceListAPI({'maId': maId.value}) if (response.data && response.data.length !== 0) { formData.value = response.data[0] + setTimeout(() => { + handleIsOverToday() + }, 500) } } catch (error) { console.error("获取编号信息失败", error) diff --git a/src/pages/devicesSearch/ocrSearch.vue b/src/pages/devicesSearch/ocrSearch.vue index 67f3596..7986edf 100644 --- a/src/pages/devicesSearch/ocrSearch.vue +++ b/src/pages/devicesSearch/ocrSearch.vue @@ -741,13 +741,18 @@ export default { } } else { uni.showToast({ - title: '未查询到该编号信息', + title: '未查询到该编号信息或非编码追溯管理机具,请到工器具识别页面查询', icon: 'none', duration: 2000 }) } }).catch(error => { console.error("获取设备信息失败", error) + uni.showToast({ + title: '未查询到该编号信息或非编码追溯管理机具,请到工器具识别页面查询', + icon: 'none', + duration: 2000 + }) uni.hideLoading() }) } catch (error) { diff --git a/src/pages/devicesSearch/qrSearch.vue b/src/pages/devicesSearch/qrSearch.vue index a24726a..9603afa 100644 --- a/src/pages/devicesSearch/qrSearch.vue +++ b/src/pages/devicesSearch/qrSearch.vue @@ -86,7 +86,7 @@ import { ref, computed, onUnmounted } from 'vue' import { onLoad, onShow, } from '@dcloudio/uni-app' import { debounce } from 'lodash-es' import ScanQrCode from '@/pages/devicesSearch/ScanQrCode.vue' -import { getScanCodeAPI } from '@/services/picking/outbound.js' +import { getDeviceListAPI } from '@/services/picking/outbound.js' import ElectronicSeal from '@/components/ElectronicSeal/index.vue' const scanQrCodeRef = ref(null) @@ -115,7 +115,7 @@ const handleIsOverToday = () => { const now = Date.now() const nextCheckTimestamp = new Date(codeData.value.nextCheckTime).getTime() isOverToday.value = nextCheckTimestamp <= now - console.log('🚀 ~ isOverToday ~ :', nextCheckDate < today) + // console.log('🚀 ~ isOverToday ~ :', nextCheckDate < today) } } @@ -191,11 +191,11 @@ const getMaInfoScan = async () => { qrCode: qrCodeScan.value, } console.log(param) - const res = await getScanCodeAPI(param) + const res = await getDeviceListAPI(param) console.log(res) if (res.code == 200) { if (res.data) { - codeData.value = res.data + codeData.value = res.data[0] setTimeout(() => { handleIsOverToday() }, 500)