|
|
@@ -168,7 +168,7 @@ import {
|
|
|
setResultPercentList
|
|
|
} from "@/api/resultstatistics";
|
|
|
import PageSectionLoading from "@/components/PageBody/PageSectionLoading/index";
|
|
|
-// import { toExcel } from "@/util/exportExcel";
|
|
|
+import { toExcel } from "@/util/exportExcel";
|
|
|
|
|
|
const RESULT_SECTION = [
|
|
|
"0分",
|
|
|
@@ -218,25 +218,43 @@ export default {
|
|
|
methods: {
|
|
|
//导出学生作业成绩
|
|
|
exportStudentResult() {
|
|
|
- // const th = ['ID', '姓名', '文档作业成绩', '互评作业成绩', '代码作业成绩', '总评'];
|
|
|
- // const filterVal = ['id', 'user', 'documents', 'reviews', 'codes', 'finalRes'];
|
|
|
- // // const data = this.studentFinalResultList.map(v => filterVal.map(k => v[k]));
|
|
|
- // // console.log(data);
|
|
|
- // let data = [];
|
|
|
- // for(let item of this.studentFinalResultList){
|
|
|
- // let docResString = "";
|
|
|
- // let reviewResString = "";
|
|
|
- // for(let docRes of item.documents){
|
|
|
- // docResString += `${docRes.name}:${docRes.score};`
|
|
|
- // }
|
|
|
- // for(let reviewRes of item.reviews){
|
|
|
- // reviewResString += `${reviewRes.name}:${reviewRes.score}`;
|
|
|
- // }
|
|
|
- // for(let codes)
|
|
|
- // let outPutInfo = [item.id,item.user.nickname,docResString,];
|
|
|
- // }
|
|
|
- // // const [fileName, fileType, sheetName] = ['学生成绩', 'xlsx', '成绩'];
|
|
|
- // // toExcel({th, data, fileName, fileType, sheetName});
|
|
|
+ const th = [
|
|
|
+ "ID",
|
|
|
+ "姓名",
|
|
|
+ "文档作业成绩",
|
|
|
+ "互评作业成绩",
|
|
|
+ "代码作业成绩",
|
|
|
+ "总评"
|
|
|
+ ];
|
|
|
+ // const data = this.studentFinalResultList.map(v => filterVal.map(k => v[k]));
|
|
|
+ // console.log(data);
|
|
|
+ let data = [];
|
|
|
+ for (let item of this.studentFinalResultList) {
|
|
|
+ let docResString = "";
|
|
|
+ let reviewResString = "";
|
|
|
+ let codeResString = "";
|
|
|
+ for (let docRes of item.documents) {
|
|
|
+ docResString += `${docRes.name}:${docRes.score};`;
|
|
|
+ }
|
|
|
+ for (let reviewRes of item.reviews) {
|
|
|
+ reviewResString += `${reviewRes.name}:${reviewRes.score}`;
|
|
|
+ }
|
|
|
+ for (let codeRes of item.codes) {
|
|
|
+ codeResString += `${codeRes.name}:${codeRes.score}`;
|
|
|
+ }
|
|
|
+ let outPutInfo = [
|
|
|
+ item.id,
|
|
|
+ item.user.nickname,
|
|
|
+ docResString,
|
|
|
+ reviewResString,
|
|
|
+ codeResString,
|
|
|
+ item.finalRes
|
|
|
+ ];
|
|
|
+ data.push(outPutInfo);
|
|
|
+ }
|
|
|
+ console.log(data);
|
|
|
+ const [fileName, fileType, sheetName] = ["学生成绩", "xlsx", "成绩"];
|
|
|
+ toExcel({ th, data, fileName, fileType, sheetName });
|
|
|
},
|
|
|
//绘制成绩图表
|
|
|
drawResultChart() {
|