Commit e4184aa3 authored by 耿迪迪's avatar 耿迪迪

大屏用户统计

parent 42f78adc
......@@ -82,7 +82,6 @@ export default {
if(res.code == 200 && res.rows){
//this.eventList = res.rows;
this.eventInfo = res.rows[0];
console.log(">>>>>>>>>>",this.eventInfo)
}
});
},
......
......@@ -61,10 +61,13 @@ export default {
getUserStatistic(){
userStatistic().then(res =>{
if(res.code == 200){
this.categories = res.data.categories;
this.residential = res.residential;
this.commercial = res.data.commercial;
console.log(">>>>>>>>>", res.data);
this.categories = res.data.categories || [];
this.residential = Array.isArray(res.data.residential)
? res.data.residential
: (res.data.residential || []).map(Number);
this.commercial = Array.isArray(res.data.commercial)
? res.data.commercial
: (res.data.commercial || []).map(Number);
this.updateChart();
}
})
......@@ -85,19 +88,6 @@ export default {
if (!this.chart) {
return;
}
// 修复5: 检查数据是否有效
if (!this.categories.length || !this.residential.length || !this.commercial.length) {
console.warn("数据不完整,图表无法显示");
return;
}
// 修复6: 确保数据长度一致
const maxLength = Math.max(this.categories.length, this.residential.length, this.commercial.length);
if (this.categories.length !== maxLength ||
this.residential.length !== maxLength ||
this.commercial.length !== maxLength) {
console.warn("数据长度不一致,可能显示异常");
}
this.chart.setOption({
grid: {
left: 8,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment