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

大屏用户统计

parent 42f78adc
...@@ -82,7 +82,6 @@ export default { ...@@ -82,7 +82,6 @@ export default {
if(res.code == 200 && res.rows){ if(res.code == 200 && res.rows){
//this.eventList = res.rows; //this.eventList = res.rows;
this.eventInfo = res.rows[0]; this.eventInfo = res.rows[0];
console.log(">>>>>>>>>>",this.eventInfo)
} }
}); });
}, },
......
...@@ -61,10 +61,13 @@ export default { ...@@ -61,10 +61,13 @@ export default {
getUserStatistic(){ getUserStatistic(){
userStatistic().then(res =>{ userStatistic().then(res =>{
if(res.code == 200){ if(res.code == 200){
this.categories = res.data.categories; this.categories = res.data.categories || [];
this.residential = res.residential; this.residential = Array.isArray(res.data.residential)
this.commercial = res.data.commercial; ? res.data.residential
console.log(">>>>>>>>>", res.data); : (res.data.residential || []).map(Number);
this.commercial = Array.isArray(res.data.commercial)
? res.data.commercial
: (res.data.commercial || []).map(Number);
this.updateChart(); this.updateChart();
} }
}) })
...@@ -85,19 +88,6 @@ export default { ...@@ -85,19 +88,6 @@ export default {
if (!this.chart) { if (!this.chart) {
return; 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({ this.chart.setOption({
grid: { grid: {
left: 8, 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