| | |
| | | <template> |
| | | <div class="app-container"> |
| | | <el-form :model="form" ref="form" label-width="200px" v-loading="formLoading" :rules="rules"> |
| | | <el-form-item label="考生:" prop="examineeList" required> |
| | | <el-select v-model="form.examineeList" :collapse-tags="true" multiple placeholder="请选择" @focus="selectStudent" |
| | | <el-form-item label="考生:" prop="userIds" required> |
| | | <el-select v-model="form.userIds" :collapse-tags="true" multiple placeholder="请选择" @focus="selectStudent" |
| | | popper-class="examinee-popper"> |
| | | </el-select> |
| | | </el-form-item> |
| | | <el-form-item label="课目:" prop="subjectId" required> |
| | | <el-select ref="subjectIdRef" v-model="form.subjectId" placeholder="课目" multiple collapse-tags> |
| | | <el-option v-for="item in subjectFilter" :key="item.id" :value="item.id" :label="item.name + ' '"></el-option> |
| | | <el-option v-for="item in form.examineeList" :value="item.id" :label="item.realName" |
| | | :key="item.id"></el-option> |
| | | </el-select> |
| | | </el-form-item> |
| | | <el-form-item label="部门:" prop="deptId" required> |
| | | <el-select v-model="form.deptId" collapse-tags placeholder="部门"> |
| | | <el-select v-model="form.deptId" collapse-tags @change="getSubject" placeholder="部门"> |
| | | <el-option v-for="item in depts" :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 ref="subjectIdRef" v-model="form.subjectId" :disabled="! form.deptId" 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="paperType" required> |
| | |
| | | </el-form> |
| | | <el-dialog :visible.sync="questionPage.showDialog" width="70%"> |
| | | <el-form :model="questionPage.queryParam" ref="queryForm" :inline="true"> |
| | | <el-form-item label="ID:"> |
| | | <el-input v-model="questionPage.queryParam.id" clearable></el-input> |
| | | <el-form-item label="题干:"> |
| | | <el-input v-model="questionPage.queryParam.titleContent" clearable></el-input> |
| | | </el-form-item> |
| | | <el-form-item label="题型:"> |
| | | <el-select v-model="questionPage.queryParam.questionType" clearable> |
| | |
| | | <el-table-column prop="realName" label="学员" /> |
| | | </el-table> |
| | | <pagination v-show="total > 0" :total="total" :page.sync="student.pageIndex" :limit.sync="student.pageSize" |
| | | @pagination="selectStudent" /> |
| | | @pagination="getStudent" /> |
| | | <span slot="footer" class="dialog-footer"> |
| | | <el-button @click="studentDialog = false">取 消</el-button> |
| | | <el-button type="primary" @click="confirmStudentSelect">确定</el-button> |
| | |
| | | import { mapGetters, mapState, mapActions } from 'vuex'; |
| | | import Pagination from '@/components/Pagination'; |
| | | import QuestionShow from '../question/components/Show'; |
| | | import subjectApi from '@/api/subject'; |
| | | import examPaperApi from '@/api/examPaper'; |
| | | import questionApi from '@/api/question'; |
| | | import departmentApi from '@/api/department'; |
| | |
| | | tags: [], |
| | | depts: [], |
| | | studentDialog: false, |
| | | |
| | | isFirstShow: true, |
| | | |
| | | |
| | | student: { |
| | | deptIds: [], |
| | | pageIndex: 1, |
| | | pageSize: 5, |
| | | listLoading: true, |
| | | multipleSelection: [], |
| | | excludeTagIds: [] |
| | | excludeTagIds: [], |
| | | }, |
| | | tableData: [], |
| | | total: 0, |
| | |
| | | titleItems: [], |
| | | subjectSource: {}, |
| | | questionTypeVMS: [], |
| | | examineeList: [] |
| | | examineeList: [], |
| | | userNames: [] |
| | | }, |
| | | subjectFilter: null, |
| | | formLoading: false, |
| | | rules: { |
| | | examineeList: [ |
| | | { required: true, message: '请选择', trigger: 'change' } |
| | | userIds: [ |
| | | { required: true, message: '请选择考生', trigger: 'change' } |
| | | ], |
| | | subjectId: [ |
| | | { required: true, message: '请选择课目', trigger: 'change' } |
| | |
| | | multipleSelection: [], |
| | | showDialog: false, |
| | | queryParam: { |
| | | id: null, |
| | | titleContent: "", |
| | | questionType: null, |
| | | subjectId: 1, |
| | | pageIndex: 1, |
| | |
| | | if (id && parseInt(id) !== 0) { |
| | | _this.formLoading = true; |
| | | examPaperApi.select(id).then(re => { |
| | | const { userIds, userNames } = re.response; |
| | | |
| | | _this.form = re.response; |
| | | // _this.form.menuIds = JSON.parse(re.response.menuIds); |
| | | _this.examineeList = JSON.parse(re.response.userIds).map(item => item.realName); |
| | | console.log(_this.form); |
| | | _this.form.examineeList = userIds.map((item, index) => { |
| | | return { |
| | | id: item, |
| | | realName: userNames && userNames[index] ? userNames[index] : '' |
| | | }; |
| | | }); |
| | | _this.formLoading = false; |
| | | }); |
| | | } |
| | |
| | | }); |
| | | }, |
| | | methods: { |
| | | getSubject(deptId) { |
| | | // 获取对应部门的课目 |
| | | subjectApi.selectByDeptId(deptId).then(res => { |
| | | this.form.subjectId = null |
| | | this.subjectFilter = res.response |
| | | }) |
| | | }, |
| | | getTags() { |
| | | userApi.tagList(null).then(data => { |
| | | this.tags = data.response; |
| | |
| | | this.getTags(); |
| | | this.studentDialog = true; |
| | | this.student.listLoading = true; |
| | | this.getStudent(); |
| | | }, |
| | | |
| | | getStudent() { |
| | | this.student.listLoading = true; |
| | | examPaperApi.selectStudent(this.student).then(res => { |
| | | this.tableData = res.response.list; |
| | | this.total = res.response.total; |
| | | this.student.listLoading = false; |
| | | |
| | | this.$nextTick(() => { |
| | | this.tableData.map(data => { |
| | | if (this.form.userIds.find(item => item === data.id)) { |
| | | this.$refs.multipleTable.toggleRowSelection(data, true); |
| | | } else { |
| | | this.$refs.multipleTable.toggleRowSelection(data, false); |
| | | } |
| | | if (this.studentDialog && this.isFirstShow) { |
| | | this.isFirstShow = false; |
| | | this.form.examineeList.forEach(item => { |
| | | this.$refs.multipleTable.toggleRowSelection(item, true); |
| | | }); |
| | | }); |
| | | } |
| | | }); |
| | | }, |
| | | handleChange(val) { |
| | |
| | | // } |
| | | }); |
| | | this.form.subjectSource = obj1; |
| | | |
| | | console.log(this.form.subjectSource); |
| | | console.log(this.form.questionTypeVMS); |
| | | // this.form.paperType = 7 |
| | | this.form.titleItems = []; |
| | | } else { |
| | |
| | | if (this.subjectIdList.length == 1) { |
| | | tempForm.subjectId = tempForm.subjectId; |
| | | }; |
| | | tempForm.userIds = tempForm.menuIds; |
| | | // tempForm.menuIds = JSON.stringify(tempForm.menuIds); |
| | | |
| | | tempForm.menuIds = tempForm.userIds.join(','); |
| | | |
| | | if (tempForm.questionTypeVMS == null) { |
| | | tempForm.questionTypeVMS = []; |
| | |
| | | }); |
| | | }, |
| | | addQuestion(titleItem) { |
| | | console.log('titleItem', titleItem); |
| | | this.currentTitleItem = titleItem; |
| | | this.questionPage.showDialog = true; |
| | | this.search(); |
| | |
| | | this.questionPage.showDialog = false; |
| | | }, |
| | | confirmStudentSelect() { |
| | | // this.form.menuIds = this.student.multipleSelection.map((item) => item.id); |
| | | this.form.userIds = this.student.multipleSelection.map((item) => { |
| | | this.form.userIds = this.student.multipleSelection.map((item) => item.id); |
| | | |
| | | this.form.examineeList = this.student.multipleSelection.map((item) => { |
| | | return { |
| | | id: item.id, |
| | | realName: item.realName |
| | | }; |
| | | }); |
| | | this.form.examineeList = this.student.multipleSelection.map((item) => item.realName); |
| | | |
| | | this.student.multipleSelection = []; |
| | | this.studentDialog = false; |
| | | }, |
| | | |
| | |
| | | levelEnum: state => state.user.levelEnum |
| | | }), |
| | | ...mapState('exam', { subjects: state => state.subjects }), |
| | | |
| | | examineeFormat() { |
| | | return this.examineeList.map(item => item.realName); |
| | | } |
| | | } |
| | | }; |
| | | </script> |