457 lines
		
	
	
		
			11 KiB
		
	
	
	
		
			Vue
		
	
			
		
		
	
	
			457 lines
		
	
	
		
			11 KiB
		
	
	
	
		
			Vue
		
	
<!--托盘信息查询-->
 | 
						|
<template>
 | 
						|
	<view class="container">
 | 
						|
		<cu-custom  :isBack="true">
 | 
						|
			<block slot="backText"></block>
 | 
						|
			<block slot="content">托盘信息查询</block>
 | 
						|
		</cu-custom>
 | 
						|
		<view class="example">
 | 
						|
			<uni-forms ref="form" :model="formData" labelWidth="80px">
 | 
						|
				<uni-forms-item label="托盘编号" name="palletCode">
 | 
						|
					<view class="fromItem">
 | 
						|
						<view class="flex-twice  padding-0 radius">
 | 
						|
							<uni-easyinput v-model="formData.palletCode" placeholder="请输入托盘编号" @blur="queryPalletInfo" />
 | 
						|
						</view>
 | 
						|
						<image style="width: 28rpx;" src="/static/images/right.png" mode="widthFix"></image>
 | 
						|
					</view>
 | 
						|
				
 | 
						|
					<!-- <view class="flex-sub padding-0 margin-xs radius">
 | 
						|
						<view class="cu-capsule radius" v-if="palletInfo.needPickQty>0">
 | 
						|
							<view class='cu-tag bg-blue '>
 | 
						|
								需分拣数量{{palletInfo.needPickQty}}
 | 
						|
							</view>
 | 
						|
						</view>
 | 
						|
					</view> -->
 | 
						|
				</uni-forms-item>
 | 
						|
			</uni-forms>
 | 
						|
			<!-- <button type="primary" @click="formSubmit">托盘解绑</button> -->
 | 
						|
			<bottomBtn :isSubmit="true" :isWhite="false" position="fixed"  :texts="['托盘解绑']"
 | 
						|
				@onSubmit="formSubmit"></bottomBtn>
 | 
						|
			<!--明细-->
 | 
						|
			<view v-if='palletInfo.details.length>0'>
 | 
						|
				<view class="uni-container">
 | 
						|
					<uni-table ref="table" :loading="loading" border stripe type="" emptyText="暂无更多数据"
 | 
						|
						@selection-change="selectionChange">
 | 
						|
						<uni-tr>
 | 
						|
							<uni-th style="flex: 1;" >基本信息</uni-th>
 | 
						|
							<!-- <uni-th width="100" align="center">设置</uni-th> -->
 | 
						|
						</uni-tr>
 | 
						|
						<uni-tr v-for="(item, index) in palletInfo.details" :key="index">
 | 
						|
							<uni-td>
 | 
						|
								<view class="flex">
 | 
						|
									<view class="flex-sub padding-0 margin-xs radius">托盘编号</view>
 | 
						|
									<view class="flex-twice padding-0 margin-xs radius">{{item.palletCode}}</view>
 | 
						|
								</view>
 | 
						|
								<view class="flex">
 | 
						|
									<view class="flex-sub padding-0 margin-xs radius">物料编号</view>
 | 
						|
									<view class="flex-twice padding-0 margin-xs radius">{{item.skuCode}}</view>
 | 
						|
								</view>
 | 
						|
								<view class="flex">
 | 
						|
									<view class="flex-sub padding-0 margin-xs radius">物料名称</view>
 | 
						|
									<view class="flex-twice padding-0 margin-xs radius">{{item.skuName}}</view>
 | 
						|
								</view>
 | 
						|
								<view class="flex">
 | 
						|
									<view class="flex-sub padding-0 margin-xs radius">物料类型</view>
 | 
						|
									<view class="flex-twice padding-0 margin-xs radius">{{item.skuType}}</view>
 | 
						|
								</view>
 | 
						|
								<!-- <view class="flex">
 | 
						|
									<view class="flex-sub padding-0 margin-xs radius">批次号</view>
 | 
						|
									<view class="flex-twice padding-0 margin-xs radius">{{item.batch}}</view>
 | 
						|
								</view> -->
 | 
						|
								<view class="flex">
 | 
						|
									<view class="flex-sub padding-0 margin-xs radius">物料数量</view>
 | 
						|
									<view class="flex-twice padding-0 margin-xs radius">{{item.skuQty}}</view>
 | 
						|
								</view>
 | 
						|
								<!-- <view class="flex">
 | 
						|
									<view class="flex-sub padding-0 margin-xs radius">拣选数量</view>
 | 
						|
									<view class="flex-twice padding-0 margin-xs radius">
 | 
						|
										<input placeholder="请输入拣选数量" v-model="item.pickQty"></input>
 | 
						|
									</view>
 | 
						|
								</view> -->
 | 
						|
							</uni-td>
 | 
						|
							<!-- <uni-td>
 | 
						|
								<view class="grid  text-center solid-bottom  justify-start">
 | 
						|
									<has-authority :code="'pallet:infoQuery:btn'">
 | 
						|
										<view class=" margin-xs radius">
 | 
						|
											<button class="uni-button" size="mini" type="primary"
 | 
						|
												@click="btnModify">修改</button>
 | 
						|
										</view>
 | 
						|
									</has-authority>
 | 
						|
									<has-authority :code="'pallet:infoQuery:btnAA'">
 | 
						|
										<view class=" margin-xs radius">
 | 
						|
											<button class="uni-button" size="mini" type="warn">删除</button>
 | 
						|
										</view>
 | 
						|
									</has-authority>
 | 
						|
								</view>
 | 
						|
							</uni-td> -->
 | 
						|
						</uni-tr>
 | 
						|
					</uni-table>
 | 
						|
					<!-- <view class="uni-pagination-box"><uni-pagination show-icon :page-size="pageSize"
 | 
						|
							:current="pageCurrent" :total="total" @change="change" /></view> -->
 | 
						|
				</view>
 | 
						|
			</view>
 | 
						|
		</view>
 | 
						|
 | 
						|
	</view>
 | 
						|
 | 
						|
