编码识别问题完善
This commit is contained in:
parent
a0cde7db6b
commit
0694c4c573
|
|
@ -66,7 +66,8 @@
|
|||
<view>
|
||||
<uni-easyinput
|
||||
v-model="queryBindForm.codeSuffixStart"
|
||||
type="number" maxlength="6"
|
||||
type="number"
|
||||
maxlength="6"
|
||||
placeholder="开始值"
|
||||
/>
|
||||
</view>
|
||||
|
|
@ -75,7 +76,8 @@
|
|||
<view>
|
||||
<uni-easyinput
|
||||
v-model="queryBindForm.codeSuffixEnd"
|
||||
type="number" maxlength="6"
|
||||
type="number"
|
||||
maxlength="6"
|
||||
placeholder="结束值"
|
||||
/>
|
||||
</view>
|
||||
|
|
@ -254,24 +256,26 @@ const onHandlerFill = () => {
|
|||
let passCodeNUm =
|
||||
codeSuffixEnd - codeSuffixStart + 1 > waitBindNum.value
|
||||
? waitBindNum.value
|
||||
: codeSuffixEnd - codeSuffixStart + 1
|
||||
: codeSuffixEnd - codeSuffixStart + 1
|
||||
codeBindingList.value = []
|
||||
console.log(codeSuffixStart)
|
||||
console.log(codeSuffixEnd)
|
||||
console.log(codeSuffixEnd.length)
|
||||
console.log(passCodeNUm)
|
||||
console.log(codeSuffixStart)
|
||||
console.log(codeSuffixEnd)
|
||||
console.log(codeSuffixEnd.length)
|
||||
console.log(passCodeNUm)
|
||||
// 循环生成编码
|
||||
for (let i = 0; i < passCodeNUm; i++) {
|
||||
let digitNum = -4;
|
||||
if(codeSuffixEnd.length>4){
|
||||
digitNum = 0-codeSuffixEnd.length;
|
||||
}
|
||||
let digitNum = -4
|
||||
if (codeSuffixEnd.length > 4) {
|
||||
digitNum = 0 - codeSuffixEnd.length
|
||||
}
|
||||
const codeItem = {
|
||||
typeName,
|
||||
maTypeName,
|
||||
outFacCode: '',
|
||||
// productDate: "",
|
||||
maCode: `${codePrefix}${('000000'+Number(Number(codeSuffixStart) + i)).slice(digitNum)}`,
|
||||
maCode: `${codePrefix}${('000000' + Number(Number(codeSuffixStart) + i)).slice(
|
||||
digitNum,
|
||||
)}`,
|
||||
}
|
||||
codeBindingList.value.push(codeItem)
|
||||
}
|
||||
|
|
@ -285,9 +289,7 @@ const onHandelDelete = (index) => {
|
|||
// 编码识别按钮
|
||||
const onCodeIdentify = () => {
|
||||
uni.navigateTo({
|
||||
url: `/pages/new-purchase/bind/ocr-bind?queryParams=${JSON.stringify(
|
||||
queryParams.value,
|
||||
)}`,
|
||||
url: `/pages/new-purchase/bind/ocr-bind?queryParams=${JSON.stringify(queryParams.value)}`,
|
||||
})
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -27,15 +27,28 @@
|
|||
<uni-easyinput v-model="formData.qrCode" :disabled="true" />
|
||||
</uni-forms-item>
|
||||
<uni-forms-item label="设备编码:" name="maCode">
|
||||
<uni-easyinput v-model="formData.maCode" :maxlength="50" placeholder="请输入设备编码"/>
|
||||
</uni-forms-item>
|
||||
<uni-easyinput
|
||||
v-model="formData.maCode"
|
||||
:maxlength="50"
|
||||
placeholder="请输入设备编码"
|
||||
/>
|
||||
</uni-forms-item>
|
||||
<uni-forms-item label="出厂编码:" name="outFacCode">
|
||||
<uni-easyinput v-model="formData.outFacCode" :maxlength="50" placeholder="请输入出厂编码" />
|
||||
<uni-easyinput
|
||||
v-model="formData.outFacCode"
|
||||
:maxlength="50"
|
||||
placeholder="请输入出厂编码"
|
||||
/>
|
||||
</uni-forms-item>
|
||||
<!-- <uni-forms-item label="出厂日期:" name="warnDocuments">
|
||||
</uni-forms-item> -->
|
||||
</uni-forms>
|
||||
</div>
|
||||
<ScanQrCode
|
||||
ref="scanQrCodeRef"
|
||||
@scanSuccess="handleScanSuccess"
|
||||
@scanError="handleScanError"
|
||||
/>
|
||||
<div class="btn">
|
||||
<button class="btn-cont" @click="backPage">取消</button>
|
||||
<button class="btn-cont" @click="onHandleBinding">确认</button>
|
||||
|
|
@ -45,9 +58,10 @@
|
|||
|
||||
<script setup>
|
||||
import { ref, computed } from 'vue'
|
||||
import { setBindCodingAPI,getTypeByQrcode } from '@/services/new-purchase/bind.js'
|
||||
import { setBindCodingAPI, getTypeByQrcode } from '@/services/new-purchase/bind.js'
|
||||
import { debounce } from 'lodash-es'
|
||||
import { onShow, onLoad } from '@dcloudio/uni-app'
|
||||
import ScanQrCode from '@/pages/devicesSearch/ScanQrCode.vue'
|
||||
// const query = defineProps() // 获取上级页面传递的路由参数
|
||||
// const queryParams = JSON.parse(query.queryParams)
|
||||
const queryParams = ref({})
|
||||
|
|
@ -56,13 +70,14 @@ const formData = ref({
|
|||
qrCode: '',
|
||||
maCode: '',
|
||||
outFacCode: '',
|
||||
})
|
||||
})
|
||||
const maInfo = ref({})
|
||||
const codeNun = ref(0)
|
||||
// 计算待绑定数量
|
||||
const waitBindNum = computed(() => {
|
||||
return queryParams.value.checkNum - queryParams.value.bindNum - codeNun.value
|
||||
})
|
||||
const scanQrCodeRef = ref(null)
|
||||
|
||||
onLoad((options) => {
|
||||
queryParams.value = JSON.parse(options.queryParams)
|
||||
|
|
@ -70,120 +85,138 @@ onLoad((options) => {
|
|||
|
||||
// 编码识别按钮
|
||||
const scanStart = () => {
|
||||
if(queryParams.value.checkNum - queryParams.value.bindNum - codeNun.value==0){
|
||||
uni.showToast({ title: '待绑定数量为空!', icon: 'none' })
|
||||
}else{
|
||||
console.log('编码识别--')
|
||||
var mpaasScanModule = uni.requireNativePlugin("Mpaas-Scan-Module")
|
||||
mpaasScanModule.mpaasScan({
|
||||
// 扫码识别类型,参数可多选,qrCode、barCode,不设置,默认识别所有
|
||||
'scanType': ['qrCode','barCode'],
|
||||
// 是否隐藏相册,默认false不隐藏
|
||||
'hideAlbum': false,
|
||||
//ios需要设置这个参数,只支持中英文 zh-Hans、en,默认中文
|
||||
'language' : 'en',
|
||||
//相册选择照片识别错误提示(ios)
|
||||
'failedMsg': '未识别到二维码,请重试',
|
||||
//Android支持全屏需要设置此参数
|
||||
'screenType': 'full'
|
||||
},(ret) => {
|
||||
console.log(ret)
|
||||
if(ret.resp_code==10){
|
||||
uni.showToast({ title: '用户取消', icon: 'none' })
|
||||
}
|
||||
if(ret.resp_code==11){
|
||||
uni.showToast({ title: '扫码失败', icon: 'none' })
|
||||
}
|
||||
if(ret.resp_code==1000){
|
||||
// uni.showToast({ title: '扫码成功', icon: 'none' })
|
||||
formData.value.qrCode = ret.resp_result.split("qrcode=")[1]
|
||||
codeInBind()
|
||||
}
|
||||
// uni.showModal({
|
||||
// title: "弹窗标题",
|
||||
// // 返回值中,resp_code 表示返回结果值,10:用户取消,11:其他错误,1000:成功
|
||||
// // 返回值中,resp_message 表示返回结果信息
|
||||
// // 返回值中,resp_result 表示扫码结果,只有成功才会有返回
|
||||
// content: JSON.stringify(ret),
|
||||
// showCancel: false,
|
||||
// confirmText: "确定"
|
||||
// })
|
||||
})
|
||||
|
||||
|
||||
}
|
||||
|
||||
if (queryParams.value.checkNum - queryParams.value.bindNum - codeNun.value == 0) {
|
||||
uni.showToast({ title: '待绑定数量为空!', icon: 'none' })
|
||||
} else {
|
||||
if (scanQrCodeRef.value) {
|
||||
scanQrCodeRef.value.scanQrCode()
|
||||
}
|
||||
// console.log('编码识别--')
|
||||
// var mpaasScanModule = uni.requireNativePlugin('Mpaas-Scan-Module')
|
||||
// mpaasScanModule.mpaasScan(
|
||||
// {
|
||||
// // 扫码识别类型,参数可多选,qrCode、barCode,不设置,默认识别所有
|
||||
// scanType: ['qrCode', 'barCode'],
|
||||
// // 是否隐藏相册,默认false不隐藏
|
||||
// hideAlbum: false,
|
||||
// //ios需要设置这个参数,只支持中英文 zh-Hans、en,默认中文
|
||||
// language: 'en',
|
||||
// //相册选择照片识别错误提示(ios)
|
||||
// failedMsg: '未识别到二维码,请重试',
|
||||
// //Android支持全屏需要设置此参数
|
||||
// screenType: 'full',
|
||||
// },
|
||||
// (ret) => {
|
||||
// console.log(ret)
|
||||
// if (ret.resp_code == 10) {
|
||||
// uni.showToast({ title: '用户取消', icon: 'none' })
|
||||
// }
|
||||
// if (ret.resp_code == 11) {
|
||||
// uni.showToast({ title: '扫码失败', icon: 'none' })
|
||||
// }
|
||||
// if (ret.resp_code == 1000) {
|
||||
// // uni.showToast({ title: '扫码成功', icon: 'none' })
|
||||
// formData.value.qrCode = ret.resp_result.split('qrcode=')[1]
|
||||
// codeInBind()
|
||||
// }
|
||||
// // uni.showModal({
|
||||
// // title: "弹窗标题",
|
||||
// // // 返回值中,resp_code 表示返回结果值,10:用户取消,11:其他错误,1000:成功
|
||||
// // // 返回值中,resp_message 表示返回结果信息
|
||||
// // // 返回值中,resp_result 表示扫码结果,只有成功才会有返回
|
||||
// // content: JSON.stringify(ret),
|
||||
// // showCancel: false,
|
||||
// // confirmText: "确定"
|
||||
// // })
|
||||
// },
|
||||
// )
|
||||
}
|
||||
}
|
||||
|
||||
const codeInBind = async () => {
|
||||
let param = {
|
||||
qrCode: formData.value.qrCode,
|
||||
taskId: queryParams.value.taskId
|
||||
}
|
||||
//通过二维码获取相绑定的设备编码
|
||||
const res = await getTypeByQrcode(param)
|
||||
console.log(res)
|
||||
if(res.code==200){
|
||||
maInfo.value=res.data[0];
|
||||
if(queryParams.value.typeId!=res.data[0].typeId){
|
||||
uni.showToast({ title: '扫码识别物资类型与当前绑定类型不符!', icon: 'none'})
|
||||
}
|
||||
if(res.data[0].maCode&&res.data[0].maCode!=""){
|
||||
uni.showToast({ title: '二维码已绑定过设备编码!', icon: 'none'})
|
||||
}
|
||||
}else{
|
||||
maInfo.value.typeId=""
|
||||
uni.showToast({ title: '扫码识别失败', icon: 'none'})
|
||||
}
|
||||
// 处理扫描成功事件
|
||||
const handleScanSuccess = (result) => {
|
||||
formData.value.qrCode = ''
|
||||
formData.value.qrCode = result?.text.split('qrcode=')[1] || ''
|
||||
if (formData.value.qrCode === '') {
|
||||
uni.showToast({ title: '扫码识别失败', icon: 'none' })
|
||||
} else {
|
||||
codeInBind()
|
||||
}
|
||||
}
|
||||
|
||||
// 处理扫描失败事件
|
||||
const handleScanError = (error) => {
|
||||
console.error('扫描出错:', error.message)
|
||||
uni.showToast({ title: error.message, icon: 'none' })
|
||||
}
|
||||
|
||||
const codeInBind = async () => {
|
||||
let param = {
|
||||
qrCode: formData.value.qrCode,
|
||||
taskId: queryParams.value.taskId,
|
||||
}
|
||||
//通过二维码获取相绑定的设备编码
|
||||
const res = await getTypeByQrcode(param)
|
||||
console.log(res)
|
||||
if (res.code == 200) {
|
||||
maInfo.value = res.data[0]
|
||||
if (queryParams.value.typeId != res.data[0].typeId) {
|
||||
uni.showToast({ title: '扫码识别物资类型与当前绑定类型不符!', icon: 'none' })
|
||||
}
|
||||
if (res.data[0].maCode && res.data[0].maCode != '') {
|
||||
uni.showToast({ title: '二维码已绑定过设备编码!', icon: 'none' })
|
||||
}
|
||||
} else {
|
||||
maInfo.value.typeId = ''
|
||||
uni.showToast({ title: '扫码识别失败', icon: 'none' })
|
||||
}
|
||||
}
|
||||
|
||||
// 绑定按钮
|
||||
const onHandleBinding = debounce(async () => {
|
||||
console.log(formData.value.qrCode)
|
||||
if(formData.value.qrCode==undefined||formData.value.qrCode==""){
|
||||
uni.showToast({ title: '请先扫码后绑定', icon: 'none' })
|
||||
return
|
||||
}else if(queryParams.value.typeId!=maInfo.value.typeId){
|
||||
uni.showToast({ title: '扫码识别物资类型与当前绑定类型不符!', icon: 'none' })
|
||||
return
|
||||
}else if(formData.value.maCode==""){
|
||||
uni.showToast({ title: '请输入绑定的设备编码', icon: 'none' })
|
||||
return
|
||||
}else{
|
||||
let codeList = [
|
||||
{
|
||||
typeName: queryParams.value.typeName,
|
||||
maTypeName: queryParams.value.maTypeName,
|
||||
qrCode: formData.value.qrCode,
|
||||
outFacCode: formData.value.outFacCode,
|
||||
maCode: formData.value.maCode,
|
||||
},
|
||||
]
|
||||
// 组装参数
|
||||
const bindParams = {
|
||||
typeId: queryParams.value.typeId,
|
||||
taskId: queryParams.value.taskId,
|
||||
dtoList: codeList,
|
||||
}
|
||||
console.log('绑定参数', bindParams)
|
||||
const res = await setBindCodingAPI(bindParams)
|
||||
if (res.code === 200) {
|
||||
uni.showToast({
|
||||
title: '编码绑定成功!',
|
||||
icon: 'none',
|
||||
})
|
||||
formData.value.qrCode = '';
|
||||
formData.value.maCode = '';
|
||||
formData.value.outFacCode = '';
|
||||
codeNun.value = codeNun.value + 1;
|
||||
uni.$emit('onUpdate', codeNun.value)
|
||||
setTimeout(() => {
|
||||
scanStart()
|
||||
}, 1000)
|
||||
}
|
||||
}
|
||||
console.log(formData.value.qrCode)
|
||||
if (formData.value.qrCode == undefined || formData.value.qrCode == '') {
|
||||
uni.showToast({ title: '请先扫码后绑定', icon: 'none' })
|
||||
return
|
||||
} else if (queryParams.value.typeId != maInfo.value.typeId) {
|
||||
uni.showToast({ title: '扫码识别物资类型与当前绑定类型不符!', icon: 'none' })
|
||||
return
|
||||
} else if (formData.value.maCode == '') {
|
||||
uni.showToast({ title: '请输入绑定的设备编码', icon: 'none' })
|
||||
return
|
||||
} else {
|
||||
let codeList = [
|
||||
{
|
||||
typeName: queryParams.value.typeName,
|
||||
maTypeName: queryParams.value.maTypeName,
|
||||
qrCode: formData.value.qrCode,
|
||||
outFacCode: formData.value.outFacCode,
|
||||
maCode: formData.value.maCode,
|
||||
},
|
||||
]
|
||||
// 组装参数
|
||||
const bindParams = {
|
||||
typeId: queryParams.value.typeId,
|
||||
taskId: queryParams.value.taskId,
|
||||
dtoList: codeList,
|
||||
}
|
||||
console.log('绑定参数', bindParams)
|
||||
const res = await setBindCodingAPI(bindParams)
|
||||
if (res.code === 200) {
|
||||
uni.showToast({
|
||||
title: '编码绑定成功!',
|
||||
icon: 'none',
|
||||
})
|
||||
formData.value.qrCode = ''
|
||||
formData.value.maCode = ''
|
||||
formData.value.outFacCode = ''
|
||||
codeNun.value = codeNun.value + 1
|
||||
uni.$emit('onUpdate', codeNun.value)
|
||||
setTimeout(() => {
|
||||
scanStart()
|
||||
}, 1000)
|
||||
}
|
||||
}
|
||||
}, 500)
|
||||
|
||||
// 返回
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
<template>
|
||||
<view class="page-container">
|
||||
<view>
|
||||
<!-- <view>
|
||||
<live-pusher
|
||||
v-once
|
||||
id="livePusher"
|
||||
|
|
@ -18,9 +18,9 @@
|
|||
:style="[{ height: cameraHeight + 'rpx', width: '750rpx' }]"
|
||||
>
|
||||
</live-pusher>
|
||||
</view>
|
||||
</view> -->
|
||||
<view class="table-list-item">
|
||||
<view class="scan-btn" @click="handleInstruct('shutter')">
|
||||
<view class="scan-btn" @click="handleInstruct()">
|
||||
<text style="color: #fff">开始识别</text>
|
||||
</view>
|
||||
</view>
|
||||
|
|
@ -47,9 +47,9 @@
|
|||
<uni-forms :model="codeData" label-width="90" :border="true">
|
||||
<uni-forms-item label="识别编码:" name="typeName">
|
||||
<uni-easyinput
|
||||
v-model="codeData.maCode"
|
||||
:disabled="true"
|
||||
placeholder="识别编码"
|
||||
v-model="codeData.maCode"
|
||||
/>
|
||||
</uni-forms-item>
|
||||
<uni-forms-item label="出厂编号:" name="typeModelName">
|
||||
|
|
@ -125,51 +125,137 @@ export default {
|
|||
},
|
||||
})
|
||||
},
|
||||
handleInstruct(instruct) {
|
||||
if (this.ready) {
|
||||
this.ready = false
|
||||
this.livePusher.snapshot({
|
||||
success: async (res) => {
|
||||
console.log('拍照成功', res)
|
||||
this.ready = true
|
||||
let base64 = await this.imgToBase64(res.message.tempImagePath)
|
||||
console.log('base64', base64)
|
||||
let params = {
|
||||
image: base64,
|
||||
jiju_type: '12231',
|
||||
auth_lic:
|
||||
'xIWDlaDVdijcBB4mjhGCPYk5Kvk8tHZJbUn+vW+ih15+MYx98e/PXyBmKL5gFcWMPznLgDA15QuSAnZQSLddwdy9HkZgtuQDEEZZ351Eyb1eiDUccUnyoSGIrNimbx5TooBNNPYqU4qJeFrPJXAqjBHzRrxoBxuR2CEGKQPgHC4=',
|
||||
}
|
||||
// uni.request({
|
||||
// url: '/material/app/ocr/getOcrCode',
|
||||
// method: 'post',
|
||||
// data: params,
|
||||
// header: {
|
||||
// 'Content-Type': 'application/json', // 根据后端要求设置请求头,常见的 POST 请求数据格式为 JSON
|
||||
// },
|
||||
// success: (res) => {
|
||||
// console.log('88888888', res)
|
||||
// if (res.code == 200) {
|
||||
// uni.showToast({
|
||||
// title: '入库成功!',
|
||||
// icon: 'none',
|
||||
// })
|
||||
// } else {
|
||||
// uni.showToast({ title: '入库失败!', icon: 'none' })
|
||||
// }
|
||||
// },
|
||||
// fail: (err) => {
|
||||
// uni.showToast({
|
||||
// title: err,
|
||||
// icon: 'none',
|
||||
// })
|
||||
// },
|
||||
// })
|
||||
handleInstruct() {
|
||||
uni.showActionSheet({
|
||||
itemList: ['拍照', '从相册选择'],
|
||||
success: (res) => {
|
||||
if (res.tapIndex === 0) {
|
||||
this.getCamera()
|
||||
} else if (res.tapIndex === 1) {
|
||||
// 从相册选择
|
||||
this.getPhoto()
|
||||
}
|
||||
},
|
||||
fail: (err) => {
|
||||
console.error('操作菜单选择失败:', err)
|
||||
},
|
||||
})
|
||||
// if (this.ready) {
|
||||
// this.ready = false
|
||||
// this.livePusher.snapshot({
|
||||
// success: async (res) => {
|
||||
// console.log('拍照成功', res)
|
||||
// this.ready = true
|
||||
// let base64 = await this.imgToBase64(res.message.tempImagePath)
|
||||
// console.log('base64', base64)
|
||||
// let params = {
|
||||
// image: base64,
|
||||
// jiju_type: '12231',
|
||||
// auth_lic:
|
||||
// 'xIWDlaDVdijcBB4mjhGCPYk5Kvk8tHZJbUn+vW+ih15+MYx98e/PXyBmKL5gFcWMPznLgDA15QuSAnZQSLddwdy9HkZgtuQDEEZZ351Eyb1eiDUccUnyoSGIrNimbx5TooBNNPYqU4qJeFrPJXAqjBHzRrxoBxuR2CEGKQPgHC4=',
|
||||
// }
|
||||
// // uni.request({
|
||||
// // url: '/material/app/ocr/getOcrCode',
|
||||
// // method: 'post',
|
||||
// // data: params,
|
||||
// // header: {
|
||||
// // 'Content-Type': 'application/json', // 根据后端要求设置请求头,常见的 POST 请求数据格式为 JSON
|
||||
// // },
|
||||
// // success: (res) => {
|
||||
// // console.log('88888888', res)
|
||||
// // if (res.code == 200) {
|
||||
// // uni.showToast({
|
||||
// // title: '入库成功!',
|
||||
// // icon: 'none',
|
||||
// // })
|
||||
// // } else {
|
||||
// // uni.showToast({ title: '入库失败!', icon: 'none' })
|
||||
// // }
|
||||
// // },
|
||||
// // fail: (err) => {
|
||||
// // uni.showToast({
|
||||
// // title: err,
|
||||
// // icon: 'none',
|
||||
// // })
|
||||
// // },
|
||||
// // })
|
||||
// //this.$emit('getImage', res.message.tempImagePath)
|
||||
// },
|
||||
// })
|
||||
// }
|
||||
},
|
||||
|
||||
//this.$emit('getImage', res.message.tempImagePath)
|
||||
},
|
||||
})
|
||||
getCamera() {
|
||||
console.log(1)
|
||||
navigator.camera.getPicture(this.onCameraSuccess, this.onCameraError, {
|
||||
quality: 50,
|
||||
destinationType: window.Camera.DestinationType.DATA_URL,
|
||||
sourceType: window.Camera.PictureSourceType.CAMERA,
|
||||
})
|
||||
},
|
||||
getPhoto() {
|
||||
console.log(2)
|
||||
navigator.camera.getPicture(this.onCameraSuccess, this.onCameraError, {
|
||||
quality: 50,
|
||||
destinationType: window.Camera.DestinationType.DATA_URL,
|
||||
sourceType: window.Camera.PictureSourceType.SAVEDPHOTOALBUM,
|
||||
})
|
||||
},
|
||||
onCameraError(message) {
|
||||
console.log(message)
|
||||
},
|
||||
onCameraSuccess(file) {
|
||||
// const file1 = "data:image/jpeg;base64," + file;
|
||||
const file1 = file
|
||||
let params = {
|
||||
image: file1,
|
||||
jiju_type: '',
|
||||
auth_lic:
|
||||
'xIWDlaDVdijcBB4mjhGCPYk5Kvk8tHZJbUn+vW+ih15+MYx98e/PXyBmKL5gFcWMPznLgDA15QuSAnZQSLddwdy9HkZgtuQDEEZZ351Eyb1eiDUccUnyoSGIrNimbx5TooBNNPYqU4qJeFrPJXAqjBHzRrxoBxuR2CEGKQPgHC4=',
|
||||
}
|
||||
|
||||
this.testParams = params
|
||||
// this.$http
|
||||
// .post("/dzqm/uploadSignature", {
|
||||
// base64Str: file1,
|
||||
// })
|
||||
// .then((res) => {
|
||||
// console.log(res);
|
||||
// if (res.code == 200) {
|
||||
// // this.src = file
|
||||
// this.$set(this.obj, "src", file1);
|
||||
// this.$toast("上传成功!");
|
||||
// this.PictureVisible = false;
|
||||
// }
|
||||
// });
|
||||
|
||||
uni.request({
|
||||
url: '/material/app/ocr/getOcrCode',
|
||||
method: 'post',
|
||||
data: params,
|
||||
header: {
|
||||
'Content-Type': 'application/json', // 根据后端要求设置请求头,常见的 POST 请求数据格式为 JSON
|
||||
},
|
||||
success: (res) => {
|
||||
const { data: resData } = res
|
||||
|
||||
if (resData.data.data.result) {
|
||||
// this.queryCodeParams.maCode = resData.data.data.result
|
||||
this.codeData.maCode = resData.data.data.result
|
||||
} else {
|
||||
uni.showToast({
|
||||
title: '识别失败!' + resData.data.msg,
|
||||
icon: 'none',
|
||||
})
|
||||
}
|
||||
},
|
||||
fail: (err) => {
|
||||
uni.showToast({
|
||||
title: '请求失败:' + err.errMsg,
|
||||
icon: 'none',
|
||||
})
|
||||
},
|
||||
})
|
||||
},
|
||||
|
||||
imgToBase64(filePath) {
|
||||
|
|
@ -252,7 +338,15 @@ export default {
|
|||
})
|
||||
},
|
||||
|
||||
// 绑定按钮
|
||||
async onHandleBind() {
|
||||
if (this.codeData.maCode == '') {
|
||||
uni.showToast({
|
||||
title: '请先识别设备编码!',
|
||||
icon: 'none',
|
||||
})
|
||||
return
|
||||
}
|
||||
// let paramsList = []
|
||||
// paramsList.push({
|
||||
// maCode: this.codeData.maCode,
|
||||
|
|
@ -336,14 +430,14 @@ export default {
|
|||
}
|
||||
|
||||
.outbound-btn {
|
||||
position: fixed;
|
||||
position: absolute;
|
||||
bottom: 40rpx;
|
||||
left: 20%;
|
||||
/* transform: translateX(-50%); */
|
||||
left: 50%;
|
||||
transform: translateX(-50%);
|
||||
/* width: 90%; */
|
||||
height: 88rpx;
|
||||
width: 620rpx;
|
||||
margin: 0 10px;
|
||||
/* margin: 0 10px; */
|
||||
/* background: linear-gradient(135deg, #4b8eff 0%, #3784fb 100%); */
|
||||
background: #4b8eff;
|
||||
display: flex;
|
||||
|
|
@ -1,21 +1,21 @@
|
|||
<template>
|
||||
<!-- 编码出库-->
|
||||
<view class="page-container">
|
||||
<div class="card" style="margin-bottom: 10px">
|
||||
<uni-forms :model="formData" label-width="100" :border="true">
|
||||
<uni-forms-item label="物资名称:" name="maTypeName">
|
||||
<span class="form-view">{{ queryParams.maTypeName }}</span>
|
||||
</uni-forms-item>
|
||||
|
||||
<uni-forms-item label="物资规格:" name="typeName">
|
||||
<span class="form-view">{{ queryParams.typeName }}</span>
|
||||
</uni-forms-item>
|
||||
|
||||
<uni-forms-item label="待入库数量:" name="purchaseNum">
|
||||
<span class="form-view">{{ codeDeviceList.length }}</span>
|
||||
</uni-forms-item>
|
||||
</uni-forms>
|
||||
</div>
|
||||
<div class="card" style="margin-bottom: 10px">
|
||||
<uni-forms :model="formData" label-width="100" :border="true">
|
||||
<uni-forms-item label="物资名称:" name="maTypeName">
|
||||
<span class="form-view">{{ queryParams.maTypeName }}</span>
|
||||
</uni-forms-item>
|
||||
|
||||
<uni-forms-item label="物资规格:" name="typeName">
|
||||
<span class="form-view">{{ queryParams.typeName }}</span>
|
||||
</uni-forms-item>
|
||||
|
||||
<uni-forms-item label="待入库数量:" name="purchaseNum">
|
||||
<span class="form-view">{{ codeDeviceList.length }}</span>
|
||||
</uni-forms-item>
|
||||
</uni-forms>
|
||||
</div>
|
||||
<view class="table-list-item">
|
||||
<uni-row :gutter="24">
|
||||
<uni-col :span="6">入库方式:</uni-col>
|
||||
|
|
@ -29,7 +29,12 @@
|
|||
<view class="coding-btn" @click="boxScan">标准箱识别</view>
|
||||
</uni-col> -->
|
||||
</uni-row>
|
||||
</view>
|
||||
</view>
|
||||
<scan-qr-code
|
||||
ref="scanQrCodeRef"
|
||||
@scanSuccess="handleScanSuccess"
|
||||
@scanError="handleScanError"
|
||||
/>
|
||||
<scroll-view scroll-y @scrolltolower="onScrollTolower" style="padding-bottom: 50rpx">
|
||||
<view class="table-list-item" v-for="item in codeDeviceList" :key="item.id">
|
||||
<uni-row :gutter="24">
|
||||
|
|
@ -64,36 +69,33 @@
|
|||
</uni-col>
|
||||
</uni-row>
|
||||
</view>
|
||||
</scroll-view>
|
||||
</scroll-view>
|
||||
<view class="outbound-btn" @tap="onHandleOutbound"> 入库 </view>
|
||||
<view class="checked-btn" @tap="checkedAll">
|
||||
<span>全选</span><span>({{total}})</span>
|
||||
</view>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<span>全选</span><span>({{ total }})</span>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref, computed } from 'vue'
|
||||
import { getMachineById, setInboundCodeAPI,getTypeByQrcodeApi } from '@/services/purchase.js'
|
||||
import { getMaCodeByQrCodeApi } from '@/services/index.js';
|
||||
import { getInfoBindByCode,appWarehouseApi } from '@/services/standard.js'
|
||||
import { getMachineById, setInboundCodeAPI, getTypeByQrcodeApi } from '@/services/purchase.js'
|
||||
import { getMaCodeByQrCodeApi } from '@/services/index.js'
|
||||
import { getInfoBindByCode, appWarehouseApi } from '@/services/standard.js'
|
||||
import { getTypeByQrcode } from '@/services/new-purchase/bind.js'
|
||||
import { onBackPress, onLoad,onShow } from '@dcloudio/uni-app'
|
||||
import { onBackPress, onLoad, onShow } from '@dcloudio/uni-app'
|
||||
import ScanQrCode from '@/pages/devicesSearch/ScanQrCode.vue'
|
||||
|
||||
const codeDeviceList = ref([])
|
||||
const total = ref(0)//已选择数量
|
||||
const total = ref(0) //已选择数量
|
||||
// const query = defineProps() // 获取上级页面传递的路由参数
|
||||
// const queryParams = JSON.parse(query.queryParams)
|
||||
const queryParams = ref({})
|
||||
const boxCode = ref("")
|
||||
const boxCode = ref('')
|
||||
const boxInfo = ref({})
|
||||
const qrCode = ref("")
|
||||
const maInfo = ref({})
|
||||
const qrCode = ref('')
|
||||
const maInfo = ref({})
|
||||
const scanQrCodeRef = ref(null)
|
||||
// const typeId = ref('')
|
||||
// const taskId = ref('')
|
||||
// const maTypeName = ref('')
|
||||
|
|
@ -108,147 +110,173 @@ const onCodeIdentify = () => {
|
|||
|
||||
// 二维码扫码
|
||||
const codeScan = async () => {
|
||||
if(codeDeviceList.value.length==0){
|
||||
uni.showToast({ title: '待入库数量为空', icon: 'none'})
|
||||
}else{
|
||||
qrCode.value=""
|
||||
var mpaasScanModule = uni.requireNativePlugin("Mpaas-Scan-Module")
|
||||
mpaasScanModule.mpaasScan({
|
||||
// 扫码识别类型,参数可多选,qrCode、barCode,不设置,默认识别所有
|
||||
'scanType': ['qrCode','barCode'],
|
||||
// 是否隐藏相册,默认false不隐藏
|
||||
'hideAlbum': false,
|
||||
//ios需要设置这个参数,只支持中英文 zh-Hans、en,默认中文
|
||||
'language' : 'en',
|
||||
//相册选择照片识别错误提示(ios)
|
||||
'failedMsg': '未识别到二维码,请重试',
|
||||
//Android支持全屏需要设置此参数
|
||||
'screenType': 'full'
|
||||
},(ret) => {
|
||||
console.log(ret)
|
||||
if(ret.resp_code==10){
|
||||
uni.showToast({ title: '用户取消', icon: 'none' })
|
||||
}
|
||||
if(ret.resp_code==11){
|
||||
uni.showToast({ title: '扫码失败', icon: 'none' })
|
||||
}
|
||||
if(ret.resp_code==1000){
|
||||
qrCode.value = ret.resp_result.split("qrcode=")[1];
|
||||
codeInBound()
|
||||
}
|
||||
// uni.showModal({
|
||||
// title: "弹窗标题",
|
||||
// // 返回值中,resp_code 表示返回结果值,10:用户取消,11:其他错误,1000:成功
|
||||
// // 返回值中,resp_message 表示返回结果信息
|
||||
// // 返回值中,resp_result 表示扫码结果,只有成功才会有返回
|
||||
// content: JSON.stringify(ret),
|
||||
// showCancel: false,
|
||||
// confirmText: "确定"
|
||||
// })
|
||||
})
|
||||
}
|
||||
if (codeDeviceList.value.length == 0) {
|
||||
uni.showToast({ title: '待入库数量为空', icon: 'none' })
|
||||
} else {
|
||||
qrCode.value = ''
|
||||
if (scanQrCodeRef.value) {
|
||||
scanQrCodeRef.value.scanQrCode()
|
||||
}
|
||||
// var mpaasScanModule = uni.requireNativePlugin('Mpaas-Scan-Module')
|
||||
// mpaasScanModule.mpaasScan(
|
||||
// {
|
||||
// // 扫码识别类型,参数可多选,qrCode、barCode,不设置,默认识别所有
|
||||
// scanType: ['qrCode', 'barCode'],
|
||||
// // 是否隐藏相册,默认false不隐藏
|
||||
// hideAlbum: false,
|
||||
// //ios需要设置这个参数,只支持中英文 zh-Hans、en,默认中文
|
||||
// language: 'en',
|
||||
// //相册选择照片识别错误提示(ios)
|
||||
// failedMsg: '未识别到二维码,请重试',
|
||||
// //Android支持全屏需要设置此参数
|
||||
// screenType: 'full',
|
||||
// },
|
||||
// (ret) => {
|
||||
// console.log(ret)
|
||||
// if (ret.resp_code == 10) {
|
||||
// uni.showToast({ title: '用户取消', icon: 'none' })
|
||||
// }
|
||||
// if (ret.resp_code == 11) {
|
||||
// uni.showToast({ title: '扫码失败', icon: 'none' })
|
||||
// }
|
||||
// if (ret.resp_code == 1000) {
|
||||
// qrCode.value = ret.resp_result.split('qrcode=')[1]
|
||||
// codeInBound()
|
||||
// }
|
||||
// // uni.showModal({
|
||||
// // title: "弹窗标题",
|
||||
// // // 返回值中,resp_code 表示返回结果值,10:用户取消,11:其他错误,1000:成功
|
||||
// // // 返回值中,resp_message 表示返回结果信息
|
||||
// // // 返回值中,resp_result 表示扫码结果,只有成功才会有返回
|
||||
// // content: JSON.stringify(ret),
|
||||
// // showCancel: false,
|
||||
// // confirmText: "确定"
|
||||
// // })
|
||||
// },
|
||||
// )
|
||||
}
|
||||
}
|
||||
|
||||
// 处理扫描成功事件
|
||||
const handleScanSuccess = (result) => {
|
||||
qrCode.value = ''
|
||||
qrCode.value = result?.text.split('qrcode=')[1] || ''
|
||||
if (qrCode.value === '') {
|
||||
uni.showToast({ title: '扫码识别失败', icon: 'none' })
|
||||
} else {
|
||||
codeInBound()
|
||||
}
|
||||
}
|
||||
|
||||
// 处理扫描失败事件
|
||||
const handleScanError = (error) => {
|
||||
console.error('扫描出错:', error.message)
|
||||
uni.showToast({ title: error.message, icon: 'none' })
|
||||
}
|
||||
// 二维码入库
|
||||
const codeInBound = async () => {
|
||||
if(qrCode.value==""){
|
||||
uni.showToast({ title: '扫码识别失败', icon: 'none'})
|
||||
}else{
|
||||
let param = {
|
||||
qrCode: qrCode.value,
|
||||
}
|
||||
console.log(param)
|
||||
//通过二维码获取相绑定的设备编码
|
||||
const res = await getMaCodeByQrCodeApi(param)
|
||||
console.log(res)
|
||||
if(res.code==200){
|
||||
maInfo.value = res.data
|
||||
if(maInfo.value.maCode==undefined||maInfo.value.maCode==""){
|
||||
uni.showToast({ title: '扫码二维码未绑定设备编码!', icon: 'none'})
|
||||
}else if(maInfo.value.maStatus==1){
|
||||
uni.showToast({ title: '扫码设备已在库!', icon: 'none'})
|
||||
}else{
|
||||
uni.showModal({
|
||||
title: '提示',
|
||||
content: `扫码到二维码${qrCode.value}所绑定的设备编码为${maInfo.value.maCode},是否确定入库?`,
|
||||
confirmText: '确定',
|
||||
cancelText: '取消',
|
||||
success: async (res) => {
|
||||
if (res.confirm) {
|
||||
confirmCodeInBound()
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
}else{
|
||||
uni.showToast({ title: '扫码识别失败', icon: 'none'})
|
||||
}
|
||||
}
|
||||
const codeInBound = async () => {
|
||||
if (qrCode.value == '') {
|
||||
uni.showToast({ title: '扫码识别失败', icon: 'none' })
|
||||
} else {
|
||||
let param = {
|
||||
qrCode: qrCode.value,
|
||||
}
|
||||
console.log(param)
|
||||
//通过二维码获取相绑定的设备编码
|
||||
const res = await getMaCodeByQrCodeApi(param)
|
||||
console.log(res)
|
||||
if (res.code == 200) {
|
||||
maInfo.value = res.data
|
||||
if (maInfo.value.maCode == undefined || maInfo.value.maCode == '') {
|
||||
uni.showToast({ title: '扫码二维码未绑定设备编码!', icon: 'none' })
|
||||
} else if (maInfo.value.maStatus == 1) {
|
||||
uni.showToast({ title: '扫码设备已在库!', icon: 'none' })
|
||||
} else {
|
||||
uni.showModal({
|
||||
title: '提示',
|
||||
content: `扫码到二维码${qrCode.value}所绑定的设备编码为${maInfo.value.maCode},是否确定入库?`,
|
||||
confirmText: '确定',
|
||||
cancelText: '取消',
|
||||
success: async (res) => {
|
||||
if (res.confirm) {
|
||||
confirmCodeInBound()
|
||||
}
|
||||
},
|
||||
})
|
||||
}
|
||||
} else {
|
||||
uni.showToast({ title: '扫码识别失败', icon: 'none' })
|
||||
}
|
||||
}
|
||||
}
|
||||
// 二维码入库确认
|
||||
const confirmCodeInBound = async () => {
|
||||
let arr=[{"maCode":maInfo.value.maCode}]
|
||||
let param = {
|
||||
taskId: queryParams.value.taskId,
|
||||
typeId: queryParams.value.typeId,
|
||||
purchaseId: queryParams.value.id,
|
||||
inPutList: arr
|
||||
}
|
||||
|
||||
const res = await setInboundCodeAPI(param)
|
||||
if (res.code === 200) {
|
||||
uni.showToast({
|
||||
title: '入库成功!',
|
||||
icon: 'none',
|
||||
})
|
||||
getCodeDeviceListData()
|
||||
// uni.$emit('onUpdate')
|
||||
setTimeout(() => {
|
||||
codeScan()
|
||||
}, 800)
|
||||
}
|
||||
let arr = [{ maCode: maInfo.value.maCode }]
|
||||
let param = {
|
||||
taskId: queryParams.value.taskId,
|
||||
typeId: queryParams.value.typeId,
|
||||
purchaseId: queryParams.value.id,
|
||||
inPutList: arr,
|
||||
}
|
||||
|
||||
const res = await setInboundCodeAPI(param)
|
||||
if (res.code === 200) {
|
||||
uni.showToast({
|
||||
title: '入库成功!',
|
||||
icon: 'none',
|
||||
})
|
||||
getCodeDeviceListData()
|
||||
// uni.$emit('onUpdate')
|
||||
setTimeout(() => {
|
||||
codeScan()
|
||||
}, 800)
|
||||
}
|
||||
}
|
||||
|
||||
// 标准箱识别
|
||||
const boxScan = async () => {
|
||||
boxCode.value=""
|
||||
var mpaasScanModule = uni.requireNativePlugin("Mpaas-Scan-Module")
|
||||
mpaasScanModule.mpaasScan({
|
||||
// 扫码识别类型,参数可多选,qrCode、barCode,不设置,默认识别所有
|
||||
'scanType': ['qrCode','barCode'],
|
||||
// 是否隐藏相册,默认false不隐藏
|
||||
'hideAlbum': false,
|
||||
//ios需要设置这个参数,只支持中英文 zh-Hans、en,默认中文
|
||||
'language' : 'en',
|
||||
//相册选择照片识别错误提示(ios)
|
||||
'failedMsg': '未识别到二维码,请重试',
|
||||
//Android支持全屏需要设置此参数
|
||||
'screenType': 'full'
|
||||
},(ret) => {
|
||||
console.log(ret)
|
||||
if(ret.resp_code==10){
|
||||
uni.showToast({ title: '用户取消', icon: 'none' })
|
||||
}
|
||||
if(ret.resp_code==11){
|
||||
uni.showToast({ title: '扫码失败', icon: 'none' })
|
||||
}
|
||||
if(ret.resp_code==1000){
|
||||
boxCode.value = ret.resp_result;
|
||||
boxInBound()
|
||||
}
|
||||
})
|
||||
}
|
||||
boxCode.value = ''
|
||||
var mpaasScanModule = uni.requireNativePlugin('Mpaas-Scan-Module')
|
||||
mpaasScanModule.mpaasScan(
|
||||
{
|
||||
// 扫码识别类型,参数可多选,qrCode、barCode,不设置,默认识别所有
|
||||
scanType: ['qrCode', 'barCode'],
|
||||
// 是否隐藏相册,默认false不隐藏
|
||||
hideAlbum: false,
|
||||
//ios需要设置这个参数,只支持中英文 zh-Hans、en,默认中文
|
||||
language: 'en',
|
||||
//相册选择照片识别错误提示(ios)
|
||||
failedMsg: '未识别到二维码,请重试',
|
||||
//Android支持全屏需要设置此参数
|
||||
screenType: 'full',
|
||||
},
|
||||
(ret) => {
|
||||
console.log(ret)
|
||||
if (ret.resp_code == 10) {
|
||||
uni.showToast({ title: '用户取消', icon: 'none' })
|
||||
}
|
||||
if (ret.resp_code == 11) {
|
||||
uni.showToast({ title: '扫码失败', icon: 'none' })
|
||||
}
|
||||
if (ret.resp_code == 1000) {
|
||||
boxCode.value = ret.resp_result
|
||||
boxInBound()
|
||||
}
|
||||
},
|
||||
)
|
||||
}
|
||||
// 标准箱入库
|
||||
const boxInBound = async () => {
|
||||
if(boxCode.value==""){
|
||||
uni.showToast({ title: '扫码识别失败', icon: 'none'})
|
||||
}else{
|
||||
if (boxCode.value == '') {
|
||||
uni.showToast({ title: '扫码识别失败', icon: 'none' })
|
||||
} else {
|
||||
let param = {
|
||||
boxCode: boxCode.value,
|
||||
maTypeId:queryParams.value.typeId
|
||||
maTypeId: queryParams.value.typeId,
|
||||
}
|
||||
const res = await getInfoBindByCode(param)
|
||||
console.log(res)
|
||||
if(res.code==200){
|
||||
if (res.code == 200) {
|
||||
boxInfo.value = res.data
|
||||
uni.showModal({
|
||||
title: '提示',
|
||||
|
|
@ -257,16 +285,16 @@ const boxInBound = async () => {
|
|||
cancelText: '取消',
|
||||
success: async (res) => {
|
||||
if (res.confirm) {
|
||||
if(boxInfo.value.successMaTotal>0){
|
||||
confirmBoxInBound()
|
||||
}
|
||||
}
|
||||
}
|
||||
if (boxInfo.value.successMaTotal > 0) {
|
||||
confirmBoxInBound()
|
||||
}
|
||||
}
|
||||
},
|
||||
})
|
||||
}else{
|
||||
uni.showToast({ title: '扫码识别失败', icon: 'none'})
|
||||
} else {
|
||||
uni.showToast({ title: '扫码识别失败', icon: 'none' })
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// 标准箱入库确认
|
||||
const confirmBoxInBound = async () => {
|
||||
|
|
@ -274,14 +302,14 @@ const confirmBoxInBound = async () => {
|
|||
// taskId: queryParams.value.taskId,
|
||||
// maTypeId: queryParams.value.typeId,
|
||||
boxCode: boxInfo.value.boxCode,
|
||||
})
|
||||
})
|
||||
if (res.code === 200) {
|
||||
uni.showToast({
|
||||
title: '入库成功!',
|
||||
icon: 'none',
|
||||
})
|
||||
getCodeDeviceListData()
|
||||
}else{
|
||||
} else {
|
||||
uni.showToast({ title: '入库失败', icon: 'none' })
|
||||
}
|
||||
}
|
||||
|
|
@ -303,8 +331,8 @@ const getCodeDeviceListData = async () => {
|
|||
taskId: queryParams.value.taskId,
|
||||
}
|
||||
const res = await getMachineById(obj)
|
||||
codeDeviceList.value=res.data;
|
||||
total.value=0;
|
||||
codeDeviceList.value = res.data
|
||||
total.value = 0
|
||||
if (codeDeviceList.value.length > 0) {
|
||||
codeDeviceList.value = codeDeviceList.value.map((e) => {
|
||||
return { ...e, checked: false }
|
||||
|
|
@ -319,34 +347,34 @@ const onScrollTolower = () => {
|
|||
|
||||
// 复选框事件
|
||||
const onChangeChecked = (item) => {
|
||||
item.checked = !item.checked;
|
||||
let arr = []
|
||||
codeDeviceList.value.forEach((e) => {
|
||||
if(e.checked==true){
|
||||
return arr.push(e)
|
||||
}
|
||||
})
|
||||
console.log(arr)
|
||||
total.value=arr.length;
|
||||
item.checked = !item.checked
|
||||
let arr = []
|
||||
codeDeviceList.value.forEach((e) => {
|
||||
if (e.checked == true) {
|
||||
return arr.push(e)
|
||||
}
|
||||
})
|
||||
console.log(arr)
|
||||
total.value = arr.length
|
||||
}
|
||||
// 复选框事件
|
||||
const checkedAll = () => {
|
||||
if(total.value<codeDeviceList.value.length){
|
||||
total.value=codeDeviceList.value.length;
|
||||
codeDeviceList.value.forEach((e) => {
|
||||
e.checked=true;
|
||||
})
|
||||
}else if(total.value==codeDeviceList.value.length){
|
||||
total.value=0;
|
||||
codeDeviceList.value.forEach((e) => {
|
||||
e.checked=false;
|
||||
})
|
||||
}
|
||||
if (total.value < codeDeviceList.value.length) {
|
||||
total.value = codeDeviceList.value.length
|
||||
codeDeviceList.value.forEach((e) => {
|
||||
e.checked = true
|
||||
})
|
||||
} else if (total.value == codeDeviceList.value.length) {
|
||||
total.value = 0
|
||||
codeDeviceList.value.forEach((e) => {
|
||||
e.checked = false
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
// 入库按钮
|
||||
const onHandleOutbound = async () => {
|
||||
const isSelect = codeDeviceList.value.some((e) => e.checked === true)
|
||||
const isSelect = codeDeviceList.value.some((e) => e.checked === true)
|
||||
if (!isSelect) {
|
||||
uni.showToast({
|
||||
title: '请勾选需要入库的设备',
|
||||
|
|
@ -354,15 +382,15 @@ const onHandleOutbound = async () => {
|
|||
})
|
||||
return
|
||||
}
|
||||
let maxNum = Number(queryParams.value.purchaseNum)-Number(queryParams.value.inputNum)
|
||||
console.log(maxNum)
|
||||
if(total.value>maxNum){
|
||||
uni.showToast({
|
||||
title: '勾选设备超过待入库数量!',
|
||||
icon: 'none',
|
||||
})
|
||||
return
|
||||
}
|
||||
let maxNum = Number(queryParams.value.purchaseNum) - Number(queryParams.value.inputNum)
|
||||
console.log(maxNum)
|
||||
if (total.value > maxNum) {
|
||||
uni.showToast({
|
||||
title: '勾选设备超过待入库数量!',
|
||||
icon: 'none',
|
||||
})
|
||||
return
|
||||
}
|
||||
// 组装入库参数
|
||||
const paramsList = []
|
||||
codeDeviceList.value.map((e) => {
|
||||
|
|
@ -372,23 +400,23 @@ const onHandleOutbound = async () => {
|
|||
})
|
||||
}
|
||||
})
|
||||
let param = {
|
||||
taskId: queryParams.value.taskId,
|
||||
typeId: queryParams.value.typeId,
|
||||
purchaseId: queryParams.value.id,
|
||||
inPutList: paramsList,
|
||||
}
|
||||
const res = await setInboundCodeAPI(param)
|
||||
console.log(res,"入库")
|
||||
let param = {
|
||||
taskId: queryParams.value.taskId,
|
||||
typeId: queryParams.value.typeId,
|
||||
purchaseId: queryParams.value.id,
|
||||
inPutList: paramsList,
|
||||
}
|
||||
const res = await setInboundCodeAPI(param)
|
||||
console.log(res, '入库')
|
||||
if (res.code === 200) {
|
||||
uni.showToast({
|
||||
title: '入库成功!',
|
||||
icon: 'none',
|
||||
})
|
||||
getCodeDeviceListData()
|
||||
setTimeout(() => {
|
||||
queryParams.value.inputNum=Number(queryParams.value.inputNum)+paramsList.length
|
||||
}, 800)
|
||||
getCodeDeviceListData()
|
||||
setTimeout(() => {
|
||||
queryParams.value.inputNum = Number(queryParams.value.inputNum) + paramsList.length
|
||||
}, 800)
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
|
@ -400,19 +428,19 @@ const onHandleOutbound = async () => {
|
|||
flex-direction: column;
|
||||
background-color: #f7f8fa;
|
||||
padding: 24rpx;
|
||||
padding-bottom: 120rpx; // 为底部按钮留出空间
|
||||
.card {
|
||||
padding: 5px;
|
||||
background-color: #fff;
|
||||
border-radius: 6px;
|
||||
box-shadow: 0 2upx 4upx 0 rgba(0, 0, 0, 0.1);
|
||||
}
|
||||
.form-view {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
padding-bottom: 120rpx; // 为底部按钮留出空间
|
||||
.card {
|
||||
padding: 5px;
|
||||
background-color: #fff;
|
||||
border-radius: 6px;
|
||||
box-shadow: 0 2upx 4upx 0 rgba(0, 0, 0, 0.1);
|
||||
}
|
||||
.form-view {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
.table-list-item {
|
||||
margin: 20rpx 0;
|
||||
padding: 20rpx;
|
||||
|
|
@ -428,7 +456,7 @@ const onHandleOutbound = async () => {
|
|||
|
||||
:deep(.uni-row) {
|
||||
margin-bottom: 20rpx;
|
||||
|
||||
|
||||
.uni-col-7 {
|
||||
color: #8c8c8c;
|
||||
font-size: 28rpx;
|
||||
|
|
@ -464,7 +492,8 @@ const onHandleOutbound = async () => {
|
|||
.line {
|
||||
margin: 24rpx 0;
|
||||
height: 2rpx;
|
||||
background: linear-gradient(90deg,
|
||||
background: linear-gradient(
|
||||
90deg,
|
||||
rgba(232, 232, 232, 0) 0%,
|
||||
rgba(232, 232, 232, 1) 50%,
|
||||
rgba(232, 232, 232, 0) 100%
|
||||
|
|
@ -504,30 +533,30 @@ const onHandleOutbound = async () => {
|
|||
// opacity: 0.9;
|
||||
// }
|
||||
}
|
||||
|
||||
// 底部全选按钮
|
||||
.checked-btn {
|
||||
position: fixed;
|
||||
bottom: 40rpx;
|
||||
left: 70%;
|
||||
// transform: translateX(-1%);
|
||||
width: 25%;
|
||||
height: 88rpx;
|
||||
background: #fff;
|
||||
text-align: center;
|
||||
line-height: 88rpx;
|
||||
color: #000;
|
||||
border-radius: 12rpx;
|
||||
font-size: 28rpx;
|
||||
font-weight: 600;
|
||||
box-shadow: 0 6rpx 20rpx rgba(55, 132, 251, 0.2);
|
||||
// transition: all 0.3s ease;
|
||||
|
||||
// &:active {
|
||||
// transform: translateX(-50%) scale(0.98);
|
||||
// opacity: 0.9;
|
||||
// }
|
||||
}
|
||||
|
||||
// 底部全选按钮
|
||||
.checked-btn {
|
||||
position: fixed;
|
||||
bottom: 40rpx;
|
||||
left: 70%;
|
||||
// transform: translateX(-1%);
|
||||
width: 25%;
|
||||
height: 88rpx;
|
||||
background: #fff;
|
||||
text-align: center;
|
||||
line-height: 88rpx;
|
||||
color: #000;
|
||||
border-radius: 12rpx;
|
||||
font-size: 28rpx;
|
||||
font-weight: 600;
|
||||
box-shadow: 0 6rpx 20rpx rgba(55, 132, 251, 0.2);
|
||||
// transition: all 0.3s ease;
|
||||
|
||||
// &:active {
|
||||
// transform: translateX(-50%) scale(0.98);
|
||||
// opacity: 0.9;
|
||||
// }
|
||||
}
|
||||
}
|
||||
|
||||
// 加载提示文字
|
||||
|
|
|
|||
Loading…
Reference in New Issue