135 lines
3.3 KiB
Vue
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<template>
<div class="wrap">
<div class="title">{{ title }}</div>
<div class="charts">
<div class="chart">
<JRingChart :title="{ text: totals.totalNum, subTitle: '问题总数' }" :color="['#3CABFD']" />
</div>
<div class="chart">
<JRingChart :title="{ text: totals.reviewedNum, subTitle: '待审核问题' }" :color="['#ff9800']" />
</div>
<div class="chart">
<JRingChart :title="{ text: totals.rectificationNum, subTitle: '待整改问题' }" :color="['#FF6C7F']" />
</div>
<div class="chart">
<JRingChart
:title="{ text: totals.ratioNum + '%', subTitle: '及时整改率' }"
:color="['#44d7b640', '#44D7B6']"
:data="[
{ value: totals.totalNum - totals.closeNum, name: '' },
{ value: totals.closeNum, name: '' }
]"
/>
</div>
<!-- <div class="count">
<div class="count-item">
<div class="num">一般隐患 <span>2314</span></div>
<div class="rate">占比66%</div>
</div>
<div class="count-item">
<div class="num">重大隐患 <span>987</span></div>
<div class="rate">占比34%</div>
</div>
</div> -->
</div>
</div>
</template>
<script>
import { selectSecurityManageStatisticsApi } from '@/assets/js/api/dataBoard'
import JRingChart from '../jChart/pie/JRingChart.vue'
export default {
components: { JRingChart },
props: {
title: {
type: String,
default: 'default title'
}
},
mounted() {
this.getCounts()
},
data() {
return {
projectSn: this.$store.state.projectSn,
totals: {}
}
},
methods: {
getCounts() {
selectSecurityManageStatisticsApi({ projectSn: this.projectSn }).then(res => {
const totals = res.result.total
const { totalNum, reviewedNum, rectificationNum, closeNum } = totals
const ratioNum = totals.totalNum ? ((totals.closeNum / totals.totalNum) * 100).toFixed(2) : 0
this.totals = { totalNum, reviewedNum, rectificationNum, closeNum, ratioNum }
})
}
}
}
</script>
<style lang="less" scoped>
.wrap {
width: 100%;
height: 100%;
border: 1px solid #0081c3;
.title {
padding-left: 6px;
height: 30px;
line-height: 30px;
font-size: 18px;
color: #6ee4f0;
}
.charts {
padding: 10px 30px 0;
display: flex;
justify-content: space-around;
.chart {
width: 200px;
height: 200px;
}
.count {
width: 14%;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
.count-item {
position: relative;
&::before {
position: absolute;
left: -16px;
top: 10px;
content: '';
width: 6px;
height: 6px;
border-radius: 50%;
}
&:first-child {
margin-bottom: 20px;
}
&:first-child::before {
background-color: #557dee;
}
&:last-child::before {
background-color: #ff6c7f;
}
.num {
margin-bottom: 8px;
font-size: 14px;
color: rgba(255, 255, 255, 0.7);
span {
font-size: 18px;
color: #fff;
}
}
.rate {
font-size: 14px;
}
}
}
}
}
</style>