This commit is contained in:
hayu 2025-09-14 21:04:41 +08:00
parent bc1502c8c5
commit 4fe12506fe
4 changed files with 44 additions and 14 deletions

View File

@ -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,
// })
}
}

View File

@ -100,8 +100,10 @@
</uni-forms>
</view>
</view>
<ElectronicSeal :maCode="formData?.maCode" :maId="formData?.maId" :devType="formData?.devType" />
<div style="width: 100%;">
<div v-if="isOverToday && formData?.nextCheckTime">该工器具已临近下次检验时间请及时退还至机具物流分公司</div>
<ElectronicSeal v-if="!isOverToday" :maCode="formData?.maCode" :maId="formData?.maId" :devType="2" />
</div>
</scroll-view>
</view>
</template>
@ -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)

View File

@ -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) {

View File

@ -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)