<template>
	<view class="content">
		<view class="card" v-if="isMenu(14)||isMenu(16)||isMenu(17)||isMenu(18)||isMenu(19)||isMenu(20)">
			<view class="card-title">检验</view>
			<view class="card-content">
				<view v-if="isMenu(14)" class="card-list" @tap="rawMaterial()">
					<view class="card-list-img">
						<image class="icon-yclj" src="../../static/yclj.png"></image>
					</view>
					<view class="menu-text">
						来料检验
					</view>
				</view>
				
				<view v-if="isMenu(16)" class="card-list" @tap="stampingInspection()">
					<view class="card-list-img">
						<image class="icon-yclj" src="../../static/cyxj.png"></image>
					</view>
					<view class="menu-text">
						冲压巡检
					</view>
				</view>
				<view v-if="isMenu(17)" class="card-list" @tap="spray()">
					<view class="card-list-img">
						<image class="icon-yclj" src="../../static/ptxj.png"></image>
					</view>
					<view class="menu-text">
						喷涂巡检
					</view>
				</view>
				<view v-if="isMenu(18)" class="card-list" @click="assemble()">
					<view class="card-list-img">
						<image class="icon-yclj" src="../../static/zzxj.png"></image>
					</view>
					<view class="menu-text">
						组装巡检
					</view>
				</view>
				<view v-if="isMenu(19)" class="card-list" @tap="hardware()">
					<view class="card-list-img">
						<image class="icon-yclj" src="../../static/wjxj.png"></image>
					</view>
					<view class="menu-text">
						五金巡检
					</view>
				</view>
				<!-- <view v-if="isMenu('制程质量')" class="card-list gery">
					<view class="card-list-img">
						<image class="icon-yclj" src="../../static/zczl.png"></image>
					</view>
					<view class="menu-text">
						制程质量
					</view>
				</view>
				<view v-if="isMenu('成品巡检')" class="card-list gery">
					<view class="card-list-img">
						<image class="icon-yclj" src="../../static/cpcj.png"></image>
					</view>
					<view class="menu-text">
						成品巡检
					</view>
				</view> -->
				<view v-if="isMenu(20)" class="card-list" @tap="TCQ()">
					<view class="card-list-img">
						<image class="icon-yclj" src="../../static/cto.png"></image>
					</view>
					<view class="menu-text">
						三次元检测
					</view>
				</view>
			</view>
		</view>
		<view class="card" style="margin-top: 24upx;" v-if="isMenu(21)||isMenu(22)">
			<view class="card-title">生产作业</view>
			<view class="card-content">
				<view class="card-list " @tap="stampingRecordList()" v-if="isMenu(21)">
					<view class="card-list-img">
						<image class="icon-cyjl" src="../../static/cybb.png"></image>
					</view>
					<view class="menu-text">
						冲压记录
					</view>
				</view>
				<view class="card-list gery" @tap="kfz()" v-if="isMenu(22)">
					<view class="card-list-img">
						<image class="icon-yclj" src="../../static/ptjl.png"></image>
					</view>
					<view class="menu-text">
						喷涂记录
					</view>
				</view>
			</view>
		</view>
		<view class="card" style="margin-top: 24upx;" v-if="isMenu(23)||isMenu(24)||isMenu(25)||isMenu(26)">
			<view class="card-title">报表</view>
			<view class="card-content">
				<view class="card-list gery" @tap="kfz()"  v-if="isMenu(23)">
					<view class="card-list-img">
						<image class="icon-yclj" src="../../static/cyrb.png"></image>
					</view>
					<view class="menu-text">
						冲压日报
					</view>
				</view>
				<view class="card-list gery" @tap="kfz()" v-if="isMenu(24)">
					<view class="card-list-img">
						<image class="icon-yclj" src="../../static/cyzb.png"></image>
					</view>
					<view class="menu-text">
						冲压周报
					</view>
				</view>
				<view class="card-list gery" v-if="isMenu(25)">
					<view class="card-list-img">
						<image class="icon-yclj" src="../../static/ptrb.png"></image>
					</view>
					<view class="menu-text">
						喷涂日报
					</view>
				</view>
				<view class="card-list gery" @tap="kfz()" v-if="isMenu(26)">
					<view class="card-list-img">
						<image class="icon-yclj" src="../../static/ptzb.png"></image>
					</view>
					<view class="menu-text">
						喷涂周报
					</view>
				</view>
				<view class="card-list gery" @tap="kfz()">
					<view class="card-list-img">
						<image class="icon-cyfx" src="../../static/cyfx.png"></image>
					</view>
					<view class="menu-text">
						冲压返修
					</view>
				</view>
				<view class="card-list gery" @tap="kfz()">
					<view class="card-list-img">
						<image class="icon-yclj" src="../../static/ptfx.png"></image>
					</view>
					<view class="menu-text">
						喷涂返修
					</view>
				</view>
			</view>
		</view>
		<view class="card" style="margin-top: 24upx;" v-if="isMenu(49)||isMenu(50)">
			<view class="card-title">保养</view>
			<view class="card-content">
				<view class="card-list" @tap="modeMaintainList()" v-if="isMenu(49)">
					<view class="card-list-img">
						<image class="icon-yclj" src="../../static/cyrb.png"></image>
					</view>
					<view class="menu-text">
						模具保养
					</view>
				</view>
				<view class="card-list" @tap="LineList()" v-if="isMenu(50)">
					<view class="card-list-img">
						<image class="icon-yclj" src="../../static/cyzb.png"></image>
					</view>
					<view class="menu-text">
						设备保养
					</view>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	import {
		power
	} from "../../api/user.js";
	import {
		mapGetters,
		mapMutations
	} from 'vuex';
	export default {
		data() {
			return {
				title: 'Hello',
				menuNameList: [],
				power: [],
				jurisdiction: [],
			}
		},
		onShow() {
			this.isMenu();
		},
		computed: {
			...mapGetters(['userInfo', 'roleType'])

		},
		onLoad() {


			this.power = this.userInfo.power
			power({}).then(res => {
				res.map(item => {
					this.menuNameList.push(item.id);
				})
			})
			this.getArr()
			this.isMenu();
		},
		methods: {
			getArr() {
				if (this.power.length > 0) {
					let newArr = this.power.map(item => {
						this.jurisdiction.push(item.id)

					})

				}
				console.log("xinshuzu", this.jurisdiction)

			},
			isMenu(id) {
				console.log("id", id)
				return this.jurisdiction.includes(id);
			},
			rawMaterial() {
				uni.navigateTo({
					url: '../rawMaterial/rawMaterial',
					success: res => {},
					fail: () => {},
					complete: () => {}
				});
			},
			firstInspection() {
				uni.navigateTo({
					url: '../firstInspection/firstInspection'
				});
			},
			stampingInspection() {
				uni.navigateTo({
					url: '../stampingInspection/stampingInspection'
				});
			},
			spray() {
				uni.navigateTo({
					url: '../spray/spray'
				});
			},
			assemble() {
				uni.navigateTo({
					url: '../assemble/assemble'
				});
			},
			hardware() {
				uni.navigateTo({
					url: '../hardware/hardware'
				});
			},
			stampingRecordList() {
				uni.navigateTo({
					url: '../stampingRecordList/stampingRecordList'
				});
			},
			TCQ() {
				uni.navigateTo({
					url: '../TCQ/TCQ'
				});
			},
			modeMaintainList() {
				uni.navigateTo({
					url: '../modeMaintainList/modeMaintainList'
				});
			},
			LineList() {
				uni.navigateTo({
					url: '../lineList/lineList'
				});
			},
			kfz() {
				this.$functions.error("功能开发中");
			}
		}
	}
</script>

<style lang="scss">
	@import "./index.scss"
</style>
