<template>
	<view>
		<!-- 宫格列表 -->
		<view class="section2 section  bg-white padding-top-sm margin-bottom-sm">
			<view class="cu-list grid col-3 no-border">
				<view class="cu-item justify-center align-center"  v-for="(item,index) in alarmingSquareList" @tap="goProcessList(item)"
				 :key="index">
					<image :src="item.imgUrl" style="width:100rpx;height:100rpx"></image>
					<view class="cu-tag badge" v-if="item.badge!=0">
						<block>{{item.badge>99?'99+':item.badge}}</block>
					</view>
					<text>{{item.name}}</text>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	import json from '../../data/json.js';


	export default {

		data() {
			return {
				powerMonitoringCount: '',
				videoMonitoringCount: '',
				companyCode: '',
				count2: '',
				// 宫格列表数据
				alarmingSquareList: json.alarmingSquareList,
				getData:{}

			}
		},
		onLoad(option) {
			this.getSiteType(uni.getStorageSync('selectedCode'))
			this.companyCode=option.companyCode
		},
		methods: {

			async getSiteType(params) {
				const res = await this.$myRequest({
					url: 'ComprehensiveAlarm/getAlarmStatistics',
					data: {
						"company_code": params,
					}
				})
				this.getData=res.data.data[0]
				this.alarmingSquareList[0].badge=this.getData.untreated_alarm_host_count;
				this.alarmingSquareList[1].badge=this.getData.untreated_fire_water_count;
				this.alarmingSquareList[2].badge=this.getData.untreated_rtu_count;
				this.alarmingSquareList[3].badge=this.getData.untreated_electrical_fire_count;
				this.alarmingSquareList[4].badge=this.getData.untreated_video_monitoring_count;
				this.alarmingSquareList[5].badge=this.getData.untreated_elevator_count;
				this.alarmingSquareList[6].badge=this.getData.untreated_door_count;  //门磁
				this.alarmingSquareList[7].badge=this.getData.untreated_gas_count; //可燃气体
				this.alarmingSquareList[8].badge=this.getData.untreated_manhole_cover_count;  //井盖
				this.alarmingSquareList[9].badge=this.getData.untreated_fire_hydrant_count; //消防栓
			},

			// 页面跳转
			goProcessList(item) {
					uni.navigateTo({
						url: '/pages/processList/processList?type='+item.type,
						success: res => {},
						fail: () => {},
						complete: () => {}
					});
			},
			

		}
	}
</script>

<style>

</style>
