lzhe
2024-06-21 dd0cc539598b599240ac3d95a74170544ed5741c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
<!--
 * @Author: lzhe lzhe@example.com
 * @Date: 2024-04-16 15:22:46
 * @LastEditors: lzhe lzhe@example.com
 * @LastEditTime: 2024-06-20 21:49:13
 * @FilePath: /CPSnew/smart-web/src/views/home/widgets/components/mdcDeviceStatus.vue
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
-->
<template>
    <el-card shadow="hover" header="设备状态统计" style="height: 100%;" class="deviceStatus">
        <ul class="status-view-box">
            <li v-for="(item,index) in devicestatus" @click="searchstatus(item,index)" :class="{'active': item.active}">
                <el-icon :style="{'color': item.color}">
                    <component :is='item.icon'></component>
                </el-icon>
                <span class="statusName">{{item.statusName}}</span>
                <span class="view-box-num">{{item.deviceNum}}</span>
            </li>
        </ul>
    </el-card>
</template>
 
<script>
    import * as ElementPlusIconsVue from '@element-plus/icons-vue'
    let icons = []
    for (const [key, component] of Object.entries(ElementPlusIconsVue)) {
        icons.push(key)
    }
    export default {
        title: "设备状态统计",
        icon: "el-icon-data-line",
        description: "快速查看设备状态统计",
        data() {
            return {
                devicestatus: []
            }
        },
        components: {...ElementPlusIconsVue},
        mounted() {
            this.getdevicestatus();  //获取具体数据
        },
        methods: {
            getdevicestatus() {
                this.$HTTP.get(`/api/blade-mdc/work-station-analysis/device-status-statistics`).then(res=> {
                    if(res.code == 200) {
                        res.data[0].icon = "Position";
                        res.data[1].icon = "Loading";
                        res.data[2].icon = "Clock";
                        res.data[3].icon = "Warning";
                        res.data[4].icon = "Odometer";
                        this.devicestatus = res.data;
                    }
                })
            },
            goPage(item) {
                
            }
        }
    }
</script>
<style scoped>
    .status-view-box {
        display: flex;
        padding: 0;
    }
    .status-view-box li {
        list-style: none;
        border-radius: 2px;
        background: #f6f6f6;
        cursor: pointer;
        padding: 13px 37px 13px 17px;
        margin: 0 8px;
        flex-direction: row;
        display: flex;
        align-items: center;
        flex: 1;
        height: 90px;
    }
    .status-view-box li:nth-child(1) {
        background-color: rgba(55, 12, 13, 0.14);
    }
    .status-view-box li:nth-child(2) {
        background-color: rgba(255, 197, 61, 0.14);
    }
    .status-view-box li:nth-child(3) {
        background-color: rgba(89, 89, 89, 0.14);
    }
    .status-view-box li:nth-child(4) {
        background-color: rgba(64, 169, 255, 0.14);
    }
    .status-view-box li:nth-child(5) {
        background-color: rgba(115, 209, 61, 0.14);
    }
    .status-view-box li i {
        margin-right:6px;
        font-size: 14px;
        font-weight: bold;
    }
    .view-box-num {
        font-weight: bold;
        font-size: 25px;
        margin-left:12px;
    }
    .deviceStatus .el-card__body {
        padding: 12px 12px 6px;
    }
    .statusName {
        font-weight: 700;
        font-size: 15px;
        color: #666;
    }
</style>