|
|
@ -76,14 +76,14 @@ |
|
|
|
<div v-if="curTab == 0"> |
|
|
|
<div v-if="curTab == 0"> |
|
|
|
<el-button type="primary" @click="delAllData">批量删除</el-button> |
|
|
|
<el-button type="primary" @click="delAllData">批量删除</el-button> |
|
|
|
<el-button type="primary" @click="exportData">导出成绩列表</el-button> |
|
|
|
<el-button type="primary" @click="exportData">导出成绩列表</el-button> |
|
|
|
<el-button type="primary" @click="exportReport">导出成绩报告</el-button> |
|
|
|
<el-button type="primary" :loading="exporting" @click="exportReport">导出成绩报告</el-button> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
<div v-else> |
|
|
|
<div v-else> |
|
|
|
<el-button type="primary" @click="exportDataActivation">导出</el-button> |
|
|
|
<el-button type="primary" @click="exportDataActivation">导出</el-button> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
<template v-if="curTab == 0"> |
|
|
|
<template v-if="curTab == 0"> |
|
|
|
<el-table :data="listData" :key="1" class="table" ref="table" stripe header-align="center" |
|
|
|
<el-table :data="list" :key="1" class="table" ref="table" stripe header-align="center" |
|
|
|
@selection-change="handleSelectionChange" row-key="reportId"> |
|
|
|
@selection-change="handleSelectionChange" row-key="reportId"> |
|
|
|
<el-table-column type="selection" width="55" align="center" :reserve-selection="true"></el-table-column> |
|
|
|
<el-table-column type="selection" width="55" align="center" :reserve-selection="true"></el-table-column> |
|
|
|
<el-table-column type="index" width="60" label="序号" align="center"> |
|
|
|
<el-table-column type="index" width="60" label="序号" align="center"> |
|
|
@ -185,7 +185,7 @@ export default { |
|
|
|
keyword: "", |
|
|
|
keyword: "", |
|
|
|
searchTimer: null, |
|
|
|
searchTimer: null, |
|
|
|
listDataAll: [], |
|
|
|
listDataAll: [], |
|
|
|
listData: [], |
|
|
|
list: [], |
|
|
|
multipleSelection: [], |
|
|
|
multipleSelection: [], |
|
|
|
page: +this.$route.query.page || 1, |
|
|
|
page: +this.$route.query.page || 1, |
|
|
|
pageSize: 10, |
|
|
|
pageSize: 10, |
|
|
@ -212,7 +212,8 @@ export default { |
|
|
|
pageSizeActivation: 10, |
|
|
|
pageSizeActivation: 10, |
|
|
|
totalActivation: 0, |
|
|
|
totalActivation: 0, |
|
|
|
loading: false, |
|
|
|
loading: false, |
|
|
|
scores: {} |
|
|
|
scores: {}, |
|
|
|
|
|
|
|
exporting: false, |
|
|
|
}; |
|
|
|
}; |
|
|
|
}, |
|
|
|
}, |
|
|
|
components: { |
|
|
|
components: { |
|
|
@ -265,7 +266,7 @@ export default { |
|
|
|
await this.$post(`${this.api.getPracticeDetail}?pageNum=${this.page}&pageSize=${this.pageSize}&projectId=${this.id}&keyWord=${this.keyword}&classId=${this.classId}&mallId=${this.mallId}`) |
|
|
|
await this.$post(`${this.api.getPracticeDetail}?pageNum=${this.page}&pageSize=${this.pageSize}&projectId=${this.id}&keyWord=${this.keyword}&classId=${this.classId}&mallId=${this.mallId}`) |
|
|
|
// 返回格式有两种 |
|
|
|
// 返回格式有两种 |
|
|
|
const isArr = res.page instanceof Array |
|
|
|
const isArr = res.page instanceof Array |
|
|
|
this.listData = isArr ? res.page : res.page.records |
|
|
|
this.list = isArr ? res.page : res.page.records |
|
|
|
this.total = isArr ? res.total : res.page.total |
|
|
|
this.total = isArr ? res.total : res.page.total |
|
|
|
this.avgScore = (+res.avgScore).toFixed(2) |
|
|
|
this.avgScore = (+res.avgScore).toFixed(2) |
|
|
|
this.examCount = res.examCount |
|
|
|
this.examCount = res.examCount |
|
|
@ -331,45 +332,30 @@ export default { |
|
|
|
}, |
|
|
|
}, |
|
|
|
// 导出实验报告 |
|
|
|
// 导出实验报告 |
|
|
|
async exportReport () { |
|
|
|
async exportReport () { |
|
|
|
// 没选择数据,则导出全部 |
|
|
|
this.exporting = true |
|
|
|
|
|
|
|
// 选择了数据则导出选中的,否则不用给reportId,导出全部 |
|
|
|
let list = this.multipleSelection |
|
|
|
let list = this.multipleSelection |
|
|
|
if (!this.multipleSelection.length) { |
|
|
|
let reportIds = [] |
|
|
|
// 考核和练习调不同接口 |
|
|
|
if (list.length) { |
|
|
|
const res = this.permissions ? |
|
|
|
list.map(e => { |
|
|
|
await this.$post(`${this.api.getAssessmentDetail}?pageNum=1&pageSize=10000&assessmentId=${this.id}&classId=${this.classId}&keyword=${this.keyword}&mallId=${this.mallId}`) : |
|
|
|
e.reportId && reportIds.push(e.reportId) |
|
|
|
await this.$post(`${this.api.getPracticeDetail}?pageNum=1&pageSize=10000&projectId=${this.id}&keyWord=${this.keyword}&classId=${this.classId}&mallId=${this.mallId}`) |
|
|
|
}) |
|
|
|
list = res.page.records |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
const res = await axios.post(this.api.exportMultipleExperimentalReports, list.map(e => e.reportId), { |
|
|
|
const data = { |
|
|
|
|
|
|
|
mallId: this.mallId, |
|
|
|
|
|
|
|
reportIds |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
data[this.permissions ? 'assessmentId' : 'projectId'] = this.id |
|
|
|
|
|
|
|
const res = await axios.post(this.api.batchExportReportsAsZip, data, { |
|
|
|
headers: { |
|
|
|
headers: { |
|
|
|
token: this.token |
|
|
|
token: this.token |
|
|
|
}, |
|
|
|
}, |
|
|
|
responseType: 'blob' |
|
|
|
responseType: 'blob' |
|
|
|
}) |
|
|
|
}) |
|
|
|
const name = res.headers['content-disposition'] |
|
|
|
const name = res.headers['content-disposition'] |
|
|
|
util.downloadFileDirect(name ? decodeURI(name) : '成绩报告.xlsx', new Blob([res.data])) |
|
|
|
util.downloadFileDirect(name ? decodeURI(name) : '成绩报告.zip', new Blob([res.data])) |
|
|
|
this.exporting = false |
|
|
|
this.exporting = false |
|
|
|
return |
|
|
|
|
|
|
|
list.forEach(async e => { |
|
|
|
|
|
|
|
if (e.reportId) { |
|
|
|
|
|
|
|
try { |
|
|
|
|
|
|
|
const { report, userScores } = await this.$get(`${this.api.reportDetail}?reportId=${e.reportId}`) |
|
|
|
|
|
|
|
userScores.map((e, i) => { |
|
|
|
|
|
|
|
if (e.answer && typeof e.answer === 'string') e.answer = e.answer.replace(/<[^>]+>/g, '').replace(/( |&|%s)/g, '').replace(/>/g, '>').replace(/</g, '<') |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
for (const i in report) { |
|
|
|
|
|
|
|
if (report[i] && typeof report[i] === 'string') report[i] = report[i].replace(/<[^>]+>/g, '') |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
report.purpose = report.purpose.replace(/<[^>]+>/g, '') |
|
|
|
|
|
|
|
const res = await this.$post(this.api[userScores.find(e => e.lcRuleRecords) ? 'exportBankExperimentReport' : 'exportLabReport'], { |
|
|
|
|
|
|
|
...report, |
|
|
|
|
|
|
|
experimentalData: userScores |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
util.downloadFileDirect(`${e.userName}的实验报告.docx`, new Blob([res])) |
|
|
|
|
|
|
|
} catch (e) { } |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
}, |
|
|
|
}, |
|
|
|
handleDelete (row) { // 删除 |
|
|
|
handleDelete (row) { // 删除 |
|
|
|
this.$confirm("确定要删除吗?", "提示", { |
|
|
|
this.$confirm("确定要删除吗?", "提示", { |
|
|
|