理论题目分类只能单选

This commit is contained in:
dong 2022-10-28 16:17:03 +08:00
parent 8b47049f69
commit e1f9d6e0c8
6 changed files with 20 additions and 16 deletions

View File

@ -51,7 +51,7 @@ export default {
type: 'select',
label: '分 类',
config: {
multiple: true,
// multiple: true,
data: []
}
}
@ -70,7 +70,8 @@ export default {
{
title: '分 类',
prop: 'tags',
type: 'tagMore',
// type: 'tagMore',
type: 'tag',
width: '200',
columnValue: (row) => { return this.lableTags(row); },
tagType: (row) => {
@ -165,7 +166,7 @@ export default {
},
methods: {
beforeQuery(obj) {
obj.labels = obj.labels ? obj.labels.join(',') : '';
// obj.labels = obj.labels ? obj.labels.join(',') : '';
return obj;
},
doCreate() {
@ -204,7 +205,8 @@ export default {
},
lableTags(row) {
return row.tags ? row.tags.split(',') : '';
// return row.tags ? row.tags.split(',') : '';
return row.tags || '';
},
answerTags(row) {
@ -310,7 +312,8 @@ export default {
const param = {
type: questionTypeMap[item],
topic: dataList[topicIndex][index],
tags: dataList[tagsIndex][index] ? dataList[tagsIndex][index].replace(/\s+/g, ',') : '',
// tags: dataList[tagsIndex][index] ? dataList[tagsIndex][index].replace(/\s+/g, ',') : '',
tags: dataList[tagsIndex][index] || '',
optionList: []
};
if (param.type === 'fill') {
@ -448,7 +451,7 @@ export default {
exportTemplate() {
const wb = XLSX.utils.book_new();
const data1 = [{A: '理论试题导入模板', B: '', C:'', D:'', E:'', F: '', G: '', H: '', I: '', J: '', K: ''}];
const data2 = [{A: '说明1、本表表头第一行到第三行内容不能修改删除;\n 2、支持批量导入的题型单选题多选题判断题题型不能自定义只能按照表格提供的进行录入;\n 3、【判断题】在选项A中可填写√ 或正确选项B中填写× 或错误答案填写A或B\n 4、【分类】多个分类项使用空格隔开', B: '', C:'', D:'', E:'', F: '', G: '', H: '', I: '', J: '', K: ''}];
const data2 = [{A: '说明1、本表表头第一行到第三行内容不能修改删除;\n 2、支持批量导入的题型单选题多选题判断题题型不能自定义只能按照表格提供的进行录入;\n 3、【判断题】在选项A中可填写√ 或正确选项B中填写× 或错误答案填写A或B', B: '', C:'', D:'', E:'', F: '', G: '', H: '', I: '', J: '', K: ''}];
const data3 = [{A: '序号', B: '题干(必填)', C:'题型(必填)', D:'选项A必填', E:'选项B必填', F: '选项C', G: '选项D', H: '选项E', I: '选项F', J: '正确答案(必填)', K: '分类'}];
const data = [...data1, ...data2, ...data3];
const mapType = {
@ -483,7 +486,8 @@ export default {
H: item.optionList[4] ? item.optionList[4].content : '',
I: item.optionList[5] ? item.optionList[5].content : '',
J: as,
K: item.tags ? item.tags.replace(',', ' ') : ''
// K: item.tags ? item.tags.replace(',', ' ') : ''
K: item.tags || ''
};
data.push(obj);
});

View File

@ -20,7 +20,8 @@
</el-table-column>
<el-table-column prop="tags" label="分类" width="200">
<template slot-scope="scope">
<el-tag v-for="item in getTagesArr(scope.row.tags)" :key="item" type="primary" disable-transitions style="margin-right: 10px;">{{ item }}</el-tag>
<!-- <el-tag v-for="item in getTagesArr(scope.row.tags)" :key="item" type="primary" disable-transitions style="margin-right: 10px;">{{ item }}</el-tag> -->
<el-tag v-if="scope.row.tags" type="primary" disable-transitions style="margin-right: 10px;">{{ scope.row.tags }}</el-tag>
</template>
</el-table-column>
<el-table-column prop="type" label="类型" width="100">

View File

@ -80,8 +80,7 @@ export default {
this.$message.warning('选项不能为空!');
return;
}
// this.formModel.companyId = parseInt(this.companyId);
this.formModel.tags = this.tagsArr.join(',');
// this.formModel.tags = this.tagsArr.join(',');
createQuestion(this.formModel).then(resp => {
authUtils.setSessionStorage(this.path, JSON.stringify({
type: this.formModel.type

View File

@ -12,7 +12,8 @@
</el-select>
</el-form-item>
<el-form-item label="分 类">
<el-select v-model="tagsArr" multiple filterable allow-create default-first-option placeholder="请选择分类" @change="tagsChange">
<el-select v-model="option.tags" filterable allow-create default-first-option placeholder="请选择分类">
<!-- <el-select v-model="tagsArr" multiple filterable allow-create default-first-option placeholder="请选择分类" @change="tagsChange"> -->
<el-option v-for="item in labelList" :key="item" :label="item" :value="item" />
</el-select>
</el-form-item>

View File

@ -99,11 +99,10 @@ export default {
this.$store.state.race.preTheoryData[this.questionId] = this.formModel;
this.doBack();
} else if (valid) {
// this.formModel.companyId = parseInt(this.companyId);
this.formModel.tags = this.tagsArr;
if (Array.isArray(this.tagsArr)) {
this.formModel.tags = this.tagsArr.join(',');
}
// this.formModel.tags = this.tagsArr;
// if (Array.isArray(this.tagsArr)) {
// this.formModel.tags = this.tagsArr.join(',');
// }
updateOption(this.formModel).then(resp => {
this.doBack();
}).catch(error => {