|
@@ -154,7 +154,7 @@ export default {
|
|
|
toExcel() {
|
|
|
const { export_json_to_excel } = require('@frame/excel/Export2Excel');
|
|
|
let duplicate = _.cloneDeep(this.cdata);
|
|
|
- const data = [];
|
|
|
+ let data = [];
|
|
|
for (const dup of duplicate) {
|
|
|
const elm = { studentname: dup.studentname };
|
|
|
for (const answer of dup.answers) {
|
|
@@ -162,7 +162,14 @@ export default {
|
|
|
}
|
|
|
data.push(elm);
|
|
|
}
|
|
|
- console.log(data);
|
|
|
+ let dquest = _.cloneDeep(this.quest.question);
|
|
|
+ let qarr = dquest.map(i => ({ questionid: i._id, topic: i.topic }));
|
|
|
+ let tHeader = qarr.map(i => i.topic);
|
|
|
+ tHeader.unshift('学生姓名');
|
|
|
+ let filterVal = qarr.map(i => i.questionid);
|
|
|
+ filterVal.unshift('studentname');
|
|
|
+ data = data.map(v => filterVal.map(j => v[j]));
|
|
|
+ export_json_to_excel(tHeader, data, 'test');
|
|
|
},
|
|
|
},
|
|
|
computed: {
|