计算首页的完成率

Lvtianfang
吕天方 7 months ago
parent 9d1cdc7fe5
commit 9fd0c222d2

@ -44,18 +44,27 @@ export default {
this.arr1.push({ this.arr1.push({
value: value1.count, value: value1.count,
name: value1.lawAreas, name: value1.lawAreas,
pt: value1.completionRate, // pt: value1.completionRate,
pt: this.NumFilter(value1.completed,value1.count),
}); });
} else { } else {
this.arr2.push({ this.arr2.push({
value: value1.count, value: value1.count,
name: value1.lawAreas, name: value1.lawAreas,
pt: value1.completionRate // pt: value1.completionRate
pt: this.NumFilter(value1.completed,value1.count)
}); });
} }
}); });
this.initChart(); this.initChart();
}, },
NumFilter(numOne,numTwo){
// if(numOne == 0 || numTwo == 0) {
// return 0;
// }
let realVal = parseFloat((numOne / numTwo) * 100).toFixed(2)
return realVal;
},
initChart() { initChart() {
var chartDom = document.getElementById("cakeBox"); var chartDom = document.getElementById("cakeBox");
var myChart = echarts.init(chartDom); var myChart = echarts.init(chartDom);
@ -87,7 +96,7 @@ export default {
trigger: "item", trigger: "item",
}, },
legend: { legend: {
width: "45%", width: "35%",
top: "25%", top: "25%",
right: "8%", right: "8%",
orient: "horizontal", orient: "horizontal",
@ -95,26 +104,26 @@ export default {
itemWidth: 10, itemWidth: 10,
itemHeight: 10, itemHeight: 10,
icon: "circle", icon: "circle",
formatter: function (name) {
const item = option.legend.data.find((item) => item.name === name);
// return `{a|${name}}{b|${( item.value / arrA * 100)}%}`;
return `{a|${name}}{pt|${item.pt}%}`;
},
textStyle: { textStyle: {
rich: { rich: {
a: { 'a': {
color: "#525966", color: "#525966",
width: 60, width: 60,
padding: [0, 0, 0, 5], // padding: [0, 0, 0, 5],
}, },
b: { 'pt': {
color: "#495B7D", color: "#495B7D",
fontWeight: "bold", fontWeight: "bold",
// width: 60, width: 60,
// padding: [0, 0, 0, 10], // padding: [0, 0, 0, 10],
}, },
}, },
}, },
formatter: function (name) {
const item = option.legend.data.find((item) => item.name === name);
// return `{a|${name}}{b|${( item.value / arrA * 100)}%}`;
return `{a|${name}}{b|${item.pt}%}`;
},
//waiyuan, //waiyuan,
// data: [ // data: [
// { value: 15, name: "" }, // { value: 15, name: "" },

@ -130,7 +130,8 @@
header-align="center" header-align="center"
> >
<template slot-scope="scope"> <template slot-scope="scope">
{{ scope.row.cdCompletionRate }}% <!-- {{ scope.row.cdCompletionRate }}% -->
{{ NumFilter(scope.row.cdFinish,scope.row.cdExecutionPlan) }}%
</template> </template>
</el-table-column> </el-table-column>
<el-table-column prop="count" label="执法计划" header-align="center"> <el-table-column prop="count" label="执法计划" header-align="center">
@ -164,7 +165,8 @@
header-align="center" header-align="center"
> >
<template slot-scope="scope"> <template slot-scope="scope">
{{ scope.row.completionRate }}% <!-- {{ scope.row.completionRate }}% -->
{{ NumFilter(scope.row.completed,scope.row.count) }}%
</template> </template>
</el-table-column> </el-table-column>
@ -234,7 +236,8 @@
header-align="center" header-align="center"
> >
<template slot-scope="scope"> <template slot-scope="scope">
{{ scope.row.cdCompletionRate }}% <!-- {{ scope.row.cdCompletionRate }}% -->
{{ NumFilter(scope.row.cdFinish,scope.row.cdExecutionPlan) }}%
</template> </template>
</el-table-column> </el-table-column>
<el-table-column prop="count" label="执法计划" header-align="center"> <el-table-column prop="count" label="执法计划" header-align="center">
@ -265,7 +268,8 @@
header-align="center" header-align="center"
> >
<template slot-scope="scope"> <template slot-scope="scope">
{{ scope.row.completionRate }}% <!-- {{ scope.row.completionRate }}% -->
{{ NumFilter(scope.row.completed,scope.row.count) }}%
</template> </template>
</el-table-column> </el-table-column>
@ -420,6 +424,13 @@ export default {
resetPwd() { resetPwd() {
this.isResetPwdDialog = true; this.isResetPwdDialog = true;
}, },
NumFilter(numOne,numTwo){
if(numOne == 0 || numTwo == 0) {
return 0;
}
let realVal = parseFloat((numOne / numTwo) * 100).toFixed(2)
return realVal;
},
// //
handelExport() { handelExport() {
this.download( this.download(
@ -455,8 +466,10 @@ export default {
}, },
// //
getList() { getList() {
this.load1 = true;
treeEnterprise(this.queryParams).then((response) => { treeEnterprise(this.queryParams).then((response) => {
// console.log(response); // console.log(response);
this.load1 = false;
this.tableData = response.data; this.tableData = response.data;
this.newTable = response.data; this.newTable = response.data;
}); });

Loading…
Cancel
Save