<template>
	<view>
		<view>
			<sl-filter :themeColor="themeColor" :menuList="menuList" @result="result"></sl-filter>
		</view>
		<scroll-view :scroll-y="true" class="page">
			<view class="cu-list menu card-menu margin-top">
				<view class="cu-item" style="margin-top: 10rpx;" v-for="(item,index) in data">
					<view class="content">
						<view class="cu-form-group">
							<view class="title" style="min-width: calc(6em + 15px);">制衣生产车间</view>
							<text class="text-grey" style="flex: 1;">{{item.zyProductWorkshop}}</text>
						</view>
						<view class="cu-form-group">
							<view class="title" style="min-width: calc(6em + 15px);">制衣班组</view>
							<text class="text-grey" style="flex: 1;">{{item.zyTeam}}</text>
						</view>
						<view class="cu-form-group">
							<view class="title" style="min-width: calc(6em + 15px);">订单号</view>
							<text class="text-grey" style="flex: 1;">{{item.orderNo}}</text>
						</view>
						<view class="cu-form-group">
							<view class="title" style="min-width: calc(6em + 15px);">数量</view>
							<text class="text-grey" style="flex: 1;">{{item.stockQty}}</text>
						</view>
						<view class="cu-form-group">
							<view class="title" style="min-width: calc(6em + 15px);">交期</view>
							<text class="text-grey" style="flex: 1;">{{item.deliveryDate}}</text>
						</view>
					</view>
				</view>
				<u-toast ref="uToast"></u-toast>
			</view>
		</scroll-view>
	</view>

</template>

<script>
	import {
		getFilterData
	} from '@/api/biz/filing.js'
	import slFilter from '@/components/sl-filter/sl-filter.vue'
	export default {
		components: {
			slFilter
		},
		data() {
			return {
				data: [],
				themeColor: '#000000',
				filterResult: '',
				menuList: [{
						'title': '车间',
						'detailTitle': '请选择制衣生产车间（可多选）',
						'isMutiple': true,
						'key': 'workshop',
						'detailList': [{
							'title': '不限',
							'value': ''
						}, {
							'title': '制衣一厂',
							'value': '1'
						}, {
							'title': '制衣二厂',
							'value': '1'
						}]

					},
					{
						'title': '排序',
						'key': 'sort',
						'isSort': true,
						'detailList': [{
							'title': '默认排序',
							'value': ''
						}]
					}
				]
			}
		},
		onLoad() {
			this.loadData()
		},
		onShow(){
			this.loadData()
		},
		methods: {
			result(val) {
				console.log('filter_result:' + JSON.stringify(val));
				this.filterResult = JSON.stringify(val, null, 2)
			},
			loadData() {
				getFilterData().then(res => {
					if (res.success) {
						this.data = res.data
					} else {
						this.$refs.uToast.show({
							type: 'error',
							message: res.message,
							iconUrl: 'https://cdn.uviewui.com/uview/demo/toast/success.png'
						})
					}
				})
			}
		}
	}
</script>

<style scoped>
	.page {
		height: 100Vh;
		width: 100vw;
	}

	.page.show {
		overflow: hidden;
	}

	.cu-form-group {
		min-height: 0;
		border: none;

	}
</style>
