<template>
	<view class="home-container">
		<u--text text="生产投料" size="36" bold></u--text>
		<u-grid :border="false" @click="gridCheck" col="4" class="u-grid-style">
			<u-grid-item v-if="item.type === 1" v-for="(item,index) in gridItemList" :key="index" :name="item.url">
				<u-icon color="#ff9900" :customStyle="{paddingTop:20+'rpx'}" :name="item.icon" :size="128"></u-icon>
				<text class="grid-text">{{item.name}}</text>
			</u-grid-item>
		</u-grid>

		<u--text text="成品入库" size="36" bold></u--text>
		<u-grid :border="false" @click="gridCheck" col="4" class="u-grid-style">
			<u-grid-item v-if="item.type === 2" v-for="(item,index) in gridItemList" :key="index" :name="item.url">
				<u-icon color="#2979ff" :customStyle="{paddingTop:20+'rpx'}" :name="item.icon" :size="128"></u-icon>
				<text class="grid-text">{{item.name}}</text>
			</u-grid-item>
		</u-grid>
		<u--text text="包装箱" size="36" bold></u--text>
		<u-grid :border="false" @click="gridCheck" col="4" class="u-grid-style">
			<u-grid-item v-if="item.type === 3" v-for="(item,index) in gridItemList" :key="index" :name="item.url">
				<u-icon color="#00ff00" :customStyle="{paddingTop:20+'rpx'}" :name="item.icon" :size="128"></u-icon>
				<text class="grid-text">{{item.name}}</text>
			</u-grid-item>
		</u-grid>
		<u--text text="AGV控制" size="36" bold></u--text>
		<u-grid :border="false" @click="gridCheck" col="4" class="u-grid-style">
			<u-grid-item v-if="item.type === 4" v-for="(item,index) in gridItemList" :key="index" :name="item.url">
				<u-icon color="#ff5500" :customStyle="{paddingTop:20+'rpx'}" :name="item.icon" :size="128"></u-icon>
				<text class="grid-text">{{item.name}}</text>
			</u-grid-item>
		</u-grid>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				// 页面按钮参数
				gridItemList: [{
						name: '仓库配料',
						icon: 'file-text-fill',
						url: '/pages/materialManagement/MaterialProductionInput/MaterialProductionInput',
						type: 1,
					},
					{
						name: '车间叫料',
						icon: 'file-text',
						url: '/pages/materialManagement/MaterialRequisition/MaterialRequisition',
						type: 1,
					},
					{
						name: '车间进料',
						icon: 'file-text-fill',
						url: '/pages/materialManagement/MaterialFeeding/MaterialFeeding',
						type: 1,
					},
					{
						name: '入库',
						icon: 'shopping-cart-fill',
						url: '/pages/materialManagement/MaterialWarehousing/MaterialWarehousing',
						type: 2,
					},
					{
						name: '进箱',
						icon: 'gift',
						url: '/pages/materialManagement/package/package',
						type: 3,
					},
					{
						name: '全点位移动',
						icon: 'coupon-fill',
						url: '/pages/materialManagement/AGVRemoteControl/AGVRemoteControl',
						type: 4,
					},
				]
			}
		},
		methods: {
			gridCheck(url) {
				if (url === '') {
					return;
				}
				uni.navigateTo({
					url
				});
			},
		}
	}
</script>


<style scoped>
	@import url('materialManagement.css');
</style>