2024-11-19 14:52:39 +08:00
|
|
|
|
<template>
|
|
|
|
|
|
<!-- 编码出库-->
|
|
|
|
|
|
<view class="page-container">
|
2024-11-19 18:07:40 +08:00
|
|
|
|
<view class="table-list-item">
|
|
|
|
|
|
<uni-row :gutter="24">
|
|
|
|
|
|
<uni-col :span="6">领料单位:</uni-col>
|
|
|
|
|
|
<uni-col :span="18">
|
|
|
|
|
|
<view class="cont">{{ queryParams.leaseUnit }}</view>
|
|
|
|
|
|
</uni-col>
|
|
|
|
|
|
</uni-row>
|
|
|
|
|
|
<uni-row :gutter="24">
|
|
|
|
|
|
<uni-col :span="6">领料工程:</uni-col>
|
|
|
|
|
|
<uni-col :span="18">
|
|
|
|
|
|
<view class="cont">{{ queryParams.leaseProject }}</view>
|
|
|
|
|
|
</uni-col>
|
|
|
|
|
|
</uni-row>
|
|
|
|
|
|
<uni-row :gutter="24">
|
|
|
|
|
|
<uni-col :span="6">当前出库物资:</uni-col>
|
|
|
|
|
|
<uni-col :span="18"
|
|
|
|
|
|
><view class="cont">{{ queryParams.maTypeName }}</view>
|
|
|
|
|
|
</uni-col>
|
|
|
|
|
|
</uni-row>
|
|
|
|
|
|
<uni-row :gutter="24">
|
|
|
|
|
|
<uni-col :span="6">待出库数量:</uni-col>
|
|
|
|
|
|
<uni-col :span="18">
|
|
|
|
|
|
<view class="cont">{{ maxNum }}</view>
|
|
|
|
|
|
</uni-col>
|
|
|
|
|
|
</uni-row>
|
2024-11-19 14:52:39 +08:00
|
|
|
|
</view>
|
2024-11-19 18:07:40 +08:00
|
|
|
|
|
|
|
|
|
|
<view class="table-list-item">
|
|
|
|
|
|
<uni-row :gutter="24">
|
|
|
|
|
|
<uni-col :span="6">出库方式:</uni-col>
|
|
|
|
|
|
<uni-col :span="6">
|
|
|
|
|
|
<view class="coding-btn">编码识别</view>
|
|
|
|
|
|
</uni-col>
|
|
|
|
|
|
<uni-col :span="6">
|
|
|
|
|
|
<view class="coding-btn">编码识别</view>
|
|
|
|
|
|
</uni-col>
|
|
|
|
|
|
<uni-col :span="6">
|
|
|
|
|
|
<view class="coding-btn">二维码识别</view>
|
|
|
|
|
|
</uni-col>
|
|
|
|
|
|
</uni-row>
|
|
|
|
|
|
</view>
|
|
|
|
|
|
|
|
|
|
|
|
<view class="table-list-item">
|
|
|
|
|
|
<uni-row :gutter="24" style="display: flex; align-items: center">
|
|
|
|
|
|
<uni-col :span="6">
|
|
|
|
|
|
<view> 设备编码 </view>
|
|
|
|
|
|
</uni-col>
|
|
|
|
|
|
<uni-col :span="12">
|
|
|
|
|
|
<view>
|
|
|
|
|
|
<uni-easyinput placeholder="请输入内容" />
|
|
|
|
|
|
</view>
|
|
|
|
|
|
</uni-col>
|
|
|
|
|
|
<uni-col :span="6">
|
|
|
|
|
|
<view
|
|
|
|
|
|
class="coding-btn"
|
|
|
|
|
|
style="
|
|
|
|
|
|
padding: 10rpx 0;
|
|
|
|
|
|
color: #fe9a09;
|
|
|
|
|
|
background-color: #fff7eb;
|
|
|
|
|
|
border: 1px solid #fe9a09;
|
|
|
|
|
|
"
|
2024-11-20 10:20:39 +08:00
|
|
|
|
@tap="onCodeSearch"
|
|
|
|
|
|
>编码检索
|
|
|
|
|
|
</view>
|
2024-11-19 18:07:40 +08:00
|
|
|
|
</uni-col>
|
|
|
|
|
|
</uni-row>
|
|
|
|
|
|
</view>
|
|
|
|
|
|
|
|
|
|
|
|
<scroll-view scroll-y @scrolltolower="onScrollTolower" style="padding-bottom: 85rpx">
|
|
|
|
|
|
<view class="table-list-item" v-for="item in codeDeviceList" :key="item.maId">
|
2024-11-19 14:52:39 +08:00
|
|
|
|
<uni-row :gutter="24">
|
2024-11-19 18:07:40 +08:00
|
|
|
|
<uni-col :span="5">物资类型:</uni-col>
|
|
|
|
|
|
<uni-col :span="15">
|
|
|
|
|
|
<view class="cont">{{ item.materialName }}</view>
|
2024-11-19 14:52:39 +08:00
|
|
|
|
</uni-col>
|
2024-11-19 18:07:40 +08:00
|
|
|
|
<uni-col :span="4">
|
|
|
|
|
|
<checkbox-group @change="onChangeChecked(item)">
|
|
|
|
|
|
<label>
|
|
|
|
|
|
<checkbox
|
|
|
|
|
|
color="#409eff"
|
|
|
|
|
|
borderColor="#409eff"
|
|
|
|
|
|
activeBorderColor="#409eff"
|
|
|
|
|
|
:checked="item.checked"
|
|
|
|
|
|
:disabled="maxNum === isSelectNum && !item.checked"
|
|
|
|
|
|
style="transform: scale(0.7)"
|
|
|
|
|
|
/>
|
|
|
|
|
|
</label>
|
|
|
|
|
|
</checkbox-group>
|
2024-11-19 14:52:39 +08:00
|
|
|
|
</uni-col>
|
|
|
|
|
|
</uni-row>
|
|
|
|
|
|
<uni-row :gutter="24">
|
2024-11-19 18:07:40 +08:00
|
|
|
|
<uni-col :span="5">规格型号:</uni-col>
|
2024-11-19 14:52:39 +08:00
|
|
|
|
<uni-col :span="18">
|
2024-11-19 18:07:40 +08:00
|
|
|
|
<view class="cont">{{ item.materialModel }}</view>
|
2024-11-19 14:52:39 +08:00
|
|
|
|
</uni-col>
|
|
|
|
|
|
</uni-row>
|
|
|
|
|
|
<uni-row :gutter="24">
|
2024-11-19 18:07:40 +08:00
|
|
|
|
<uni-col :span="5">设备状态:</uni-col>
|
2024-11-19 14:52:39 +08:00
|
|
|
|
<uni-col :span="18">
|
2024-11-19 18:07:40 +08:00
|
|
|
|
<view class="cont">{{ item.statusName }}</view>
|
2024-11-19 14:52:39 +08:00
|
|
|
|
</uni-col>
|
|
|
|
|
|
</uni-row>
|
|
|
|
|
|
<uni-row :gutter="24">
|
2024-11-19 18:07:40 +08:00
|
|
|
|
<uni-col :span="5">设备数量:</uni-col>
|
2024-11-19 14:52:39 +08:00
|
|
|
|
<uni-col :span="18">
|
2024-11-19 18:07:40 +08:00
|
|
|
|
<view class="cont">1</view>
|
2024-11-19 14:52:39 +08:00
|
|
|
|
</uni-col>
|
|
|
|
|
|
</uni-row>
|
|
|
|
|
|
</view>
|
2024-11-19 18:07:40 +08:00
|
|
|
|
|
|
|
|
|
|
<view class="loading-text">
|
|
|
|
|
|
{{ finish ? '没有更多数据了~' : '正在加载...' }}
|
|
|
|
|
|
</view>
|
2024-11-19 14:52:39 +08:00
|
|
|
|
</scroll-view>
|
2024-11-19 18:07:40 +08:00
|
|
|
|
|
|
|
|
|
|
<view class="outbound-btn" @tap="onHandleOutbound"> 出库 </view>
|
2024-11-19 14:52:39 +08:00
|
|
|
|
</view>
|
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
|
|
<script setup>
|
2024-11-19 18:07:40 +08:00
|
|
|
|
import { ref, computed } from 'vue'
|
|
|
|
|
|
import { getCodeDeviceListAPI, setOutboundNumAPI } from '@/services/picking/outbound.js'
|
|
|
|
|
|
import { onBackPress } from '@dcloudio/uni-app'
|
|
|
|
|
|
const query = defineProps() // 获取上级页面传递的路由参数
|
|
|
|
|
|
const queryParams = JSON.parse(query.queryParams)
|
|
|
|
|
|
const codeDeviceList = ref([])
|
|
|
|
|
|
const total = ref(0)
|
|
|
|
|
|
|
|
|
|
|
|
// 编码设备列表查询参数
|
|
|
|
|
|
const queryCodeParams = ref({
|
2024-11-19 14:52:39 +08:00
|
|
|
|
pageNum: 1,
|
2024-11-19 18:07:40 +08:00
|
|
|
|
pageSize: 10,
|
|
|
|
|
|
typeId: queryParams.typeId,
|
|
|
|
|
|
maStatus: 1,
|
2024-11-19 14:52:39 +08:00
|
|
|
|
})
|
|
|
|
|
|
|
2024-11-19 18:07:40 +08:00
|
|
|
|
// 计算出库最大数量
|
|
|
|
|
|
const maxNum = computed(() => {
|
|
|
|
|
|
// 1. 先通过预领数量和已领数量计算剩余待出库数量
|
|
|
|
|
|
const waitNum = queryParams.preNum - queryParams.alNum
|
|
|
|
|
|
|
|
|
|
|
|
// 2. 判断库存数量是否大于待出库数量 如大于则取待出库数量 如小于则取库存书看了
|
|
|
|
|
|
return total.value > waitNum ? waitNum : total.value
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
// 获取编码列表
|
|
|
|
|
|
const getCodeDeviceListData = async () => {
|
|
|
|
|
|
// console.log('queryCodeParams', queryCodeParams)
|
|
|
|
|
|
const res = await getCodeDeviceListAPI(queryCodeParams.value)
|
|
|
|
|
|
codeDeviceList.value.push(...res.rows)
|
2024-11-20 10:20:39 +08:00
|
|
|
|
|
|
|
|
|
|
if (codeDeviceList.value.length > 0) {
|
|
|
|
|
|
codeDeviceList.value = codeDeviceList.value.map((e) => {
|
|
|
|
|
|
return { ...e, checked: false }
|
|
|
|
|
|
})
|
|
|
|
|
|
}
|
2024-11-19 18:07:40 +08:00
|
|
|
|
total.value = res.total
|
2024-11-19 14:52:39 +08:00
|
|
|
|
}
|
2024-11-19 18:07:40 +08:00
|
|
|
|
getCodeDeviceListData()
|
2024-11-19 14:52:39 +08:00
|
|
|
|
|
2024-11-20 10:20:39 +08:00
|
|
|
|
// 编码搜索按钮
|
|
|
|
|
|
const onCodeSearch = () => {
|
|
|
|
|
|
codeDeviceList.value = []
|
|
|
|
|
|
getCodeDeviceListData()
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2024-11-19 18:07:40 +08:00
|
|
|
|
// 滚动触底事件
|
|
|
|
|
|
const onScrollTolower = () => {
|
|
|
|
|
|
console.log('滚动触底--')
|
|
|
|
|
|
if (total.value > codeDeviceList.value.length) {
|
|
|
|
|
|
queryCodeParams.value.pageNum++
|
|
|
|
|
|
getCodeDeviceListData()
|
2024-11-19 14:52:39 +08:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2024-11-19 18:07:40 +08:00
|
|
|
|
// 判断数据是否加载完毕
|
|
|
|
|
|
const finish = computed(() => {
|
|
|
|
|
|
if (total.value === codeDeviceList.value.length) return true
|
2024-11-19 14:52:39 +08:00
|
|
|
|
})
|
|
|
|
|
|
|
2024-11-19 18:07:40 +08:00
|
|
|
|
// 复选框事件
|
|
|
|
|
|
const onChangeChecked = (item) => {
|
|
|
|
|
|
item.checked = !item.checked
|
2024-11-19 14:52:39 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2024-11-19 18:07:40 +08:00
|
|
|
|
// 计算已选择数量
|
|
|
|
|
|
const isSelectNum = computed(() => {
|
|
|
|
|
|
const isSelectList = codeDeviceList.value.filter((e) => e.checked === true)
|
|
|
|
|
|
if (maxNum.value === isSelectList.length) {
|
|
|
|
|
|
uni.showToast({
|
|
|
|
|
|
title: '勾选设备已达到最大待出库数量!',
|
|
|
|
|
|
icon: 'none',
|
|
|
|
|
|
})
|
2024-11-19 14:52:39 +08:00
|
|
|
|
}
|
2024-11-19 18:07:40 +08:00
|
|
|
|
return isSelectList.length
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
// 出库按钮
|
|
|
|
|
|
const onHandleOutbound = async () => {
|
|
|
|
|
|
const isSelect = codeDeviceList.value.some((e) => e.checked === true)
|
|
|
|
|
|
|
|
|
|
|
|
if (!isSelect) {
|
|
|
|
|
|
uni.showToast({
|
|
|
|
|
|
title: '请勾选需要出库的设备',
|
|
|
|
|
|
icon: 'none',
|
|
|
|
|
|
})
|
|
|
|
|
|
return
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// 解构所需要的数据
|
|
|
|
|
|
const { typeId, parentId } = queryParams
|
|
|
|
|
|
// 组装出库参数
|
|
|
|
|
|
const paramsList = []
|
|
|
|
|
|
codeDeviceList.value.map((e) => {
|
|
|
|
|
|
if (e.checked) {
|
|
|
|
|
|
paramsList.push({
|
|
|
|
|
|
leaseType: 0,
|
|
|
|
|
|
maId: e.maId,
|
|
|
|
|
|
manageType: 0,
|
|
|
|
|
|
outNum: 1,
|
|
|
|
|
|
parentId,
|
|
|
|
|
|
typeId,
|
|
|
|
|
|
})
|
|
|
|
|
|
}
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
const res = await setOutboundNumAPI({ leaseOutDetailsList: paramsList })
|
2024-11-19 14:52:39 +08:00
|
|
|
|
|
2024-11-19 18:07:40 +08:00
|
|
|
|
if (res.code === 200) {
|
|
|
|
|
|
uni.showToast({
|
|
|
|
|
|
title: '出库成功!',
|
|
|
|
|
|
icon: 'none',
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
setTimeout(() => {
|
|
|
|
|
|
// 返回上一个页面
|
|
|
|
|
|
uni.navigateBack({
|
|
|
|
|
|
delta: 1,
|
|
|
|
|
|
success() {
|
|
|
|
|
|
uni.$emit('onUpdate')
|
|
|
|
|
|
},
|
|
|
|
|
|
})
|
|
|
|
|
|
}, 500)
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2024-11-19 14:52:39 +08:00
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
|
|
<style lang="scss" scoped>
|
|
|
|
|
|
.page-container {
|
|
|
|
|
|
display: flex;
|
|
|
|
|
|
height: 100%;
|
|
|
|
|
|
padding: 0 15rpx;
|
|
|
|
|
|
flex-direction: column;
|
2024-11-19 18:07:40 +08:00
|
|
|
|
background-color: #e8f5fb;
|
2024-11-19 14:52:39 +08:00
|
|
|
|
|
2024-11-19 18:07:40 +08:00
|
|
|
|
.table-list-item {
|
|
|
|
|
|
margin: 5rpx 0;
|
2024-11-19 14:52:39 +08:00
|
|
|
|
padding: 20rpx;
|
2024-11-19 18:07:40 +08:00
|
|
|
|
background-color: #fff;
|
|
|
|
|
|
border-radius: 10rpx;
|
|
|
|
|
|
.title {
|
2024-11-19 14:52:39 +08:00
|
|
|
|
display: flex;
|
2024-11-19 18:07:40 +08:00
|
|
|
|
justify-content: space-between;
|
2024-11-19 14:52:39 +08:00
|
|
|
|
align-items: center;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2024-11-19 18:07:40 +08:00
|
|
|
|
.coding-btn {
|
|
|
|
|
|
padding: 5rpx 0;
|
|
|
|
|
|
background-color: #409eff;
|
|
|
|
|
|
border-radius: 6rpx;
|
|
|
|
|
|
text-align: center;
|
|
|
|
|
|
color: #fff;
|
|
|
|
|
|
font-size: 14px;
|
2024-11-19 14:52:39 +08:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
// 加载提示文字
|
|
|
|
|
|
.loading-text {
|
|
|
|
|
|
text-align: center;
|
|
|
|
|
|
font-size: 28rpx;
|
|
|
|
|
|
color: #666;
|
|
|
|
|
|
padding: 20rpx 0;
|
|
|
|
|
|
}
|
2024-11-19 18:07:40 +08:00
|
|
|
|
|
|
|
|
|
|
.outbound-btn {
|
|
|
|
|
|
position: fixed;
|
|
|
|
|
|
bottom: 15rpx;
|
|
|
|
|
|
left: 15%;
|
|
|
|
|
|
width: 70%;
|
|
|
|
|
|
height: 65rpx;
|
|
|
|
|
|
line-height: 65rpx;
|
|
|
|
|
|
text-align: center;
|
|
|
|
|
|
background-color: #19be6b;
|
|
|
|
|
|
border-radius: 12rpx;
|
|
|
|
|
|
color: #fff;
|
|
|
|
|
|
}
|
2024-11-19 14:52:39 +08:00
|
|
|
|
</style>
|