violationCaseTable.vue
2.04 KB
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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
<template>
<el-table :data="tableData" :span-method="spanMethod" show-summary="true" :summary-method="getSummaries">
<el-table-column label="行政范围" header-align="center" align="center" >
<template slot-scope="scope">
长沙市
</template>
</el-table-column>
<el-table-column property="type" label="案卷类型" header-align="center" align="center"></el-table-column>
<el-table-column property="count" label="违规案卷数" header-align="center" align="center"></el-table-column>
<el-table-column property="repCount" label="违规案卷回复数" header-align="center" align="center"></el-table-column>
<el-table-column property="repPct" label="违规案卷回复率" header-align="center" align="center"></el-table-column>
</el-table>
</template>
<script>
import {caseTable} from "@/api/casefile/violationCaseFile";
export default {
name: "caseTable",
props: {
},
data() {
return {
tableData:[],
}
},
created() {
caseTable().then(res=>{
this.tableData = res.data;
});
},
methods:{
spanMethod({ row, column, rowIndex, columnIndex }) {
if(columnIndex == 0) {
if(rowIndex == 0){
return {rowspan:300 , colspan:1}
}else{
return {rowspan:0 , colspan:0}
}
}
},
getSummaries(param){
const { columns, data } = param;
const sums = [];
let allCount = 0;
let allRepCount = 0;
for(let i in data){
allCount += Number(data[i].count );
allRepCount += Number(data[i].repCount );
}
columns.forEach((column, index) => {
if (index == 0 || index == 1) {
return;
}
if(index == 2){
sums[2] = allCount;
}
if(index == 3){
sums[3] = allRepCount;
}
if(index == 4){
sums[4] = ((allRepCount/allCount)*100 ).toFixed(2)+ "%";
}
})
return sums;
},
}
}
</script>
<style scoped>
</style>