理论题调整

This commit is contained in:
fan 2020-10-22 09:45:33 +08:00
parent 12bcbdb02b
commit 94e626ce49
7 changed files with 196 additions and 9 deletions

View File

@ -17,6 +17,7 @@ import ibp from './modules/ibp';
import order from './modules/order';
import iscs from './modules/iscs';
import rpTools from './modules/rpTools';
import race from './modules/race';
import getters from './getters';
@ -39,8 +40,9 @@ const store = new Vuex.Store({
scriptRecord,
ibp,
order,
iscs,
rpTools
iscs,
rpTools,
race
},
getters
});

View File

@ -16,6 +16,7 @@ import scriptRecord from './modules/scriptRecord';
import ibp from './modules/ibp';
import order from './modules/order';
import iscs from './modules/iscs';
import race from './modules/race';
import getters from './getters';
@ -38,7 +39,8 @@ const store = new Vuex.Store({
scriptRecord,
ibp,
order,
iscs
iscs,
race
},
getters
});

40
src/store/modules/race.js Normal file
View File

@ -0,0 +1,40 @@
/**
* 竞赛状态数据
*/
const race = {
namespaced: true,
state: {
preTheoryData: [] // 导入的理论预保存数据,
},
getters: {
preTheoryData: (state)=>{
return state.preTheoryData;
}
},
mutations: {
setPreTheoryData: (state, preTheoryData) => {
state.orderList = preTheoryData;
}
},
actions: {
/**
* 设置导入的理论预保存数据
*/
setPreTheoryData: ({ commit }, preTheoryData) => {
commit('setPreTheoryData', preTheoryData);
}
// getRouteDataListByCode: ({ state, commit }, code) => { // 获取进路数据
// return new Promise((resolve) => {
// const list = [];
// const routeList = Object.values(state.routeData);
// routeList.forEach(route => {
// if (route.startSignalCode == code) {
// list.push(route);
// }
// });
// resolve(list);
// });
// },
}
};
export default race;

View File

@ -38,6 +38,7 @@ export default {
doInput() {
const node = this.node;
node.model[node.prop] = this.content;
// this.$emit('update');
this.doClose();
}
}

View File

@ -254,6 +254,11 @@ export default {
});
}
}
// this.$store.dispatch('race/setPreTheoryData', questionList).then(({ valid }) => {
//
// }).catch(() => {
// this.$message.error('');
// });
importQuestionBand(questionList, 'DRTS').then(resp => {
this.$message.success('导入题库成功!');
}).catch(()=>{

View File

@ -78,13 +78,13 @@ export default {
} else if (this.type === 'answer') {
this.answer = (this.optionList[0] || {content: ''}).content;
}
},
answerList: {
handler(val) {
this.onChange(val);
},
deep: true
}
// answerList: {
// handler(val) {
// this.onChange(val);
// },
// deep: true
// }
},
methods: {
onChange(e) {
@ -95,6 +95,7 @@ export default {
},
doModify(el) {
this.$emit('modify', {model: el, prop: 'value'});
console.log('-----------', this.answerList);
},
doRemove(index) {
this.answerList.splice(index, 1);

View File

@ -0,0 +1,136 @@
<template>
<div>
<query-list-page ref="user" :pager-config="pagerConfig" :query-form="queryForm" :query-list="queryList" />
</div>
</template>
<script>
import { UrlConfig } from '@/scripts/ConstDic';
import { listQuestionPage, deleteQuestion } from '@/api/questionBank.js';
import { convertSheetToList } from '@/utils/runPlan';
import XLSX from 'xlsx';
import { importQuestionBand } from '@/api/race';
export default {
data() {
return {
pagerConfig: {
pageSize: 'pageSize',
pageIndex: 'pageNum'
},
queryForm: {
reset: true,
labelWidth: '80px',
leftSpan: 18,
queryObject: {
}
},
queryList: {
query: this.handlePreDataPaging,
selectCheckShow: false,
indexShow: true,
columns: [
{
title: '题 目',
prop: 'topic'
},
{
title: '类 型',
prop: 'type',
type: 'tag',
width: '120',
columnValue: (row) => { return this.$ConstSelect.translate(row.type, 'QuestionTypeList'); },
tagType: (row) => {
return '';
}
},
{
title: '答 案',
prop: 'answer',
type: 'tagMore',
width: '200',
columnValue: (row) => { return this.answerTags(row); },
tagType: (row) => {
return '';
}
},
{
type: 'button',
title: '操 作',
width: '320',
buttons: [
{
name: '编辑',
handleClick: this.edit
},
{
name: '删 除',
handleClick: this.doDelete,
type: 'danger'
}
]
}
]
}
};
},
computed: {
userId() {
return this.$store.state.user.id;
}
},
methods: {
edit(index, row) {
this.$router.push({path: `${UrlConfig.bank.questionUpdate}/${row.id}`});
},
handlePreDataPaging(param) {
},
doDelete(index, row) {
this.$confirm('删除试题,是否继续?', '提 示', {
confirmButtonText: '确 定',
cancelButtonText: '取 消',
type: 'warning'
}).then(() => {
deleteQuestion(row.id).then(resp => {
this.reloadTable();
}).catch(error => {
this.$message.error(`删除试题失败: ${error.message}`);
});
}).catch( () => { });
},
answerTags(row) {
const answer = [];
row.optionList.forEach((el, i) => {
switch (row.type) {
case 'select':
if (el.correct) {
answer.push(this.$asc2chart(i + 65));
}
break;
case 'judge':
if (el.correct) {
answer.push(el.content);
}
break;
case 'multi':
if (el.correct) {
answer.push(this.$asc2chart(i + 65));
}
break;
case 'fill':
answer.push(el.content);
break;
case 'answer':
answer.push(el.content);
break;
}
});
return answer;
},
reloadTable() {
this.queryList.reload();
}
}
};
</script>