<template>
|
<view style="margin-bottom: 2rem;">
|
<uni-section
|
:title="'流程卡号:'+processId"
|
:sub-title="'项目名称:'+title.project"
|
padding="0 0 5px 10px">
|
{{title.productName}}
|
|
<template v-slot:right>
|
<button @click="open(1)" type="primary" size='mini'>提交</button>
|
</template>
|
</uni-section>
|
</view>
|
|
|
<view>
|
<uni-table ref="table" border stripe type="selection" emptyText="暂无更多数据" @selection-change="selectionChange">
|
<uni-tr>
|
<uni-th align="center" width="150">可入数量</uni-th>
|
<uni-th align="center">总数量</uni-th>
|
<uni-th align="center">订序</uni-th>
|
<uni-th align="center">宽*高</uni-th>
|
<uni-th align="center">楼号</uni-th>
|
<uni-th align="center">已入数量</uni-th>
|
</uni-tr>
|
<uni-tr v-for="(item, index) in tableData" :key="index">
|
<uni-td align="center">
|
<uni-easyinput type="number"
|
:clearable='false'
|
v-model='item.inventoryQuantity'
|
style="text-align: center;"
|
@change="change($event,item)"
|
/>
|
</uni-td>
|
<uni-td align="center">{{ item.orderDetail.quantity }}</uni-td>
|
<uni-td align="center">{{ item.orderNumber }}</uni-td>
|
<uni-td align="center">{{ item.orderDetail.width }}*{{ item.orderDetail.height }}</uni-td>
|
<uni-td align="center">{{ item.orderDetail.buildingNumber }}</uni-td>
|
<uni-td align="center">{{ item.receivedQuantity }}</uni-td>
|
</uni-tr>
|
</uni-table>
|
<uni-popup ref="message" type="message">
|
<uni-popup-message :type="msgType" :message="messageText" :duration="3000"></uni-popup-message>
|
</uni-popup>
|
</view>
|
|
<!-- 提示窗示例 -->
|
<uni-popup ref="alertDialog" type="dialog" :mask-click="false">
|
<view class="flex-item foot_main">
|
<uni-row >
|
<uni-col :span="6">箱号:</uni-col>
|
<uni-col :span="18">
|
<uni-easyinput
|
:clearable='false'
|
v-model="flowData.container"/>
|
</uni-col>
|
</uni-row>
|
<uni-row >
|
<uni-col :span="6">库位:</uni-col>
|
<uni-col :span="18">
|
<uni-easyinput
|
:clearable='false'
|
v-model="flowData.storageRegion"/>
|
</uni-col>
|
</uni-row>
|
<uni-row >
|
<uni-col :span="6">备注:</uni-col>
|
<uni-col :span="18">
|
<uni-easyinput
|
:clearable='false'
|
v-model="flowData.remark"/>
|
</uni-col>
|
</uni-row>
|
</view>
|
<view>
|
<uni-row>
|
<uni-col :span='12'>
|
<button @click="open(0)">取消</button>
|
</uni-col>
|
<uni-col :span='12'>
|
<button type="primary" :loading="subLoading" @click="glassToStore">入库</button>
|
</uni-col>
|
</uni-row>
|
</view>
|
</uni-popup>
|
</template>
|
|
<script setup>
|
import { onMounted, ref } from 'vue';
|
import { onLoad } from '@dcloudio/uni-app'
|
import request from '../../utils/request'
|
import userInfo from '@/stores/userInfo'
|
import { debounce } from 'lodash'
|
const user=userInfo()
|
const message = ref(null)
|
const msgType=ref('success')
|
const messageText=ref('')
|
const checkList = ref([])
|
const alertDialog = ref(null)
|
|
let processId = ref(null)
|
let title = ref({
|
project:null,
|
productName:null
|
})
|
let subLoading = ref(false)
|
const table = ref(null)
|
const tableData = ref([])
|
const flowData = ref({
|
decValue:2,//计算保留位数
|
userId:user.user.userId ,
|
userName: user.user.userName,
|
storageRegion: null,
|
remark: null,
|
container: null,//库位
|
flowCard: []
|
})
|
|
onLoad(async (option)=>{
|
processId.value = option.processId
|
await getfinishedGlass(option.processId)
|
})
|
|
const getfinishedGlass = async (processIdVal) => {
|
const para = {
|
processId:processIdVal
|
}
|
await request.post(`/app/getSelectWarehousingList`,para).then(res => {
|
if(res.data.data.length===0){
|
uni.showModal({
|
title: '提示',
|
content: "此流程卡无可入库数据",
|
showCancel:false,
|
success:()=>{
|
uni.reLaunch({
|
url: `/pages/mainView/mainView`
|
})
|
}
|
});
|
return
|
}
|
tableData.value = res.data.data
|
title.value.project = `${tableData.value[0].order.project}(${tableData.value[0].order.batch})`
|
title.value.productName = tableData.value[0].orderDetail.productName
|
})
|
table.value.selectionAll()
|
}
|
|
const glassToStore = debounce(() => {
|
subLoading.value = true
|
checkList.value.sort()
|
const arr = []
|
|
checkList.value.forEach(item => {
|
arr.push(tableData.value[item])
|
})
|
flowData.value.flowCard = arr
|
request.post(`/app/addSelectWarehousing`,flowData.value).then(res => {
|
|
}).catch(e => {
|
uni.showModal({
|
title: '提示',
|
content: "此流程卡无可入库数据",
|
showCancel:false
|
});
|
}).finally(()=> {
|
uni.reLaunch({
|
url: `/pages/mainView/mainView`
|
})
|
})
|
},200)
|
|
const change = (e,item) => {
|
const quantity = item.orderDetail.quantity*1 - item.receivedQuantity*1
|
if(e>quantity || e<=0){
|
item.inventoryQuantity = quantity
|
messageToggle('error',`请输入大于0小于等于${quantity}`)
|
}
|
}
|
|
const selectionChange = (e) => {
|
checkList.value = e.detail.index
|
}
|
const messageToggle = (type,msg) => {
|
msgType.value = type
|
messageText.value = msg
|
message.value.open()
|
}
|
|
const open = (type) => {
|
if(type===1){
|
alertDialog.value.open()
|
}else{
|
alertDialog.value.close()
|
}
|
}
|
</script>
|
|
<style>
|
.foot_main{
|
width: 80vw;
|
margin: 0 auto;
|
background-color: white;
|
text-align: center;
|
}
|
</style>
|