| | |
| | | <template> |
| | | <div class="app-container"> |
| | | <el-form :model="form" ref="form" label-width="200px" v-loading="formLoading" :rules="rules"> |
| | | <el-form-item label="考生:" prop="userIds" required> |
| | | <el-cascader v-model="form.userIds" :options="options" :props="props" clearable collapse-tags> |
| | | <el-form-item label="考生:" prop="menuIds" required> |
| | | <el-cascader v-model="form.menuIds" :options="options" :props="props" @change="handleChange" clearable collapse-tags> |
| | | </el-cascader> |
| | | </el-form-item> |
| | | <el-form-item label="课目:" prop="subjectId" required> |
| | |
| | | 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="deptId" required> |
| | | <el-select v-model="form.deptId" collapse-tags 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="paperType" required> |
| | |
| | | components: { Pagination, QuestionShow }, |
| | | data () { |
| | | return { |
| | | props: { |
| | | depts: [], |
| | | props: { |
| | | multiple: true |
| | | // lazy: true, |
| | | // lazyLoad (node, resolve) { |
| | |
| | | subjectFilter: null, |
| | | formLoading: false, |
| | | rules: { |
| | | userIds: [ |
| | | menuIds: [ |
| | | { required: true, message: '请选择', trigger: 'change' } |
| | | ], |
| | | subjectId: [ |
| | | { required: true, message: '请选择课目', trigger: 'change' } |
| | | ], |
| | | deptId: [ |
| | | { required: true, message: '请选择部门', trigger: 'change' } |
| | | ], |
| | | paperType: [ |
| | | { required: true, message: '请选择试卷类型', trigger: 'change' } |
| | |
| | | _this.formLoading = true |
| | | examPaperApi.select(id).then(re => { |
| | | _this.form = re.response |
| | | _this.form.userIds = re.response.userId |
| | | _this.form.menuIds = JSON.parse(re.response.menuIds) |
| | | console.log(_this.form) |
| | | _this.formLoading = false |
| | | }) |
| | |
| | | |
| | | _this.options = res.response.map(x=>{return{value:x.department.id,label:x.department.name,children:x.userList.map(xx=>{return{value: xx.id,label: xx.realName}})}}) |
| | | }) |
| | | departmentApi.getDeptAdmins().then(res => { |
| | | this.depts = res.response |
| | | }) |
| | | }, |
| | | methods: { |
| | | handleChange(val){ |
| | | console.log(val) |
| | | }, |
| | | titlejs(val){ |
| | | console.log(val) |
| | | let str = '' |
| | |
| | | }else { |
| | | this.form.subjectSource={} |
| | | this.subjectIdList = [] |
| | | this.form.questionTypeVMS=[] |
| | | // this.form.paperType = 1 |
| | | } |
| | | }, |
| | | submitForm () { |
| | | let _this = this |
| | | console.log(this.subjectIdList) |
| | | console.log(this.form.subjectSource) |
| | | this.$refs.form.validate((valid) => { |
| | | if (valid) { |
| | | this.formLoading = true; |
| | |
| | | this.form.subjectId= this.form.subjectId |
| | | }; |
| | | let op = []; |
| | | for(var ele of this.form.userIds){ |
| | | for(var ele of this.form.menuIds){ |
| | | op.push(ele[1]) |
| | | }; |
| | | this.form.menuIds = JSON.stringify(this.form.menuIds); |
| | | this.form.userIds = op; |
| | | console.log("laks",this.form) |
| | | if(this.form.questionTypeVMS == null){ |
| | |
| | | }) |
| | | }, |
| | | addQuestion (titleItem) { |
| | | console.log('titleItem', titleItem) |
| | | this.currentTitleItem = titleItem |
| | | this.questionPage.showDialog = true |
| | | this.search() |
| | |
| | | let _this = this |
| | | this.questionPage.multipleSelection.forEach(q => { |
| | | questionApi.select(q.id).then(re => { |
| | | _this.currentTitleItem.questionItems.push(re.response) |
| | | if (!_this.currentTitleItem.questionItems.some(obj => obj.id === re.response.id)) { |
| | | _this.currentTitleItem.questionItems.push(re.response) |
| | | } |
| | | }) |
| | | }) |
| | | this.questionPage.showDialog = false |