<template>
	<view class="zd_container">
		<!-- <nav-bar title="空木箱库存"></nav-bar> -->
		<nav-bar :title="title"></nav-bar>
		<view class="zd_content">
			<view class="zd_wrapper">
				<view class="filter_item">
					<view class="filter_label_wraper">
						<span class="filter_label">木箱料号</span>
					</view>
					<view class="filter_input_wraper">
						<input type="text" class="filter_input" v-model="val1">
					</view>
				</view>
				<view class="filter_item">
					<view class="filter_label">木箱描述</view>
					<view class="filter_input_wraper">
						<input type="text" class="filter_input" v-model="val2">
					</view>
				</view>
				<view class="filter_item">
					<view class="filter_label_wraper">
						<span class="filter_label">木箱号</span>
					</view>
					<view class="filter_input_wraper">
						<input type="text" class="filter_input" v-model="val3">
					</view>
				</view>
			</view>
			<view class="zd_wrapper grid-wraper">
				<view class="slide_new">
					<table>
						<thead>
							<tr>
								<th>木箱号</th>
								<th>木箱料号</th>
								<th>木箱描述</th>
								<th>最大子卷数</th>
								<th>木箱长度</th>
								<th>木箱宽度</th>
								<th>木箱高度</th>
								<th>载具类型</th>
								<th>木箱重量</th>
								<th>仓位</th>
							</tr>
						</thead>
						<tbody>
							<tr v-for="(e, i) in dataList" :key="i">
								<td>{{e.box_no}}</td>
								<td>{{e.material_code}}</td>
								<td>{{e.material_name}}</td>
								<td>{{e.num}}</td>
								<td>{{e.box_length}}</td>
								<td>{{e.box_width}}</td>
								<td>{{e.box_high}}</td>
								<td>{{e.vehicle_type}}</td>
								<td>{{e.box_weight}}</td>
								<td>{{e.struct_code}}</td>
							</tr>
						</tbody>
					</table>
				</view>
			</view>
		</view>
		<view class="zd-row submitbar">
			<button class="zd-col-6 btn-submit btn-default" @tap="clearUp">清空</button>
			<button class="zd-col-15 btn-submit btn-success" @tap="_queryBoxIvt">查询</button>
		</view>
		<up-top ref="UT" :scrollTop="top"></up-top>
	</view>
</template>

<script>
	import NavBar from '@/components/NavBar.vue'
	import UpTop from '@/components/upTop.vue'
	import {queryBoxIvt} from '@/utils/getData3.js'
	export default {
		components: {
			NavBar,
			UpTop
		},
		data() {
			return {
				title: '',
				top: 0,
				val1: '',
				val2: '',
				val3: '',
				dataList: []
			};
		},
		onPageScroll(e) {
			this.$refs.UT.topData(e.scrollTop)
		},
		onLoad (options) {
			this.title = options.title
		},
		methods: {
			selectChange (e) {
				this.index = e
			},
			async _queryBoxIvt () {
				try {
					let res = await queryBoxIvt(this.val1, this.val2, this.val3)
					this.dataList = [...res.data]
				} catch (e) {
					console.log(e)
				}
			},
			clearUp () {
				this.val1 = ''
				this.val3 = ''
				this.val2 = ''
				this.dataList = []
			}
		}
	}
</script>