盘点绑定
This commit is contained in:
parent
b441997a84
commit
c1d0664cdb
|
|
@ -692,6 +692,18 @@
|
||||||
"navigationStyle": "custom"
|
"navigationStyle": "custom"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"path": "pages/inventoryBinding/index",
|
||||||
|
"style": {
|
||||||
|
"navigationBarTitleText": "盘点绑定"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"path": "pages/inventoryBinding/qrCodeBinding",
|
||||||
|
"style": {
|
||||||
|
"navigationStyle": "custom"
|
||||||
|
}
|
||||||
|
},
|
||||||
// 材料站 start
|
// 材料站 start
|
||||||
// 首页
|
// 首页
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -71,18 +71,18 @@
|
||||||
</text>
|
</text>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup>
|
<script setup>
|
||||||
import { ref,computed } from 'vue'
|
import { ref } from 'vue'
|
||||||
import { onShow,onLoad } from '@dcloudio/uni-app'
|
import { onShow } from '@dcloudio/uni-app'
|
||||||
|
|
||||||
const urlPermissions = ref([])
|
const urlPermissions = ref([])
|
||||||
|
|
||||||
onShow((options) => {
|
onShow((options) => {
|
||||||
urlPermissions.value = uni.getStorageSync('urlPermissions')
|
urlPermissions.value = uni.getStorageSync('urlPermissions')
|
||||||
console.log("yyyyyyy",urlPermissions.value)
|
console.log('yyyyyyy', urlPermissions.value)
|
||||||
})
|
})
|
||||||
|
|
||||||
// 业务办理
|
// 业务办理
|
||||||
|
|
@ -104,12 +104,6 @@ const newInfoList = ref([
|
||||||
},
|
},
|
||||||
])
|
])
|
||||||
|
|
||||||
// 使用计算属性筛选 newInfoList 中的数据
|
|
||||||
const newInfoListTwo = computed(() => {
|
|
||||||
return newInfoList.value.filter(item => urlPermissions.value.includes(item.url))
|
|
||||||
})
|
|
||||||
|
|
||||||
|
|
||||||
// 电子档案
|
// 电子档案
|
||||||
const newPurchaseList = ref([
|
const newPurchaseList = ref([
|
||||||
{
|
{
|
||||||
|
|
@ -119,12 +113,6 @@ const newPurchaseList = ref([
|
||||||
},
|
},
|
||||||
])
|
])
|
||||||
|
|
||||||
// 使用计算属性筛选 newInfoList 中的数据
|
|
||||||
const newPurchaseListTwo = computed(() => {
|
|
||||||
return newPurchaseList.value.filter(item => urlPermissions.value.includes(item.url))
|
|
||||||
})
|
|
||||||
|
|
||||||
|
|
||||||
// 检验预警
|
// 检验预警
|
||||||
const pickingList = ref([
|
const pickingList = ref([
|
||||||
{
|
{
|
||||||
|
|
@ -134,12 +122,6 @@ const pickingList = ref([
|
||||||
},
|
},
|
||||||
])
|
])
|
||||||
|
|
||||||
// 使用计算属性筛选 newInfoList 中的数据
|
|
||||||
const pickingListTwo = computed(() => {
|
|
||||||
return pickingList.value.filter(item => urlPermissions.value.includes(item.url))
|
|
||||||
})
|
|
||||||
|
|
||||||
|
|
||||||
// 综合查询
|
// 综合查询
|
||||||
const integratedQueryList = ref([
|
const integratedQueryList = ref([
|
||||||
{
|
{
|
||||||
|
|
@ -174,12 +156,6 @@ const integratedQueryList = ref([
|
||||||
},
|
},
|
||||||
])
|
])
|
||||||
|
|
||||||
// 使用计算属性筛选 newInfoList 中的数据
|
|
||||||
const integratedQueryListTwo = computed(() => {
|
|
||||||
return integratedQueryList.value.filter(item => urlPermissions.value.includes(item.url))
|
|
||||||
})
|
|
||||||
|
|
||||||
|
|
||||||
const onNavigateTo = (url) => {
|
const onNavigateTo = (url) => {
|
||||||
uni.navigateTo({ url })
|
uni.navigateTo({ url })
|
||||||
}
|
}
|
||||||
|
|
@ -195,7 +171,6 @@ page {
|
||||||
min-height: 100vh;
|
min-height: 100vh;
|
||||||
background-color: #f7f8fa;
|
background-color: #f7f8fa;
|
||||||
|
|
||||||
|
|
||||||
// 功能区块样式
|
// 功能区块样式
|
||||||
.new-purchase {
|
.new-purchase {
|
||||||
background-color: #fff;
|
background-color: #fff;
|
||||||
|
|
@ -231,7 +206,6 @@ page {
|
||||||
background-color: #2d73cf;
|
background-color: #2d73cf;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// 功能项样式
|
// 功能项样式
|
||||||
.purchase-item {
|
.purchase-item {
|
||||||
width: 25%;
|
width: 25%;
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,92 @@
|
||||||
|
<template>
|
||||||
|
<div>
|
||||||
|
<ScanQrCode
|
||||||
|
ref="scanQrCodeRef"
|
||||||
|
@scanSuccessBox="handleScanSuccess"
|
||||||
|
@scanErrorBox="handleScanError"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup>
|
||||||
|
import { ref, onMounted } from 'vue'
|
||||||
|
import ScanQrCode from '@/pages/devicesSearch/ScanQrCode.vue'
|
||||||
|
import { onShow } from '@dcloudio/uni-app'
|
||||||
|
|
||||||
|
const scanQrCodeRef = ref()
|
||||||
|
const qrCode = ref('')
|
||||||
|
|
||||||
|
onShow(() => {
|
||||||
|
// 扫描二维码
|
||||||
|
setTimeout(() => {
|
||||||
|
if (scanQrCodeRef.value) scanQrCodeRef.value.scanQrCode()
|
||||||
|
}, 300)
|
||||||
|
})
|
||||||
|
// 处理扫描成功事件
|
||||||
|
const handleScanSuccess = (result) => {
|
||||||
|
qrCode.value = result?.text?.split('?qrcode=')[1] || result?.text
|
||||||
|
if (qrCode.value === '') {
|
||||||
|
uni.showToast({ title: '扫码识别失败', icon: 'none' })
|
||||||
|
setTimeout(() => {
|
||||||
|
if (scanQrCodeRef.value) scanQrCodeRef.value.scanQrCode()
|
||||||
|
}, 500)
|
||||||
|
} else {
|
||||||
|
uni.navigateTo({
|
||||||
|
url: '/pages/inventoryBinding/qrCodeBinding?qrCode=' + JSON.stringify(qrCode.value),
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 处理扫描失败事件
|
||||||
|
const handleScanError = (error) => {
|
||||||
|
console.error('扫描出错:', error.message)
|
||||||
|
uni.showToast({ title: error.message, icon: 'none' })
|
||||||
|
setTimeout(() => {
|
||||||
|
if (scanQrCodeRef.value) scanQrCodeRef.value.scanQrCode()
|
||||||
|
}, 500)
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="scss" scoped>
|
||||||
|
.modal-wrapper {
|
||||||
|
padding: 40rpx 30rpx 20rpx;
|
||||||
|
width: 560rpx;
|
||||||
|
border-radius: 8rpx;
|
||||||
|
box-sizing: border-box;
|
||||||
|
}
|
||||||
|
|
||||||
|
.modal-title {
|
||||||
|
font-size: 32rpx;
|
||||||
|
font-weight: bold;
|
||||||
|
text-align: left;
|
||||||
|
margin-bottom: 24rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.modal-content {
|
||||||
|
font-size: 28rpx;
|
||||||
|
color: #333;
|
||||||
|
text-align: left;
|
||||||
|
margin-bottom: 36rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.modal-footer {
|
||||||
|
display: flex;
|
||||||
|
border-top: 1px solid #eee;
|
||||||
|
}
|
||||||
|
|
||||||
|
.btn {
|
||||||
|
flex: 1;
|
||||||
|
padding: 20rpx 0;
|
||||||
|
text-align: center;
|
||||||
|
font-size: 28rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.cancel-btn {
|
||||||
|
color: #333;
|
||||||
|
border-right: 1px solid #eee;
|
||||||
|
}
|
||||||
|
|
||||||
|
.confirm-btn {
|
||||||
|
color: #007aff;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|
@ -0,0 +1,124 @@
|
||||||
|
<template>
|
||||||
|
<uni-nav-bar
|
||||||
|
fixed
|
||||||
|
:border="false"
|
||||||
|
background-color="#dcf4ff"
|
||||||
|
color="#333"
|
||||||
|
status-bar
|
||||||
|
title="二维码绑定"
|
||||||
|
left-icon="left"
|
||||||
|
@clickLeft="back"
|
||||||
|
/>
|
||||||
|
<div class="item">
|
||||||
|
<div><span style="color: red">*</span>设备编码:</div>
|
||||||
|
<uni-easyinput v-model="maCode" placeholder="请输入设备编码" />
|
||||||
|
</div>
|
||||||
|
<div class="item">
|
||||||
|
<div>出厂编码:</div>
|
||||||
|
<uni-easyinput v-model="outFacCode" placeholder="请输入出厂编码" />
|
||||||
|
</div>
|
||||||
|
<div class="deviceInfo">
|
||||||
|
<div>二维码编号:{{ deviceInfo.qrCode }}</div>
|
||||||
|
<div>设备名称:{{ deviceInfo.typeName }}</div>
|
||||||
|
<div>设备规格:{{ deviceInfo.typeModelName }}</div>
|
||||||
|
</div>
|
||||||
|
<div class="btn">
|
||||||
|
<button type="primary" @click="handleSubmit">绑 定</button>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup>
|
||||||
|
import { ref, reactive } from 'vue'
|
||||||
|
import { onLoad } from '@dcloudio/uni-app'
|
||||||
|
import { getInventoryInfo, inventoryBind } from '@/services/information'
|
||||||
|
|
||||||
|
const maCode = ref('') // 设备编码
|
||||||
|
const outFacCode = ref('') // 出厂编码
|
||||||
|
// 设备信息
|
||||||
|
let deviceInfo = reactive({
|
||||||
|
qrCode: '',
|
||||||
|
typeId: '',
|
||||||
|
typeName: '',
|
||||||
|
typeModelName: '',
|
||||||
|
})
|
||||||
|
|
||||||
|
onLoad((opt) => {
|
||||||
|
console.log('onLoad', opt)
|
||||||
|
deviceInfo.qrCode = opt.qrCode ? JSON.parse(opt.qrCode) : ''
|
||||||
|
if (deviceInfo.qrCode) {
|
||||||
|
getDeviceInfo()
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
const back = () => {
|
||||||
|
uni.navigateBack()
|
||||||
|
}
|
||||||
|
|
||||||
|
// 获取设备信息
|
||||||
|
const getDeviceInfo = async () => {
|
||||||
|
try {
|
||||||
|
const res = await getInventoryInfo({ qrCode: deviceInfo.qrCode })
|
||||||
|
console.log('🚀 ~ getDeviceInfo ~ res:', res)
|
||||||
|
deviceInfo.typeId = res.data.typeId
|
||||||
|
deviceInfo.typeName = res.data.materialName
|
||||||
|
deviceInfo.typeModelName = res.data.materialModel
|
||||||
|
} catch (error) {
|
||||||
|
console.log('🚀 ~ getDeviceInfo ~ error:', error)
|
||||||
|
back()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// 提交
|
||||||
|
const handleSubmit = () => {
|
||||||
|
if (!maCode.value) {
|
||||||
|
uni.showToast({
|
||||||
|
title: '请输入设备编码',
|
||||||
|
icon: 'none',
|
||||||
|
})
|
||||||
|
return
|
||||||
|
}
|
||||||
|
// 弹框确认
|
||||||
|
uni.showModal({
|
||||||
|
title: '提示',
|
||||||
|
content: '是否确认绑定?',
|
||||||
|
success: async (res) => {
|
||||||
|
console.log('🚀 ~ success: ~ res:', res)
|
||||||
|
if (res.confirm) {
|
||||||
|
const params = {
|
||||||
|
maCode: maCode.value,
|
||||||
|
outFacCode: outFacCode.value,
|
||||||
|
qrCode: deviceInfo.qrCode,
|
||||||
|
typeId: deviceInfo.typeId,
|
||||||
|
}
|
||||||
|
inventoryBind(params).then((res) => {
|
||||||
|
if (res.code === 200) {
|
||||||
|
uni.showToast({
|
||||||
|
title: '绑定成功',
|
||||||
|
icon: 'success',
|
||||||
|
})
|
||||||
|
back()
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
},
|
||||||
|
})
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="scss" scoped>
|
||||||
|
::v-deep .uni-nav-bar-text {
|
||||||
|
font-size: 18px !important;
|
||||||
|
}
|
||||||
|
.item {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: space-between;
|
||||||
|
padding: 20px 10px;
|
||||||
|
border-bottom: 1px solid #ccc;
|
||||||
|
}
|
||||||
|
.deviceInfo {
|
||||||
|
padding: 20px 10px;
|
||||||
|
}
|
||||||
|
.btn {
|
||||||
|
margin: 20px 10px;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|
@ -99,7 +99,6 @@
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup>
|
<script setup>
|
||||||
import { getWsMaInfoList, updateCheckTime } from '@/services/wsMaInfo/wsMaInfo.js'
|
|
||||||
import { getInfoByCode, updateInfo } from '@/services/information'
|
import { getInfoByCode, updateInfo } from '@/services/information'
|
||||||
import { getSupplierList } from '@/services/repair/repair.js'
|
import { getSupplierList } from '@/services/repair/repair.js'
|
||||||
import { onLoad } from '@dcloudio/uni-app'
|
import { onLoad } from '@dcloudio/uni-app'
|
||||||
|
|
|
||||||
|
|
@ -148,7 +148,7 @@ const newInfoList = ref([
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: '盘点绑定',
|
title: '盘点绑定',
|
||||||
url: '/pages/new-purchase/entry/index',
|
url: '/pages/inventoryBinding/index',
|
||||||
iconSrc: '../../static/workbench/panDian.png',
|
iconSrc: '../../static/workbench/panDian.png',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -17,3 +17,21 @@ export const updateInfo = (data) => {
|
||||||
data,
|
data,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 盘点绑定-获取设备信息
|
||||||
|
export const getInventoryInfo = (data) => {
|
||||||
|
return http({
|
||||||
|
method: 'GET',
|
||||||
|
url: '/material/purchase/bind/getInventoryInfo',
|
||||||
|
data,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 盘点绑定-绑定
|
||||||
|
export const inventoryBind = (data) => {
|
||||||
|
return http({
|
||||||
|
method: 'POST',
|
||||||
|
url: '/material/purchase/bind/inventoryBind',
|
||||||
|
data,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue