index.vue 8.98 KB
Newer Older
geqilin's avatar
geqilin committed
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 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236
<template lang='pug'>
    el-container(style="padding:0px;" :style="{height:currentHeight-65+'px'}")
        el-aside( width="18vw" v-loading="leftLoading" style="z-index:1000;")
            div.left_aside(style="height:auto")
                el-header.left_header 报警统计
                el-main.left_main
                    div.left_main_body(v-for="item in eventList")
                        div.left_col_header {{item.systemName}}
                        el-row.row_style
                            el-col(:span="8")
                                div(style="color:#F56C6C;font-size:18px;font-weight:400;font-family:Microsoft YaHei;") {{item.oneCount}}
                                div(style="font-size:12px;color:#656565;font-family:Microsoft YaHei;font-weight:400;") 特别重大
                            el-col(:span="8")
                                div(style="color:#E6A23C;font-size:18px;font-weight:400;font-family:Microsoft YaHei;")  {{item.twoCount}}
                                div(style="font-size:12px;color:#656565;font-family:Microsoft YaHei;font-weight:400;") 重大
                            el-col(:span="8")
                                div(style="color:#409EFF;font-size:18px;font-weight:400;font-family:Microsoft YaHei;")  {{item.threeCount}}
                                div(style="font-size:12px;color:#656565;font-family:Microsoft YaHei;font-weight:400;") 一般
            div.left_aside(style="height:auto;margin-bottom:0px;")
                el-header.left_header 等级分布
                div(id="myCharts" style="height:232px;background:#ffffff")
                    //ve-pie.untreated_canvas(:data="chartData" :extend="chartExtend" legend-position="bottom" width="260px"  height="350px"  )
        el-main(style="padding:0px;z-index:1001;" :style="{height:currentHeight-45+'px'}" class="alarms-untreated-main")
            el-tabs(v-model="activeName" type="border-card" @tab-click="handleClick")
                el-tab-pane(label="全部" name="0")
                    query-list(v-if="activeName == 0" ref="queryList")
                el-tab-pane(label="视频监控系统" name="438c30d3d7f241b573f22a1a36c60485")
                    query-list(v-if="activeName == '438c30d3d7f241b573f22a1a36c60485'" ref="queryList")
                el-tab-pane(label="出入口控制系统" name="ed401f7d9291b508d411d8192b016c6e")
                    query-list(v-if="activeName == 'ed401f7d9291b508d411d8192b016c6e'" ref="queryList")
                el-tab-pane(label="入侵报警系统" name="75c7c11716713edfd2ce3581f5e7c193")
                    query-list(v-if="activeName == '75c7c11716713edfd2ce3581f5e7c193'" ref="queryList")
                el-tab-pane(label="安全检查及探测系统" name="3a64b86b1a5dead8ff9d2ad913744e50")
                    query-list(v-if="activeName == '3a64b86b1a5dead8ff9d2ad913744e50'" ref="queryList")
