理论题目管理调整

This commit is contained in:
dong 2022-10-14 14:53:46 +08:00
parent 22205736f9
commit 0f09744cc4
3 changed files with 32 additions and 14 deletions

View File

@ -7,10 +7,10 @@
<script>
// import { UrlConfig } from '@/scripts/ConstDic';
import { listQuestionPage, deleteQuestion } from '@/api/questionBank.js';
import { listQuestionPage, deleteQuestion, getLableList } from '@/api/questionBank.js';
import DialogDetail from './dialog-detail';
import { convertSheetToList } from '@/jmapNew/theme/parser/util.js';
import { getCompanyList } from '@/api/company';
// import { getCompanyList } from '@/api/company';
import XLSX from 'xlsx';
export default {
@ -19,7 +19,7 @@ export default {
},
data() {
return {
companyList: [],
// companyList: [],
companyMap: {},
pagerConfig: {
pageSize: 'pageSize',
@ -29,6 +29,7 @@ export default {
reset: true,
labelWidth: '80px',
leftSpan: 17,
beforeQuery: this.beforeQuery,
queryObject: {
type: {
type: 'select',
@ -40,14 +41,15 @@ export default {
topic: {
type: 'text',
label: '题 目'
},
labels: {
type: 'select',
label: '标 签',
config: {
multiple: true,
data: []
}
}
// companyId: {
// type: 'select',
// label: '',
// config: {
// data: []
// }
// }
}
},
queryList: {
@ -134,15 +136,26 @@ export default {
}
},
mounted() {
this.companyList = [];
// this.companyList = [];
// getCompanyList().then(resp => {
// resp.data.forEach(item => {
// // this.queryForm.queryObject.companyId.config.data.push({ value: item.id, label: item.name });
// this.companyMap[item.id] = item.name;
// });
// });
getLableList().then(res => {
res.data.forEach(item => {
this.queryForm.queryObject.labels.config.data.push({ value: item, label: item });
});
}).catch(err => {
console.log(err);
});
},
methods: {
beforeQuery(obj) {
obj.labels = obj.labels ? obj.labels.join(',') : '';
return obj;
},
doCreate() {
// this.$router.push({path: `${UrlConfig.bank.questionCreate}`});
this.$router.push({path: '/teaching/questionCreate'});

View File

@ -73,7 +73,8 @@ export default {
},
computed: {
isSelect() {
return this.remove && this.option.type == 'select';
const selectArr = ['select', 'multi'];
return this.remove && selectArr.includes(this.option.type);
},
isProject() {
const project = getSessionStorage('project');

View File

@ -57,13 +57,17 @@ export default {
setTimeout(() => {
this.formModel = deepAssign({}, this.$store.state.race.preTheoryData[this.questionId]);
this.formModel.answer = this.formModel.optionList.findIndex(ele => ele.correct);
this.$refs.info.tagsArr = this.formModel.tags.split(',');
const tagVal = this.formModel.tags ? this.formModel.tags.split(',') : '';
this.$refs.info.tagsArr = tagVal;
this.tagsArr = tagVal;
}, 500);
} else {
getQuestionInfo(this.questionId).then(resp => {
this.formModel = resp.data;
this.formModel.answer = this.formModel.optionList.findIndex(ele => ele.correct);
this.$refs.info.tagsArr = this.formModel.tags.split(',');
const tagVal = this.formModel.tags ? this.formModel.tags.split(',') : '';
this.$refs.info.tagsArr = tagVal;
this.tagsArr = tagVal;
});
}
},