echarts更改数据

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

@ -35,7 +35,7 @@ export default {
const first = matched[0] const first = matched[0]
if (!this.isDashboard(first)) { 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) this.levelList = matched.filter(item => item.meta && item.meta.title && item.meta.breadcrumb !== false)
@ -49,6 +49,7 @@ export default {
}, },
handleLink(item) { handleLink(item) {
const { redirect, path } = item const { redirect, path } = item
console.log(item);
if (redirect) { if (redirect) {
this.$router.push(redirect) this.$router.push(redirect)
return return

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

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

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

Loading…
Cancel
Save