<template> <el-row :gutter="40" class="panel-group"> <div> <el-col> <div class="flagBoxStyle"> <div class="flagStyle" /> <div>报警情况</div> </div> </el-col> </div> <div v-for="card in dataGroup" :key="card.title"> <el-col v-if="hasPerm(card.permission)" class="card-panel-col"> <card :title="card.title" :context="card.context" :flags="card.flags" :icon="card.icon" :color="card.color" /> </el-col> </div> <div class="tableStyle"> <el-table border :data="tableList" stripe> <el-table-column prop="name" label="设备型号" /> <el-table-column prop="value" label="设备名称" /> </el-table> </div> </el-row> </template> <script> import Card from '@/components/BigData/Card' import { wellCountByBfzt } from '@/api/well/well' import { deviceStaticByStatus, alarmNowStatic } from '@/api/data/dataStatics' import { jobCountByStatus } from '@/api/alarm/job' export default { name: 'AlarmStatus', components: { Card }, data() { return { tableList: [], dataGroup: [ { title: '井', context: '--', flags: '条', icon: 'icon-alarm', color: '#40c9c6', permission: '/well/list' } ] } }, created() { this.getWellCount() this.getDeviceCount() this.getAlarmCount() this.getJobCount() }, mounted() { this.tableList = [ { value: 'WELL-001', name: '液位超限' }, { value: 'WELL-002', name: '燃气浓度超限' }, { value: 'WELL-003', name: '井盖开启' }, { value: 'WELL-004', name: '井盖开启' } ] }, methods: { refresh() { this.getAlarmCount() this.getJobCount() }, getWellCount() { wellCountByBfzt().then(response => { this.dataGroup[0].context = response.data.total }) }, getDeviceCount() { deviceStaticByStatus().then(response => { this.dataGroup[1].context = response.data.total }) }, getAlarmCount() { alarmNowStatic().then(response => { this.dataGroup[2].context = response.data.total }) }, getJobCount() { jobCountByStatus().then(response => { const data = response.data const total = data.beforeGet + data.beforeConfirm + data.inHandle this.dataGroup[3].context = total }) } } } </script> <style lang="scss" scoped> .tableStyle{ padding: 20px; } .flagBoxStyle { display: flex; margin-bottom: 20px; margin-top: -30px; } .flagBoxStyle div:nth-child(2){ line-height: 30px; font-weight: 600; } .flagStyle { width: 4px; height: 30px; margin-right: 6px; background: rgb(64 121 242); } .panel-group { margin-top: 18px; .card-panel-col { margin-bottom: 32px; } .card-panel { height: 108px; cursor: pointer; font-size: 12px; position: relative; overflow: hidden; color: #666; background: #fff; box-shadow: 4px 4px 40px rgba(0, 0, 0, .05); border-color: rgba(0, 0, 0, .05); &:hover { .card-panel-icon-wrapper { color: #fff; } .icon-people { background: #40c9c6; } .icon-message { background: #36a3f7; } .icon-money { background: #f4516c; } .icon-shopping { background: #34bfa3 } } .icon-people { color: #40c9c6; } .icon-message { color: #36a3f7; } .icon-money { color: #f4516c; } .icon-shopping { color: #34bfa3 } .card-panel-icon-wrapper { float: left; margin: 14px 0 0 14px; padding: 16px; transition: all 0.38s ease-out; border-radius: 6px; } .card-panel-icon { float: left; font-size: 48px; } .card-panel-description { float: right; font-weight: bold; margin: 26px; margin-left: 0px; .card-panel-text { line-height: 18px; color: rgba(0, 0, 0, 0.45); font-size: 16px; margin-bottom: 12px; } .card-panel-num { font-size: 20px; } } } } @media (max-width:550px) { .card-panel-description { display: none; } .card-panel-icon-wrapper { float: none !important; width: 100%; height: 100%; margin: 0 !important; .svg-icon { display: block; margin: 14px auto !important; float: none !important; } } } </style>