riku
2024-07-11 505798927f75c84693cc51becf16aa525503fc92
src/views/inspection/problem/component/ProblemSummary.vue
@@ -1,7 +1,9 @@
<template>
  <div>
    问题数: {{ summary.proNum }},整改数: {{ summary.changeNum }},整改率: {{ summary.changePer }}
  <div class="font-small">
    今日统计:问题数: {{ summary.proNum }},整改数: {{ summary.changeNum }},整改率:
    {{ summary.changePer }}
  </div>
  <div class="font-small">突出问题:路面积尘,问题数:13,占比:81%</div>
</template>
<script setup>
import { computed, ref } from 'vue'
@@ -23,9 +25,37 @@
  })
  if (proNum > 0) {
    changePer = Math.round((changeNum / proNum) * 100) / 100 + '%'
    changePer = Math.round((changeNum / proNum) * 100) + '%'
  }
  return { proNum, changeNum, changePer }
})
const mainPro = computed(() => {
  let res
  let total = 0,
    max = 0
  props.data.forEach((d) => {
    total += d.proNum
  })
  props.data.forEach((d) => {
    if (total > 0) {
      const per = d.proNum / total
      if (per >= max) {
        max = per
        // res.push({
        //   name: d.name,
        //   count: d.count,
        //   per: Math.round(per * 100) + '%'
        // })
        res = {
          name: d.name,
          count: d.count,
          per: Math.round(per * 100) + '%'
        }
      }
    }
  })
  return res
})
</script>