<template>
	<view>
		<!-- 宫格列表 -->
		<!-- <square :cuIconList="cuIconList"></square> -->
		<view class="section2 section  bg-white margin-top-sm margin-bottom-sm">
			<view class="cu-list grid col-3 no-border">
				<view class="cu-item justify-center align-center"  @tap="goProcessList">
					<image src="../../static/square-dl.png" style="width:100rpx;height:100rpx"></image>
					<view class="cu-tag badge" v-if="powerMonitoringCount!=0">{{powerMonitoringCount>99?'99+':powerMonitoringCount}}
					</view>
					<text>电力监测</text>
				</view>
				<view class="cu-item justify-center align-center" @tap="goProcessList2">
					<image src="../../static/square-alarm.png" style="width:100rpx;height:100rpx"></image>  
					<view class="cu-tag badge" v-if="videoMonitoringCount!=0">{{videoMonitoringCount>99?'99+':videoMonitoringCount}}
					</view>
					<text>视频告警</text>
				</view>
				
			</view>
		</view>
	</view>
</template>

<script>
	
	// import square from '../../components/square/square.vue';
	
	export default {
		// components: {
		// 	square
		// },
		
		data() {
			return {
				powerMonitoringCount:'',
				videoMonitoringCount:'',
				companyCode:'',
				count2:'',
				// 宫格列表数据
				cuIconList: [{
					imgUrl:'../../static/square-dl.png',
					badge: this.powerMonitoringCount,
					name: '电力监测',
					redirectUrl:'/pages/processList/processList?type=1'
				}, {
					imgUrl:'../../static/square-alarm.png',
					badge: 20,
					name: '视频告警',
					redirectUrl:'/pages/processList/processList?type=2'
				}],
				
			}
		},
		onLoad(option) {
			uni.setNavigationBarTitle({
				title: '站点类型'
			});
			console.log(option.companyCode)
			this.getSiteType(option.companyCode)

		},
		methods: {
			
			async getSiteType(ming) {
				const res= await this.$myRequest({
					url:'IntegratedAlarm/getSiteType',
					data:{
						"companyCode": ming,
						
					}
				})
				console.log(res.data)
				// this.cuIconList=res.data.data   videoMonitoringCount
				this.powerMonitoringCount= res.data.data[0].powerMonitoringCount
				this.videoMonitoringCount= res.data.data[0].videoMonitoringCount
				this.companyCode=res.data.companyCode;
				
			},
			
			// 页面跳转
			goProcessList() {
				if(this.powerMonitoringCount){
					uni.navigateTo({
						url: '/pages/processList/processList?type=1&companyCode='+this.companyCode+'',
						success: res => {},
						fail: () => {},
						complete: () => {}
					});
				}
				
			},
			goProcessList2() {
				if(this.videoMonitoringCount){
					uni.navigateTo({
						url: '/pages/processList/processList?type=2&companyCode='+this.companyCode+'',
						success: res => {},
						fail: () => {},
						complete: () => {}
					});
				}
				
			},
			
		}
	}
</script>

<style>

</style>
