报表数据概览checkbox切换不调接口

This commit is contained in:
weixiaobo@boe.com.cn
2023-09-12 11:13:03 +08:00
parent a4398bd7b6
commit 95c8a26d70

View File

@@ -349,7 +349,8 @@ export default {
one: "学习人数", one: "学习人数",
two: "总学习时长", two: "总学习时长",
three: "人均学习时长", three: "人均学习时长",
} },
topChartData:[],
}); });
const surfaceRef = ref(null); const surfaceRef = ref(null);
const surface1Ref = ref(null); const surface1Ref = ref(null);
@@ -372,9 +373,87 @@ export default {
state.limitCheckedList = event; state.limitCheckedList = event;
// modalChange(); // modalChange();
if (state.towParmasn.dateType == 2) { if (state.towParmasn.dateType == 2) {
twoMonthChange(state.towParmasn.time); // twoMonthChange(state.towParmasn.time);
const xData = [];
const avgDuration = [];
const count = [];
const duration = [];
state.topChartData.forEach((item) => {
xData.push(item.day);
avgDuration.push(item.avgDuration);
count.push(item.count);
duration.push(item.duration);
});
option.value.xAxis.data = xData;
// 右侧坐标轴数据
// option.value.series[0].data = count;
// //左侧坐标轴数据
// option.value.series[1].data = avgDuration;
// option.value.series[2].data = duration;
option.value.series[0].data = [];
option.value.series[1].data = [];
option.value.series[2].data = [];
console.log("checkedList:",state.checkedList);
console.log("666 duration:",duration);
for(let i=0;i<state.checkedList.length;i++){
if(state.checkedList[i]=="学习人数" || state.checkedList[i]=="总阅读人数" || state.checkedList[i]=="总查看人数"){
option.value.series[0].data = count;
option.value.series[0].name = state.checkedList[i];
}
if(state.checkedList[i]=="人均学习时长" || state.checkedList[i]=="人均阅读时长" || state.checkedList[i]=="总回答人数"){
option.value.series[1].data = avgDuration;
option.value.series[1].yAxisIndex = i;
option.value.series[1].name = state.checkedList[i];
}
if(state.checkedList[i]=="总学习时长" || state.checkedList[i]=="总阅读时长" || state.checkedList[i]=="总提问人数"){
option.value.series[2].data = duration;
option.value.series[2].yAxisIndex = i;
option.value.series[2].name = state.checkedList[i];
}
}
console.log("123:",option.value.series)
createEcharts2();
} else if (state.towParmasn.dateType == 1) { } else if (state.towParmasn.dateType == 1) {
twoDatChange(state.towParmasn.day); // twoDatChange(state.towParmasn.day);
const xData = [];
const avgDuration = [];
const count = [];
const duration = [];
state.topChartData.forEach((item) => {
xData.push(item.day);
avgDuration.push(item.avgDuration);
count.push(item.count);
duration.push(item.duration);
});
option.value.xAxis.data = xData;
// 右侧坐标轴数据
// option.value.series[0].data = count;
// //左侧坐标轴数据
// option.value.series[1].data = avgDuration;
// option.value.series[2].data = duration;
option.value.series[0].data = [];
option.value.series[1].data = [];
option.value.series[2].data = [];
console.log("checkedList:",state.checkedList);
for(let i=0;i<state.checkedList.length;i++){
if(state.checkedList[i]=="学习人数" || state.checkedList[i]=="总阅读人数" || state.checkedList[i]=="总查看人数"){
option.value.series[0].data = count;
option.value.series[0].name = state.checkedList[i];
}
if(state.checkedList[i]=="人均学习时长" || state.checkedList[i]=="人均阅读时长" || state.checkedList[i]=="总回答人数"){
option.value.series[1].data = avgDuration;
option.value.series[1].yAxisIndex = i;
option.value.series[1].name = state.checkedList[i];
}
if(state.checkedList[i]=="总学习时长" || state.checkedList[i]=="总阅读时长" || state.checkedList[i]=="总提问人数"){
option.value.series[2].data = duration;
option.value.series[2].yAxisIndex = i;
option.value.series[2].name = state.checkedList[i];
}
}
createEcharts2();
} }
} }
}; };
@@ -698,6 +777,7 @@ export default {
type: state.towParmasn.type, type: state.towParmasn.type,
}); });
if (res) { if (res) {
state.topChartData = res?.data?.result;
if ( if (
state.towParmasn.type == 4 || state.towParmasn.type == 4 ||
state.towParmasn.type == 5 || state.towParmasn.type == 5 ||
@@ -799,6 +879,7 @@ export default {
type: state.towParmasn.type, type: state.towParmasn.type,
}); });
if (res) { if (res) {
state.topChartData = res?.data?.result;
if ( if (
state.towParmasn.type == 4 || state.towParmasn.type == 4 ||
state.towParmasn.type == 5 || state.towParmasn.type == 5 ||