From d44a2361fa5173f0421ec05921bde28d59614d45 Mon Sep 17 00:00:00 2001 From: qirong <2032486488@qq.com> Date: 星期二, 28 十一月 2023 11:09:18 +0800 Subject: [PATCH] 随机试卷修改 --- src/views/exam/question/edit/single-choice.vue | 47 +++++++++++++++++++++++++++++++++++------------ 1 files changed, 35 insertions(+), 12 deletions(-) diff --git a/src/views/exam/question/edit/single-choice.vue b/src/views/exam/question/edit/single-choice.vue index af93b5a..4042019 100644 --- a/src/views/exam/question/edit/single-choice.vue +++ b/src/views/exam/question/edit/single-choice.vue @@ -1,14 +1,15 @@ <template> <div class="app-container"> <el-form :model="form" ref="form" label-width="100px" v-loading="formLoading" :rules="rules"> - <el-form-item label="閮ㄩ棬锛�" prop="gradeLevel" required> + <el-form-item label="閮ㄩ棬锛�" prop="gradeLevel" style="display: none"> <el-select v-model="form.gradeLevel" placeholder="閮ㄩ棬" @change="levelChange" clearable> - <el-option v-for="item in levelEnum" :key="item.key" :value="item.key" :label="item.value"></el-option> + <el-option v-for="item in depart" :key="item.id" :value="item.id" :label="item.name"></el-option> </el-select> </el-form-item> - <el-form-item label="璇剧洰锛�" prop="subjectId" required> - <el-select v-model="form.subjectId" placeholder="璇剧洰" > - <el-option v-for="item in subjectFilter" :key="item.id" :value="item.id" :label="item.name+' ( '+item.levelName+' )'"></el-option> + <el-form-item label="璇剧洰锛�" prop="subjectIds" required> + <el-select v-model="form.subjectIds" placeholder="璇剧洰" multiple + collapse-tags> + <el-option v-for="item in subjectFilter" :key="item.id" :value="item.id" :label="item.name+' '"></el-option> </el-select> </el-form-item> <el-form-item label="棰樺共锛�" prop="title" required> @@ -60,6 +61,7 @@ import Ueditor from '@/components/Ueditor' import { mapGetters, mapState, mapActions } from 'vuex' import questionApi from '@/api/question' +import departmentApi from '@/api/department' export default { components: { @@ -67,11 +69,17 @@ }, data () { return { + queryParam: { + level: null, + pageIndex: 1, + pageSize: 100 + }, + depart:[], form: { id: null, questionType: 1, gradeLevel: null, - subjectId: null, + title: '', items: [ { prefix: 'A', content: '' }, @@ -87,10 +95,10 @@ subjectFilter: null, formLoading: false, rules: { - gradeLevel: [ - { required: true, message: '璇烽�夋嫨閮ㄩ棬', trigger: 'change' } - ], - subjectId: [ + // gradeLevel: [ + // { required: true, message: '璇烽�夋嫨閮ㄩ棬', trigger: 'change' } + // ], + subjectIds: [ { required: true, message: '璇烽�夋嫨璇剧洰', trigger: 'change' } ], title: [ @@ -128,13 +136,28 @@ }) if (id && parseInt(id) !== 0) { _this.formLoading = true + questionApi.select(id).then(re => { _this.form = re.response + _this.form.subjectIds = [] + _this.form.questionSubjects.forEach(item=>{ + _this.form.subjectIds.push(item.subjectId) + }) _this.formLoading = false }) } + _this.seachPageDepartMentList() }, methods: { + seachPageDepartMentList(){ + let that = this + departmentApi.pageList(this.queryParam).then(res=>{ + console.log(res) + if (res.code == 1){ + that.depart = res.response.list + } + }) + }, editorReady (instance) { this.richEditor.instance = instance let currentContent = this.richEditor.object[this.richEditor.parameterName] @@ -196,7 +219,7 @@ id: null, questionType: 1, gradeLevel: null, - subjectId: null, + title: '', items: [ { prefix: 'A', content: '' }, @@ -212,7 +235,7 @@ this.form.id = lastId }, levelChange () { - this.form.subjectId = null + this.subjectFilter = this.subjects.filter(data => data.level === this.form.gradeLevel) }, showQuestion () { -- Gitblit v1.8.0