<template>
    <view class="index-zhuanzhi">
        <div class="header">
            <div class="header-item">
                <div class="header-item-value">{{ devCount.allDevCount || 0 }}</div>
                <div class="header-item-label">设备总数</div>
            </div>
            <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 class="header-item">
                <div class="header-item-value">{{ devCount.alarmEventCount || 0 }}</div>
                <div class="header-item-label">告警数量</div>
            </div>
            <div class="header-item">
                <div class="header-item-value">{{ devCount.eventCount || 0 }}</div>
                <div class="header-item-label">事件数量</div>
            </div>
            <div class="header-item" @click="projectNum">
                <div class="header-item-value">{{ devCount.projectCount || 0 }}</div>
                <div class="header-item-label">项目个数</div>
            </div>
        </div>
    </view>
</template>
<script>
export default {
    data() {
        return {
            loading: false,
        }
    },
    props: {
        devCount: {
            type: Object,
            default: {},
        },
    },
    methods: {
        projectWarning() {
            uni.navigateTo({
                url: '/pages/zhuanzhi/warning',
            })
        },
        projectNum() {
            uni.navigateTo({
                url: '/pages/project/list',
            })
        },
        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
            }
        },
    },
    created() {},
}
</script>
<style lang="scss">
.index-zhuanzhi {
}
</style>
