This commit is contained in:
hongchao 2025-11-03 16:38:02 +08:00
commit c0f90cc4ee
2 changed files with 1468 additions and 1454 deletions

File diff suppressed because it is too large Load Diff

View File

@ -1,454 +1,454 @@
<template> <template>
<view class="page-container"> <view class="page-container">
<!-- 表单信息区域 --> <!-- 表单信息区域 -->
<scroll-view scroll-y style="height: 100vh;"> <scroll-view scroll-y style="height: 100vh;">
<view class="outbound-btn" @click="scanStart"> 二维码扫描 </view> <view class="outbound-btn" @click="scanStart"> 二维码扫描 </view>
<ScanQrCode ref="scanQrCodeRef" @scanSuccess="handleScanSuccess" @scanError="handleScanError" /> <ScanQrCode ref="scanQrCodeRef" @scanSuccess="handleScanSuccess" @scanError="handleScanError" />
<view class="form-section"> <view class="form-section">
<view class="section-header"> <view class="section-header">
<text class="title">设备信息</text> <text class="title">设备信息</text>
</view> </view>
<view class="form-content"> <view class="form-content">
<uni-forms :model="formData" label-width="100" :border="true"> <uni-forms :model="formData" label-width="100" :border="true">
<uni-forms-item label="设备类型:" name="maName"> <uni-forms-item label="设备类型:" name="maName">
<span class="form-view">{{codeData.maName}}</span> <span class="form-view">{{codeData.maName}}</span>
</uni-forms-item> </uni-forms-item>
<uni-forms-item label="规格型号:" name="maModel"> <uni-forms-item label="规格型号:" name="maModel">
<span class="form-view">{{codeData.maModel}}</span> <span class="form-view">{{codeData.maModel}}</span>
</uni-forms-item> </uni-forms-item>
<uni-forms-item label="二维码编码:" name="qrCode"> <uni-forms-item label="二维码编码:" name="qrCode">
<span class="form-view">{{codeData.qrCode}}</span> <span class="form-view">{{codeData.qrCode}}</span>
</uni-forms-item> </uni-forms-item>
<uni-forms-item label="设备编码:" name="maCode"> <uni-forms-item label="设备编码:" name="maCode">
<span class="form-view">{{codeData.maCode}}</span> <span class="form-view">{{codeData.maCode}}</span>
</uni-forms-item> </uni-forms-item>
<uni-forms-item label="设备状态:" name="maStatus"> <uni-forms-item label="设备状态:" name="maStatus">
<span class="form-view">{{codeData.maStatus}}</span> <span class="form-view">{{codeData.maStatus}}</span>
</uni-forms-item> </uni-forms-item>
<uni-forms-item label="本次检修时间:" name="checkTimeSynch"> <uni-forms-item label="本次检修时间:" name="checkTimeSynch">
<text class="form-view">{{codeData.thisCheckTime}}</text> <text class="form-view">{{codeData.thisCheckTime}}</text>
</uni-forms-item> </uni-forms-item>
<uni-forms-item label="下次检修时间:" name="nextCheckTimeSynch"> <uni-forms-item label="下次检修时间:" name="nextCheckTimeSynch">
<text class="form-view">{{codeData.nextCheckTime}}</text> <text class="form-view">{{codeData.nextCheckTime}}</text>
</uni-forms-item> </uni-forms-item>
<uni-forms-item label="出入库次数:" name="inOutNum"> <uni-forms-item label="出入库次数:" name="inOutNum">
<text class="form-view">{{codeData.inOutNum}}</text> <text class="form-view">{{codeData.inOutNum}}</text>
</uni-forms-item> </uni-forms-item>
<uni-forms-item label="初次入库:" name="inTime"> <uni-forms-item label="初次入库:" name="inTime">
<text class="form-view">{{codeData.inTime}}</text> <text class="form-view">{{codeData.inTime}}</text>
</uni-forms-item> </uni-forms-item>
<uni-forms-item label="服务工程次数:" name="serviceNum"> <uni-forms-item label="服务工程次数:" name="serviceNum">
<text class="form-view">{{codeData.serviceNum}}</text> <text class="form-view">{{codeData.serviceNum}}</text>
</uni-forms-item> </uni-forms-item>
<uni-forms-item label="检验次数:" name="serviceNum"> <uni-forms-item label="检验次数:" name="serviceNum">
<text class="form-view">{{codeData.serviceNum}}</text> <text class="form-view">{{codeData.serviceNum}}</text>
</uni-forms-item> </uni-forms-item>
<uni-forms-item label="更换配件次数:" name="checkNum"> <uni-forms-item label="更换配件次数:" name="checkNum">
<text class="form-view">{{codeData.checkNum}}</text> <text class="form-view">{{codeData.checkNum}}</text>
</uni-forms-item> </uni-forms-item>
<uni-forms-item label="报废:" name="scrapTime"> <uni-forms-item label="报废:" name="scrapTime">
<text class="form-view">{{codeData.scrapTime}}</text> <text class="form-view">{{codeData.scrapTime}}</text>
</uni-forms-item> </uni-forms-item>
<uni-forms-item label="生产厂家:" name="maVender"> <uni-forms-item label="生产厂家:" name="maVender">
<text class="form-view">{{codeData.maVender}}</text> <text class="form-view">{{codeData.maVender}}</text>
</uni-forms-item> </uni-forms-item>
<uni-forms-item label="领料单位:" name="leaseUnit"> <uni-forms-item label="领料单位:" name="leaseUnit">
<text class="form-view">{{codeData.leaseUnit}}</text> <text class="form-view">{{codeData.leaseUnit}}</text>
</uni-forms-item> </uni-forms-item>
<uni-forms-item label="领料工程:" name="leaseProject"> <uni-forms-item label="领料工程:" name="leaseProject">
<text class="form-view">{{codeData.leaseProject}}</text> <text class="form-view">{{codeData.leaseProject}}</text>
</uni-forms-item> </uni-forms-item>
<uni-forms-item label="领料时间:" name="leaseTime"> <uni-forms-item label="领料时间:" name="leaseTime">
<text class="form-view">{{codeData.leaseTime}}</text> <text class="form-view">{{codeData.leaseTime}}</text>
</uni-forms-item> </uni-forms-item>
<uni-forms-item label="退料单位:" name="backUnit"> <uni-forms-item label="退料单位:" name="backUnit">
<text class="form-view">{{codeData.backUnit}}</text> <text class="form-view">{{codeData.backUnit}}</text>
</uni-forms-item> </uni-forms-item>
<uni-forms-item label="退料工程:" name="backProject"> <uni-forms-item label="退料工程:" name="backProject">
<text class="form-view">{{codeData.backProject}}</text> <text class="form-view">{{codeData.backProject}}</text>
</uni-forms-item> </uni-forms-item>
<uni-forms-item label="退料时间:" name="backTime"> <uni-forms-item label="退料时间:" name="backTime">
<text class="form-view">{{codeData.backTime}}</text> <text class="form-view">{{codeData.backTime}}</text>
</uni-forms-item> </uni-forms-item>
</uni-forms> </uni-forms>
</view> </view>
</view> </view>
<div v-if="isOverToday && codeData.nextCheckTime">该工器具已临近下次检验时间请及时退还至机具物流分公司</div> <div v-if="isOverToday && codeData.nextCheckTime">该工器具已临近下次检验时间请及时退还至机具物流分公司</div>
<ElectronicSeal v-else v-show="codeData.maId" :maCode="codeData?.maCode" :maId="codeData?.maId" :devType="2" /> <ElectronicSeal v-else v-show="codeData.maId" :maCode="codeData?.maCode" :maId="codeData?.maId" :devType="2" />
</scroll-view> </scroll-view>
</view> </view>
</template> </template>
<script setup> <script setup>
import { ref, computed, onUnmounted } from 'vue' import { ref, computed, onUnmounted } from 'vue'
import { onLoad, onShow, } from '@dcloudio/uni-app' import { onLoad, onShow, } from '@dcloudio/uni-app'
import { debounce } from 'lodash-es' import { debounce } from 'lodash-es'
import ScanQrCode from '@/pages/devicesSearch/ScanQrCode.vue' import ScanQrCode from '@/pages/devicesSearch/ScanQrCode.vue'
import { getDeviceListAPI } from '@/services/picking/outbound.js' import { getDeviceListAPI } from '@/services/picking/outbound.js'
import ElectronicSeal from '@/components/ElectronicSeal/index.vue' import ElectronicSeal from '@/components/ElectronicSeal/index.vue'
const scanQrCodeRef = ref(null) const scanQrCodeRef = ref(null)
const queryParams = ref({}) const queryParams = ref({})
const formData = ref({}) const formData = ref({})
// //
const queryCodeParams = ref({ const queryCodeParams = ref({
maCode: '', maCode: '',
}) })
const qrCodeScan = ref('') const qrCodeScan = ref('')
const codeData = ref({}) const codeData = ref({})
const isOverToday = ref(false) const isOverToday = ref(false)
// //
onLoad((options) => { onLoad((options) => {
// scanStart() // scanStart()
}) })
onShow(() => { onShow(() => {
}) })
const handleIsOverToday = () => { const handleIsOverToday = () => {
console.log('🚀 ~ .nextCheckTime:', codeData.value.nextCheckTime) console.log('🚀 ~ .nextCheckTime:', codeData.value.nextCheckTime)
if (!codeData.value.nextCheckTime) { if (!codeData.value.nextCheckTime) {
isOverToday.value = true isOverToday.value = true
} else { } else {
const now = Date.now() const now = Date.now()
const nextCheckTimestamp = new Date(codeData.value.nextCheckTime).getTime() const nextCheckTimestamp = new Date(codeData.value.nextCheckTime).getTime()
isOverToday.value = nextCheckTimestamp <= now isOverToday.value = nextCheckTimestamp <= now
// console.log('🚀 ~ isOverToday ~ :', nextCheckDate < today) // console.log('🚀 ~ isOverToday ~ :', nextCheckDate < today)
} }
} }
// // // //
// const scanStart = () => { // const scanStart = () => {
// var mpaasScanModule = uni.requireNativePlugin("Mpaas-Scan-Module") // var mpaasScanModule = uni.requireNativePlugin("Mpaas-Scan-Module")
// mpaasScanModule.mpaasScan({ // mpaasScanModule.mpaasScan({
// // qrCodebarCode // // qrCodebarCode
// 'scanType': ['qrCode','barCode'], // 'scanType': ['qrCode','barCode'],
// // false // // false
// 'hideAlbum': false, // 'hideAlbum': false,
// //ios zh-Hansen // //ios zh-Hansen
// 'language' : 'en', // 'language' : 'en',
// //(ios) // //(ios)
// 'failedMsg': '', // 'failedMsg': '',
// //Android // //Android
// 'screenType': 'full' // 'screenType': 'full'
// },(ret) => { // },(ret) => {
// if(ret.resp_code==10){ // if(ret.resp_code==10){
// uni.showToast({ title: '', icon: 'none' }) // uni.showToast({ title: '', icon: 'none' })
// } // }
// if(ret.resp_code==11){ // if(ret.resp_code==11){
// uni.showToast({ title: '', icon: 'none' }) // uni.showToast({ title: '', icon: 'none' })
// } // }
// if(ret.resp_code==1000){ // if(ret.resp_code==1000){
// // uni.showToast({ title: '', icon: 'none' }) // // uni.showToast({ title: '', icon: 'none' })
// qrCodeScan.value = ret.resp_result.split("qrcode=")[1] // qrCodeScan.value = ret.resp_result.split("qrcode=")[1]
// if (qrCodeScan.value=="") { // if (qrCodeScan.value=="") {
// uni.showToast({ title: '', icon: 'none'}) // uni.showToast({ title: '', icon: 'none'})
// }else{ // }else{
// getMaInfoScan() // getMaInfoScan()
// } // }
// } // }
// }) // })
// } // }
// //
const scanStart = () => { const scanStart = () => {
qrCodeScan.value = '' qrCodeScan.value = ''
codeData.value = {} codeData.value = {}
if (scanQrCodeRef.value) { if (scanQrCodeRef.value) {
scanQrCodeRef.value.scanQrCode() scanQrCodeRef.value.scanQrCode()
} }
// -- // --
// qrCodeScan.value = '201807-00009' // qrCodeScan.value = '201807-00009'
// getMaInfoScan() // getMaInfoScan()
} }
// //
const handleScanSuccess = (result) => { const handleScanSuccess = (result) => {
console.log('🚀 ~ handleScanSuccess ~ result:', result) console.log('🚀 ~ handleScanSuccess ~ result:', result)
qrCodeScan.value = result?.data?.split('?qrcode=')[1] || result?.data qrCodeScan.value = result?.data?.split('?qrcode=')[1] || result?.data
console.log('🚀 ~ handleScanSuccess ~ qrCodeScan.value:', qrCodeScan.value) console.log('🚀 ~ handleScanSuccess ~ qrCodeScan.value:', qrCodeScan.value)
if (qrCodeScan.value === '') { if (qrCodeScan.value === '') {
uni.showToast({ title: '扫码识别失败', icon: 'none' }) uni.showToast({ title: '扫码识别失败', icon: 'none' })
} else { } else {
getMaInfoScan() getMaInfoScan()
} }
} }
// //
const handleScanError = (error) => { const handleScanError = (error) => {
console.error('扫描出错:', error.message) console.error('扫描出错:', error.message)
uni.showToast({ title: error.message, icon: 'none' }) uni.showToast({ title: error.message, icon: 'none' })
} }
// //
const getMaInfoScan = async () => { const getMaInfoScan = async () => {
try { try {
uni.showLoading({ title: '加载中...', mask: true }) uni.showLoading({ title: '加载中...', mask: true })
let param = { let param = {
qrCode: qrCodeScan.value, qrCode: qrCodeScan.value,
} }
console.log(param) console.log(param)
const res = await getDeviceListAPI(param) const res = await getDeviceListAPI(param)
console.log(res) console.log(res)
if (res.code == 200) { if (res.code == 200) {
if (res.data) { if (res.data) {
codeData.value = res.data[0] codeData.value = res.data[0]
setTimeout(() => { setTimeout(() => {
handleIsOverToday() handleIsOverToday()
}, 500) }, 500)
}else{ }else{
uni.showToast({ title: res.data.msg, icon: 'none'}) uni.showToast({ title: res.data.msg, icon: 'none'})
} }
} else { } else {
uni.showToast({ title: res.data.msg, icon: 'none' }) uni.showToast({ title: res.data.msg, icon: 'none' })
} }
} catch (error) { } catch (error) {
console.log('🚀 ~ getMaInfoScan ~ error:', error) console.log('🚀 ~ getMaInfoScan ~ error:', error)
} finally { } finally {
uni.hideLoading() uni.hideLoading()
} }
} }
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.uni-forms-item--border[data-v-4c3fe719] { .uni-forms-item--border[data-v-4c3fe719] {
margin-bottom: 0; margin-bottom: 0;
padding: 0 0; padding: 0 0;
border-top: 1px #eee solid; border-top: 1px #eee solid;
} }
.page-container { .page-container {
display: flex; display: flex;
height: 100%; height: 100%;
flex-direction: column; flex-direction: column;
background-color: #f7f8fa; background-color: #f7f8fa;
padding: 24rpx; padding: 24rpx;
.table-list-item { .table-list-item {
background: #fff; background: #fff;
padding: 32rpx; padding: 32rpx;
border-radius: 20rpx; border-radius: 20rpx;
box-shadow: 0 4rpx 16rpx rgba(0, 0, 0, 0.06); box-shadow: 0 4rpx 16rpx rgba(0, 0, 0, 0.06);
margin-bottom: 24rpx; margin-bottom: 24rpx;
// //
:deep(.uni-forms) { :deep(.uni-forms) {
.uni-forms-item { .uni-forms-item {
margin-bottom: 24rpx; margin-bottom: 24rpx;
padding: 0; padding: 0;
&:last-child { &:last-child {
margin-bottom: 0; margin-bottom: 0;
} }
.uni-forms-item__label { .uni-forms-item__label {
color: #8c8c8c; color: #8c8c8c;
font-size: 28rpx; font-size: 28rpx;
font-weight: 500; font-weight: 500;
padding: 0; padding: 0;
line-height: 1.8; line-height: 1.8;
} }
.uni-forms-item__content { .uni-forms-item__content {
display: flex; display: flex;
align-items: center; align-items: center;
min-height: unset; min-height: unset;
} }
} }
} }
// //
.coding-btn { .coding-btn {
padding: 16rpx 0; padding: 16rpx 0;
background: linear-gradient(135deg, #4b8eff 0%, #3784fb 100%); background: linear-gradient(135deg, #4b8eff 0%, #3784fb 100%);
border-radius: 12rpx; border-radius: 12rpx;
text-align: center; text-align: center;
color: #fff; color: #fff;
font-size: 28rpx; font-size: 28rpx;
font-weight: 600; font-weight: 600;
box-shadow: 0 6rpx 20rpx rgba(55, 132, 251, 0.2); box-shadow: 0 6rpx 20rpx rgba(55, 132, 251, 0.2);
transition: all 0.3s ease; transition: all 0.3s ease;
&:active { &:active {
transform: scale(0.98); transform: scale(0.98);
opacity: 0.9; opacity: 0.9;
} }
// //
&.search-btn { &.search-btn {
padding: 12rpx 0; padding: 12rpx 0;
background: #fff; background: #fff;
color: #ff9800; color: #ff9800;
border: 2rpx solid rgba(255, 152, 0, 0.5); border: 2rpx solid rgba(255, 152, 0, 0.5);
background: linear-gradient(to bottom, rgba(255, 152, 0, 0.05), rgba(255, 152, 0, 0.1)); background: linear-gradient(to bottom, rgba(255, 152, 0, 0.05), rgba(255, 152, 0, 0.1));
box-shadow: none; box-shadow: none;
font-weight: 600; font-weight: 600;
letter-spacing: 1rpx; letter-spacing: 1rpx;
&:active { &:active {
background: rgba(255, 152, 0, 0.15); background: rgba(255, 152, 0, 0.15);
border-color: rgba(255, 152, 0, 0.6); border-color: rgba(255, 152, 0, 0.6);
transform: translateY(1rpx); transform: translateY(1rpx);
} }
} }
} }
// //
:deep(.uni-row) { :deep(.uni-row) {
/* margin-bottom: 20rpx; */ /* margin-bottom: 20rpx; */
&:last-child { &:last-child {
margin-bottom: 0; margin-bottom: 0;
} }
.uni-col-6 { .uni-col-6 {
color: #8c8c8c; color: #8c8c8c;
font-size: 28rpx; font-size: 28rpx;
font-weight: 500; font-weight: 500;
} }
.cont { .cont {
color: #262626; color: #262626;
font-size: 28rpx; font-size: 28rpx;
font-weight: 500; font-weight: 500;
line-height: 1.8; line-height: 1.8;
} }
} }
// //
:deep(.uni-easyinput__content) { :deep(.uni-easyinput__content) {
background-color: #f7f8fa; background-color: #f7f8fa;
border: 2rpx solid #e8e8e8; border: 2rpx solid #e8e8e8;
border-radius: 12rpx; border-radius: 12rpx;
height: 75rpx; height: 75rpx;
transition: all 0.3s ease; transition: all 0.3s ease;
&:focus-within { &:focus-within {
border-color: #3784fb; border-color: #3784fb;
box-shadow: 0 0 0 2rpx rgba(55, 132, 251, 0.1); box-shadow: 0 0 0 2rpx rgba(55, 132, 251, 0.1);
} }
.uni-easyinput__content-input { .uni-easyinput__content-input {
font-size: 28rpx; font-size: 28rpx;
color: #262626; color: #262626;
} }
} }
// //
:deep(checkbox) { :deep(checkbox) {
.wx-checkbox-input { .wx-checkbox-input {
width: 36rpx; width: 36rpx;
height: 36rpx; height: 36rpx;
border-radius: 8rpx; border-radius: 8rpx;
border: 2rpx solid #e8e8e8; border: 2rpx solid #e8e8e8;
background: transparent; background: transparent;
&.wx-checkbox-input-checked { &.wx-checkbox-input-checked {
background: #3784fb; background: #3784fb;
border-color: #3784fb; border-color: #3784fb;
&::before { &::before {
font-size: 28rpx; font-size: 28rpx;
color: #fff; color: #fff;
} }
} }
&.wx-checkbox-input-disabled { &.wx-checkbox-input-disabled {
background: #f5f5f5; background: #f5f5f5;
border-color: #e8e8e8; border-color: #e8e8e8;
} }
} }
} }
} }
// //
.outbound-btn { .outbound-btn {
width: 96%; width: 96%;
height: 88rpx; height: 88rpx;
margin: 10rpx auto; margin: 10rpx auto;
background: linear-gradient(135deg, #4b8eff 0%, #3784fb 100%); background: linear-gradient(135deg, #4b8eff 0%, #3784fb 100%);
text-align: center; text-align: center;
line-height: 88rpx; line-height: 88rpx;
color: #fff; color: #fff;
border-radius: 12rpx; border-radius: 12rpx;
font-size: 32rpx; font-size: 32rpx;
font-weight: 600; font-weight: 600;
box-shadow: 0 6rpx 20rpx rgba(55, 132, 251, 0.2); box-shadow: 0 6rpx 20rpx rgba(55, 132, 251, 0.2);
transition: all 0.3s ease; transition: all 0.3s ease;
} }
} }
// //
.loading-text { .loading-text {
text-align: center; text-align: center;
font-size: 26rpx; font-size: 26rpx;
color: #8c8c8c; color: #8c8c8c;
padding: 32rpx 0; padding: 32rpx 0;
letter-spacing: 1rpx; letter-spacing: 1rpx;
} }
.form-section { .form-section {
background: #fff; background: #fff;
border-radius: 20rpx; border-radius: 20rpx;
margin-bottom: 24rpx; margin-bottom: 24rpx;
box-shadow: 0 4rpx 16rpx rgba(0, 0, 0, 0.06); box-shadow: 0 4rpx 16rpx rgba(0, 0, 0, 0.06);
// //
.section-header { .section-header {
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;
align-items: center; align-items: center;
padding: 24rpx 32rpx; padding: 24rpx 32rpx;
background: #fff; background: #fff;
cursor: pointer; cursor: pointer;
transition: all 0.3s ease; transition: all 0.3s ease;
&:active { &:active {
background: #f7f8fa; background: #f7f8fa;
} }
.title { .title {
font-size: 32rpx; font-size: 32rpx;
font-weight: 600; font-weight: 600;
color: #262626; color: #262626;
} }
} }
// //
.form-content { .form-content {
// max-height: 0; // max-height: 0;
overflow: auto; overflow: auto;
transition: max-height 0.3s ease-out; transition: max-height 0.3s ease-out;
:deep(.uni-forms) { :deep(.uni-forms) {
padding: 0 32rpx 32rpx; padding: 0 32rpx 32rpx;
} }
:deep(.uni-forms-item) { :deep(.uni-forms-item) {
margin-bottom: 10rpx; margin-bottom: 10rpx;
&:last-child { &:last-child {
margin-bottom: 0; margin-bottom: 0;
} }
.uni-forms-item__label { .uni-forms-item__label {
color: #8c8c8c; color: #8c8c8c;
} }
.form-view { .form-view {
height: 100%; height: 100%;
display: flex; display: flex;
align-items: center; align-items: center;
color: #262626; color: #262626;
font-size: 28rpx; font-size: 28rpx;
} }
} }
} }
} }
</style> </style>