From b292a0a81869547e94fd85e783f9597db241a87e Mon Sep 17 00:00:00 2001
From: riku <risaku@163.com>
Date: 星期一, 15 七月 2024 17:30:37 +0800
Subject: [PATCH] 2024.7.15

---
 src/views/inspection/problem/component/ProblemSummary.vue |   63 +++++++++++++++++++++++++++++--
 1 files changed, 58 insertions(+), 5 deletions(-)

diff --git a/src/views/inspection/problem/component/ProblemSummary.vue b/src/views/inspection/problem/component/ProblemSummary.vue
index 71c3684..1bdc8c4 100644
--- a/src/views/inspection/problem/component/ProblemSummary.vue
+++ b/src/views/inspection/problem/component/ProblemSummary.vue
@@ -1,14 +1,44 @@
 <template>
-  <div>
-    闂鏁�: {{ summary.proNum }}锛屾暣鏀规暟: {{ summary.changeNum }}锛屾暣鏀圭巼: {{ summary.changePer }}
+  <!-- <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
+    type: Array,
+    default: () => []
+  },
+  proStatistic: {
+    type: Array,
+    default: () => []
   },
   loading: Boolean
 })
@@ -23,9 +53,32 @@
   })
 
   if (proNum > 0) {
-    changePer = Math.round((changeNum / proNum) * 100) / 100 + '%'
+    changePer = Math.round((changeNum / proNum) * 100) + '%'
   }
 
-  return { proNum, changeNum, changePer }
+  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>

--
Gitblit v1.9.3