编码出库完善
This commit is contained in:
parent
91b53a428e
commit
7606cab67e
|
|
@ -1,177 +1,241 @@
|
|||
<template>
|
||||
<!-- 编码出库-->
|
||||
<view class="page-container">
|
||||
<view class="complete-btn">
|
||||
<view class="btn" @click="changeTab(1)">
|
||||
<span>已完成</span>
|
||||
<div v-if="active == 1" class="bt-line"></div>
|
||||
</view>
|
||||
<view class="btn" style="margin-left: 120rpx" @click="changeTab(2)">
|
||||
<span>未完成</span>
|
||||
<div v-if="active == 2" class="bt-line"></div>
|
||||
</view>
|
||||
<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>
|
||||
</view>
|
||||
<uni-row :gutter="24" class="search-form">
|
||||
<uni-col :span="12">
|
||||
<view>
|
||||
<uni-datetime-picker
|
||||
v-model="dateArray"
|
||||
type="daterange"
|
||||
@maskClick="maskClick"
|
||||
@change="onChangeDate"
|
||||
placeholder="选择日期范围"
|
||||
/>
|
||||
</view>
|
||||
</uni-col>
|
||||
<uni-col :span="8">
|
||||
<view>
|
||||
<uni-easyinput placeholder="请输入内容" v-model="queryParams.keyWord" />
|
||||
</view>
|
||||
</uni-col>
|
||||
<uni-col :span="4">
|
||||
<view class="search" @click="getTableList()">搜索</view>
|
||||
</uni-col>
|
||||
</uni-row>
|
||||
|
||||
<scroll-view scroll-y @scrolltolower="onScrollTolower" class="scroll-container">
|
||||
<view
|
||||
class="table-list-item"
|
||||
v-for="(item, index) in tableList"
|
||||
:key="index"
|
||||
@click="handleItem(item)"
|
||||
>
|
||||
<div class="line"></div>
|
||||
<uni-row :gutter="24">
|
||||
<uni-col :span="6">申请时间:</uni-col>
|
||||
<uni-col :span="18"
|
||||
><div class="cont">{{ item.createTime }}</div></uni-col
|
||||
<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;
|
||||
"
|
||||
>编码检索</view
|
||||
>
|
||||
</uni-row>
|
||||
</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">
|
||||
<uni-row :gutter="24">
|
||||
<uni-col :span="6">领料单号:</uni-col>
|
||||
<uni-col :span="18"
|
||||
><div class="cont">{{ item.code }}</div></uni-col
|
||||
>
|
||||
</uni-row>
|
||||
<uni-row :gutter="24">
|
||||
<uni-col :span="6">领料物资:</uni-col>
|
||||
<uni-col :span="18"
|
||||
><div class="cont">{{ item.purchaseMaTypeName }}</div></uni-col
|
||||
>
|
||||
</uni-row>
|
||||
<uni-row :gutter="24">
|
||||
<uni-col :span="6">领料单位:</uni-col>
|
||||
<uni-col :span="18"
|
||||
><div class="cont">{{ item.purchaseMaNumber }}</div></uni-col
|
||||
>
|
||||
</uni-row>
|
||||
<uni-row :gutter="24">
|
||||
<uni-col :span="6">领料工程:</uni-col>
|
||||
<uni-col :span="18"><div class="cont"></div></uni-col>
|
||||
</uni-row>
|
||||
<uni-row :gutter="24">
|
||||
<uni-col :span="6">领料人:</uni-col>
|
||||
<uni-col :span="18">
|
||||
<div class="cont">{{ item.leasePerson }}</div>
|
||||
<uni-col :span="5">物资类型:</uni-col>
|
||||
<uni-col :span="15">
|
||||
<view class="cont">{{ item.materialName }}</view>
|
||||
</uni-col>
|
||||
<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>
|
||||
</uni-col>
|
||||
</uni-row>
|
||||
<uni-row :gutter="24">
|
||||
<uni-col :span="6">预领数量:</uni-col>
|
||||
<uni-col :span="5">规格型号:</uni-col>
|
||||
<uni-col :span="18">
|
||||
<div class="cont">{{ item.alNum }}</div>
|
||||
<view class="cont">{{ item.materialModel }}</view>
|
||||
</uni-col>
|
||||
</uni-row>
|
||||
<uni-row :gutter="24">
|
||||
<uni-col :span="6">已领数量:</uni-col>
|
||||
<uni-col :span="5">设备状态:</uni-col>
|
||||
<uni-col :span="18">
|
||||
<div class="cont">{{ item.alNum }}</div>
|
||||
<view class="cont">{{ item.statusName }}</view>
|
||||
</uni-col>
|
||||
</uni-row>
|
||||
<uni-row :gutter="24">
|
||||
<uni-col :span="6">待领数量:</uni-col>
|
||||
<uni-col :span="5">设备数量:</uni-col>
|
||||
<uni-col :span="18">
|
||||
<div class="cont">{{ item.alNum }}</div>
|
||||
</uni-col>
|
||||
</uni-row>
|
||||
<uni-row :gutter="24">
|
||||
<uni-col :span="6">状态:</uni-col>
|
||||
<uni-col :span="18">
|
||||
<div class="cont">未完成</div>
|
||||
<view class="cont">1</view>
|
||||
</uni-col>
|
||||
</uni-row>
|
||||
</view>
|
||||
<view class="loading-text"> {{ finish ? '没有更多数据了~' : '正在加载...' }} </view>
|
||||
|
||||
<view class="loading-text">
|
||||
{{ finish ? '没有更多数据了~' : '正在加载...' }}
|
||||
</view>
|
||||
</scroll-view>
|
||||
|
||||
<view class="outbound-btn" @tap="onHandleOutbound"> 出库 </view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref, reactive } from 'vue'
|
||||
import { getPickingOutboundListAPI } from '@/services/picking/outbound.js'
|
||||
import { onLoad } from '@dcloudio/uni-app'
|
||||
const active = ref(1)
|
||||
const tableList = ref([])
|
||||
const statusList = ref(['3', '13', '4', '14', '19'])
|
||||
const finish = ref(false) // 判断数据是否加载完毕
|
||||
// 查询参数
|
||||
const queryParams = ref({
|
||||
startTime: '', // 开始时间
|
||||
endTime: '', // 结束时间
|
||||
keyWord: '',
|
||||
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({
|
||||
pageNum: 1,
|
||||
pageSize: 3,
|
||||
pageSize: 10,
|
||||
typeId: queryParams.typeId,
|
||||
maStatus: 1,
|
||||
})
|
||||
const dateArray = ref([]) //日期范围
|
||||
|
||||
// 日期 change 事件
|
||||
const onChangeDate = (val) => {
|
||||
const [val_1, val_2] = val
|
||||
queryParams.value.startTime = val_1
|
||||
queryParams.value.endTime = val_2
|
||||
}
|
||||
// 计算出库最大数量
|
||||
const maxNum = computed(() => {
|
||||
// 1. 先通过预领数量和已领数量计算剩余待出库数量
|
||||
const waitNum = queryParams.preNum - queryParams.alNum
|
||||
|
||||
// 获取列表数据
|
||||
const getTableList = async () => {
|
||||
console.log('queryParams.value查询参数', queryParams.value)
|
||||
const res = await getPickingOutboundListAPI(queryParams.value)
|
||||
if (res.total > tableList.value.length) {
|
||||
tableList.value = [...tableList.value, ...res.rows]
|
||||
} else {
|
||||
finish.value = true
|
||||
}
|
||||
}
|
||||
|
||||
// 页面加载完毕
|
||||
onLoad(() => {
|
||||
getTableList()
|
||||
// 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)
|
||||
codeDeviceList.value = codeDeviceList.value.map((e) => {
|
||||
return { ...e, checked: false }
|
||||
})
|
||||
total.value = res.total
|
||||
}
|
||||
getCodeDeviceListData()
|
||||
|
||||
// 滚动触底事件
|
||||
const onScrollTolower = () => {
|
||||
if (!finish.value) {
|
||||
queryParams.value.pageNum++
|
||||
}
|
||||
getTableList()
|
||||
}
|
||||
|
||||
// tap 栏切换
|
||||
const changeTab = (index) => {
|
||||
active.value = index
|
||||
if (index == 1) {
|
||||
statusList.value = ['3', '13', '4', '14', '19']
|
||||
getTableList()
|
||||
} else if (index == 2) {
|
||||
statusList.value = ['2', '12']
|
||||
getTableList()
|
||||
console.log('滚动触底--')
|
||||
if (total.value > codeDeviceList.value.length) {
|
||||
queryCodeParams.value.pageNum++
|
||||
getCodeDeviceListData()
|
||||
}
|
||||
}
|
||||
// 点击跳转
|
||||
const handleItem = (item) => {
|
||||
console.log('🚀 ~ handleItem ~ item:', item)
|
||||
// uni.navigateTo({ url: '/pages/new-purchase/accept/acceptDetails' })
|
||||
|
||||
// 判断数据是否加载完毕
|
||||
const finish = computed(() => {
|
||||
if (total.value === codeDeviceList.value.length) return true
|
||||
})
|
||||
|
||||
// 复选框事件
|
||||
const onChangeChecked = (item) => {
|
||||
item.checked = !item.checked
|
||||
}
|
||||
|
||||
const maskClick = () => {}
|
||||
// 计算已选择数量
|
||||
const isSelectNum = computed(() => {
|
||||
const isSelectList = codeDeviceList.value.filter((e) => e.checked === true)
|
||||
if (maxNum.value === isSelectList.length) {
|
||||
uni.showToast({
|
||||
title: '勾选设备已达到最大待出库数量!',
|
||||
icon: 'none',
|
||||
})
|
||||
}
|
||||
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 })
|
||||
|
||||
if (res.code === 200) {
|
||||
uni.showToast({
|
||||
title: '出库成功!',
|
||||
icon: 'none',
|
||||
})
|
||||
|
||||
setTimeout(() => {
|
||||
// 返回上一个页面
|
||||
uni.navigateBack({
|
||||
delta: 1,
|
||||
success() {
|
||||
uni.$emit('onUpdate')
|
||||
},
|
||||
})
|
||||
}, 500)
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
|
|
@ -180,60 +244,26 @@ const maskClick = () => {}
|
|||
height: 100%;
|
||||
padding: 0 15rpx;
|
||||
flex-direction: column;
|
||||
background-color: #e8f5fb;
|
||||
|
||||
.complete-btn {
|
||||
display: flex;
|
||||
.table-list-item {
|
||||
margin: 5rpx 0;
|
||||
padding: 20rpx;
|
||||
.btn {
|
||||
background-color: #fff;
|
||||
border-radius: 10rpx;
|
||||
.title {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
font-size: 30rpx;
|
||||
font-weight: 800;
|
||||
}
|
||||
.bt-line {
|
||||
width: 80rpx;
|
||||
height: 4rpx;
|
||||
background-color: #3784fb;
|
||||
}
|
||||
}
|
||||
|
||||
.search-form {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
box-sizing: content-box;
|
||||
}
|
||||
|
||||
.search {
|
||||
height: 65rpx;
|
||||
background-color: #3784fb;
|
||||
text-align: center;
|
||||
line-height: 65rpx;
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
.scroll-container {
|
||||
.table-list-item {
|
||||
margin: 20rpx 0;
|
||||
padding: 20rpx;
|
||||
background-color: #fff;
|
||||
min-height: 300rpx;
|
||||
border-radius: 10rpx;
|
||||
.title {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
}
|
||||
.cont {
|
||||
display: flex;
|
||||
justify-content: flex-end;
|
||||
line-height: 1.9;
|
||||
}
|
||||
.line {
|
||||
margin: 20rpx 0;
|
||||
height: 1px;
|
||||
background-color: #e8e8e8;
|
||||
}
|
||||
.coding-btn {
|
||||
padding: 5rpx 0;
|
||||
background-color: #409eff;
|
||||
border-radius: 6rpx;
|
||||
text-align: center;
|
||||
color: #fff;
|
||||
font-size: 14px;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -244,4 +274,17 @@ const maskClick = () => {}
|
|||
color: #666;
|
||||
padding: 20rpx 0;
|
||||
}
|
||||
|
||||
.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;
|
||||
}
|
||||
</style>
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@
|
|||
</view>
|
||||
</uni-col>
|
||||
<uni-col :span="4">
|
||||
<!-- <view class="search" @click="getTableList()">查询</view> -->
|
||||
<view class="search">查询</view>
|
||||
</uni-col>
|
||||
</uni-row>
|
||||
|
||||
|
|
@ -168,7 +168,7 @@ const onCodingItem = (item) => {
|
|||
if (manageType === 0) {
|
||||
codingUrl = '/pages/picking/outbound/code-outbound' // 编码出库
|
||||
}
|
||||
if (manageType === 1) {
|
||||
if (manageType == 1) {
|
||||
codingUrl = '/pages/picking/outbound/num-outbound' // 数量出库
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -29,3 +29,13 @@ export const setOutboundNumAPI = (data) => {
|
|||
data,
|
||||
})
|
||||
}
|
||||
/**
|
||||
* 领料出库 ---- 编码出库 ---- 获取编码设备列表
|
||||
*/
|
||||
export const getCodeDeviceListAPI = (data) => {
|
||||
return http({
|
||||
method: 'GET',
|
||||
url: '/material/ma_machine/list',
|
||||
data,
|
||||
})
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ import { useMemberStore } from '@/stores'
|
|||
* baseURL 设置请求ip地址和端口
|
||||
*/
|
||||
const ENV = process.env.NODE_ENV
|
||||
const baseURL = ENV === 'development' ? '/api' : '***'
|
||||
const baseURL = ENV === 'development' ? 'http://192.168.2.76:18080' : '***'
|
||||
|
||||
/**
|
||||
* httpInterceptor 分别拦截 request 和 uploadFile 请求
|
||||
|
|
|
|||
Loading…
Reference in New Issue