理论题目添加清空操作

This commit is contained in:
dong 2022-10-20 10:17:38 +08:00
parent 2754e14bff
commit b06248a366
2 changed files with 25 additions and 3 deletions

View File

@ -83,3 +83,11 @@ export function testAnswer(questionId, data) {
data
});
}
// 清空题库
export function clearBank() {
return request({
url: `/api/question/org/clear`,
method: 'get'
});
}

View File

@ -8,7 +8,7 @@
<script>
// import { UrlConfig } from '@/scripts/ConstDic';
import { listQuestionPage, deleteQuestion, getLabelList, listQuestionAll } from '@/api/questionBank.js';
import { listQuestionPage, deleteQuestion, getLabelList, listQuestionAll, clearBank } from '@/api/questionBank.js';
import DialogDetail from './dialog-detail';
import PreviewAnswer from './previewAnswer';
import { convertSheetToList } from '@/jmapNew/theme/parser/util.js';
@ -33,7 +33,7 @@ export default {
queryForm: {
reset: true,
labelWidth: '80px',
leftSpan: 17,
leftSpan: 16,
beforeQuery: this.beforeQuery,
queryObject: {
type: {
@ -136,7 +136,8 @@ export default {
{ text: '导 入', fileType: 'file', handler: this.importQuestionBank },
// { text: '', handler: this.questionsRuleManage},
// { text: '', handler: this.exportTemplate},
{ text: '导出模板', handler: this.downloadTemplate}
{ text: '导出模板', handler: this.downloadTemplate},
{ text: '清空题库', type:'danger', handler: this.clearBank}
]
}
};
@ -418,6 +419,19 @@ export default {
// this.$router.push({ path: `/system/questionsRuleManage`});
this.$router.push({ path: `/teaching/questionsRuleManage`});
},
clearBank() {
this.$confirm('慎重!本操作可清空所有题库数据,是否继续?', '提 示', {
confirmButtonText: '确 定',
cancelButtonText: '取 消',
type: 'warning'
}).then(() => {
clearBank().then(resp => {
this.reloadTable();
}).catch(error => {
this.$message.error(`清空题库数据失败: ${error.message}`);
});
}).catch( () => { });
},
downloadTemplate() {
//
var eleLink = document.createElement('a');