From 2fec0e532ba87715f8beff38723a4f47b06eee25 Mon Sep 17 00:00:00 2001
From: yujialong <479214531@qq.com>
Date: Mon, 22 Jul 2024 15:00:19 +0800
Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0ai=E5=8F=8A=E4=BD=8E=E4=BB=A3?=
=?UTF-8?q?=E7=A0=81=E5=B9=B3=E5=8F=B0=E8=B7=B3=E8=BD=AC?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
public/index.html | 2 +-
src/api/index.js | 1 +
src/pages/achievement/info/project.vue | 54 ++++++++++----------------
src/pages/station/preview/index.vue | 5 ++-
4 files changed, 26 insertions(+), 36 deletions(-)
diff --git a/public/index.html b/public/index.html
index 7b9845e..2a0608a 100644
--- a/public/index.html
+++ b/public/index.html
@@ -10,7 +10,7 @@
var _hmt = _hmt || [];
(function() {
var hm = document.createElement('script');
- hm.src = 'https://hm.baidu.com/hm.js?72fbad6ebf1d6c705117fe8fe0686a0e';
+ hm.src = 'https://hm.baidu.com/hm.js?e4d7deeca2d6ea71d2bd5fa2365bc654';
var s = document.getElementsByTagName('script')[0];
s.parentNode.insertBefore(hm, s);
})();
diff --git a/src/api/index.js b/src/api/index.js
index 024a71f..dcd84f1 100644
--- a/src/api/index.js
+++ b/src/api/index.js
@@ -127,6 +127,7 @@ export default {
exportProductPracticeResults: `${host}occupationlab/occupationlab/achievement/exportProductPracticeResults`,
exportProductAssessResults: `${host}occupationlab/occupationlab/achievement/exportProductAssessResults`,
exportMultipleExperimentalReports: `${host}occupationlab/occupationlab/achievement/exportMultipleExperimentalReports`,
+ batchExportReportsAsZip: `${host}occupationlab/occupationlab/achievement/batchExportReportsAsZip`,
// 项目管理
getSystemIdBySchool: `occupationlab/occupationlab/projectManage/getSystemIdBySchool`, // 获取学校下拥有的系统
diff --git a/src/pages/achievement/info/project.vue b/src/pages/achievement/info/project.vue
index bd9472e..b4e9a9d 100644
--- a/src/pages/achievement/info/project.vue
+++ b/src/pages/achievement/info/project.vue
@@ -76,14 +76,14 @@
批量删除
导出成绩列表
- 导出成绩报告
+ 导出成绩报告
导出
-
@@ -185,7 +185,7 @@ export default {
keyword: "",
searchTimer: null,
listDataAll: [],
- listData: [],
+ list: [],
multipleSelection: [],
page: +this.$route.query.page || 1,
pageSize: 10,
@@ -212,7 +212,8 @@ export default {
pageSizeActivation: 10,
totalActivation: 0,
loading: false,
- scores: {}
+ scores: {},
+ exporting: false,
};
},
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}`)
// 返回格式有两种
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.avgScore = (+res.avgScore).toFixed(2)
this.examCount = res.examCount
@@ -331,45 +332,30 @@ export default {
},
// 导出实验报告
async exportReport () {
- // 没选择数据,则导出全部
+ this.exporting = true
+ // 选择了数据则导出选中的,否则不用给reportId,导出全部
let list = this.multipleSelection
- if (!this.multipleSelection.length) {
- // 考核和练习调不同接口
- const res = this.permissions ?
- await this.$post(`${this.api.getAssessmentDetail}?pageNum=1&pageSize=10000&assessmentId=${this.id}&classId=${this.classId}&keyword=${this.keyword}&mallId=${this.mallId}`) :
- 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
+ let reportIds = []
+ if (list.length) {
+ list.map(e => {
+ e.reportId && reportIds.push(e.reportId)
+ })
}
- 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: {
token: this.token
},
responseType: 'blob'
})
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
- 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, '')
- }
- 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) { // 删除
this.$confirm("确定要删除吗?", "提示", {
diff --git a/src/pages/station/preview/index.vue b/src/pages/station/preview/index.vue
index 3e7595b..bc56186 100644
--- a/src/pages/station/preview/index.vue
+++ b/src/pages/station/preview/index.vue
@@ -396,7 +396,8 @@ export default {
deleteIdentity: false,
archProject: '',
curReplyId: '',
- maximumScores: []
+ maximumScores: [],
+ third: '',
};
},
computed: {
@@ -850,6 +851,7 @@ export default {
projectId ? util.cookies.set('projectId', projectId) : util.cookies.set('projectId', '', -1)
util.cookies.set('token', token)
util.cookies.set('mallId', this.mallId)
+ util.cookies.set('third', this.third)
util.cookies.set('courseId', this.courseId)
util.cookies.set('curriculumName', encodeURIComponent(this.curriculumName))
util.cookies.set('systemId', id)
@@ -876,6 +878,7 @@ export default {
const { systemId } = curProject
let token = util.local.get(Setting.tokenKey);
+ this.third = curProject.type === 2 ? (curProject.systemId === 28 ? 'low' : 'ai') : ''
if (systemId == 11) {
// 银行系统
sessionStorage.removeItem('projectId')