diff --git a/src/pages/achievement/list/index.vue b/src/pages/achievement/list/index.vue index c5f5cd3..227f34c 100644 --- a/src/pages/achievement/list/index.vue +++ b/src/pages/achievement/list/index.vue @@ -24,7 +24,7 @@
  • - + {{ item.name }}
  • @@ -237,6 +237,9 @@ export default { this.loadIns.close(); }); }, + perChange(val) { + this.$router.push(`list?per=${val}`) + }, initData() { this.$refs.table.clearSelection(); this.page = 1; diff --git a/src/pages/achievement/teach/index.vue b/src/pages/achievement/teach/index.vue index d3e9a5a..3ef1f41 100644 --- a/src/pages/achievement/teach/index.vue +++ b/src/pages/achievement/teach/index.vue @@ -2,7 +2,7 @@
    - +
    @@ -59,7 +59,11 @@ - + + + @@ -93,6 +97,7 @@ export default { id: this.$route.query.id, keyword: "", searchTimer: null, + listDataAll: [], listData: [], multipleSelection: [], page: 1, @@ -140,25 +145,32 @@ export default { getData() { // 考核 if (this.permissions) { - this.$post(`${this.api.getAssessmentDetail}?pageNum=${this.page}&pageSize=${this.pageSize}&assessmentId=${this.id}&classId=${this.classId}&keyword=${this.keyword}`).then(res => { - this.listData = res.page.records + this.$post(`${this.api.getAssessmentDetail}?pageNum=${this.page}&pageSize=10000&assessmentId=${this.id}&classId=${this.classId}&keyword=${this.keyword}`).then(res => { + this.listDataAll = res.page.records this.total = res.page.total this.avgScore = res.avgScore this.peopleNum = res.peopleNum + this.handlePage() this.getChart() }).catch(err => {}) } else { // 练习 - this.$post(`${this.api.getPracticeDetail}?pageNum=${this.page}&pageSize=${this.pageSize}&projectId=${this.id}&keyword=${this.keyword}`).then(res => { - this.listData = res.page.records + this.$post(`${this.api.getPracticeDetail}?pageNum=${this.page}&pageSize=10000&projectId=${this.id}&keyword=${this.keyword}`).then(res => { + this.listDataAll = res.page.records this.total = res.page.total let avgScore = +res.avgScore this.avgScore = avgScore.toFixed(2) this.peopleNum = res.peopleNum + this.handlePage() this.getChart() }).catch(res => {}) } }, + // 分页 + handlePage(){ + const list = this.listDataAll + this.listData = list.slice((this.page - 1) * this.pageSize,this.page * this.pageSize) + }, // 查看成绩报告 show(row) { this.$router.push(`show?reportId=${row.reportId}`) @@ -224,36 +236,34 @@ export default { this.handlePage(); }, getChart() { // 初始化折线图 - let data = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0] - let list = this.listData + const data = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] + const list = this.listDataAll list.map(n => { n.score; - if (n.score >= 0 && n.score <= 10) { + if (n.score === 0) { data[0]++; - } else if (n.score > 10 && n.score <= 20) { + } else if (n.score > 0 && n.score <= 10) { data[1]++; - } else if (n.score > 20 && n.score <= 30) { + } else if (n.score > 10 && n.score <= 20) { data[2]++; - } else if (n.score > 30 && n.score <= 40) { + } else if (n.score > 20 && n.score <= 30) { data[3]++; - } else if (n.score > 40 && n.score <= 50) { + } else if (n.score > 30 && n.score <= 40) { data[4]++; - } else if (n.score > 50 && n.score <= 60) { + } else if (n.score > 40 && n.score <= 50) { data[5]++; - } else if (n.score > 60 && n.score <= 70) { + } else if (n.score > 50 && n.score <= 60) { data[6]++; - } else if (n.score > 70 && n.score <= 80) { + } else if (n.score > 60 && n.score <= 70) { data[7]++; - } else if (n.score > 80 && n.score <= 90) { + } else if (n.score > 70 && n.score <= 80) { data[8]++; - } else if (n.score > 90 && n.score <= 100) { + } else if (n.score > 80 && n.score <= 90) { data[9]++; + } else if (n.score > 90 && n.score <= 100) { + data[10]++; } }) - // const datas = [] - // for (let i = 0; i <= 100; i++) { - // datas.push(list.filter(e => e.score === i).length) - // } let myChart = echarts.init(document.getElementById("chart")); myChart.setOption({ title: { text: "实验分数分布图" }, @@ -263,8 +273,7 @@ export default { type: "category", boundaryGap: false, interval: 10, - // splitNumber: 10, - data: ["0-10", "11-20", "21-30", "31-40", "41-50", "51-60", "61-70", "71-80", "81-90", "91-100"] + data: ["0", "10", "20", "30", "40", "50", "60", "70", "80", "90", '100'] }, yAxis: { name: "人数", @@ -278,9 +287,6 @@ export default { color: ["#8191fd"] }] }); - }, - goBack() { - this.$router.push("/achievement/list?per=1"); } } };