1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
| <template>
| <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'
|
| const props = defineProps({
| data: {
| type: Array
| },
| 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 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>
|
|