<template>
	<view class="content background">
		<view class="grid-box">
			<uni-grid :column="3" @change="gridCheck" :showBorder="false" :highlight="false">
				<uni-grid-item v-for="(item, index) in gridItemList" :index="index + 1">
					<view class="item">
						<uni-icons :type="item.icon" :size="40" color="#00aaff" />
						<text class="text">{{ item.name }}</text>
					</view>
				</uni-grid-item>
			</uni-grid>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				gridItemList: [{
						name: '入料',
						icon: 'download-filled'
					},
					{
						name: '出料',
						icon: 'upload-filled'
					},

				]
			}
		},
		methods: {
			gridCheck(item) {
				const index = item.detail?.index;
				switch (index) {
					case 1:
						uni.navigateTo({
							url: '/pages/agv/agv-in/agv-in'
						});
						break;
					case 2:
						uni.navigateTo({
							url: '/pages/agv/agv-out/agv-out'
						});
						break;
					default:
						break;
				}
			}
		}
	}
</script>

<style scoped>
	.background {
		/* margin-top: 20px;
		height: 692px; */
		/* background-color: #4671d5; */
	}

	.title-box {
		width: 100%;
		height: 150px;
	}

	.grid-box {
		width: 100%;
		height: 100%;
	}

	.grid-box .item {
		width: 100%;
		height: 100%;
		display: flex;
		flex-direction: column;
		align-items: center;
		justify-content: center;
	}

	.item {
		background-color: rgba(128, 128, 128, 0.5);
	}

	.text {
		font-size: 24px;
		color: white;
	}
</style>