雷达分页

This commit is contained in:
熊丽君
2022-01-22 10:43:22 +08:00
parent 5e97aea340
commit 0007b23b1e

View File

@ -2,6 +2,7 @@
<div> <div>
<container2 title="战略指标"> <container2 title="战略指标">
<el-pagination <el-pagination
v-if="total"
small small
slot="datePicker" slot="datePicker"
layout="prev, pager, next" layout="prev, pager, next"
@ -203,12 +204,8 @@ export default {
if (200 == res.code) { if (200 == res.code) {
this.total = res.data.length; this.total = res.data.length;
this.dataList = res.data; this.dataList = res.data;
if (res.data.length && res.data.length % 2 == 0) { if (this.total == 0) return false;
this.isOdd = true;
} else {
this.isOdd = false;
this.setData(res.data.slice(0, 2)); this.setData(res.data.slice(0, 2));
}
// if (res.data.length > 2) { // if (res.data.length > 2) {
// list = res.data.splice(0, 2); // list = res.data.splice(0, 2);
// } else { // } else {
@ -223,8 +220,6 @@ export default {
this.setData(data); this.setData(data);
}, },
// this.chart = echarts.init(this.$refs.chartOdd, "macarons");
setData(list) { setData(list) {
if (list.length < 2) return this.setOddEchars(list); if (list.length < 2) return this.setOddEchars(list);
this.chart = echarts.init(this.$refs.chart, "macarons"); this.chart = echarts.init(this.$refs.chart, "macarons");
@ -260,7 +255,7 @@ export default {
}, },
{ {
text: list[1].key, text: list[1].key,
left: "65%", left: "68%",
bottom: 5, bottom: 5,
textStyle: { textStyle: {
color: "#fff", color: "#fff",
@ -400,18 +395,21 @@ export default {
}); });
}, },
setOddEchars(list) { setOddEchars(list) {
console.log(list);
let arr1 = [ let arr1 = [
...list[0].value.map((e) => parseInt(e.startNumber)), ...list[0].value.map((e) => parseInt(e.startNumber)),
...list[0].value.map((e) => parseInt(e.endNumber)), ...list[0].value.map((e) => parseInt(e.endNumber)),
...list[0].value.map((e) => parseInt(e.yearTarget)), ...list[0].value.map((e) => parseInt(e.yearTarget)),
]; ];
let max0 = Math.max.apply(null, arr1); let max0 = Math.max.apply(null, arr1);
if (this.chart) {
this.chart.dispose(); this.chart.dispose();
this.chart = null;
}
this.chart = echarts.init(this.$refs.chart, "macarons");
this.chart.setOption({ this.chart.setOption({
title: { title: {
text: list[0].key, text: list[0].key,
left: "19%", left: "43%",
bottom: 5, bottom: 5,
textStyle: { textStyle: {
color: "#fff", color: "#fff",
@ -452,7 +450,7 @@ export default {
}), }),
// { name: '登陆频次', max: 6500, axisLabel: { show: true }, color: '#fff' }, // { name: '登陆频次', max: 6500, axisLabel: { show: true }, color: '#fff' },
], ],
center: ["25.5%", "50%"], center: ["50%", "50%"],
radius: 50, radius: 50,
name: { name: {
// (圆外的标签)雷达图每个指示器名称的配置项。 // (圆外的标签)雷达图每个指示器名称的配置项。