Merge branch 'bjxz-cjw' into bjxz-dev
This commit is contained in:
commit
e2e3ca95d4
@ -2,6 +2,7 @@
|
||||
* 考试系统api接口统一管理
|
||||
*/
|
||||
import { post, get } from '../../http'
|
||||
import axios from 'axios'
|
||||
|
||||
//杂项Api
|
||||
export const getWorkerInfoListApi = data => post('xmgl/workerInfo/selectWorkerInfoList', data); // 查询临时人员
|
||||
@ -72,6 +73,10 @@ export const importQuestionBankApi = data => post('exam/questionBank/importExcel
|
||||
export const detailIdQuestionBankApi = data => post('exam/questionBank/queryById', data) //查询题目详情
|
||||
export const moveQuestionBankApi = data => post('exam/questionBank/move', data) //移动科目类别
|
||||
export const getRandomQuestionApi = data => post('exam/questionBank/random', data) //随机获取题目
|
||||
// 题库模板下载
|
||||
export function downloadTheTemplate(projectSn) {
|
||||
window.location.href = axios.defaults.baseURL + `xmgl/download/exporExcelExamQuestionTemplate?projectSn=${projectSn}`;
|
||||
}
|
||||
|
||||
|
||||
// 考试管理
|
||||
|
||||
@ -61,10 +61,10 @@
|
||||
v-permission="{key: 'questionManagement_add', menuPath: '/project/examSystem2/questionManagement'}">
|
||||
添加试题
|
||||
</el-button>
|
||||
<!-- <el-button type="primary" plain size="medium" @click="downloadFn"
|
||||
<el-button type="primary" plain size="medium" @click="downloadFn"
|
||||
v-permission="{key: 'questionManagement_download', menuPath: '/project/examSystem2/questionManagement'}">
|
||||
下载题库导入模板
|
||||
</el-button> -->
|
||||
</el-button>
|
||||
<el-button type="primary" plain size="medium" @click="exportFn"
|
||||
v-permission="{key: 'questionManagement_export', menuPath: '/project/examSystem2/questionManagement'}">
|
||||
导出题库
|
||||
@ -116,7 +116,8 @@
|
||||
</el-table-column>
|
||||
<el-table-column prop="options" width="100px" label="试题答案">
|
||||
<template slot-scope="scope">
|
||||
{{sortedOptions(scope.row.options)}}
|
||||
<!-- {{sortedOptions(scope.row.options)}} -->
|
||||
{{scope.row.options}}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="createTime" width="180px" label="创建时间"></el-table-column>
|
||||
@ -503,6 +504,7 @@ import {
|
||||
detailIdQuestionBankApi,
|
||||
moveQuestionBankApi,
|
||||
importQuestionBankApi,
|
||||
downloadTheTemplate,
|
||||
} from '@/assets/js/api/examSystem/examSystem'
|
||||
export default {
|
||||
name: "questionManagement",
|
||||
@ -636,10 +638,11 @@ export default {
|
||||
this.$refs.upload.clearFiles()
|
||||
this.fullscreenLoading = false
|
||||
if (res.code == 200 || res.code == 0) {
|
||||
this.$message.success('题库导入成功')
|
||||
this.$message.success(res.message)
|
||||
this.getList()
|
||||
} else {
|
||||
this.$message.error('题库导入失败')
|
||||
//导入失败提示
|
||||
this.$message.error(res.message)
|
||||
}
|
||||
},
|
||||
beforeAvatarUpload() {
|
||||
@ -651,10 +654,18 @@ export default {
|
||||
exportFn() {
|
||||
// fetch(this.$http.defaults.baseURL + 'exam/questionBank/exportXls?&projectSn=' + this.projectSn + '&endReceiveTime=' + this.time[1] + '&startReceiveTime=' + this.time[0] + '&devName=' + this.devName, {
|
||||
// + '&endReceiveTime=' + this.time[1] + '&startReceiveTime=' + this.time[0] + '&devName=' + this.devName, {
|
||||
fetch(this.$http.defaults.baseURL + 'exam/questionBank/exportXls?&projectSn=' + this.projectSn + "&subjectId=" + this.subjectId,{
|
||||
// fetch(this.$http.defaults.baseURL + 'exam/questionBank/exportXls?&projectSn=' + this.projectSn + "&subjectId=" + this.subjectId,{
|
||||
let data = {
|
||||
projectSn:this.projectSn,
|
||||
subjectId:this.subjectId
|
||||
}
|
||||
fetch(this.$http.defaults.baseURL + 'exam/questionBank/exportXls',{
|
||||
method: "POST",
|
||||
headers: {
|
||||
'Authorization': this.$store.state.userInfo.token
|
||||
}
|
||||
'Authorization': this.$store.state.userInfo.token,
|
||||
'Content-Type': 'application/json' // 指定请求体为 JSON 格式
|
||||
},
|
||||
body: JSON.stringify(data)
|
||||
})
|
||||
.then(response => {
|
||||
// 处理响应
|
||||
@ -679,6 +690,7 @@ export default {
|
||||
window.URL.revokeObjectURL(url);
|
||||
// 处理导出的文件
|
||||
// 这里可以使用blob对象来获取导出的文件内容或者将其保存到本地
|
||||
|
||||
})
|
||||
.catch(error => {
|
||||
// 处理错误
|
||||
@ -687,39 +699,40 @@ export default {
|
||||
},
|
||||
// 下载模板
|
||||
downloadFn() {
|
||||
fetch(this.$http.defaults.baseURL + 'exam/questionBank/exportXls?&projectSn=' + this.projectSn, {
|
||||
headers: {
|
||||
'Authorization': this.$store.state.userInfo.token
|
||||
}
|
||||
})
|
||||
.then(response => {
|
||||
// 处理响应
|
||||
if (!response.ok) {
|
||||
throw new Error('导出失败');
|
||||
}
|
||||
return response.blob();
|
||||
})
|
||||
.then(blob => {
|
||||
console.log('导出成功');
|
||||
// 创建一个下载链接
|
||||
const url = window.URL.createObjectURL(blob);
|
||||
// 创建一个<a>元素
|
||||
const link = document.createElement('a');
|
||||
link.href = url;
|
||||
link.download = '题库导入模板.xlsx'; // 指定下载文件的文件名
|
||||
// 模拟点击下载链接
|
||||
document.body.appendChild(link);
|
||||
link.click();
|
||||
document.body.removeChild(link);
|
||||
// 释放URL对象
|
||||
window.URL.revokeObjectURL(url);
|
||||
// 处理导出的文件
|
||||
// 这里可以使用blob对象来获取导出的文件内容或者将其保存到本地
|
||||
})
|
||||
.catch(error => {
|
||||
// 处理错误
|
||||
console.error(error);
|
||||
});
|
||||
downloadTheTemplate(this.projectSn)
|
||||
// fetch(this.$http.defaults.baseURL + 'exam/questionBank/exportXls?&projectSn=' + this.projectSn, {
|
||||
// headers: {
|
||||
// 'Authorization': this.$store.state.userInfo.token
|
||||
// }
|
||||
// })
|
||||
// .then(response => {
|
||||
// // 处理响应
|
||||
// if (!response.ok) {
|
||||
// throw new Error('导出失败');
|
||||
// }
|
||||
// return response.blob();
|
||||
// })
|
||||
// .then(blob => {
|
||||
// console.log('导出成功');
|
||||
// // 创建一个下载链接
|
||||
// const url = window.URL.createObjectURL(blob);
|
||||
// // 创建一个<a>元素
|
||||
// const link = document.createElement('a');
|
||||
// link.href = url;
|
||||
// link.download = '题库导入模板.xlsx'; // 指定下载文件的文件名
|
||||
// // 模拟点击下载链接
|
||||
// document.body.appendChild(link);
|
||||
// link.click();
|
||||
// document.body.removeChild(link);
|
||||
// // 释放URL对象
|
||||
// window.URL.revokeObjectURL(url);
|
||||
// // 处理导出的文件
|
||||
// // 这里可以使用blob对象来获取导出的文件内容或者将其保存到本地
|
||||
// })
|
||||
// .catch(error => {
|
||||
// // 处理错误
|
||||
// console.error(error);
|
||||
// });
|
||||
},
|
||||
handleInputArea(){
|
||||
this.$forceUpdate()
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user