|
@@ -30,15 +30,25 @@
|
|
</el-select>
|
|
</el-select>
|
|
</el-form-item>
|
|
</el-form-item>
|
|
<el-form-item label="题目类别" prop="questionType">
|
|
<el-form-item label="题目类别" prop="questionType">
|
|
- <el-select v-model="queryParams.questionType" ref="typeSelect" placeholder="请选择类别" clearable size="small">
|
|
|
|
|
|
+ <el-select v-model="queryParams.questionType" ref="typeSelect" placeholder="请选择类别" @change="changeCateType" clearable size="small">
|
|
<el-option
|
|
<el-option
|
|
- v-for="item in questionTypeOptions"
|
|
|
|
- :key="item.cateId"
|
|
|
|
- :label="item.cateName"
|
|
|
|
- :value="item.cateId"
|
|
|
|
|
|
+ v-for="item in questionRootTypeOptions"
|
|
|
|
+ :key="item.dictValue"
|
|
|
|
+ :label="item.dictLabel"
|
|
|
|
+ :value="item.dictValue"
|
|
/>
|
|
/>
|
|
</el-select>
|
|
</el-select>
|
|
</el-form-item>
|
|
</el-form-item>
|
|
|
|
+ <el-form-item label="题目子类别" prop="questionSubType" label-width="100px">
|
|
|
|
+ <el-select v-model="queryParams.questionSubType" ref="typeSelect" placeholder="请选择子类别" clearable size="small">
|
|
|
|
+ <el-option
|
|
|
|
+ v-for="item in questionSubTypeOptions"
|
|
|
|
+ :key="item.dictValue"
|
|
|
|
+ :label="item.dictLabel"
|
|
|
|
+ :value="item.dictValue"
|
|
|
|
+ />
|
|
|
|
+ </el-select>
|
|
|
|
+ </el-form-item>
|
|
|
|
|
|
|
|
|
|
<!-- <el-form-item label="状态" prop="status">-->
|
|
<!-- <el-form-item label="状态" prop="status">-->
|
|
@@ -124,9 +134,14 @@
|
|
</el-table-column>
|
|
</el-table-column>
|
|
<el-table-column label="题目类别" align="center" prop="questionType">
|
|
<el-table-column label="题目类别" align="center" prop="questionType">
|
|
<template slot-scope="scope">
|
|
<template slot-scope="scope">
|
|
- <el-tag>{{ getCategoryName(scope.row.questionType) }}</el-tag>
|
|
|
|
|
|
+ <el-tag v-if="scope.row.questionType">{{ getCategoryName(scope.row.questionType) }}</el-tag>
|
|
</template>
|
|
</template>
|
|
</el-table-column>
|
|
</el-table-column>
|
|
|
|
+ <el-table-column label="题目子类别" align="center" prop="questionType">
|
|
|
|
+ <template slot-scope="scope">
|
|
|
|
+ <el-tag v-if="scope.row.questionSubType">{{ getCategoryName(scope.row.questionSubType) }}</el-tag>
|
|
|
|
+ </template>
|
|
|
|
+ </el-table-column>
|
|
<el-table-column label="状态" align="center" prop="status">
|
|
<el-table-column label="状态" align="center" prop="status">
|
|
<template slot-scope="scope">
|
|
<template slot-scope="scope">
|
|
<dict-tag :options="statusOptions" :value="scope.row.status"/>
|
|
<dict-tag :options="statusOptions" :value="scope.row.status"/>
|
|
@@ -182,14 +197,22 @@
|
|
</el-select>
|
|
</el-select>
|
|
</el-form-item>
|
|
</el-form-item>
|
|
<el-form-item label="题目类别 " prop="questionType">
|
|
<el-form-item label="题目类别 " prop="questionType">
|
|
- <el-select v-model="form.questionType" placeholder="请选择题目类别" >
|
|
|
|
|
|
+ <el-select v-model="form.questionType" clearable placeholder="请选择题目类别" @change="changeCateType">
|
|
<el-option
|
|
<el-option
|
|
- v-for="item in questionTypeOptions"
|
|
|
|
- :key="item.cateId"
|
|
|
|
- :label="item.cateName"
|
|
|
|
- :value="item.cateId"
|
|
|
|
|
|
+ v-for="item in questionRootTypeOptions"
|
|
|
|
+ :key="item.dictValue"
|
|
|
|
+ :label="item.dictLabel"
|
|
|
|
+ :value="item.dictValue"
|
|
/>
|
|
/>
|
|
</el-select>
|
|
</el-select>
|
|
|
|
+ <el-select v-model="form.questionSubType" clearable placeholder="请选择题目子类别" >
|
|
|
|
+ <el-option
|
|
|
|
+ v-for="item in questionSubTypeOptions"
|
|
|
|
+ :key="item.dictValue"
|
|
|
|
+ :label="item.dictLabel"
|
|
|
|
+ :value="item.dictValue"
|
|
|
|
+ />
|
|
|
|
+ </el-select>
|
|
</el-form-item>
|
|
</el-form-item>
|
|
<el-form-item label="状态">
|
|
<el-form-item label="状态">
|
|
<el-radio-group v-model="form.status">
|
|
<el-radio-group v-model="form.status">
|
|
@@ -292,7 +315,11 @@
|
|
<script>
|
|
<script>
|
|
import { listCourseQuestionBank, getCourseQuestionBank, delCourseQuestionBank, addCourseQuestionBank, updateCourseQuestionBank, exportCourseQuestionBank, importTemplate } from "@/api/course/courseQuestionBank";
|
|
import { listCourseQuestionBank, getCourseQuestionBank, delCourseQuestionBank, addCourseQuestionBank, updateCourseQuestionBank, exportCourseQuestionBank, importTemplate } from "@/api/course/courseQuestionBank";
|
|
import { getToken } from "@/utils/auth";
|
|
import { getToken } from "@/utils/auth";
|
|
-import { listUserCourseCategory } from '@/api/course/userCourseCategory'
|
|
|
|
|
|
+import {
|
|
|
|
+ listUserCourseCategory,
|
|
|
|
+ getCatePidList,
|
|
|
|
+ getCateListByPid
|
|
|
|
+} from '@/api/course/userCourseCategory'
|
|
|
|
|
|
export default {
|
|
export default {
|
|
name: "CourseQuestionBank",
|
|
name: "CourseQuestionBank",
|
|
@@ -335,6 +362,8 @@ export default {
|
|
// 题库表格数据
|
|
// 题库表格数据
|
|
courseQuestionBankList: [],
|
|
courseQuestionBankList: [],
|
|
questionTypeOptions: [],
|
|
questionTypeOptions: [],
|
|
|
|
+ questionRootTypeOptions: [],
|
|
|
|
+ questionSubTypeOptions: [],
|
|
// 弹出层标题
|
|
// 弹出层标题
|
|
title: "",
|
|
title: "",
|
|
// 是否显示弹出层
|
|
// 是否显示弹出层
|
|
@@ -349,6 +378,7 @@ export default {
|
|
status: null,
|
|
status: null,
|
|
question: null,
|
|
question: null,
|
|
questionType:null,
|
|
questionType:null,
|
|
|
|
+ questionSubType: null,
|
|
answer: null,
|
|
answer: null,
|
|
},
|
|
},
|
|
// 表单参数
|
|
// 表单参数
|
|
@@ -399,6 +429,17 @@ export default {
|
|
listUserCourseCategory().then(response => {
|
|
listUserCourseCategory().then(response => {
|
|
this.questionTypeOptions = response.data
|
|
this.questionTypeOptions = response.data
|
|
});
|
|
});
|
|
|
|
+ getCatePidList().then(response => {
|
|
|
|
+ this.questionRootTypeOptions = response.data
|
|
|
|
+ });
|
|
|
|
+ },
|
|
|
|
+ changeCateType(val) {
|
|
|
|
+ if (!val) {
|
|
|
|
+ return
|
|
|
|
+ }
|
|
|
|
+ getCateListByPid(val).then(response => {
|
|
|
|
+ this.questionSubTypeOptions = response.data
|
|
|
|
+ })
|
|
},
|
|
},
|
|
getCategoryName(id) {
|
|
getCategoryName(id) {
|
|
return this.questionTypeOptions.find(item => item.cateId === id)?.cateName || '';
|
|
return this.questionTypeOptions.find(item => item.cateId === id)?.cateName || '';
|
|
@@ -466,6 +507,7 @@ export default {
|
|
cancel() {
|
|
cancel() {
|
|
this.open = false;
|
|
this.open = false;
|
|
this.reset();
|
|
this.reset();
|
|
|
|
+ this.changeCateType(this.queryParams.questionType)
|
|
},
|
|
},
|
|
// 表单重置
|
|
// 表单重置
|
|
reset() {
|
|
reset() {
|
|
@@ -501,6 +543,7 @@ export default {
|
|
/** 新增按钮操作 */
|
|
/** 新增按钮操作 */
|
|
handleAdd() {
|
|
handleAdd() {
|
|
this.reset();
|
|
this.reset();
|
|
|
|
+ this.questionSubTypeOptions = []
|
|
this.open = true;
|
|
this.open = true;
|
|
this.title = "添加题库";
|
|
this.title = "添加题库";
|
|
},
|
|
},
|
|
@@ -510,7 +553,7 @@ export default {
|
|
const id = row.id || this.ids
|
|
const id = row.id || this.ids
|
|
getCourseQuestionBank(id).then(response => {
|
|
getCourseQuestionBank(id).then(response => {
|
|
this.form = response.data;
|
|
this.form = response.data;
|
|
-
|
|
|
|
|
|
+ this.changeCateType(this.form.questionType)
|
|
|
|
|
|
//初始化多选的选择结果,单选的选择的时候,就取消其他的了 selectedAnswers
|
|
//初始化多选的选择结果,单选的选择的时候,就取消其他的了 selectedAnswers
|
|
if (this.form.type===2) {
|
|
if (this.form.type===2) {
|