<template>
	<view>
		<view class="alarm-box ddflex" @click="jumpUrl('warning/userAlarm/userAlarm')">
			<view class="alarm-icon ddflex" >
				<image src="../static/images/yc1.png"></image>
			</view>
			<view class="fflex">
				<view class="alarm-title">用户报障</view>
				<view class="alarm-note">您有{{userAlarmCount}}条用户保障记录，请及时处理</view>
			</view>
			<image class="rico" src="../../static/pages/images/ssicon.png"></image>
			<view class="dot" v-if="userAlarmCount>0"></view>
		</view>
		
		<view class="alarm-box ddflex" @click="jumpUrl('warning/machineAlarm/machineAlarm')">
			<view class="alarm-icon ddflex" >
				<image src="../static/images/yc2.png"></image>
			</view>
			<view class="fflex">
				<view class="alarm-title">机柜报障</view>
				<view class="alarm-note">您有{{cabAlarmCount}}条机柜保障提醒，请及时处理</view>
			</view>
			<image class="rico" src="../../static/pages/images/ssicon.png"></image>
			<view class="dot" v-if="cabAlarmCount>0"></view>
		</view>
		
		<view class="alarm-box ddflex" @click="jumpUrl('warning/reconditionAlarm/reconditionAlarm')">
			<view class="alarm-icon ddflex" >
				<image src="../static/images/yc3.png"></image>
			</view>
			<view class="fflex">
				<view class="alarm-title">检修提醒</view>
				<view class="alarm-note">您有{{reconditionCount}}条检修提醒，请及时处理</view>
			</view>
			<image class="rico" src="../../static/pages/images/ssicon.png"></image>
			<view class="dot" v-if="reconditionCount>0"></view>
		</view>
	</view>
</template>

<script>
	const app = getApp();
	const req = require("../../utils/request.js");

	export default {
		components: {},
		props: {},
		data() {
			return {
				userAlarmCount:0,
				cabAlarmCount:0,
				reconditionCount:0
				
			}
		},
		onLoad(options) {

		},
		onShow() {
			this.getCount()
		},
		methods: {
			jumpUrl(url) {
				if (!req.isLogin()) return false;
				app.globalData.navigateTo(url);
			},
			getCount(){
				req.getRequest('/admin/v2/alarm/userAlarmPage',{page:1,limit:1,type:0},res=>{
					this.userAlarmCount = res.total
				})
				req.getRequest('/admin/v2/alarm/cabAlarmPage',{page:1,limit:1,type:1},res=>{
					this.cabAlarmCount = res.total
				})
				req.getRequest('/admin/v2/alarm/reconditionPage',{page:1,limit:1,type:0},res=>{
					this.reconditionCount = res.total
				})
			}
		},
		mounted() {
		},
		onPageScroll: function(e) {
		}
	}
</script>

<style>
	@import "./abnormalAlarm.css";
</style>