</template>
 | 
						|
 | 
						|
<script>
 | 
						|
	import auth from '@/plugins/auth.js'
 | 
						|
	import {
 | 
						|
		queryConfirmOutPallet,
 | 
						|
		confirmOut,confirmOutPallet
 | 
						|
	} from "@/api/wms/outConfirm.js"
 | 
						|
	import{queryPalletInfo,unBindRack} from "@/api/wms/palletDetailUnBind.js"
 | 
						|
	import {
 | 
						|
		formateDate
 | 
						|
	} from 'tough-cookie'
 | 
						|
	import {
 | 
						|
		bottomBtn
 | 
						|
	} from '@/components/bottomBtn/bottomBtn.vue'
 | 
						|
	export default {
 | 
						|
		data() {
 | 
						|
			return {
 | 
						|
				whCode: this.$store.state.user.warehouse[0]?.warehouseCode,
 | 
						|
				userCode:this.$store.state.user.name,
 | 
						|
				//表单中的数据信息	
 | 
						|
				formData: {
 | 
						|
					palletCode: "",
 | 
						|
					pickQty: 0,
 | 
						|
					details: []
 | 
						|
				},
 | 
						|
				rules: {
 | 
						|
					palletCode: {
 | 
						|
						rules: [{
 | 
						|
							required: true,
 | 
						|
							errorMessage: '托盘编号不能为空'
 | 
						|
						}]
 | 
						|
					},
 | 
						|
					pickQty: {
 | 
						|
						rules: [{
 | 
						|
							required: true,
 | 
						|
							errorMessage: '拣选数量不能为空'
 | 
						|
						}]
 | 
						|
					}
 | 
						|
				},
 | 
						|
				//查询获取的托盘信息
 | 
						|
				palletInfo: {
 | 
						|
					needPickQty: 1,
 | 
						|
					details: [],
 | 
						|
					palletCode:''
 | 
						|
				},
 | 
						|
 | 
						|
				//table 相关
 | 
						|
				searchVal: '',
 | 
						|
				tableData: [],
 | 
						|
				// 每页数据量
 | 
						|
				pageSize: 10,
 | 
						|
				// 当前页
 | 
						|
				pageCurrent: 1,
 | 
						|
				// 数据总量
 | 
						|
				total: 0,
 | 
						|
				loading: false,
 | 
						|
				//tabe选中的数据对象
 | 
						|
				selectedIndexs: [],
 | 
						|
				// 列配置
 | 
						|
				tableClumns: []
 | 
						|
			};
 | 
						|
		},
 | 
						|
		onReady() {
 | 
						|
			this.$refs.form.setRules(this.rules)
 | 
						|
		},
 | 
						|
		component: {
 | 
						|
			bottomBtn
 | 
						|
		},
 | 
						|
		methods: {
 | 
						|
			btnModify(e) {
 | 
						|
				console.log("修改按钮", e);
 | 
						|
				var a = auth.hasPermi("pallet:infoQuery:btn");
 | 
						|
				console.log("hasPermi", a)
 | 
						|
				//获取按钮权限
 | 
						|
			},
 | 
						|
			//数据来源[模拟]
 | 
						|
			async fetch(param) {
 | 
						|
				var response = await queryPalletInfo(param);
 | 
						|
				return {
 | 
						|
					total: response.data.total,
 | 
						|
					data: response.data.record,
 | 
						|
				};
 | 
						|
			},
 | 
						|
			// table多选处理
 | 
						|
			selectedItems() {
 | 
						|
				return this.selectedIndexs.map(i => this.tableData[i])
 | 
						|
			},
 | 
						|
			// 多选
 | 
						|
			selectionChange(e) {
 | 
						|
				console.log(e.detail.index)
 | 
						|
				console.log(e)
 | 
						|
				this.selectedIndexs = e.detail.index
 | 
						|
				//选中内容改变时获取选中数据
 | 
						|
 | 
						|
			},
 | 
						|
			//批量删除
 | 
						|
			delTable() {
 | 
						|
				console.log(this.selectedItems())
 | 
						|
			},
 | 
						|
			// 分页触发
 | 
						|
			change(e) {
 | 
						|
				this.$refs.table.clearSelection()
 | 
						|
				this.selectedIndexs.length = 0
 | 
						|
				this.getData(e.current)
 | 
						|
			},
 | 
						|
			// 搜索
 | 
						|
			search() {
 | 
						|
				this.getData(1, this.searchVal)
 | 
						|
			},
 | 
						|
			// 获取数据
 | 
						|
			getData(pageCurrent, value = '') {
 | 
						|
				this.loading = true
 | 
						|
				this.pageCurrent = pageCurrent
 | 
						|
				this.request({
 | 
						|
					pageSize: this.pageSize,
 | 
						|
					pageCurrent: pageCurrent,
 | 
						|
					value: value,
 | 
						|
					success: res => {
 | 
						|
						// console.log('data', res);
 | 
						|
						this.tableData = res.data
 | 
						|
						this.total = res.total
 | 
						|
						this.loading = false
 | 
						|
					}
 | 
						|
				})
 | 
						|
			},
 | 
						|
			//获取选中的数据
 | 
						|
			getSelectDetail() {
 | 
						|
				if (this.selectedIndexs.length == 0) {
 | 
						|
					//提示 
 | 
						|
					this.$modal.msgError("请选择需要拣选的托盘明细")
 | 
						|
					return;
 | 
						|
				}
 | 
						|
				//筛选出需要拣选的托盘号
 | 
						|
				let arr = [];
 | 
						|
				let len = this.palletInfo.details.length;
 | 
						|
				for (let i = 0; i < len; i++) {
 | 
						|
					if (this.selectedIndexs.indexOf(i) >= 0) {
 | 
						|
						arr.push(this.palletInfo.details[i]);
 | 
						|
					} else {
 | 
						|
						// console.log(this.selectArr.indexOf(i))
 | 
						|
						//this.selectArr.indexOf(i);
 | 
						|
					}
 | 
						|
				}
 | 
						|
				console.log("输入的托盘编号为", arr.length)
 | 
						|
				return arr;
 | 
						|
			},
 | 
						|
 | 
						|
			// 伪request请求
 | 
						|
			request(options) {
 | 
						|
				const {
 | 
						|
					pageSize,
 | 
						|
					pageCurrent,
 | 
						|
					success,
 | 
						|
					value
 | 
						|
				} = options
 | 
						|
				let total = tableData.length
 | 
						|
				let data = tableData.filter((item, index) => {
 | 
						|
					const idx = index - (pageCurrent - 1) * pageSize
 | 
						|
					return idx < pageSize && idx >= 0
 | 
						|
				})
 | 
						|
				if (value) {
 | 
						|
					data = []
 | 
						|
					tableData.forEach(item => {
 | 
						|
						if (item.name.indexOf(value) !== -1) {
 | 
						|
							data.push(item)
 | 
						|
						}
 | 
						|
					})
 | 
						|
					total = data.length
 | 
						|
				}
 | 
						|
 | 
						|
				setTimeout(() => {
 | 
						|
					typeof success === 'function' &&
 | 
						|
						success({
 | 
						|
							data: data,
 | 
						|
							total: total
 | 
						|
						})
 | 
						|
				}, 500)
 | 
						|
			},
 | 
						|
 
 | 
						|
			//表单提交
 | 
						|
			formSubmit: function(ref) {
 | 
						|
				if(!this.formData.palletCode){
 | 
						|
					return
 | 
						|
				}
 | 
						|
				if (this.formData.palletCode.length < 6) {
 | 
						|
					return;
 | 
						|
				}
 | 
						|
				
 | 
						|
				var data={
 | 
						|
				    palletCode:this.formData.palletCode,
 | 
						|
					userCode:this.userCode,
 | 
						|
					warehouseCode:this.whCode
 | 
						|
				}
 | 
						|
				this.$refs.form.validate().then(res => {
 | 
						|
					this.$modal.confirm("确认解绑该托盘,并清除系统内的记录?","请确认").then(()=>{
 | 
						|
						unBindRack(data).then(response => {
 | 
						|
							if(response.code===200){
 | 
						|
								this.$modal.msgSuccess("解绑成功,请人工取走托盘")
 | 
						|
								this.formData.palletCode = "";
 | 
						|
								this.palletInfo.details=[];
 | 
						|
							}
 | 
						|
						})
 | 
						|
					})
 | 
						|
					
 | 
						|
				})
 | 
						|
			
 | 
						|
			},
 | 
						|
 | 
						|
			hideMsgModal(e) {
 | 
						|
				//关闭信息模态框
 | 
						|
				this.msgModalName = null;
 | 
						|
			},
 | 
						|
			textareaAInput(e) {
 | 
						|
				this.textareaAValue = e.detail.value
 | 
						|
			},
 | 
						|
			textareaBInput(e) {
 | 
						|
				this.textareaBValue = e.detail.value
 | 
						|
			},
 | 
						|
			//根据单据号查询入库单
 | 
						|
			queryPalletInfo: async function(e) {
 | 
						|
				console.log('进入查询方法', e);
 | 
						|
				console.log('this.formData', this.formData);
 | 
						|
				console.log('this.formData.palletCode', this.formData.palletCode);
 | 
						|
				var palletCode = this.formData.palletCode;
 | 
						|
				if (palletCode.length < 6) {
 | 
						|
					return;
 | 
						|
				}
 | 
						|
				if (palletCode == null) {
 | 
						|
					this.$modal.msgError("托盘编号不能为空")
 | 
						|
					return;
 | 
						|
				}
 | 
						|
				if (palletCode.length < 1) {
 | 
						|
					this.$modal.msgError("托盘编号不能为空")
 | 
						|
					return;
 | 
						|
				}
 | 
						|
				//查询单据信息
 | 
						|
				var palletInfo = await queryPalletInfo({
 | 
						|
					'palletCode': palletCode
 | 
						|
				});
 | 
						|
				console.log("palletInfo", palletInfo)
 | 
						|
				if (palletInfo) {
 | 
						|
					this.palletInfo = palletInfo.data;
 | 
						|
				};
 | 
						|
			}
 | 
						|
		}
 | 
						|
	}
 | 
						|
