|
@@ -73,6 +73,7 @@
|
|
|
<span class="serach_icon" @click="searchCourse"></span>
|
|
|
</div>
|
|
|
<div class="btnA" v-if="stype == 1 && !pdfLoading" @click="exportPDF">导出PDF</div>
|
|
|
+ <!-- <div class="btnA" v-if="stype == 2 || stype == 3">导出人员数据</div> -->
|
|
|
</div>
|
|
|
</div>
|
|
|
<div class="title_content" v-if="stype == 1">
|
|
@@ -167,7 +168,7 @@
|
|
|
</el-table-column>
|
|
|
<el-table-column prop="time" label="提交时间" width="170px" align="left">
|
|
|
</el-table-column>
|
|
|
- <el-table-column v-for="(item, index) in chapters" :key="index" :label="item.json.title" min-width="150"
|
|
|
+ <el-table-column v-for="(item, index) in chapters" :key="index" :label="item.json.title" :min-width="item.type == 5 ? 200 : 150"
|
|
|
align="left" :filters="item.type == 1 ? item.nameFilters : null"
|
|
|
:filter-method="item.type == 1 ? (value, row) => { return filterName(value, row, index) } : null"
|
|
|
:filter-placement="item.type == 1 ? filterPlacement : null">
|
|
@@ -198,9 +199,10 @@
|
|
|
</div>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
- <el-table-column label="操作" width="200px" fixed="right">
|
|
|
+ <el-table-column label="操作" width="300px" fixed="right">
|
|
|
<template slot-scope="scope">
|
|
|
<el-button @click="getTest(scope.row)" type="primary" size="small">查看</el-button>
|
|
|
+ <!-- <el-button @click="setWordHtml(scope.row)" type="primary" size="small">导出答题信息</el-button> -->
|
|
|
<el-button @click="deleteTest(scope.row.id)" type="primary" size="small">删除</el-button>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
@@ -215,7 +217,7 @@
|
|
|
</el-table-column>
|
|
|
<el-table-column prop="time" label="提交时间" min-width="15" align="center">
|
|
|
</el-table-column>
|
|
|
- <el-table-column prop="time" label="是否批改" min-width="15" align="center">
|
|
|
+ <el-table-column label="是否批改" min-width="15" align="center">
|
|
|
<template slot-scope="scope">
|
|
|
<div>{{ scope.row.type == 3 ? '是' : '否' }}</div>
|
|
|
</template>
|
|
@@ -258,6 +260,7 @@ import wordcloud from 'vue-wordcloud';
|
|
|
import checkPie from '../data/checkPie.vue';
|
|
|
|
|
|
import { downloadPDF } from '../../../tools/pdf'
|
|
|
+
|
|
|
export default {
|
|
|
components: {
|
|
|
shareBox,
|
|
@@ -476,7 +479,8 @@ export default {
|
|
|
userid: this.works[i].userid,
|
|
|
name: this.works[i].username,
|
|
|
time: this.works[i].time,
|
|
|
- array: _json
|
|
|
+ array: _json,
|
|
|
+ courseJson: JSON.parse(this.works[i].courseJson),
|
|
|
})
|
|
|
}
|
|
|
}
|
|
@@ -778,6 +782,95 @@ export default {
|
|
|
|
|
|
}, 2000);
|
|
|
})
|
|
|
+ },
|
|
|
+ score(json) {
|
|
|
+ let score = 0
|
|
|
+ json.forEach(el => {
|
|
|
+ if ((el.ttype == 3 || el.ttype == 2) && el.array.length > 0) {
|
|
|
+ el.array.forEach(item => {
|
|
|
+ if (item.ttype == 2 && item.array.length > 0) {
|
|
|
+ item.array.forEach(item2 => {
|
|
|
+ if (item2.ttype == 1 && item2.json) {
|
|
|
+ score += item2.json.score ? parseFloat(item2.json.score) : 0
|
|
|
+ }
|
|
|
+ })
|
|
|
+ } else if (item.ttype == 1 && item.json) {
|
|
|
+ score += item.json.score ? parseFloat(item.json.score) : 0
|
|
|
+ }
|
|
|
+ })
|
|
|
+ } else if (el.ttype == 1 && el.json) {
|
|
|
+ score += el.json.score ? parseFloat(el.json.score) : 0
|
|
|
+ }
|
|
|
+ })
|
|
|
+ return score > 0 ? score + '分' : ''
|
|
|
+ },
|
|
|
+ score2(json) {
|
|
|
+ let score = 0
|
|
|
+ // let type = 1
|
|
|
+ json.forEach(el => {
|
|
|
+ if ((el.ttype == 3 || el.ttype == 2) && el.array.length > 0) {
|
|
|
+ el.array.forEach(item => {
|
|
|
+ if (item.ttype == 2 && item.array.length > 0) {
|
|
|
+ item.array.forEach(item2 => {
|
|
|
+ if (item2.ttype == 1 && item2.json) {
|
|
|
+ score += item2.json.score2 ? parseFloat(item2.json.score2) : 0
|
|
|
+ }
|
|
|
+ })
|
|
|
+ } else if (item.ttype == 1 && item.json) {
|
|
|
+ score += item.json.score2 ? parseFloat(item.json.score2) : 0
|
|
|
+ }
|
|
|
+ })
|
|
|
+ } else if (el.ttype == 1 && el.json) {
|
|
|
+ score += el.json.score2 ? parseFloat(el.json.score2) : 0
|
|
|
+ }
|
|
|
+ })
|
|
|
+ return score + '分'
|
|
|
+ },
|
|
|
+ setWordHtml(data) {
|
|
|
+ let _data = data
|
|
|
+
|
|
|
+ let _title = `<div style="font-size:40px;font-weight:bold;text-align:center;">${this.testJson.title}</div>`;
|
|
|
+ let score = this.score(data.courseJson)
|
|
|
+ let isScore = this.score2(data.courseJson)
|
|
|
+ let scoreContent = score ? `<b>(得分/总分)${isScore}/${score}</b>` : ''
|
|
|
+ let _content = `<div style="font-size:25px;text-align:center;margin-top: 20px;"><b style="margin-right:40px">(答题人)${_data.name}</b>${scoreContent}(填写范围)${this.testJson.juriP ? this.testJson.juriP : '所有人'}(提交时间)${_data.time}</div>`
|
|
|
+ let _detail = this.testJson.brief ? `<div style="font-size:25px;text-align:center;margin-top: 20px;">${this.testJson.brief}</div>` : ''
|
|
|
+
|
|
|
+ let _html = _title + _content + _detail;
|
|
|
+ this.exportToWord(_data.name, _html);
|
|
|
+ },
|
|
|
+ async exportToWord(a, html) {
|
|
|
+ // 将html文件中需要用到的数据挂载到store上
|
|
|
+ const content = `<!DOCTYPE html>
|
|
|
+ <html lang="en">
|
|
|
+ <head>
|
|
|
+ <meta charset="UTF-8">
|
|
|
+ <meta http-equiv="X-UA-Compatible" content="IE=edge">
|
|
|
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
|
+ <title>${a}</title>
|
|
|
+ <style>
|
|
|
+ </style>
|
|
|
+ </head>
|
|
|
+ <body>
|
|
|
+ ${html}
|
|
|
+ </body>
|
|
|
+ </html>`;
|
|
|
+ // debugger
|
|
|
+ // 生成报告
|
|
|
+ const link = document.createElement("a");
|
|
|
+ let dname = a + ".doc";
|
|
|
+ // link.download = "报告.html"; // 文件名
|
|
|
+ link.download = dname; // 文件名
|
|
|
+ link.style.display = "none";
|
|
|
+ // 创建文件流
|
|
|
+ // 创建bolb实例时,内容一定要放在[]中
|
|
|
+ const blob = new Blob([content], {
|
|
|
+ type: "text/plain;charset='utf-8'",
|
|
|
+ });
|
|
|
+ link.href = window.URL.createObjectURL(blob);
|
|
|
+ document.body.appendChild(link);
|
|
|
+ link.click();
|
|
|
+ document.body.removeChild(link);
|
|
|
}
|
|
|
},
|
|
|
beforeDestroy() {
|