| | |
| | | <template> |
| | | <div class="app-container"> |
| | | <el-form :model="form" ref="form" label-width="200px" v-loading="formLoading" :rules="rules"> |
| | | <el-form-item label="考生:" prop="menuIds" required> |
| | | <el-select v-model="form.menuIds" :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 |
| | | @visible-change="subjectIdEvent"> |
| | | <el-option v-for="item in subjectFilter" :key="item.id" :value="item.id" :label="item.name + ' '"></el-option> |
| | | <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-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 |
| | | @visible-change="subjectIdEvent"> |
| | | <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-col> |
| | | </el-row> |
| | | </el-form-item> |
| | | <el-form-item :key="item.subjectId" :label="item.label" required v-for="(item, key) in form.questionTypeVMS" |
| | | <!-- <el-form-item :key="item.subjectId" :label="item.label" required v-for="(item, key) in form.questionTypeVMS" |
| | | v-if="form.paperType == 7"> |
| | | <el-row> |
| | | <el-col :span="3"> |
| | |
| | | <el-input v-model="form.questionTypeVMS[key].trueFalse" style="width: 80%" /> |
| | | </el-col> |
| | | </el-row> |
| | | </el-form-item> |
| | | </el-form-item> --> |
| | | <!-- <el-form-item label="总数分:" v-if="form.paperType==7" prop="name" required>--> |
| | | <!-- <el-input v-model="form.name"/>--> |
| | | <!-- </el-form-item>--> |
| | |
| | | <el-dialog :visible.sync="studentDialog" width="70%"> |
| | | <el-form :model="student" ref="queryForm" :inline="true"> |
| | | <el-form-item label="标签:"> |
| | | <el-select v-model="student.tagId" clearable> |
| | | <el-select v-model="student.tagIds" clearable multiple> |
| | | <el-option v-for="item in tags" :key="item.id" :value="item.id" :label="item.name"></el-option> |
| | | </el-select> |
| | | </el-form-item> |
| | | <el-form-item label="排除标签:"> |
| | | <el-select v-model="student.excludeTagIds" clearable multiple> |
| | | <el-option v-for="item in tags" :key="item.id" :value="item.id" :label="item.name"></el-option> |
| | | </el-select> |
| | | </el-form-item> |
| | |
| | | import Pagination from '@/components/Pagination'; |
| | | import QuestionShow from '../question/components/Show'; |
| | | import examPaperApi from '@/api/examPaper'; |
| | | import subjectApi from '@/api/subject'; |
| | | import userApi from '@/api/user'; |
| | | import questionApi from '@/api/question'; |
| | | import departmentApi from '@/api/department'; |
| | |
| | | pageIndex: 1, |
| | | pageSize: 5, |
| | | listLoading: true, |
| | | multipleSelection: [] |
| | | multipleSelection: [], |
| | | excludeTagIds: [] |
| | | }, |
| | | isFirstShow: true, |
| | | |
| | | tableData: [], |
| | | total: 0, |
| | | props: { |
| | |
| | | suggestTime: null, |
| | | titleItems: [], |
| | | subjectSource: {}, |
| | | questionTypeVMS: [] |
| | | questionTypeVMS: [], |
| | | examineeList: [], |
| | | userIds: [] |
| | | }, |
| | | subjectFilter: null, |
| | | formLoading: false, |
| | | rules: { |
| | | userIds: [ |
| | | { required: true, message: '请选择考生', trigger: 'change' } |
| | | ], |
| | | subjectId: [ |
| | | { required: true, message: '请选择课目', trigger: 'change' } |
| | | ], |
| | |
| | | console.log(res); |
| | | this.subjectFilter = res.response; |
| | | }); |
| | | departmentApi.getDeptAdmins().then(res => { |
| | | departmentApi.list().then(res => { |
| | | this.depts = res.response; |
| | | }); |
| | | }, |
| | |
| | | if (id && parseInt(id) !== 0) { |
| | | _this.formLoading = true; |
| | | await examPaperApi.selfselect(id).then(re => { |
| | | const { userIds, userNames } = re.response; |
| | | _this.form = re.response; |
| | | _this.form.menuIds = JSON.parse(re.response.menuIds); |
| | | _this.optionsData = _this.form.menuIds; |
| | | console.log(_this.form); |
| | | if (userIds && userIds.length) { |
| | | _this.form.examineeList = userIds.map((item, index) => { |
| | | return { |
| | | id: item, |
| | | realName: userNames && userNames[index] ? userNames[index] : '' |
| | | }; |
| | | }); |
| | | } else { |
| | | _this.form.examineeList = []; |
| | | } |
| | | |
| | | _this.formLoading = false; |
| | | }); |
| | |
| | | }; |
| | | }); |
| | | }); |
| | | |
| | | // this.subjectIdEvent(false) |
| | | }, |
| | | methods: { |
| | | getSubject(deptId) { |
| | | // 获取对应部门的课目 |
| | | subjectApi.selectByDeptId(deptId).then(res => { |
| | | this.form.subjectId = null |
| | | this.subjectFilter = res.response |
| | | }) |
| | | }, |
| | | handleSelection(val) { |
| | | this.student.multipleSelection = val; |
| | | }, |
| | | confirmStudentSelect() { |
| | | this.form.menuIds = this.student.multipleSelection.map((item) => item.id); |
| | | 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.student.multipleSelection = []; |
| | | this.studentDialog = false; |
| | | }, |
| | | getTags() { |
| | |
| | | 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.menuIds.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); |
| | | }); |
| | | }); |
| | | } |
| | | }); |
| | | }, |
| | | cascaderChangeFun(event) { |
| | |
| | | }, |
| | | submitForm() { |
| | | let _this = this; |
| | | console.log(this.subjectIdList); |
| | | console.log(this.form.subjectSource); |
| | | this.$refs.form.validate((valid) => { |
| | | if (valid) { |
| | | const tempForm = JSON.parse(JSON.stringify(this.form)); |
| | |
| | | tempForm.subjectId = tempForm.subjectId; |
| | | }; |
| | | |
| | | let lastHasAll = tempForm.menuIds.find(arr => { |
| | | return arr[0] === 'all'; |
| | | }); |
| | | if (lastHasAll) { |
| | | tempForm.menuIds = tempForm.menuIds.slice(1); |
| | | } |
| | | // let op = []; |
| | | // for(var ele of this.form.menuIds){ |
| | | // op.push(ele[1]) |
| | | // }; |
| | | tempForm.userIds = tempForm.menuIds; |
| | | tempForm.menuIds = JSON.stringify(tempForm.menuIds); |
| | | console.log("laks", this.form); |
| | | // let lastHasAll = tempForm.menuIds.find(arr => { |
| | | // return arr[0] === 'all'; |
| | | // }); |
| | | // if (lastHasAll) { |
| | | // tempForm.menuIds = tempForm.menuIds.slice(1); |
| | | // } |
| | | |
| | | tempForm.menuIds = tempForm.userIds.join(','); |
| | | |
| | | if (tempForm.questionTypeVMS == null) { |
| | | tempForm.questionTypeVMS = []; |
| | | } |