<template>
	<view class="homePage" :style="'height:' + screenHeight + 'px;'">
		<view class="title">
			<text>工厂别：</text>
			<zxz-uni-data-select :clear='false' class="item-select" filterable v-model="factoryCode" placeholder="请选择工厂"
				dataKey="label" dataValue="value" :localdata="factoryData" @change="factoryChange"/>
		</view>
		<view class="lines"></view>
		<view class="boxs">
			<uni-section v-for="(item, index) in tableData" :key="index" :title="item.title" type="line">
				<u-row gutter="10">
					<u-col v-for="(v, i) in item.list" :key="i" span="3">
						<navigator :url="v.url" open-type="navigate">
							<view class="demo-layout">
								<u-image :src="v.src" width="100rpx" height="100rpx"></u-image>
								<text>{{ v.text }}</text>
							</view>
						</navigator>
					</u-col>
				</u-row>
			</uni-section>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				screenHeight: 0,
				src: require('@/static/images/cgrk.png'),
				factoryData: [{
						label: '1000 - 广州市宝绅科技有限公司',
						value: '1000'
					},
					{
						label: '1010 - 广州市宝绅科技有限公司RFID工厂',
						value: '1010'
					},
				],
				tableData: [{
					title: '仓库扫描作业',
					list: [{
							src: require('@/static/images/cgrk.png'),
							text: '采购入库',
							url: '/pages/purchaseStorage/purchaseStorage'
						},
						{
							src: require('@/static/images/cgxj.png'),
							text: '采购下架',
							url: '/pages/purchase/purchaseRemove'
						},
						{
							src: require('@/static/images/ckjdb.png'),
							text: '质量异常下架',
							url: '/pages/abnormal/abnormalRemove'
						},
						{
							src: require('@/static/images/fclyk.png'),
							text: '仓位调拨',
							url: '/pages/positionTansfer/positionTansfer'
						},
						{
							src: require('@/static/images/kglrk.png'),
							text: '完工入库',
							url: '/pages/confirComplete/confirComplete'
						},
						{
							src: require('@/static/images/qtck.png'),
							text: '库存盘点',
							url: '/pages/inventoryCounting/inventoryCounting'
						},
						{
							src: require('@/static/images/scfl.png'),
							text: '生产发料',
							url: '/pages/productionIssuance/productionIssuance'
						},
						{
							src: require('@/static/images/xsth.png'),
							text: '销售退货',
							url: '/pages/salesReturns/salesReturns'
						},
						{
							src: require('@/static/images/sctl.png'),
							text: '生产退料',
							url: '/pages/produceReturn/produceReturn'
						},
						{
							src: require('@/static/images/wwfl.png'),
							text: '委外发料',
							url: '/pages/outsourcedMaterial/outsourcedMaterial'
						},
						{
							src: require('@/static/images/zlycxj.png'),
							text: '委外退料',
							url: '/pages/outsourcedReturn/outsourcedReturn'
						},
						{
							src: require('@/static/images/xsjh.png'),
							text: '销售拣货',
							url: '/pages/salesOutbound/salesOutbound'
						},
						{
							src: require('@/static/images/xsck.png'),
							text: '装箱',
							url: '/pages/packing/packing'
						},
						{
							src: require('@/static/images/wgrk.png'),
							text: '发货过账',
							url: '/pages/posting/posting'
						},
						{
							src: require('@/static/images/cwdb.png'),
							text: '反冲料移库',
							url: '/pages/recoil/recoilMaterial'
						},
						{
							src: require('@/static/images/fhxj.png'),
							text: '发货下架',
							url: '/pages/sendOutGoodsOff/index'
						},
						{
							src: require('@/static/images/fhgz.png'),
							text: '工厂间调拨',
							url: '/pages/factoryTransfer/index'
						},
						{
							src: require('@/static/images/clycxj.png'),
							text: '工作中心发料',
							url: '/pages/workCenter/workCenter'
						},
						{
							src: require('@/static/images/wwbl.png'),
							text: '成本中心发料',
							url: '/pages/costCenter/costCenter'
						},
					]
				}]
			};
		},
		computed: {
			factoryCode: {
				get() {
					return this.vuex_user_factory || 1000
				},
				set(e) {
					this.$u.vuex('vuex_user_factory', e)
				}
			}
		},
		created() {
			this.screenHeight = uni.getSystemInfoSync().screenHeight;
		},
		methods: {
			handleClick(v) {
				uni.nav;
			},
			factoryChange(e) {
				console.log(e, 'factoryChange')
			},
		}
	};
</script>

<style lang="scss" scoped>
	.homePage {
		background: #fff;

		.title {
			background: #fff;
			padding: 20rpx 32rpx;
			font-size: 28rpx;
			line-height: 40rpx;
			font-weight: 600;
			display: flex;
			flex-direction: row;
			align-items: center;
		}

		.lines {
			height: 32rpx;
			background: #f8f8f8;
		}
	}

	.demo-layout {
		height: 164rpx;
		border-radius: 4px;
		margin-bottom: 10px;
		display: flex;
		flex-direction: column;
		align-items: center;

		text {
			margin-top: 24rpx;
			font-size: 24rpx;
			color: #000;
		}
	}
</style>