</template>
<script>
    import QueryList from '../untreated/query-list'
    export default {
        computed: {
            currentHeight() {
            return this.$store.state.d2admin.currentHeight.height
            }
        },
        data() {
            return {
                leftLoading: false,
                activeName: '0',
                eventList: [],
                chartData: null
            }
        },
        components: {
            QueryList
        },
        created() {
            this.eventList = []
            this.$nextTick(() => {
                this.$refs.queryList.init('0')
            })
            this.getGroupList()
        },
        methods: {
            groupInit() {
                let dom = document.getElementById('myCharts')
                if (!dom) return
                let myCharts = this.$echarts.init(dom)
                let option = {
                    tooltip: {
                        trigger: 'item',
                        formatter: '{b}: {c} ({d}%)'
                    },
                    legend: {
                        orient: 'horizontal',
                        bottom: 10,
                        data: ['特别重大', '重大', '一般']
                    },
                    series: [
                        {
                            bottom: 30,
                            type: 'pie',
                            radius: ['50%', '70%'],
                            avoidLabelOverlap: false,
                            label: {
                                formatter: (element) => {
                                    //自定义文字
                                    //return element.name + ':' + element.value + '(' + element.percent + '%)'
                                    return element.percent + '%'
                                }
                            },
                            itemStyle: {
                                normal: {
                                    color: function (params) {
                                        //自定义颜色
                                        let colorList = [
                                            '#F56C6C', '#E6A23C', '#409EFF'
                                        ]
                                        return colorList[params.dataIndex]
                                    }
                                }
                            },
                            labelLine: {
                                show: true
                            },
                            data: this.chartData
                        }
                    ]
                }
                myCharts.setOption(option)
            },
            //获取按报警等级统计信息
            getGroupList() {
                this.leftLoading = true
                this.$http({
                    url: this.$http.adornUrlAlarm(`/alarmsInfo/queryGroupUntreated`),
                    method: 'get',
                    params: this.$http.adornParams({
                        stationId: localStorage.getItem('stationId')
                    })
                }).then(data => {
                    this.leftLoading = false
                    if (data && data.code === 0) {
                        this.eventList = data.list
                        let oneCount, twoCount, threeCount
                        oneCount = twoCount = threeCount = 0
                        for (let i in this.eventList) {
                            oneCount += this.eventList[i].oneCount
                            twoCount += this.eventList[i].twoCount
                            threeCount += this.eventList[i].threeCount
                        }

                        this.chartData = [
                            { value: oneCount, name: '特别重大' },
                            { value: twoCount, name: '重大' },
                            { value: threeCount, name: '一般' }
                        ]
                        this.groupInit()
                    }
                })
            },
            handleClick(tab, event) {
                this.$nextTick(() => {
                    this.$refs.queryList.init(this.activeName)
                })
            }
        }
    }
</script>
<style lang='scss' scoped>
    .left_aside {
        margin-bottom: 10px;
        border: 1px #DCDFE6 solid;
        background: #f4f4f4;
        box-shadow: 2px 0px 8px 0px rgba(0, 0, 0, 0.2);
    }

    .left_header {
        line-height: 40px;
        height: 40px !important;
        background-color: #E1EDF4;
        border-bottom: 1px #E4E7ED solid;
        font-size:16px;
        font-family:Microsoft YaHei;
        font-weight:bold;
    }

    .left_main {
        padding: 0rem 1rem 1rem 1rem;
        overflow: hidden;
        background: #FFFFFF;
    }

    .left_main_char {
        /*padding:0rem 1rem 1rem 1rem;*/
        /*overflow: hidden;*/
        background: #FFFFFF;
        /*height: 300px;*/
        .untreated_canvas {
            margin: 0 auto;
            /*transform: translateY(-80px);*/
            top: -80px

        }
    }

    .left_main_body {
        margin-top: 1rem;
        border: 1px #D1D1D1 solid;
        /*height:120px;*/
        background: #fff;
    }

    .left_col_header {
        background-color: #E1EDF4;
        height: 30px;
        line-height: 30px;
        color: #000000;
        text-align: center;
        font-size:15px;
        font-family:Adobe Heiti Std;
        font-weight:bold;
    }

    .row_style {
        line-height: 24px;
        text-align: center;
        /*height:60px;*/
        /*padding:3px;*/
    }

    .alarms-untreated-main > .el-tabs {
        box-shadow: none;
        border: none;
    }

    .alarms-untreated-main > .el-tabs > .el-tabs__content {
        padding: 0 !important;
        margin-top: 10px;
    }

    .el-tanle th {
        background: #EEF8FF !important
    }

    .el-tabs__nav-scroll {
        height: 42px;
        /*padding-top: 10px;*/
        /*padding-left: 10px;*/
        line-height:42px;
        background: #f4f4f4;
        border-bottom: 1px solid rgba(196, 196, 196, 1);
        .el-tabs__item {
            border-top-color: #DCDFE6 !important;
        }
    }

</style>