<style lang='scss' scoped>
	.electricalSafeMange{
		width: 100%;
		background-color: #F9F9F9;
		padding: 30rpx $paddingLR;
		.u-grid-item{
			box-shadow: $box-shadow;
		}
		&-list{
			display: grid;
			width: 100%;
			grid-template-columns:320rpx 320rpx;
			grid-gap: 30rpx 30rpx;
		}
		&-box{
			display: flex;
			justify-content: center;
			align-items: center;
			flex-direction: column;
			box-shadow: $box-shadow;
			background-color: #fff;
			padding: 20rpx 0;
			border-radius: 12rpx;
		}
	}
</style>
<template>
	<view class="electricalSafeMange">
		<view class="electricalSafeMange-list">
			<view class="electricalSafeMange-box" v-for="(item,index) in boxList" :key="index" @click="goSafeMangeFn(item)">
				<tuiIcon :name="item.icon" :size="60" color="#FA6400" class="pb15"></tuiIcon>
				<view class="grid-text">{{item.text}}</view>
			</view>
		</view>
		
	</view>
</template>
<script>
	export default {
		data() {
			return {
				projectId:"",
				boxList:[
					{
						icon:"baojingjilu",
						text:"全部报警",
						url:"/pages/project/electricalSafeMange/allAlarm",
						type: "all"
					},
					{
						icon:"dianliu",
						text:"漏电流",
						url:"/pages/project/electricalSafeMange/leakageCurrent",
						type: "leakageCurrent"
					},
					{
						icon:"wendu",
						text:"温度",
						url:"/pages/project/electricalSafeMange/temperature",
						type: "temperature"
					},
					{
						icon:"loudianbaojing",
						text:"漏电报警",
						url:"",
						type: "a2",
						apiName: "EL"
					},
					{
						icon:"wendubaojing",
						text:"温度报警",
						url:"",
						type: "a7",
						apiName: "T"
					},
					{
						icon:"sanxiangdl",
						text:"漏电自检",
						url:"",
						type: "a10",
						apiName: "LST"
					},
					{
						icon:"60",
						text:"短路报警",
						url:"",
						type: "a1",
						apiName: "SC"
					},
					{
						icon:"guoyaqianya",
						text:"过压欠压",
						url:"",
						type: "a5,a6",
						apiName: "OVUV"
					},
					{
						icon:"dianhu",
						text:"过流过载",
						url:"",
						type: "a3",
						apiName: "OCO"
					},
					{
						icon:"loudianbaohu",
						text:"电弧报警",
						url:"",
						type: "a11",
						apiName: "EA"
					},
					{
						icon:"dianxiang",
						text:"三相报警",
						url:"",
						type: "a17,a18,a19",
						apiName: "TP"
					},
					{
						icon:"suidaobaojing",
						text:"分合闸警示",
						url:"",
						type: "a23,a24",
						apiName: "OAC"
					},
					// {
					// 	icon:"qiedianhecha",
					// 	text:"窃电报警",
					// 	url:"",
					// 	type: "alarm"
					// },
				]
			}
		},
		onLoad(e) {
			this.projectId = e.projectId;
		},
		methods: {
			goSafeMangeFn(item){
				console.log(item,"item");
				if (item.url !== '') {
					uni.navigateTo({
						url: `${item.url}?projectId=${this.projectId}`
					});
				} else {
					uni.navigateTo({
						url: `/pages/project/electricalSafeMange/otherAlarm?projectId=${this.projectId}&typeCode=${item.type}&typeName=${item.text}&apiName=${item.apiName}`
					});
				}
			}
		}
	}
</script>
