<template>
|
<!-- <div class="font-small">
|
今日统计:问题数: {{ summary.proNum }},整改数: {{ summary.changeNum }},整改率:
|
{{ summary.changePer }}
|
</div> -->
|
|
<div v-if="mainProType" class="font-small">
|
突出问题:{{ mainProType.name }},问题数:{{ mainProType.count }},占比{{ mainProType.per }}
|
</div>
|
<BaseTable :data="summary">
|
<el-table-column
|
label="问题数"
|
prop="proNum"
|
:show-overflow-tooltip="true"
|
width="60"
|
></el-table-column>
|
<el-table-column
|
label="整改数"
|
prop="changeNum"
|
:show-overflow-tooltip="true"
|
width="60"
|
></el-table-column>
|
<el-table-column
|
label="整改率"
|
prop="changePer"
|
:show-overflow-tooltip="true"
|
width="60"
|
></el-table-column>
|
</BaseTable>
|
</template>
|
<script setup>
|
import { computed, ref } from 'vue'
|
|
const props = defineProps({
|
data: {
|
type: Array,
|
default: () => []
|
},
|
proStatistic: {
|
type: Array,
|
default: () => []
|
},
|
loading: Boolean
|
})
|
|
const summary = computed(() => {
|
let proNum = 0,
|
changeNum = 0,
|
changePer = '/'
|
props.data.forEach((d) => {
|
proNum += d.proNum
|
changeNum += d.changeNum
|
})
|
|
if (proNum > 0) {
|
changePer = Math.round((changeNum / proNum) * 100) + '%'
|
}
|
|
return [{ proNum, changeNum, changePer }]
|
})
|
|
const mainProType = computed(() => {
|
let res
|
let total = 0,
|
max = 0
|
props.proStatistic.forEach((d) => {
|
total += d.count
|
})
|
props.proStatistic.forEach((d) => {
|
if (total > 0) {
|
const per = d.count / total
|
if (per >= max) {
|
max = per
|
res = {
|
name: d.name,
|
count: d.count,
|
per: Math.round(per * 100) + '%'
|
}
|
}
|
}
|
})
|
return res
|
})
|
</script>
|