</script>
 | 
						|
 | 
						|
 | 
						|
 | 
						|
<style lang="scss">
 | 
						|
	.cu-form-group .title {
 | 
						|
		min-width: calc(4em + 15px);
 | 
						|
	}
 | 
						|
 | 
						|
	page {
 | 
						|
		background-color: #ffffff;
 | 
						|
	}
 | 
						|
 | 
						|
	.container {
 | 
						|
		background: rgb(242, 243, 245);
 | 
						|
		height: 100vh;
 | 
						|
	}
 | 
						|
	
 | 
						|
	.uni-forms-item {
 | 
						|
		border-bottom: 1px solid #E5E6EB;
 | 
						|
		margin-bottom: 0;
 | 
						|
		padding: 24rpx 0;
 | 
						|
	}
 | 
						|
	
 | 
						|
	::v-deep .uni-forms-item__label {
 | 
						|
		color: #1D2129;
 | 
						|
		font-size: 28rpx;
 | 
						|
		font-weight: 400;
 | 
						|
	}
 | 
						|
	
 | 
						|
	::v-deep .uni-select {
 | 
						|
		border: 0px;
 | 
						|
	}
 | 
						|
	
 | 
						|
	::v-deep.uni-select__input-placeholder {
 | 
						|
		font-size: 28rpx;
 | 
						|
		font-weight: 400;
 | 
						|
		color: #86909C;
 | 
						|
	}
 | 
						|
	
 | 
						|
	.textarea {
 | 
						|
		background-color: #F2F3F5;
 | 
						|
		width: 100%;
 | 
						|
	}
 | 
						|
	
 | 
						|
	::v-deep.full-width-textarea {
 | 
						|
		width: 100% !important;
 | 
						|
		border: unset !important;
 | 
						|
	}
 | 
						|
	
 | 
						|
	::v-deep .is-input-border {
 | 
						|
		border: unset;
 | 
						|
	}
 | 
						|
	
 | 
						|
	::v-deep .uni-easyinput__placeholder-class {
 | 
						|
		font-size: 28rpx;
 | 
						|
		color: #86909C;
 | 
						|
	}
 | 
						|
	
 | 
						|
	::v-deep .uni-input-input {
 | 
						|
		font-size: 28rpx;
 | 
						|
	}
 | 
						|
	
 | 
						|
	::v-deep .uni-select__input-placeholder {
 | 
						|
		font-size: 28rpx;
 | 
						|
		color: #86909C;
 | 
						|
	}
 | 
						|
	
 | 
						|
	::v-deep .uniui-bottom {
 | 
						|
		display: none;
 | 
						|
	}
 | 
						|
	
 | 
						|
	::v-deep .uniui-top {
 | 
						|
		display: none;
 | 
						|
	}
 | 
						|
	
 | 
						|
	.fromItem {
 | 
						|
		display: flex;
 | 
						|
		align-items: center;
 | 
						|
	}
 | 
						|
	
 | 
						|
	.example {
 | 
						|
		padding: 0 24rpx;
 | 
						|
		background-color: #fff;
 | 
						|
		width: 702rpx;
 | 
						|
		border-radius: 24rpx;
 | 
						|
		margin: 24rpx auto;
 | 
						|
	
 | 
						|
	}
 | 
						|
 | 
						|
	.segmented-control {
 | 
						|
		margin-bottom: 15px;
 | 
						|
	}
 | 
						|
 | 
						|
	.button-group {
 | 
						|
		margin-top: 15px;
 | 
						|
		display: flex;
 | 
						|
		justify-content: space-around;
 | 
						|
	}
 | 
						|
 | 
						|
	.form-item {
 | 
						|
		display: flex;
 | 
						|
		align-items: center;
 | 
						|
		flex: 1;
 | 
						|
	}
 | 
						|
 | 
						|
	.button {
 | 
						|
		display: flex;
 | 
						|
		align-items: center;
 | 
						|
		height: 35px;
 | 
						|
		line-height: 35px;
 | 
						|
		margin-left: 10px;
 | 
						|
	}
 | 
						|
</style> |