<!-- * @Description: 环卫设施统计 * @Author: 王晓颖 * @Date:2021-01-11 18:59:02 --> <template> <div class="chart-div"> <div class="chart-child" style="flex:2;padding:5px;"> <div class="block-div"> <image-block :data="toiletCount" size="small" font-family="DS-DigitalBold"> <svg-icon icon-class="icon-toilet" class="device-icon"/> </image-block> </div> <div class="block-div"> <image-block :data="wastebinCount" size="small" font-family="DS-DigitalBold"> <svg-icon icon-class="icon-wastebin" class="device-icon"/> </image-block> </div> <div class="block-div"> <image-block :data="transferCount" size="small" font-family="DS-DigitalBold"> <svg-icon icon-class="icon-transfer" class="device-icon"/> </image-block> </div> <div class="block-div"> <image-block :data="car" size="small" font-family="DS-DigitalBold"> <svg-icon icon-class="icon-car" class="device-icon"/> </image-block> </div> </div> </div> </template> <script> import ImageBlock from '@/components/BigData/Block/imageBlock' import { getSingleCount } from '@/api/sanitation/statistics' export default { name: 'DeviceStatistic', components: { ImageBlock }, data() { return { color: '', toiletCount: { name: '公厕', // 标题 value: '--', // 数值 unit: '个' }, wastebinCount: { name: '垃圾桶', // 标题 value: '--', // 数值 unit: '个' }, transferCount: { name: '垃圾中转站', // 标题 value: '--', // 数值 unit: '个' }, car: { name: '环卫车', // 标题 value: '--', // 数值 unit: '辆' } } }, created() { this.getToiletCount() this.getWasteBinCount() this.getTransferStationCount() this.getCarCount() }, methods: { getToiletCount() { getSingleCount('toilet').then(response => { this.toiletCount.value = response.data }) }, getWasteBinCount() { getSingleCount('wastebin').then(response => { this.wastebinCount.value = response.data }) }, getTransferStationCount() { getSingleCount('transferstation').then(response => { this.transferCount.value = response.data }) }, getCarCount() { getSingleCount('car').then(response => { this.car.value = response.data }) } } } </script> <style rel="stylesheet/scss" lang="scss" scoped> .chart-div{ display: flex; height: 100%; width: 100%; /*flex-direction: column;*/ justify-content: space-between; .chart-child{ height: 100%; flex:1; display: flex; flex-wrap:wrap; .block-div{ width:50%; height:50%; padding:3px; .device-icon{ font-size:1.5rem; color: #1890ff } } } } </style>