Merge branch 'dev-sy-11-18'
This commit is contained in:
commit
26c1e3d2dc
|
|
@ -104,22 +104,61 @@
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup>
|
<script setup>
|
||||||
import { ref } from 'vue'
|
import { ref, onUnmounted } from 'vue'
|
||||||
import { getOutboundDetailsAPI } from '@/services/picking/outbound.js'
|
import { getOutboundDetailsAPI } from '@/services/picking/outbound.js'
|
||||||
import { onLoad } from '@dcloudio/uni-app'
|
import { onLoad } from '@dcloudio/uni-app'
|
||||||
const detailsList = ref([])
|
const detailsList = ref([])
|
||||||
const query = defineProps() // 获取上级页面传递的路由参数
|
const query = defineProps() // 获取上级页面传递的路由参数
|
||||||
|
|
||||||
|
// 领料单位,参数等信息
|
||||||
|
const leaseApplyInfo = ref({
|
||||||
|
leaseUnit: '', // 领料单位
|
||||||
|
leaseProject: '', // 领料工程
|
||||||
|
maTypeName: '', // 物资类型
|
||||||
|
typeName: '', // 规格型号
|
||||||
|
unitName: '', // 单位
|
||||||
|
storageNum: '', // 库存数量
|
||||||
|
preNum: '', // 预领数量
|
||||||
|
parentId: query.id, // 出库时所需参数 取列表 id
|
||||||
|
id: '', // 出库时所需参数 取详情接口 id
|
||||||
|
typeId: '', // 出库时所需参数 取详情接口 typeId
|
||||||
|
manageType: '', // 出库时所需参数 取详情接口 manageType
|
||||||
|
})
|
||||||
|
|
||||||
// 获取列表详情
|
// 获取列表详情
|
||||||
const getOutboundDetailsData = async () => {
|
const getOutboundDetailsData = async () => {
|
||||||
const { data: res } = await getOutboundDetailsAPI(query.id)
|
const { data: res } = await getOutboundDetailsAPI(query.id)
|
||||||
detailsList.value = res.leaseApplyDetailsList
|
detailsList.value = res.leaseApplyDetailsList
|
||||||
console.log('详情数据', res)
|
leaseApplyInfo.value.leaseUnit = res.leaseApplyInfo.leaseUnit
|
||||||
|
leaseApplyInfo.value.leaseProject = res.leaseApplyInfo.leaseProject
|
||||||
|
// console.log('详情数据', res)
|
||||||
}
|
}
|
||||||
|
|
||||||
// 点击跳转出库页面
|
// 点击跳转出库页面
|
||||||
const onCodingItem = (item) => {
|
const onCodingItem = (item) => {
|
||||||
const { status, manageType } = item
|
// 解构所需要的数据
|
||||||
|
const {
|
||||||
|
status,
|
||||||
|
manageType,
|
||||||
|
maTypeName,
|
||||||
|
typeName,
|
||||||
|
storageNum,
|
||||||
|
preNum,
|
||||||
|
alNum,
|
||||||
|
unitName,
|
||||||
|
id,
|
||||||
|
typeId,
|
||||||
|
} = item
|
||||||
|
|
||||||
|
leaseApplyInfo.value.maTypeName = maTypeName
|
||||||
|
leaseApplyInfo.value.typeName = typeName
|
||||||
|
leaseApplyInfo.value.unitName = unitName
|
||||||
|
leaseApplyInfo.value.storageNum = storageNum
|
||||||
|
leaseApplyInfo.value.preNum = preNum
|
||||||
|
leaseApplyInfo.value.alNum = alNum
|
||||||
|
leaseApplyInfo.value.id = id
|
||||||
|
leaseApplyInfo.value.typeId = typeId
|
||||||
|
leaseApplyInfo.value.manageType = manageType
|
||||||
|
|
||||||
if (status == 2) {
|
if (status == 2) {
|
||||||
uni.showToast({ title: '该物资已完成出库!', icon: 'none' })
|
uni.showToast({ title: '该物资已完成出库!', icon: 'none' })
|
||||||
|
|
@ -133,12 +172,25 @@ const onCodingItem = (item) => {
|
||||||
codingUrl = '/pages/picking/outbound/num-outbound' // 数量出库
|
codingUrl = '/pages/picking/outbound/num-outbound' // 数量出库
|
||||||
}
|
}
|
||||||
|
|
||||||
uni.navigateTo({ url: codingUrl })
|
// 把 leaseApplyInfo 领料信息转成 json 传递到下个页面
|
||||||
|
uni.navigateTo({ url: `${codingUrl}?queryParams=${JSON.stringify(leaseApplyInfo.value)}` })
|
||||||
}
|
}
|
||||||
|
|
||||||
// 页面加载完毕
|
// 页面加载完毕
|
||||||
onLoad(() => {
|
onLoad(() => {
|
||||||
getOutboundDetailsData()
|
getOutboundDetailsData()
|
||||||
|
|
||||||
|
// 监听出库完成事件 刷新列表
|
||||||
|
uni.$on('onUpdate', () => {
|
||||||
|
// console.log('监听事件')
|
||||||
|
// 刷新列表
|
||||||
|
getOutboundDetailsData()
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
|
// 页面销毁时移除事件监听
|
||||||
|
onUnmounted(() => {
|
||||||
|
uni.$off('onUpdate') // 移除事件监听
|
||||||
})
|
})
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -116,6 +116,7 @@
|
||||||
import { ref, computed } from 'vue'
|
import { ref, computed } from 'vue'
|
||||||
import { getPickingOutboundListAPI } from '@/services/picking/outbound.js'
|
import { getPickingOutboundListAPI } from '@/services/picking/outbound.js'
|
||||||
import { onLoad } from '@dcloudio/uni-app'
|
import { onLoad } from '@dcloudio/uni-app'
|
||||||
|
import { onShow } from '@dcloudio/uni-app'
|
||||||
|
|
||||||
const total = ref(0) // 数据总量
|
const total = ref(0) // 数据总量
|
||||||
const active = ref(1) // tap索引
|
const active = ref(1) // tap索引
|
||||||
|
|
@ -160,6 +161,11 @@ onLoad(() => {
|
||||||
getTableList()
|
getTableList()
|
||||||
})
|
})
|
||||||
|
|
||||||
|
onShow(() => {
|
||||||
|
tableList.value = []
|
||||||
|
getTableList()
|
||||||
|
})
|
||||||
|
|
||||||
// 滚动触底事件
|
// 滚动触底事件
|
||||||
const onScrollTolower = () => {
|
const onScrollTolower = () => {
|
||||||
if (total.value > tableList.value.length) {
|
if (total.value > tableList.value.length) {
|
||||||
|
|
|
||||||
|
|
@ -6,83 +6,142 @@
|
||||||
<uni-row :gutter="24">
|
<uni-row :gutter="24">
|
||||||
<uni-col :span="6">领料单位:</uni-col>
|
<uni-col :span="6">领料单位:</uni-col>
|
||||||
<uni-col :span="18"
|
<uni-col :span="18"
|
||||||
><div class="cont">{{ item.createTime }}</div></uni-col
|
><div class="cont">{{ queryParams.leaseUnit }}</div></uni-col
|
||||||
>
|
>
|
||||||
</uni-row>
|
</uni-row>
|
||||||
<uni-row :gutter="24">
|
<uni-row :gutter="24">
|
||||||
<uni-col :span="6">领料工程:</uni-col>
|
<uni-col :span="6">领料工程:</uni-col>
|
||||||
<uni-col :span="18"
|
<uni-col :span="18"
|
||||||
><div class="cont">{{ item.code }}</div></uni-col
|
><div class="cont">{{ queryParams.leaseProject }}</div></uni-col
|
||||||
>
|
>
|
||||||
</uni-row>
|
</uni-row>
|
||||||
<uni-row :gutter="24">
|
<uni-row :gutter="24">
|
||||||
<uni-col :span="6">物资类型:</uni-col>
|
<uni-col :span="6">物资类型:</uni-col>
|
||||||
<uni-col :span="18"
|
<uni-col :span="18"
|
||||||
><div class="cont">{{ item.purchaseMaTypeName }}</div></uni-col
|
><div class="cont">{{ queryParams.maTypeName }}</div></uni-col
|
||||||
>
|
>
|
||||||
</uni-row>
|
</uni-row>
|
||||||
<uni-row :gutter="24">
|
<uni-row :gutter="24">
|
||||||
<uni-col :span="6">规格型号:</uni-col>
|
<uni-col :span="6">规格型号:</uni-col>
|
||||||
<uni-col :span="18"
|
<uni-col :span="18"
|
||||||
><div class="cont">{{ item.purchaseMaNumber }}</div></uni-col
|
><div class="cont">{{ queryParams.typeName }}</div></uni-col
|
||||||
>
|
>
|
||||||
</uni-row>
|
</uni-row>
|
||||||
<uni-row :gutter="24">
|
<uni-row :gutter="24">
|
||||||
<uni-col :span="6">单位:</uni-col>
|
<uni-col :span="6">单位:</uni-col>
|
||||||
<uni-col :span="18"><div class="cont"></div></uni-col>
|
<uni-col :span="18">
|
||||||
|
<div class="cont">{{ queryParams.unitName }}</div>
|
||||||
|
</uni-col>
|
||||||
</uni-row>
|
</uni-row>
|
||||||
<uni-row :gutter="24">
|
<uni-row :gutter="24">
|
||||||
<uni-col :span="6">库存数量:</uni-col>
|
<uni-col :span="6">库存数量:</uni-col>
|
||||||
<uni-col :span="18">
|
<uni-col :span="18">
|
||||||
<div class="cont">{{ item.leasePerson }}</div>
|
<div class="cont">{{ queryParams.storageNum }}</div>
|
||||||
</uni-col>
|
</uni-col>
|
||||||
</uni-row>
|
</uni-row>
|
||||||
<uni-row :gutter="24">
|
<uni-row :gutter="24">
|
||||||
<uni-col :span="6">预领数量:</uni-col>
|
<uni-col :span="6">预领数量:</uni-col>
|
||||||
<uni-col :span="18">
|
<uni-col :span="18">
|
||||||
<div class="cont">{{ item.alNum }}</div>
|
<div class="cont">{{ queryParams.preNum }}</div>
|
||||||
</uni-col>
|
</uni-col>
|
||||||
</uni-row>
|
</uni-row>
|
||||||
<uni-row :gutter="24">
|
<uni-row :gutter="24">
|
||||||
<uni-col :span="6">已领数量:</uni-col>
|
<uni-col :span="6">已领数量:</uni-col>
|
||||||
<uni-col :span="18">
|
<uni-col :span="18">
|
||||||
<div class="cont">{{ item.alNum }}</div>
|
<div class="cont">{{ queryParams.alNum }}</div>
|
||||||
</uni-col>
|
</uni-col>
|
||||||
</uni-row>
|
</uni-row>
|
||||||
<uni-row :gutter="24">
|
<uni-row :gutter="24">
|
||||||
<uni-col :span="6">出库数量:</uni-col>
|
<uni-col :span="6">出库数量:</uni-col>
|
||||||
<uni-col :span="18">
|
<uni-col :span="18">
|
||||||
<div class="cont" style="width: 200rpx">
|
<div class="cont" style="width: 200rpx">
|
||||||
<uni-number-box :min="0" :max="100"></uni-number-box>
|
<uni-number-box
|
||||||
|
:min="0"
|
||||||
|
:max="maxNum"
|
||||||
|
v-model="outboundNum"
|
||||||
|
@change="onChangeNumber"
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
</uni-col>
|
</uni-col>
|
||||||
</uni-row>
|
</uni-row>
|
||||||
|
|
||||||
<view class="outbound-btn"> 出库 </view>
|
<view class="outbound-btn" @tap="onHandleOutbound"> 出库 </view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup>
|
<script setup>
|
||||||
import { ref } from 'vue'
|
import { computed, ref } from 'vue'
|
||||||
import { getPickingOutboundListAPI } from '@/services/picking/outbound.js'
|
import { setOutboundNumAPI } from '@/services/picking/outbound.js'
|
||||||
import { onLoad } from '@dcloudio/uni-app'
|
const outboundNum = ref(0)
|
||||||
|
const query = defineProps() // 获取上级页面传递的路由参数
|
||||||
|
const queryParams = JSON.parse(query.queryParams)
|
||||||
|
|
||||||
// 获取列表数据
|
// 计算出库最大数量
|
||||||
const getTableList = async () => {
|
const maxNum = computed(() => {
|
||||||
console.log('queryParams.value查询参数', queryParams.value)
|
// 1. 先通过预领数量和已领数量计算剩余待出库数量
|
||||||
const res = await getPickingOutboundListAPI(queryParams.value)
|
const waitNum = queryParams.preNum - queryParams.alNum
|
||||||
if (res.total > tableList.value.length) {
|
|
||||||
tableList.value = [...tableList.value, ...res.rows]
|
// 2. 判断库存数量是否大于待出库数量 如大于则取待出库数量 如小于则取库存书看了
|
||||||
} else {
|
return queryParams.storageNum > waitNum ? waitNum : queryParams.storageNum
|
||||||
finish.value = true
|
})
|
||||||
|
|
||||||
|
// 数量选择框change事件
|
||||||
|
const onChangeNumber = (e) => {
|
||||||
|
if (e == maxNum.value) {
|
||||||
|
uni.showToast({
|
||||||
|
title: '已达到当前物资最大出库数量!',
|
||||||
|
icon: 'none',
|
||||||
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 页面加载完毕
|
// 出库按钮
|
||||||
onLoad(() => {
|
const onHandleOutbound = async () => {
|
||||||
getTableList()
|
if (outboundNum.value === 0) {
|
||||||
})
|
uni.showToast({
|
||||||
|
title: '出库数量不能为0',
|
||||||
|
icon: 'none',
|
||||||
|
})
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// 解构所需要的数据
|
||||||
|
const { maTypeName, typeName, preNum, alNum, id, typeId, parentId, manageType } = queryParams
|
||||||
|
// 组装接口参数
|
||||||
|
const params = {
|
||||||
|
alNum,
|
||||||
|
id,
|
||||||
|
parentId,
|
||||||
|
typeId,
|
||||||
|
manageType,
|
||||||
|
typeName,
|
||||||
|
maTypeName,
|
||||||
|
inputNum: outboundNum.value,
|
||||||
|
leaseType: 0,
|
||||||
|
outNum: preNum,
|
||||||
|
}
|
||||||
|
|
||||||
|
const res = await setOutboundNumAPI({ leaseOutDetailsList: [params] })
|
||||||
|
console.log('出库结果', res)
|
||||||
|
|
||||||
|
if (res.code === 200) {
|
||||||
|
uni.showToast({
|
||||||
|
title: '出库成功!',
|
||||||
|
icon: 'none',
|
||||||
|
})
|
||||||
|
|
||||||
|
setTimeout(() => {
|
||||||
|
// 返回上一个页面
|
||||||
|
uni.navigateBack({
|
||||||
|
delta: 1,
|
||||||
|
success() {
|
||||||
|
uni.$emit('onUpdate')
|
||||||
|
},
|
||||||
|
})
|
||||||
|
}, 500)
|
||||||
|
}
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
|
|
@ -158,9 +217,9 @@ onLoad(() => {
|
||||||
|
|
||||||
.outbound-btn {
|
.outbound-btn {
|
||||||
width: 70%;
|
width: 70%;
|
||||||
margin: 15rpx auto;
|
margin: 25rpx auto;
|
||||||
height: 68rpx;
|
height: 65rpx;
|
||||||
line-height: 68rpx;
|
line-height: 65rpx;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
background-color: #19be6b;
|
background-color: #19be6b;
|
||||||
border-radius: 12rpx;
|
border-radius: 12rpx;
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
import { http } from '@/utils/http'
|
import { http } from '@/utils/http'
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 领料出库 ---- 列表查询接口
|
* 领料出库 ---- 列表查询
|
||||||
*/
|
*/
|
||||||
export const getPickingOutboundListAPI = (data) => {
|
export const getPickingOutboundListAPI = (data) => {
|
||||||
return http({
|
return http({
|
||||||
|
|
@ -19,3 +19,13 @@ export const getOutboundDetailsAPI = (id) => {
|
||||||
url: `/material/lease_apply_info/${id}`,
|
url: `/material/lease_apply_info/${id}`,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* 领料出库 ---- 数量出库
|
||||||
|
*/
|
||||||
|
export const setOutboundNumAPI = (data) => {
|
||||||
|
return http({
|
||||||
|
method: 'POSt',
|
||||||
|
url: '/material/lease_apply_info/leaseOut',
|
||||||
|
data,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue