<template>
    <view class="index-zhuyonghu">
        <div class="header">
            <div class="header-item">
                <div class="header-item-value">{{ devCount.onLineCount || 0 }}</div>
                <div class="header-item-label">正常设备</div>
            </div>
            <div class="header-item" @click="jump('alarmLineDevs')">
                <div class="header-item-value">{{ devCount.alarmLineCount || 0 }}</div>
                <div class="header-item-label">报警设备</div>
            </div>
            <div class="header-item"  @click="jump('offLineDevs')">
                <div class="header-item-value">{{ devCount.offLineCount || 0 }}</div>
                <div class="header-item-label">离线设备</div>
            </div>
        </div>
    </view>
</template>
<script>
export default {
    props: {
        devCount: {
            type: Object,
            default: {},
        },
    },
    methods:{
        jump(type) {
            switch (type) {
                case 'alarmLineDevs':
                    uni.navigateTo({
                        url:
                            '/pages/device/list?type=alarmLineDevs&projectList=' +
                            encodeURIComponent(JSON.stringify(this.devCount.alarmLineDevs)),
                    })
                    break
                case 'offLineDevs':
                    uni.navigateTo({
                        url:
                            '/pages/device/list?type=offLineDevs&projectList=' +
                            encodeURIComponent(JSON.stringify(this.devCount.offLineDevs)),
                    })
                    break

                default:
                    break
            }
        },
    }
}
</script>
<style lang="scss"></style>
