|
@@ -1,23 +1,17 @@
|
|
<template>
|
|
<template>
|
|
<div class="report-college">
|
|
<div class="report-college">
|
|
<report-box
|
|
<report-box
|
|
- v-for="(chartPage, cindex) in collegeCharts"
|
|
|
|
- :key="`chart-${cindex}`"
|
|
|
|
|
|
+ v-for="(page, pindex) in pages"
|
|
|
|
+ :key="pindex"
|
|
title="学院成绩分析"
|
|
title="学院成绩分析"
|
|
>
|
|
>
|
|
<div
|
|
<div
|
|
- v-for="(chart, index) in chartPage"
|
|
|
|
- :key="index"
|
|
|
|
|
|
+ v-for="(chart, index) in page.charts"
|
|
|
|
+ :key="`chart-${index}`"
|
|
class="college-chart"
|
|
class="college-chart"
|
|
>
|
|
>
|
|
<v-chart :option="chart" :init-options="initOption"></v-chart>
|
|
<v-chart :option="chart" :init-options="initOption"></v-chart>
|
|
</div>
|
|
</div>
|
|
- </report-box>
|
|
|
|
- <report-box
|
|
|
|
- v-for="(tgroup, tindex) in collegeTables"
|
|
|
|
- :key="`table-${tindex}`"
|
|
|
|
- title="学院成绩分析"
|
|
|
|
- >
|
|
|
|
<table class="table table-border">
|
|
<table class="table table-border">
|
|
<tr>
|
|
<tr>
|
|
<th>学院</th>
|
|
<th>学院</th>
|
|
@@ -29,7 +23,7 @@
|
|
<th>优秀数</th>
|
|
<th>优秀数</th>
|
|
<th>优秀率(%)</th>
|
|
<th>优秀率(%)</th>
|
|
</tr>
|
|
</tr>
|
|
- <tr v-for="(item, ind) in tgroup" :key="ind">
|
|
|
|
|
|
+ <tr v-for="(item, ind) in page.tables" :key="ind">
|
|
<td>{{ item.name }}</td>
|
|
<td>{{ item.name }}</td>
|
|
<td>{{ item.avgScore }}</td>
|
|
<td>{{ item.avgScore }}</td>
|
|
<td>{{ item.maxScore }}</td>
|
|
<td>{{ item.maxScore }}</td>
|
|
@@ -47,7 +41,7 @@
|
|
<script>
|
|
<script>
|
|
import { mapState } from "vuex";
|
|
import { mapState } from "vuex";
|
|
import ReportBox from "./ReportBox.vue";
|
|
import ReportBox from "./ReportBox.vue";
|
|
-import { sectionArr } from "./utils";
|
|
|
|
|
|
+import { sectionArr, getGroupNum, sectionArrFirstPage } from "./utils";
|
|
import { getBarsOptions, initOption } from "./chart";
|
|
import { getBarsOptions, initOption } from "./chart";
|
|
|
|
|
|
export default {
|
|
export default {
|
|
@@ -55,8 +49,7 @@ export default {
|
|
components: { ReportBox },
|
|
components: { ReportBox },
|
|
data() {
|
|
data() {
|
|
return {
|
|
return {
|
|
- collegeCharts: [],
|
|
|
|
- collegeTables: [],
|
|
|
|
|
|
+ pages: [],
|
|
initOption,
|
|
initOption,
|
|
};
|
|
};
|
|
},
|
|
},
|
|
@@ -74,11 +67,38 @@ export default {
|
|
name: item.college,
|
|
name: item.college,
|
|
};
|
|
};
|
|
});
|
|
});
|
|
- this.collegeCharts = sectionArr(
|
|
|
|
- sectionArr(college, 6).map((data) => getBarsOptions(data)),
|
|
|
|
- 4
|
|
|
|
|
|
+ const maxChartCountPerPage = 4;
|
|
|
|
+ const maxTableCountPerPage = 30;
|
|
|
|
+ const groupNum = getGroupNum(college.length, 6);
|
|
|
|
+ const collegeCharts = sectionArr(college, groupNum).map((data) =>
|
|
|
|
+ getBarsOptions(data)
|
|
);
|
|
);
|
|
- this.collegeTables = sectionArr(college, 30);
|
|
|
|
|
|
+ let pages = [];
|
|
|
|
+ let curPage = { charts: [], tables: [] };
|
|
|
|
+ collegeCharts.forEach((item) => {
|
|
|
|
+ curPage.charts.push(item);
|
|
|
|
+ if (curPage.charts.length === maxChartCountPerPage) {
|
|
|
|
+ pages.push(curPage);
|
|
|
|
+ curPage = { charts: [], tables: [] };
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+ const firstPageTableCount = Math.floor(
|
|
|
|
+ (maxChartCountPerPage - curPage.charts.length) *
|
|
|
|
+ (maxTableCountPerPage / maxChartCountPerPage)
|
|
|
|
+ );
|
|
|
|
+ console.log(firstPageTableCount);
|
|
|
|
+ const collegeTables = sectionArrFirstPage(
|
|
|
|
+ college,
|
|
|
|
+ maxTableCountPerPage,
|
|
|
|
+ firstPageTableCount
|
|
|
|
+ );
|
|
|
|
+ collegeTables.forEach((item) => {
|
|
|
|
+ curPage.tables = item;
|
|
|
|
+ pages.push(curPage);
|
|
|
|
+ curPage = { charts: [], tables: [] };
|
|
|
|
+ });
|
|
|
|
+ this.pages = pages;
|
|
|
|
+ console.log(pages);
|
|
},
|
|
},
|
|
},
|
|
},
|
|
};
|
|
};
|