<template>
    <view class="index-zhuyonghu">
        <template v-if="devCount.engineeringListLength > 1">
            <view class="canneng-index-title mb20">所有工程设备统计</view>
            <view class="header">
                <view class="header-item boxClick"  @click="jump('allEngineering')">
                    <view class="header-item-value">{{ devCount.onLineDevCount + devCount.offLineDevCount || 0 }}</view>
                    <view class="header-item-label">设备总数</view>
                </view>
                <view class="header-item boxClick" @click="jump('onLineDevs')">
                    <view class="header-item-value">{{ devCount.onLineDevCount || 0 }}</view>
                    <view class="header-item-label">在线设备</view>
                </view>
                <view class="header-item boxClick" @click="jump('offLineDevs')">
                    <view class="header-item-value">{{ devCount.offLineDevCount || 0 }}</view>
                    <view class="header-item-label">离线设备</view>
                </view>
            </view>
            <view class="mt20"></view>
        </template>
        <view class="canneng-index-title mb20">当前工程设备统计</view>
        <view class="header">
            <view class="header-item boxClick"  @click="jump('nowEngineering')">
                <view class="header-item-value">{{
                    devCount.currentOnLineDevCount + devCount.currentOffLineDevCount || 0
                }}</view>
                <view class="header-item-label">设备总数</view>
            </view>
            <view class="header-item boxClick" @click="jump('currentOnLineDevs')">
                <view class="header-item-value">{{ devCount.currentOnLineDevCount || 0 }}</view>
                <view class="header-item-label">在线设备</view>
            </view>
            <view class="header-item boxClick" @click="jump('currentOffLineDevs')">
                <view class="header-item-value">{{ devCount.currentOffLineDevCount || 0 }}</view>
                <view class="header-item-label">离线设备</view>
            </view>
        </view>
        <!-- <view style="padding: 20rpx 20rpx 0">
            <Cn-grid title="">
                <Cn-grid-item src="/static/device2.png" text="设备注册" @click="registerDevice"></Cn-grid-item>
                <Cn-grid-item src="/static/feedback2.png" text="问题反馈" @click="submitFeedBack"></Cn-grid-item>
            </Cn-grid>
        </view> -->
		
    </view>
</template>
<script>
export default {
    props: {
        devCount: {
            type: Object,
            default: {},
        },
    },
    methods: {
        jump(type) {
            uni.navigateTo({
                url:
                    '/pages/device/list?type=' + type
            })
        },
        submitFeedBack() {
            uni.navigateTo({url: '/pages/home/feedback'})
        },
        registerDevice() {
            this.$util.toast('此功能仅对正式用户开放')
        },
    },
}
</script>
<style lang="scss"></style>
