|
@@ -6,16 +6,16 @@
|
|
|
<div class="stepsNav">
|
|
|
<el-breadcrumb separator-class="el-icon-arrow-right">
|
|
|
<el-breadcrumb-item :to="{
|
|
|
- path:
|
|
|
- '/test?userid=' +
|
|
|
- userid +
|
|
|
- '&oid=' +
|
|
|
- oid +
|
|
|
- '&org=' +
|
|
|
- org +
|
|
|
- '&role=' +
|
|
|
- role,
|
|
|
- }">表单管理</el-breadcrumb-item>
|
|
|
+ path:
|
|
|
+ '/test?userid=' +
|
|
|
+ userid +
|
|
|
+ '&oid=' +
|
|
|
+ oid +
|
|
|
+ '&org=' +
|
|
|
+ org +
|
|
|
+ '&role=' +
|
|
|
+ role,
|
|
|
+ }">表单管理</el-breadcrumb-item>
|
|
|
<el-breadcrumb-item>
|
|
|
<span style="color: rgb(15, 126, 255)">查看表单</span>
|
|
|
</el-breadcrumb-item>
|
|
@@ -161,11 +161,17 @@
|
|
|
</div>
|
|
|
</div>
|
|
|
</div>
|
|
|
+ <div class="content4" v-if="item.type == 6">
|
|
|
+ <div class="courses" v-for="(courses, index2) in item.array" :key="index + '-' + index2">
|
|
|
+ {{ courses }}
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
</div>
|
|
|
</div>
|
|
|
<div class="table_content" v-if="stype == 2">
|
|
|
- <el-table class="el-table" ref="table" :data="worksArray" border :fit="true" :key="2"
|
|
|
- v-loading="isLoading" style="width: 100%" :header-cell-style="{ background: '#f1f1f1', fontSize: '17px' }" @filter-change="handleFilterChange">
|
|
|
+ <el-table class="el-table" ref="table" :data="worksArray" border :fit="true" :key="2" v-loading="isLoading"
|
|
|
+ style="width: 100%" :header-cell-style="{ background: '#f1f1f1', fontSize: '17px' }"
|
|
|
+ @filter-change="handleFilterChange">
|
|
|
<el-table-column fixed label="序号" width="80px" align="left">
|
|
|
<template slot-scope="scope">
|
|
|
{{ scope.$index + 1 }}
|
|
@@ -179,6 +185,7 @@
|
|
|
: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">
|
|
|
+
|
|
|
<template slot-scope="scope">
|
|
|
<div v-if="scope.row.array[index].type == 1" style="display: flex; flex-wrap: wrap;">
|
|
|
<span class="answer_type" v-for="(answer2, index2) in scope.row.array[index].json.answer2"
|
|
@@ -187,7 +194,8 @@
|
|
|
<div v-if="scope.row.array[index].type == 3" style="display: flex; flex-wrap: wrap;">
|
|
|
{{ scope.row.array[index].json.answer2 }}
|
|
|
</div>
|
|
|
- <div v-if="scope.row.array[index].type == 5" style="display: flex; flex-wrap: wrap;" class="table_file">
|
|
|
+ <div v-if="scope.row.array[index].type == 5" style="display: flex; flex-wrap: wrap;"
|
|
|
+ class="table_file">
|
|
|
<div class="file" v-for="(file, index2) in scope.row.array[index].json.file"
|
|
|
:key="index + '-' + index2" @click.stop="checkFile(file)">
|
|
|
<img class="download" src="../../../../assets/icon/fileIcon/download.png"
|
|
@@ -204,9 +212,16 @@
|
|
|
</div>
|
|
|
</div>
|
|
|
</div>
|
|
|
+ <div v-if="scope.row.array[index].type == 6" style="display: flex; flex-wrap: wrap;">
|
|
|
+ {{ scope.row.array[index].json.answer2 }}
|
|
|
+ </div>
|
|
|
+ <div v-if="scope.row.array[index].type == 7" style="display: flex; flex-wrap: wrap;">
|
|
|
+ {{ getScore(scope.row.array[index].json) }}
|
|
|
+ </div>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
<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>
|
|
@@ -217,19 +232,20 @@
|
|
|
</div>
|
|
|
<div class="table_content" v-if="stype == 3">
|
|
|
<div class="student_table">
|
|
|
- <el-table ref="table" :data="tableData" border :fit="true" v-loading="isLoading"
|
|
|
- style="width: 100%" :header-cell-style="{ background: '#f1f1f1', fontSize: '17px' }"
|
|
|
- :row-class-name="tableRowClassName">
|
|
|
+ <el-table ref="table" :data="tableData" border :fit="true" v-loading="isLoading" style="width: 100%"
|
|
|
+ :header-cell-style="{ background: '#f1f1f1', fontSize: '17px' }" :row-class-name="tableRowClassName">
|
|
|
<el-table-column prop="username" label="提交人" min-width="15" align="center">
|
|
|
</el-table-column>
|
|
|
<el-table-column prop="time" label="提交时间" min-width="15" align="center">
|
|
|
</el-table-column>
|
|
|
<el-table-column label="是否批改" min-width="15" align="center">
|
|
|
+
|
|
|
<template slot-scope="scope">
|
|
|
<div>{{ scope.row.type == 3 ? '是' : '否' }}</div>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
<el-table-column label="操作" width="300px">
|
|
|
+
|
|
|
<template slot-scope="scope">
|
|
|
<el-button @click="getTest(scope.row)" type="primary" size="small">查看</el-button>
|
|
|
<el-button @click="setWordHtml2(scope.row)" type="primary" size="small">导出答题信息</el-button>
|
|
@@ -350,6 +366,15 @@ export default {
|
|
|
// return array.length ? _array : [];
|
|
|
// };
|
|
|
// },
|
|
|
+ getScore() {
|
|
|
+ return function (item) {
|
|
|
+ let array = []
|
|
|
+ for (var i = parseInt(item.small); i <= parseInt(item.big); i++) {
|
|
|
+ array.push(i)
|
|
|
+ }
|
|
|
+ return item.answer2 ? array[item.answer2] : ''
|
|
|
+ };
|
|
|
+ },
|
|
|
selectType() {
|
|
|
return function (item) {
|
|
|
if (item.type == 1 && item.atype == 2) {
|
|
@@ -464,6 +489,7 @@ export default {
|
|
|
this.getData()
|
|
|
}
|
|
|
},
|
|
|
+
|
|
|
getData() {
|
|
|
this.isLoading = true;
|
|
|
let params = {
|
|
@@ -472,7 +498,7 @@ export default {
|
|
|
};
|
|
|
this.ajax
|
|
|
.get(this.$store.state.api + "getTestWorksNoPage", params)
|
|
|
- .then((res) => {
|
|
|
+ .then(async (res) => {
|
|
|
this.isLoading = false;
|
|
|
this.testJson = res.data[0][0]
|
|
|
this.works = res.data[1]
|
|
@@ -487,6 +513,13 @@ export default {
|
|
|
let cJson = this.setJSON(JSON.parse(JSON.stringify(JSON.parse(this.works[i].courseJson))))
|
|
|
if (JSON.stringify(cJson) == JSON.stringify(chapters)) {
|
|
|
let _json = this.JSONSetting(JSON.parse(JSON.stringify(JSON.parse(this.works[i].courseJson))))
|
|
|
+
|
|
|
+ for(var ja = 0; ja < _json.length; ja++){
|
|
|
+ let _json2 = _json[ja].json
|
|
|
+ if(_json[ja].type == 6){
|
|
|
+ _json2.answer2 = await this.getCourse(_json2.answer2)
|
|
|
+ }
|
|
|
+ }
|
|
|
array.push({
|
|
|
courseid: this.works[i].courseid,
|
|
|
id: this.works[i].id,
|
|
@@ -554,6 +587,9 @@ export default {
|
|
|
for (var k = 0; k < _answer.length; k++) {
|
|
|
topic.array.push(_answer[k])
|
|
|
}
|
|
|
+ } else if (topic.type == 6) {
|
|
|
+ let _answer = el2.array[i].json.courses ? el2.array[i].json.courses : []
|
|
|
+ topic.array = _answer
|
|
|
}
|
|
|
}
|
|
|
testArray.push(topic)
|
|
@@ -1086,7 +1122,7 @@ export default {
|
|
|
.catch((err) => {
|
|
|
console.error(err);
|
|
|
});
|
|
|
-
|
|
|
+
|
|
|
},
|
|
|
downLoadAll(url) {
|
|
|
const data = url; // 需要下载打包的路径, 可以是本地相对路径, 也可以是跨域的全路径
|
|
@@ -1095,23 +1131,23 @@ export default {
|
|
|
data.forEach((item) => {
|
|
|
// 下载文件, 并存成ArrayBuffer对象
|
|
|
const file_name = item.name; // 获取文件名
|
|
|
- zip.file(file_name+'.doc', item.blob, { binary: true }); // 逐个添加文件
|
|
|
+ zip.file(file_name + '.doc', item.blob, { binary: true }); // 逐个添加文件
|
|
|
cache[file_name] = item.blob;
|
|
|
});
|
|
|
zip.generateAsync({ type: "blob" }).then((content) => {
|
|
|
// 生成二进制流
|
|
|
- FileSaver.saveAs(content, this.testJson.title+".zip"); // 利用file-saver保存文件 自定义文件名
|
|
|
+ FileSaver.saveAs(content, this.testJson.title + ".zip"); // 利用file-saver保存文件 自定义文件名
|
|
|
setTimeout(() => {
|
|
|
this.pdfLoading = false;
|
|
|
}, 2000);
|
|
|
});
|
|
|
},
|
|
|
- handleFilterChange(){
|
|
|
- console.log( this.$refs.table.store.states.data);
|
|
|
+ handleFilterChange() {
|
|
|
+ console.log(this.$refs.table.store.states.data);
|
|
|
},
|
|
|
- exportExcel(){
|
|
|
- let res = this.$refs.table.store.states.data
|
|
|
- if(!res.length){
|
|
|
+ exportExcel() {
|
|
|
+ let res = this.$refs.table.store.states.data
|
|
|
+ if (!res.length) {
|
|
|
this.$message.error('无导出数据')
|
|
|
return
|
|
|
}
|
|
@@ -1121,47 +1157,49 @@ export default {
|
|
|
var array = [];
|
|
|
for (var i = 0; i < res.length; i++) {
|
|
|
var _json = {};
|
|
|
- _json["序号"] = i+1;
|
|
|
+ _json["序号"] = i + 1;
|
|
|
_json["提交人"] = res[i].name;
|
|
|
_json["提交时间"] = res[i].time;
|
|
|
- for(var j = 0; j < chapters.length; j++){
|
|
|
- _json[j+1+"."+chapters[j].json.title] = '';
|
|
|
- if(res[i].array[j].type == 1 && res[i].array[j].json.answer2){
|
|
|
+ for (var j = 0; j < chapters.length; j++) {
|
|
|
+ _json[j + 1 + "." + chapters[j].json.title] = '';
|
|
|
+ if (res[i].array[j].type == 1 && res[i].array[j].json.answer2) {
|
|
|
let a = []
|
|
|
- for(var answer2 = 0;answer2 < res[i].array[j].json.answer2.length; answer2++){
|
|
|
+ for (var answer2 = 0; answer2 < res[i].array[j].json.answer2.length; answer2++) {
|
|
|
a.push(res[i].array[j].json.array[answer2].option)
|
|
|
}
|
|
|
- _json[j+1+"."+chapters[j].json.title] = a.join('、')
|
|
|
- }else if(res[i].array[j].type == 3 && res[i].array[j].json.answer2){
|
|
|
- _json[j+1+"."+chapters[j].json.title] = res[i].array[j].json.answer2
|
|
|
- }else if(res[i].array[j].type == 5 && res[i].array[j].json.file){
|
|
|
+ _json[j + 1 + "." + chapters[j].json.title] = a.join('、')
|
|
|
+ } else if (res[i].array[j].type == 3 && res[i].array[j].json.answer2) {
|
|
|
+ _json[j + 1 + "." + chapters[j].json.title] = res[i].array[j].json.answer2
|
|
|
+ } else if (res[i].array[j].type == 5 && res[i].array[j].json.file) {
|
|
|
let files = []
|
|
|
for (let file = 0; file < res[i].array[j].json.file.length; file++) {
|
|
|
let check = res[i].array[j].json.file[file]
|
|
|
- files.push(file+1+'.'+check.name+'----'+check.url)
|
|
|
+ files.push(file + 1 + '.' + check.name + '----' + check.url)
|
|
|
}
|
|
|
- _json[j+1+"."+chapters[j].json.title] = files.join('\n')
|
|
|
+ _json[j + 1 + "." + chapters[j].json.title] = files.join('\n')
|
|
|
}
|
|
|
}
|
|
|
array.push(_json);
|
|
|
}
|
|
|
let widthJson = []
|
|
|
let widthArray = Object.keys(array[0])
|
|
|
- for(let i = 0; i < widthArray.length; i++){
|
|
|
- if(i == 0){
|
|
|
- widthJson.push({wch: 5})
|
|
|
- }else{
|
|
|
- widthJson.push({wch: 30})
|
|
|
+ for (let i = 0; i < widthArray.length; i++) {
|
|
|
+ if (i == 0) {
|
|
|
+ widthJson.push({ wch: 5 })
|
|
|
+ } else {
|
|
|
+ widthJson.push({ wch: 30 })
|
|
|
}
|
|
|
}
|
|
|
|
|
|
const workbook = XLSX.utils.book_new(); //创建一个新的工作簿对象
|
|
|
let ws = XLSX.utils.json_to_sheet(array); //将json对象数组转化成工作表
|
|
|
ws["!cols"] = widthJson;
|
|
|
- const styleObj = { alignment: {
|
|
|
- horizontal: "center",
|
|
|
- vertical: "center" // 设置垂直居中
|
|
|
- } }; // 设置居中对齐和加粗样式
|
|
|
+ const styleObj = {
|
|
|
+ alignment: {
|
|
|
+ horizontal: "center",
|
|
|
+ vertical: "center" // 设置垂直居中
|
|
|
+ }
|
|
|
+ }; // 设置居中对齐和加粗样式
|
|
|
|
|
|
for (let cell in ws) {
|
|
|
if (!cell[0].startsWith("!")) {
|
|
@@ -1171,13 +1209,20 @@ export default {
|
|
|
|
|
|
XLSX.utils.book_append_sheet(workbook, ws, "sheet1"); //把sheet添加到workbook里,第三个参数是sheet名
|
|
|
|
|
|
- XLSX.writeFile(workbook, this.testJson.title+".xlsx");
|
|
|
+ XLSX.writeFile(workbook, this.testJson.title + ".xlsx");
|
|
|
this.isLoading = false;
|
|
|
this.$message({
|
|
|
message: "导出成功",
|
|
|
type: "success"
|
|
|
});
|
|
|
},
|
|
|
+ async getCourse(id) {
|
|
|
+ let params = {
|
|
|
+ cid: id,
|
|
|
+ };
|
|
|
+ let res = await this.ajax.get(this.$store.state.api + "getCourseInfoTest", params)
|
|
|
+ return res.data[0][0].title
|
|
|
+ }
|
|
|
},
|
|
|
beforeDestroy() {
|
|
|
document.getElementsByTagName('html')[0].style.overflow = ''
|