| | |
| | | <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-cascader v-model="form.menuIds" :options="options" @change="cascaderChangeFun" :props="props" clearable collapse-tags>--> |
| | | <!-- </el-cascader>--> |
| | | <all-cascader :options="options" |
| | | :optionsData = "optionsData" |
| | | @change="cascaderChangeFun" |
| | | :width="200"></all-cascader> |
| | | </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="paperType" required > |
| | | <el-select v-model="form.paperType" placeholder="试卷类型" @visible-change="subjectIdEvent" disabled> |
| | | <el-option v-for="item in paperTypeEnum" :key="item.key" :value="item.key" :label="item.value" ></el-option> |
| | | <el-form-item label="部门:" prop="deptId" required> |
| | | <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-select v-model="form.paperType" placeholder="试卷类型" @visible-change="subjectIdEvent" disabled> |
| | | <el-option v-for="item in paperTypeEnum" :key="item.key" :value="item.key" :label="item.value"></el-option> |
| | | </el-select> |
| | | </el-form-item> |
| | | |
| | | <el-form-item label="时间限制:"> |
| | | <el-form-item label="时间限制:" prop="limitDateTime"> |
| | | <el-date-picker v-model="form.limitDateTime" value-format="yyyy-MM-dd HH:mm:ss" type="datetimerange" |
| | | range-separator="至" start-placeholder="开始日期" end-placeholder="结束日期"> |
| | | range-separator="至" start-placeholder="开始日期" end-placeholder="结束日期"> |
| | | </el-date-picker> |
| | | </el-form-item> |
| | | <el-form-item label="试卷名称:" prop="name" required > |
| | | <el-form-item label="试卷名称:" prop="name" required> |
| | | <el-row :gutter="20"> |
| | | <el-col :span="9"> |
| | | <el-input v-model="form.name"/> |
| | | <el-input v-model="form.name" /> |
| | | </el-col> |
| | | <el-col :span="2" v-if="form.paperType==7"> |
| | | <el-col :span="2" v-if="form.paperType == 7"> |
| | | <span>总数分:</span> |
| | | </el-col> |
| | | <el-col :span="9" v-if="form.paperType==7"> |
| | | <el-input disabled v-model="form.aggregateSource"/> |
| | | <el-col :span="9" v-if="form.paperType == 7"> |
| | | <el-input disabled v-model="form.aggregateSource" /> |
| | | </el-col> |
| | | </el-row> |
| | | </el-form-item> |
| | | <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-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"> |
| | | <span>多选题: </span> |
| | | |
| | | </el-col> |
| | | <el-col :span="3"> |
| | | <el-input v-model="form.questionTypeVMS[key].multipleChoice" style="width: 80%"/> |
| | | <el-input v-model="form.questionTypeVMS[key].multipleChoice" style="width: 80%" /> |
| | | </el-col> |
| | | <el-col :span="3" > |
| | | <el-col :span="3"> |
| | | <span>单选题:</span> |
| | | </el-col> |
| | | <el-col :span="3"> |
| | | <el-input v-model="form.questionTypeVMS[key].singleChoice" style="width: 80%"/> |
| | | <el-input v-model="form.questionTypeVMS[key].singleChoice" style="width: 80%" /> |
| | | </el-col> |
| | | <el-col :span="3" > |
| | | <el-col :span="3"> |
| | | <span>判断题:</span> |
| | | </el-col> |
| | | <el-col :span="3"> |
| | | <el-input v-model="form.questionTypeVMS[key].trueFalse" style="width: 80%"/> |
| | | <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-form-item :key="index" :label="'标题'+(index+1)+':'" required v-for="(titleItem,index) in form.titleItems"> |
| | | <el-input v-model="titleItem.name" style="width: 80%"/> |
| | | <el-button v-if="form.paperType!=7" type="text" class="link-left" style="margin-left: 20px" size="mini" @click="addQuestion(titleItem)"> |
| | | <el-form-item :key="index" :label="'标题' + (index + 1) + ':'" required |
| | | v-for="(titleItem, index) in form.titleItems"> |
| | | <el-input v-model="titleItem.name" style="width: 80%" /> |
| | | <el-button v-if="form.paperType != 7" type="text" class="link-left" style="margin-left: 20px" size="mini" |
| | | @click="addQuestion(titleItem)"> |
| | | 添加题目 |
| | | </el-button> |
| | | <el-button type="text" class="link-left" size="mini" @click="form.titleItems.splice(index,1)">删除</el-button> |
| | | <el-card class="exampaper-item-box" v-if="titleItem.questionItems&&titleItem.questionItems.length!==0&&subjectIdList.length<2"> |
| | | <el-form-item :key="questionIndex" :label="'题目'+(questionIndex+1)+':'" |
| | | v-for="(questionItem,questionIndex) in titleItem.questionItems" style="margin-bottom: 15px"> |
| | | <el-button type="text" class="link-left" size="mini" @click="form.titleItems.splice(index, 1)">删除</el-button> |
| | | <el-card class="exampaper-item-box" |
| | | v-if="titleItem.questionItems && titleItem.questionItems.length !== 0 && subjectIdList.length < 2"> |
| | | <el-form-item :key="questionIndex" :label="'题目' + (questionIndex + 1) + ':'" |
| | | v-for="(questionItem, questionIndex) in titleItem.questionItems" style="margin-bottom: 15px"> |
| | | <el-row> |
| | | <el-col :span="23"> |
| | | <QuestionShow :qType="questionItem.questionType" :question="questionItem"/> |
| | | <QuestionShow :qType="questionItem.questionType" :question="questionItem" /> |
| | | </el-col> |
| | | <el-col :span="1"> |
| | | <el-button type="text" size="mini" @click="titleItem.questionItems.splice(questionIndex,1)">删除 |
| | | <el-button type="text" size="mini" @click="titleItem.questionItems.splice(questionIndex, 1)">删除 |
| | | </el-button> |
| | | </el-col> |
| | | </el-row> |
| | |
| | | </el-card> |
| | | </el-form-item> |
| | | <el-form-item label="建议时长:" prop="suggestTime" required> |
| | | <el-input v-model="form.suggestTime" placeholder="分钟"/> |
| | | <el-input v-model="form.suggestTime" placeholder="分钟" /> |
| | | </el-form-item> |
| | | |
| | | <el-form-item> |
| | |
| | | <el-button type="success" @click="addTitle">添加标题</el-button> |
| | | </el-form-item> |
| | | </el-form> |
| | | <el-dialog :visible.sync="questionPage.showDialog" width="70%"> |
| | | <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-input v-model="questionPage.queryParam.id" clearable></el-input> |
| | | </el-form-item> |
| | | <el-form-item label="题型:"> |
| | | <el-select v-model="questionPage.queryParam.questionType" clearable> |
| | | <el-option v-for="item in questionTypeEnum" :key="item.key" :value="item.key" :label="item.value"></el-option> |
| | | <el-option v-for="item in questionTypeEnum" :key="item.key" :value="item.key" |
| | | :label="item.value"></el-option> |
| | | </el-select> |
| | | </el-form-item> |
| | | <el-form-item> |
| | |
| | | </el-form-item> |
| | | </el-form> |
| | | <el-table v-loading="questionPage.listLoading" :data="questionPage.tableData" |
| | | @selection-change="handleSelectionChange" border fit highlight-current-row style="width: 100%"> |
| | | @selection-change="handleSelectionChange" border fit highlight-current-row style="width: 100%"> |
| | | <el-table-column type="selection" width="35"></el-table-column> |
| | | <el-table-column prop="questionType" label="题型" :formatter="questionTypeFormatter" width="70px"/> |
| | | <el-table-column prop="shortTitle" label="题干" show-overflow-tooltip/> |
| | | <el-table-column prop="questionType" label="题型" :formatter="questionTypeFormatter" width="70px" /> |
| | | <el-table-column prop="shortTitle" label="题干" show-overflow-tooltip /> |
| | | </el-table> |
| | | <pagination v-show="questionPage.total>0" :total="questionPage.total" |
| | | :page.sync="questionPage.queryParam.pageIndex" :limit.sync="questionPage.queryParam.pageSize" |
| | | @pagination="search"/> |
| | | <pagination v-show="questionPage.total > 0" :total="questionPage.total" |
| | | :page.sync="questionPage.queryParam.pageIndex" :limit.sync="questionPage.queryParam.pageSize" |
| | | @pagination="search" /> |
| | | <span slot="footer" class="dialog-footer"> |
| | | <el-button @click="questionPage.showDialog = false">取 消</el-button> |
| | | <el-button type="primary" @click="confirmQuestionSelect">确定</el-button> |
| | | </span> |
| | | <el-button @click="questionPage.showDialog = false">取 消</el-button> |
| | | <el-button type="primary" @click="confirmQuestionSelect">确定</el-button> |
| | | </span> |
| | | </el-dialog> |
| | | |
| | | <el-dialog :visible.sync="studentDialog" width="70%"> |
| | | <el-form :model="student" ref="queryForm" :inline="true"> |
| | | <el-form-item label="标签:"> |
| | | <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> |
| | | <el-form-item label="部门:"> |
| | | <el-select v-model="student.deptIds" clearable multiple> |
| | | <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> |
| | | <el-button type="primary" @click="selectStudent">查询</el-button> |
| | | </el-form-item> |
| | | </el-form> |
| | | <el-table ref="multipleTable" v-loading="student.listLoading" :data="tableData" border fit highlight-current-row |
| | | style="width: 100%" @selection-change="handleSelection" row-key="id"> |
| | | <el-table-column type="selection" :reserve-selection="true"></el-table-column> |
| | | <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" /> |
| | | <span slot="footer" class="dialog-footer"> |
| | | <el-button @click="studentDialog = false">取 消</el-button> |
| | | <el-button type="primary" @click="confirmStudentSelect">确定</el-button> |
| | | </span> |
| | | </el-dialog> |
| | | </div> |
| | | </template> |
| | | |
| | | <script> |
| | | |
| | | import { mapGetters, mapState, mapActions } from 'vuex' |
| | | import Pagination from '@/components/Pagination' |
| | | import QuestionShow from '../question/components/Show' |
| | | import examPaperApi from '@/api/examPaper' |
| | | import questionApi from '@/api/question' |
| | | import departmentApi from '@/api/department' |
| | | import allCascader from '@/components/Cascader' |
| | | import { mapGetters, mapState, mapActions } from 'vuex'; |
| | | 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'; |
| | | import allCascader from '@/components/Cascader'; |
| | | export default { |
| | | components: { Pagination, QuestionShow ,allCascader}, |
| | | components: { Pagination, QuestionShow, allCascader }, |
| | | |
| | | data () { |
| | | data() { |
| | | return { |
| | | tags: [], |
| | | studentDialog: false, |
| | | student: { |
| | | deptIds: [], |
| | | pageIndex: 1, |
| | | pageSize: 5, |
| | | listLoading: true, |
| | | multipleSelection: [], |
| | | excludeTagIds: [] |
| | | }, |
| | | isFirstShow: true, |
| | | |
| | | tableData: [], |
| | | total: 0, |
| | | props: { |
| | | multiple: true |
| | | // lazy: true, |
| | |
| | | // }) |
| | | // } |
| | | }, |
| | | depts: [], |
| | | options: [], |
| | | optionsData:[], |
| | | departCascaderProps:{ |
| | | optionsData: [], |
| | | departCascaderProps: { |
| | | multiple: true |
| | | }, |
| | | subjectIdList:[], |
| | | subjectIdList: [], |
| | | form: { |
| | | aggregateSource:'100', |
| | | aggregateSource: '100', |
| | | id: null, |
| | | departmentIds: [], |
| | | menuIds:[], |
| | | menuIds: [], |
| | | subjectId: [], |
| | | paperType: 7, |
| | | limitDateTime: [], |
| | | name: '', |
| | | suggestTime: null, |
| | | titleItems: [], |
| | | subjectSource:{}, |
| | | questionTypeVMS:[] |
| | | subjectSource: {}, |
| | | questionTypeVMS: [], |
| | | examineeList: [], |
| | | userIds: [] |
| | | }, |
| | | subjectFilter: null, |
| | | formLoading: false, |
| | | rules: { |
| | | |
| | | userIds: [ |
| | | { required: true, message: '请选择考生', trigger: 'change' } |
| | | ], |
| | | subjectId: [ |
| | | { required: true, message: '请选择课目', trigger: 'change' } |
| | | ], |
| | | deptId: [ |
| | | { required: true, message: '请选择部门', trigger: 'change' } |
| | | ], |
| | | paperType: [ |
| | | { required: true, message: '请选择试卷类型', trigger: 'change' } |
| | | ], |
| | | name: [ |
| | | { required: true, message: '请输入试卷名称', trigger: 'blur' } |
| | | ], |
| | | limitDateTime: [ |
| | | { required: true, message: '请选择时间限制', trigger: 'blur' } |
| | | ], |
| | | suggestTime: [ |
| | | { required: true, message: '请输入建议时长', trigger: 'blur' } |
| | |
| | | total: 0 |
| | | }, |
| | | currentTitleItem: null |
| | | } |
| | | }; |
| | | }, |
| | | created () { |
| | | created() { |
| | | examPaperApi.selflist().then(res => { |
| | | console.log(res) |
| | | this.subjectFilter = res.response |
| | | }) |
| | | console.log(res); |
| | | this.subjectFilter = res.response; |
| | | }); |
| | | departmentApi.list().then(res => { |
| | | this.depts = res.response; |
| | | }); |
| | | }, |
| | | async mounted () { |
| | | async mounted() { |
| | | |
| | | let id = this.$route.query.id |
| | | let _this = this |
| | | let id = this.$route.query.id; |
| | | let _this = this; |
| | | |
| | | this.initSubject(function () { |
| | | _this.subjectFilter = _this.subjects |
| | | }) |
| | | if (id && parseInt(id) !== 0) { |
| | | _this.formLoading = true |
| | | await examPaperApi.selfselect(id).then(re => { |
| | | _this.form = re.response |
| | | _this.form.menuIds = JSON.parse(re.response.menuIds) |
| | | _this.optionsData = _this.form.menuIds |
| | | console.log(_this.form) |
| | | |
| | | _this.formLoading = false |
| | | }) |
| | | } |
| | | departmentApi.selectDepartmentUser().then(res => { |
| | | console.log("res", res); |
| | | |
| | | _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 } |
| | | }) |
| | | } |
| | | }) |
| | | }) |
| | | |
| | | // this.subjectIdEvent(false) |
| | | }, |
| | | methods: { |
| | | cascaderChangeFun(event){ |
| | | console.log(event) |
| | | this.form.menuIds = event |
| | | }, |
| | | titlejs(val){ |
| | | console.log(val) |
| | | let str = '' |
| | | this.subjectFilter.forEach(item=>{ |
| | | if (item.id == val){ |
| | | str = item.name |
| | | this.initSubject(function () { |
| | | _this.subjectFilter = _this.subjects; |
| | | }); |
| | | if (id && parseInt(id) !== 0) { |
| | | _this.formLoading = true; |
| | | await examPaperApi.selfselect(id).then(re => { |
| | | const { userIds, userNames } = re.response; |
| | | _this.form = re.response; |
| | | if (userIds && userIds.length) { |
| | | _this.form.examineeList = userIds.map((item, index) => { |
| | | return { |
| | | id: item, |
| | | realName: userNames && userNames[index] ? userNames[index] : '' |
| | | }; |
| | | }); |
| | | } else { |
| | | _this.form.examineeList = []; |
| | | } |
| | | }) |
| | | return str |
| | | }, |
| | | subjectIdEvent(e){ |
| | | console.log(e,this.$refs.subjectIdRef.selected) |
| | | let arr=[] |
| | | if (e){ |
| | | |
| | | }else { |
| | | this.$refs.subjectIdRef.selected.forEach(item=>{ |
| | | arr.push({ |
| | | label:item.label, |
| | | subjectId:item.value, |
| | | singleChoice:'', |
| | | multipleChoice:'', |
| | | trueFalse:'' |
| | | _this.formLoading = false; |
| | | }); |
| | | } |
| | | departmentApi.selectDepartmentUser().then(res => { |
| | | console.log("res", res); |
| | | |
| | | _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 }; |
| | | }) |
| | | }) |
| | | console.log(arr) |
| | | this.form.questionTypeVMS = arr |
| | | }; |
| | | }); |
| | | }); |
| | | }, |
| | | 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.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() { |
| | | userApi.tagList(null).then(data => { |
| | | this.tags = data.response; |
| | | }); |
| | | }, |
| | | selectStudent() { |
| | | 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; |
| | | if (this.studentDialog && this.isFirstShow) { |
| | | this.isFirstShow = false; |
| | | this.form.examineeList.forEach(item => { |
| | | this.$refs.multipleTable.toggleRowSelection(item, true); |
| | | }); |
| | | } |
| | | }); |
| | | }, |
| | | cascaderChangeFun(event) { |
| | | console.log(event); |
| | | this.form.menuIds = event; |
| | | }, |
| | | titlejs(val) { |
| | | console.log(val); |
| | | let str = ''; |
| | | this.subjectFilter.forEach(item => { |
| | | if (item.id == val) { |
| | | str = item.name; |
| | | } |
| | | }); |
| | | return str; |
| | | }, |
| | | subjectIdEvent(e) { |
| | | console.log(e, this.$refs.subjectIdRef.selected); |
| | | let arr = []; |
| | | if (e) { |
| | | |
| | | } else { |
| | | this.$refs.subjectIdRef.selected.forEach(item => { |
| | | arr.push({ |
| | | label: item.label, |
| | | subjectId: item.value, |
| | | singleChoice: '', |
| | | multipleChoice: '', |
| | | trueFalse: '' |
| | | }); |
| | | }); |
| | | console.log(arr); |
| | | this.form.questionTypeVMS = arr; |
| | | } |
| | | |
| | | if (this.form.paperType ==7){ |
| | | if (this.form.paperType == 7) { |
| | | //說明是隨機 |
| | | this.subjectIdList = arr |
| | | let obj1={} |
| | | let arr1 = [] |
| | | arr.forEach((item,index)=>{ |
| | | this.subjectIdList = arr; |
| | | let obj1 = {}; |
| | | let arr1 = []; |
| | | arr.forEach((item, index) => { |
| | | // obj1[item.id]='' |
| | | arr1.push({ |
| | | subjectId:item.id, |
| | | singleChoice:'', |
| | | multipleChoice:'', |
| | | trueFalse:'' |
| | | }) |
| | | subjectId: item.id, |
| | | singleChoice: '', |
| | | multipleChoice: '', |
| | | trueFalse: '' |
| | | }); |
| | | // let obj={ |
| | | // item |
| | | // } |
| | |
| | | // console.log('键名:', i); |
| | | // console.log('键值:', obj[i]); |
| | | // } |
| | | }) |
| | | this.form.subjectSource = obj1 |
| | | }); |
| | | this.form.subjectSource = obj1; |
| | | |
| | | console.log(this.form.subjectSource) |
| | | console.log(this.form.questionTypeVMS) |
| | | console.log(this.form.subjectSource); |
| | | console.log(this.form.questionTypeVMS); |
| | | // this.form.paperType = 7 |
| | | this.form.titleItems = [] |
| | | }else { |
| | | this.form.subjectSource={} |
| | | this.subjectIdList = [] |
| | | this.form.titleItems = []; |
| | | } else { |
| | | this.form.subjectSource = {}; |
| | | this.subjectIdList = []; |
| | | // this.form.paperType = 1 |
| | | } |
| | | }, |
| | | submitForm () { |
| | | let _this = this |
| | | console.log(this.subjectIdList) |
| | | console.log(this.form.subjectSource) |
| | | submitForm() { |
| | | let _this = this; |
| | | this.$refs.form.validate((valid) => { |
| | | if (valid) { |
| | | const tempForm = JSON.parse(JSON.stringify(this.form)); |
| | | this.formLoading = true; |
| | | if (this.subjectIdList.length == 1){ |
| | | this.form.subjectId= this.form.subjectId |
| | | if (this.subjectIdList.length == 1) { |
| | | tempForm.subjectId = tempForm.subjectId; |
| | | }; |
| | | |
| | | let lastHasAll = this.form.menuIds.find(arr => { |
| | | return arr[0] === 'all'; |
| | | }); |
| | | if (lastHasAll){ |
| | | this.form.menuIds = this.form.menuIds.slice(1) |
| | | // 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 = []; |
| | | } |
| | | let op = []; |
| | | 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){ |
| | | this.form.questionTypeVMS = []; |
| | | } |
| | | this.form.status = 0 |
| | | examPaperApi.selfedit(this.form).then(re => { |
| | | tempForm.status = 0; |
| | | examPaperApi.selfedit(tempForm).then(re => { |
| | | if (re.code === 1) { |
| | | _this.$message.success(re.message) |
| | | _this.$message.success(re.message); |
| | | _this.delCurrentView(_this).then(() => { |
| | | _this.$router.push('/exam/personalRandomTemplate/list') |
| | | }) |
| | | _this.$router.push('/exam/personalRandomTemplate/list'); |
| | | }); |
| | | } else { |
| | | _this.$message.error(re.message) |
| | | this.formLoading = false |
| | | _this.$message.error(re.message); |
| | | this.formLoading = false; |
| | | } |
| | | }).catch(e => { |
| | | this.formLoading = false |
| | | }) |
| | | this.formLoading = false; |
| | | }); |
| | | } else { |
| | | return false |
| | | return false; |
| | | } |
| | | }) |
| | | }); |
| | | }, |
| | | addTitle () { |
| | | addTitle() { |
| | | this.form.titleItems.push({ |
| | | name: '', |
| | | questionItems: [] |
| | | }) |
| | | }); |
| | | }, |
| | | addQuestion (titleItem) { |
| | | this.currentTitleItem = titleItem |
| | | this.questionPage.showDialog = true |
| | | this.search() |
| | | addQuestion(titleItem) { |
| | | this.currentTitleItem = titleItem; |
| | | this.questionPage.showDialog = true; |
| | | this.search(); |
| | | }, |
| | | removeTitleItem (titleItem) { |
| | | this.form.titleItems.remove(titleItem) |
| | | removeTitleItem(titleItem) { |
| | | this.form.titleItems.remove(titleItem); |
| | | }, |
| | | removeQuestion (titleItem, questionItem) { |
| | | titleItem.questionItems.remove(questionItem) |
| | | removeQuestion(titleItem, questionItem) { |
| | | titleItem.questionItems.remove(questionItem); |
| | | }, |
| | | queryForm () { |
| | | this.questionPage.queryParam.pageIndex = 1 |
| | | this.search() |
| | | queryForm() { |
| | | this.questionPage.queryParam.pageIndex = 1; |
| | | this.search(); |
| | | }, |
| | | confirmQuestionSelect () { |
| | | let _this = this |
| | | confirmQuestionSelect() { |
| | | let _this = this; |
| | | this.questionPage.multipleSelection.forEach(q => { |
| | | questionApi.select(q.id).then(re => { |
| | | _this.currentTitleItem.questionItems.push(re.response) |
| | | }) |
| | | }) |
| | | this.questionPage.showDialog = false |
| | | _this.currentTitleItem.questionItems.push(re.response); |
| | | }); |
| | | }); |
| | | this.questionPage.showDialog = false; |
| | | }, |
| | | levelChange () { |
| | | levelChange() { |
| | | // this.form.subjectId = null |
| | | // this.subjectFilter = this.subjects.filter(data =>{ |
| | | // return this.form.departmentIds.forEach(item=>{data.level == item}) |
| | |
| | | // } |
| | | // }) |
| | | // }) |
| | | console.log(this.subjects,this.form.departmentIds) |
| | | console.log(this.subjects, this.form.departmentIds); |
| | | // this.subjectFilter = this.subjects |
| | | }, |
| | | search () { |
| | | if (this.subjectIdList.length=1){ |
| | | this.questionPage.queryParam.subjectId = this.form.subjectId |
| | | search() { |
| | | if (this.subjectIdList.length = 1) { |
| | | this.questionPage.queryParam.subjectId = this.form.subjectId; |
| | | } |
| | | |
| | | this.questionPage.listLoading = true |
| | | this.questionPage.listLoading = true; |
| | | questionApi.pageList(this.questionPage.queryParam).then(data => { |
| | | const re = data.response |
| | | this.questionPage.tableData = re.list |
| | | this.questionPage.total = re.total |
| | | this.questionPage.queryParam.pageIndex = re.pageNum |
| | | this.questionPage.listLoading = false |
| | | }) |
| | | const re = data.response; |
| | | this.questionPage.tableData = re.list; |
| | | this.questionPage.total = re.total; |
| | | this.questionPage.queryParam.pageIndex = re.pageNum; |
| | | this.questionPage.listLoading = false; |
| | | }); |
| | | }, |
| | | handleSelectionChange (val) { |
| | | this.questionPage.multipleSelection = val |
| | | handleSelectionChange(val) { |
| | | this.questionPage.multipleSelection = val; |
| | | }, |
| | | questionTypeFormatter (row, column, cellValue, index) { |
| | | return this.enumFormat(this.questionTypeEnum, cellValue) |
| | | questionTypeFormatter(row, column, cellValue, index) { |
| | | return this.enumFormat(this.questionTypeEnum, cellValue); |
| | | }, |
| | | subjectFormatter (row, column, cellValue, index) { |
| | | return this.subjectEnumFormat(cellValue) |
| | | subjectFormatter(row, column, cellValue, index) { |
| | | return this.subjectEnumFormat(cellValue); |
| | | }, |
| | | resetForm () { |
| | | let lastId = this.form.id |
| | | this.$refs['form'].resetFields() |
| | | this.form= { |
| | | aggregateSource:100, |
| | | resetForm() { |
| | | let lastId = this.form.id; |
| | | this.$refs['form'].resetFields(); |
| | | this.form = { |
| | | aggregateSource: 100, |
| | | id: null, |
| | | departmentIds: [], |
| | | subjectId: [], |
| | |
| | | name: '', |
| | | suggestTime: null, |
| | | titleItems: [], |
| | | subjectSource:null, |
| | | questionTypeVMS:[] |
| | | } |
| | | this.form.id = lastId |
| | | subjectSource: null, |
| | | questionTypeVMS: [] |
| | | }; |
| | | this.form.id = lastId; |
| | | }, |
| | | ...mapActions('exam', { initSubject: 'initSubject' }), |
| | | ...mapActions('tagsView', { delCurrentView: 'delCurrentView' }), |
| | |
| | | }), |
| | | ...mapState('exam', { subjects: state => state.subjects }) |
| | | } |
| | | } |
| | | }; |
| | | </script> |
| | | |
| | | <style lang="scss"> |
| | |
| | | .q-title { |
| | | margin: 0px 5px 0px 5px; |
| | | } |
| | | .q-item-content { |
| | | } |
| | | |
| | | .q-item-content {} |
| | | } |
| | | |
| | | .examinee-popper { |
| | | display: none !important; |
| | | } |
| | | </style> |