echarts更改数据

lijinlong^2
杜函宇 1 year ago
parent dd97e007e8
commit cc4af5720a

@ -35,7 +35,7 @@ export default {
const first = matched[0]
if (!this.isDashboard(first)) {
matched = [{ path: '/index', meta: { title: '首页' }}].concat(matched)
matched = [{ path: '/home', meta: { title: '首页' }}].concat(matched)
}
this.levelList = matched.filter(item => item.meta && item.meta.title && item.meta.breadcrumb !== false)
@ -49,6 +49,7 @@ export default {
},
handleLink(item) {
const { redirect, path } = item
console.log(item);
if (redirect) {
this.$router.push(redirect)
return

@ -118,7 +118,15 @@ export default {
roles: (state) => state.user.roles,
}),
},
data() {
return {
avatarFlag: false,
};
},
methods: {
getDrop(e) {
this.avatarFlag = e;
},
toggleSideBar() {
this.$store.dispatch("app/toggleSideBar");
},

@ -16,6 +16,8 @@ export default {
pageSize: 10,
pageNum: 1,
},
//
numTotal: 0,
};
},
mounted() {
@ -27,13 +29,15 @@ export default {
getData() {
this.load1 = true;
workStatistics(this.beforeParams).then((res) => {
console.log(res);
res.data.list.forEach((value1) => {
this.arr1.push({
value: value1.percentageCompleted + value1.percentageNonCompleted,
value: value1.keyCompleted + value1.nonKeyCompleted,
name: value1.deptName,
});
this.numTotal += value1.keyCompleted + value1.nonKeyCompleted;
console.log(this.arr1);
});
console.log(this.arr1);
this.initChart();
this.load1 = false;
});
@ -77,8 +81,11 @@ export default {
itemWidth: 10,
itemHeight: 10,
icon: "circle",
formatter: function (name) {
return `{a|${name}}{b|15%}`;
formatter(name) {
// const arrA = this.arr1.filter((value, index) => {
// return value.name == name;
// });
return `{a|${name}}{b|1%}`;
},
textStyle: {
rich: {
@ -107,9 +114,8 @@ export default {
// { value: 10, name: "" },
// { value: 5, name: "" },
// ],
data:this.arr1
data: this.arr1,
},
series: [
{
type: "pie",
@ -130,25 +136,27 @@ export default {
labelLine: {
show: false,
},
data: [
{ value: 15, name: "张家港市" },
{ value: 10, name: "吴中区" },
{ value: 8, name: "常熟市" },
{ value: 10, name: "姑苏区" },
{ value: 18, name: "太仓市" },
{ value: 6, name: "相城区" },
{ value: 10, name: "昆山市" },
{ value: 4, name: "工业园区" },
{ value: 10, name: "吴江区" },
{ value: 5, name: "高新区" },
],
// data: [
// { value: 15, name: "" },
// { value: 10, name: "" },
// { value: 8, name: "" },
// { value: 10, name: "" },
// { value: 18, name: "" },
// { value: 6, name: "" },
// { value: 10, name: "" },
// { value: 4, name: "" },
// { value: 10, name: "" },
// { value: 5, name: "" },
// ],
data: this.arr1,
},
{
type: "pie",
center: ["28%", "55%"], //
radius: "32%",
color:'rgb(246,246,249)',
avoidLabelOverlap: false,
color: "rgb(247,247,249)",
tooltip: {
show: false,
},
@ -163,6 +171,7 @@ export default {
normal: {
position: "center",
formatter: function (params) {
console.log(params);
return `{a|${params.data.pt}%}\n{b|${params.data.name}}`;
},
rich: {
@ -182,9 +191,10 @@ export default {
labelLine: {
show: false,
},
data: [{ value: 1, name: "苏州完成率", pt: 98 }],
data: [{ value: 1, name: "苏州完成率", pt: 100 }],
},
],
};
option && myChart.setOption(option);
},

@ -50,7 +50,7 @@ module.exports = {
// },
'/api': {
// target: `http://39.101.188.84:9033`,
target: `http://192.168.0.108:9033`,
target: `http://192.168.0.119:9033`,
changeOrigin: true,
pathRewrite: {
'^/api': ''

Loading…
Cancel
Save