<template>
|
<view>
|
|
<view class="nav_item form-container">
|
<form :modelValue="formData">
|
<view class="form-group">
|
<label class="form-label">物料条码:</label>
|
<input class="form-input" placeholder="请扫描物料条码" type="text"
|
v-model="formData.barcode" @confirm="getOutBarcodes"/>
|
</view>
|
<view class="form-group">
|
<label class="form-label">出库单号:</label>
|
<input class="form-input" type="text" disabled="true"
|
v-model="formData.billNo"/>
|
</view>
|
<view class="form-group">
|
<label class="form-label">工单单号:</label>
|
<input class="form-input" disabled="true" type="text"
|
v-model="formData.WorkNo"/>
|
</view>
|
<view class="form-group">
|
<label class="form-label">物料编码:</label>
|
<input class="form-input" disabled="true" type="text" v-model="formData.itemNo"/>
|
</view>
|
<view class="form-group">
|
<label class="form-label">物料名称:</label>
|
<input class="form-input" disabled="true" type="text" v-model="formData.itemName"/>
|
</view>
|
|
<view class="form-group">
|
<label class="form-label">条码数量:</label>
|
<input class="form-input" disabled="true" type="text" v-model="formData.quantity"/>
|
</view>
|
|
</form>
|
</view>
|
|
<view class="text" v-if="Message">
|
<text v-text="Message"></text>
|
</view>
|
|
<view class="container">
|
<view class="tab-bar">
|
<view
|
class="tab-item"
|
:class="{ active: currentTab === 0 }"
|
@click="changeTab(0)">
|
出库单条码明细
|
</view>
|
<view
|
class="tab-item"
|
:class="{ active: currentTab === 1 }"
|
@click="changeTab(1)">
|
单据信息
|
</view>
|
|
</view>
|
|
<!-- 内容区域 -->
|
<scroll-view class="content">
|
<view v-if="currentTab === 0" class="tab-content">
|
<view class="list-container">
|
<uni-table border stripe emptyText="暂无更多数据">
|
<uni-tr>
|
<uni-th align="center" class="th">出库单号</uni-th>
|
<uni-th align="center" class="th">物料编码</uni-th>
|
<uni-th align="center" class="th">物料条码</uni-th>
|
<uni-th align="center" class="th">接收标识</uni-th>
|
<uni-th align="center" class="th">数量</uni-th>
|
</uni-tr>
|
<uni-tr v-for="(item, index) in itemTableData" :key="index">
|
<uni-td align="center">
|
<input class="form-input" disabled="true" type="text" v-model="item.pbillNo"/>
|
</uni-td>
|
<uni-td align="center">
|
<input class="form-input" disabled="true" type="text" v-model="item.itemNo"/>
|
</uni-td>
|
<uni-td align="center">
|
<input class="form-input" disabled="true" type="text" v-model="item.itemBarcode"/>
|
</uni-td>
|
<uni-td align="center">
|
<input class="form-input" disabled="true" type="text" v-model="item.receive"/>
|
</uni-td>
|
<uni-td align="center">
|
<input class="form-input" disabled="true" type="text" v-model="item.quantity"/>
|
</uni-td>
|
</uni-tr>
|
</uni-table>
|
</view>
|
</view>
|
<view v-if="currentTab === 1" class="tab-content">
|
<view class="nav_item">
|
<form :modelValue="itemOutsFormData">
|
<view class="form-group">
|
<label class="form-label">出库单号:</label>
|
<input class="form-input" disabled="true" type="text" v-model="itemOutsFormData.itemOutNo"/>
|
</view>
|
<view class="form-group">
|
<label class="form-label">创建时间:</label>
|
<input class="form-input" disabled="true" type="text" v-model="itemOutsFormData.createDate"/>
|
</view>
|
<view class="form-group">
|
<label class="form-label">创建人员:</label>
|
<input class="form-input" disabled="true" v-model="itemOutsFormData.createBy"/>
|
</view>
|
<view class="form-group">
|
<label class="form-label">审核日期:</label>
|
<input class="form-input" disabled="true" type="text" v-model="itemOutsFormData.checkDate"/>
|
</view>
|
</form>
|
</view>
|
</view>
|
|
</scroll-view>
|
</view>
|
|
<view class="plus-button">
|
<button type="warn" @click="SaveBarCodes">确认接收</button>
|
</view>
|
|
</view>
|
</template>
|
<script>
|
import {
|
broadcastScan
|
} from '@/utils/scanCode.js';
|
|
export default {
|
data() {
|
return {
|
formData: {
|
billNo: "",
|
WorkNo: "",
|
itemNo: "",
|
itemName: "",
|
barcode: "",
|
quantity: null
|
},
|
Message: "",
|
messageCenter: {},
|
messageId: 0,
|
showClearIcon: false,
|
focus1: true,
|
focus2: false,
|
itemTableData: [],
|
isActive: 0,
|
index: 0,
|
currentTab: 0,
|
contentScrollW: 0, // 导航区宽度
|
scrollLeft: 0, // 横向滚动条位置
|
fullHeight: "",
|
itemOutsFormData: {}
|
}
|
},
|
methods: {
|
changeTab(index) {
|
this.currentTab = index;
|
},
|
getFocus() {
|
this.focus1 = true;
|
this.focus2 = false;
|
},
|
getOutBarcodes() {
|
//MesDepotSections
|
this.$post({
|
url: "/MesInvItemOutCDetails/GetOutItemList",
|
data: {
|
barcode: this.formData.barcode
|
}
|
}).then(res => {
|
|
//console.log(res.data.tbBillList);
|
console.log(JSON.stringify(res.data.tbBillList, null, 2));
|
|
|
this.formData.billNo = res.data.tbBillList.pbillNo;
|
this.formData.WorkNo = res.data.tbBillList.workNo;
|
this.formData.itemNo = res.data.tbBillList.itemNo;
|
this.formData.itemName = res.data.tbBillList.itemName;
|
this.formData.quantity = res.data.tbBillList.quantity;
|
this.getTable();
|
|
});
|
},
|
// 自定义扫描的结果回调函数
|
getScanCode(code) {
|
let parseData = code.trim();
|
console.log('自定义扫描的结果回调函数:' + parseData);
|
if (this.focus2) {
|
this.formData.barcode = parseData;
|
this.SaveBarCodes();
|
} else {
|
this.formData.sectionCode = parseData;
|
this.getOutBarcodes();
|
}
|
},
|
// 主动触发扫描
|
openScan() {
|
broadcastScan.triggerScan();
|
},
|
|
SaveBarCodes() {
|
this.formData.userName = this.$loginInfo.account;
|
|
this.$post({
|
url: '/MesInvItemOutCDetails/ConfirmReceipt',
|
data: this.formData
|
}).then(res => {
|
console.log(res.data.tbBillList);
|
|
|
this.getTable();
|
this.formData.barcode = "";
|
|
if (res) {
|
uni.showToast({
|
title: '接收成功',
|
duration: 2000
|
})
|
}
|
|
|
})
|
},
|
getTable() {
|
this.$post({
|
url: '/MesInvItemOutCDetails/GetFormList',
|
data: this.formData
|
}).then(res => {
|
console.log(JSON.stringify(res.data.tbBillList, null, 2));
|
this.itemTableData = res.data.tbBillList.invItemoutCDetails;
|
this.itemOutsFormData = res.data.tbBillList.itemOuts
|
});
|
}
|
},
|
// onLoad 是在页面加载时触发,用于页面的初始化操作,只执行一次
|
onLoad() {
|
// init传入一个回调函数做参数,在扫描时候会将数据传入此方法里,然后处理此方法的自定义业务逻辑
|
broadcastScan.init(this.getScanCode);
|
},
|
onUnload() {
|
broadcastScan.stop();
|
},
|
// 在页面展示时触发,用于处理页面显示相关的逻辑,可能会多次执行,包括页面首次展示和从后台切换到前台时
|
onShow() {
|
broadcastScan.start();
|
},
|
onHide() {
|
broadcastScan.stop();
|
},
|
}
|
</script>
|
<style lang="scss">
|
.form-group {
|
display: flex;
|
align-items: center;
|
border-bottom: 1px solid #c9c9c9;
|
}
|
|
.form-label {
|
margin-bottom: 0;
|
padding: 5px;
|
}
|
|
.form-input {
|
flex: 1;
|
margin-bottom: 0;
|
padding: 5px;
|
}
|
|
.picker {
|
flex: 1;
|
margin-bottom: 0;
|
padding: 5px;
|
font-size: 12px;
|
}
|
|
.uni-form-item {
|
display: flex;
|
border-bottom: 1px solid #c9c9c9;
|
}
|
|
.edit {
|
background-color: white;
|
}
|
|
/* 默认样式 */
|
.list-container {
|
height: 60vh;
|
/* 设置列表容器的高度为剩余空间,并减去表单容器的高度 */
|
overflow-y: auto;
|
/* 允许列表容器垂直滚动 */
|
padding: 10px;
|
/* 可选:添加一些内边距,使列表内容更美观 */
|
}
|
|
/* 在小屏幕设备上,重置高度为适应屏幕 */
|
@media (max-width: 768px) {
|
.list-container {
|
height: calc(100vh - 500px);
|
/* 适当调整高度 */
|
}
|
}
|
|
|
.form-container {
|
padding: 10px;
|
/* 可选:添加一些内边距,使表单内容更美观 */
|
}
|
|
.th {
|
background-color: lightskyblue;
|
color: #FFFFFF;
|
}
|
|
.text {
|
background-color: #ffee6f;
|
}
|
|
.plus-button {
|
line-height: 59px;
|
font-size: 24px;
|
cursor: pointer;
|
z-index: 1000;
|
margin-bottom: 10px;
|
}
|
|
.overlay {
|
position: fixed;
|
top: 0;
|
left: 0;
|
width: 100%;
|
height: 100%;
|
background-color: rgba(0, 0, 0, 0.5);
|
display: flex;
|
justify-content: center;
|
align-items: center;
|
}
|
|
.popup {
|
background-color: #fff;
|
padding: 20px;
|
border: 1px solid #ccc;
|
box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
|
width: 68vw;
|
/* 设置宽度为视口宽度的80% */
|
height: 25vh;
|
/* 设置高度为视口高度的80% */
|
}
|
|
.container {
|
display: flex;
|
flex-direction: column;
|
}
|
|
.tab-bar {
|
display: flex;
|
justify-content: space-around;
|
background-color: #f5f5f5;
|
padding: 10px;
|
border-bottom: 1px solid #ccc;
|
}
|
|
.tab-item {
|
flex: 1;
|
text-align: center;
|
padding: 10px;
|
border-radius: 5px;
|
background-color: #fff;
|
color: #007aff;
|
cursor: pointer;
|
font-size: 16px;
|
transition: background-color 0.3s, color 0.3s;
|
}
|
|
.tab-item.active {
|
background-color: #007aff;
|
color: #fff;
|
font-weight: bold;
|
}
|
|
.content {
|
flex: 1;
|
padding: 10px;
|
}
|
|
.tab-content {
|
padding: 10px;
|
}
|
</style>
|