From c93be5548631e3623603c43c01edf6c13e2d2567 Mon Sep 17 00:00:00 2001 From: yujialong <479214531@qq.com> Date: Thu, 3 Aug 2023 14:21:00 +0800 Subject: [PATCH] fix --- src/pages/achievement/info/course.vue | 35 +++++++++++++++----------- src/pages/achievement/info/project.vue | 27 +++++++++++++++----- src/pages/achievement/list/index.vue | 3 ++- src/pages/achievement/list/project.vue | 2 +- src/pages/assessment/list/index.vue | 2 +- src/pages/product/list/index.vue | 18 ++++++++++--- src/setting.js | 2 +- 7 files changed, 61 insertions(+), 28 deletions(-) diff --git a/src/pages/achievement/info/course.vue b/src/pages/achievement/info/course.vue index 7f88582..f91682e 100644 --- a/src/pages/achievement/info/course.vue +++ b/src/pages/achievement/info/course.vue @@ -3,7 +3,7 @@
-
@@ -114,7 +114,7 @@ @@ -520,18 +520,17 @@ export default { this.$router.push(this.curTab == 1 ? `show?reportId=${row.reportId}` : `project?id=${row.projectId}&projectName=${row.goodsName}&classId=${this.curRow.classId || ''}&workNumber=${row.workNumber || row.userName}`) }, getChart () { // 初始化折线图 - const xData = Array.from({ length: 101 }, (v, k) => k) - const yData = Array.from({ length: 101 }, (v, k) => 0) + const data = {} const list = this.listDataAll const prop = this.curTab == 0 ? 'avgScore' : 'averageScore' list.map(n => { - yData[n[prop]]++ + if (!data[n[prop]]) { + data[n[prop]] = 1 + } else { + data[n[prop]]++ + } }) - return console.log(333, xData, yData) - const nums = this.stageNumber - for (const i in this.stageNumber) { - data.push(nums[i]) - } + console.log(333, data, Object.keys(data), Object.values(data)) let myChart = echarts.init(document.getElementById("chart")); myChart.setOption({ title: { text: "实验分数分布图" }, @@ -540,16 +539,22 @@ export default { name: "分数", type: "category", boundaryGap: false, - interval: 10, - data: ["0", "10", "20", "30", "40", "50", "60", "70", "80", "90", '100'] + interval: 5, + axisLabel: { + interval: 9, + }, + data: Object.keys(data) }, yAxis: { - name: this.permissions ? "人数" : '成绩报告数量', + name: this.curTab == 1 ? "人数" : '成绩报告数量', type: "value", - interval: 1 + interval: 10, + axisLabel: { + interval: 9, + }, }, series: [{ - data, + data: Object.values(data), type: "line", areaStyle: {}, color: ["#8191fd"] diff --git a/src/pages/achievement/info/project.vue b/src/pages/achievement/info/project.vue index 1d66b58..3a605d9 100644 --- a/src/pages/achievement/info/project.vue +++ b/src/pages/achievement/info/project.vue @@ -1,11 +1,14 @@