| | |
| | | <div class="app-container"> |
| | | <div style="display: flex; flex-direction: row"> |
| | | <div> |
| | | <el-button type="primary" size="small" style="margin-right: 10px" @click="openAdd">安排考试</el-button> |
| | | <el-button |
| | | type="primary" |
| | | size="small" |
| | | style="margin-right: 10px" |
| | | @click="openAdd" |
| | | >安排考试</el-button |
| | | > |
| | | </div> |
| | | <div> |
| | | <el-form :inline="true" :model="searchForm" class="demo-form-inline"> |
| | | <el-form-item label="考试名称"> |
| | | <el-input v-model="searchForm.examName" @input="page" clearable size="small" @clear="page" |
| | | placeholder="班级名称"></el-input> |
| | | <el-input |
| | | v-model="searchForm.examName" |
| | | @input="page" |
| | | clearable |
| | | size="small" |
| | | @clear="page" |
| | | placeholder="考试名称" |
| | | ></el-input> |
| | | </el-form-item> |
| | | <el-form-item label="参考班级"> |
| | | <el-select v-model="searchForm.classesId" @change="page" clearable size="small" @clear="page"> |
| | | <el-option v-for="classes in classesList" :key="classes.id" :value="classes.id" |
| | | :label="classes.className"/> |
| | | <el-select |
| | | v-model="searchForm.classesId" |
| | | @change="page" |
| | | clearable |
| | | size="small" |
| | | @clear="page" |
| | | > |
| | | <el-option |
| | | v-for="classes in classesList" |
| | | :key="classes.id" |
| | | :value="classes.id" |
| | | :label="classes.className" |
| | | /> |
| | | </el-select> |
| | | </el-form-item> |
| | | <el-form-item> |
| | | <el-button type="primary" @click="page" size="small">查询</el-button> |
| | | <el-button type="primary" @click="page" size="small" |
| | | >查询</el-button |
| | | > |
| | | </el-form-item> |
| | | </el-form> |
| | | </div> |
| | |
| | | prop="status" |
| | | :formatter="statusFormatter" |
| | | ></el-table-column> |
| | | <el-table-column |
| | | label="考试时间" |
| | | width="180px" |
| | | algin="center" |
| | | > |
| | | <el-table-column label="考试时间" width="180px" algin="center"> |
| | | <template slot-scope="scope"> |
| | | <div>{{ scope.row.startTime }}</div> |
| | | <div>至</div> |
| | |
| | | @click="handlerEdit(scope.row)" |
| | | v-if="scope.row.status === 'not_start'" |
| | | v-show="scope.row.status !== 'cancel'" |
| | | >修改 |
| | | >修改 |
| | | </el-button> |
| | | <el-popconfirm |
| | | v-if="scope.row.status === 'not_start'" |
| | | v-show="scope.row.status !== 'cancel'" |
| | | style="margin: 0 5px" |
| | | title="确定要删除该考试吗?" |
| | | @confirm="deleteExam(scope.row.id)" |
| | | @confirm="deleteExam(scope.row)" |
| | | > |
| | | <el-button slot="reference" type="danger" size="small" v-show="scope.row.status !== 'cancel'">删除</el-button> |
| | | <el-button |
| | | slot="reference" |
| | | type="danger" |
| | | size="small" |
| | | v-show="scope.row.status !== 'cancel'" |
| | | >删除</el-button |
| | | > |
| | | </el-popconfirm> |
| | | |
| | | <el-button v-if="scope.row.status === 'finished'" type="success" size="small" @click="markPaper(scope.row)" v-show="scope.row.status !== 'cancel'"> |
| | | <el-button |
| | | v-if="scope.row.status === 'finished'" |
| | | type="success" |
| | | size="small" |
| | | @click="markPaper(scope.row)" |
| | | v-show="scope.row.status !== 'cancel'" |
| | | > |
| | | 阅卷 |
| | | </el-button> |
| | | <el-button v-if="scope.row.status === 'ing'" type="warning" size="small" @click="monitor(scope.row)" v-show="scope.row.status !== 'cancel'">监控</el-button> |
| | | <el-button |
| | | v-if="scope.row.status === 'ing'" |
| | | type="warning" |
| | | size="small" |
| | | @click="monitor(scope.row)" |
| | | v-show="scope.row.status !== 'cancel'" |
| | | >监控</el-button |
| | | > |
| | | <el-popconfirm |
| | | class="confirm" |
| | | style="margin: 0 5px" |
| | | title="确定要作废该考试记录吗?" |
| | | @confirm="cancel(scope.row.id)" |
| | | > |
| | | <el-button slot="reference" v-show="scope.row.status !== 'cancel'" type="danger" |
| | | size="small" |
| | | v-if="scope.row.status !== 'ing'">作废 |
| | | <el-button |
| | | slot="reference" |
| | | v-show="scope.row.status !== 'cancel'" |
| | | type="danger" |
| | | size="small" |
| | | v-if="scope.row.status !== 'ing'" |
| | | >作废 |
| | | </el-button> |
| | | </el-popconfirm> |
| | | <el-popconfirm |
| | |
| | | title="确定要恢复该考试记录吗?" |
| | | @confirm="recover(scope.row.id)" |
| | | > |
| | | <el-button slot="reference" v-show="scope.row.status === 'cancel'" type="success" |
| | | size="small">恢复正常 |
| | | <el-button |
| | | slot="reference" |
| | | v-show="scope.row.status === 'cancel'" |
| | | type="success" |
| | | size="small" |
| | | >恢复正常 |
| | | </el-button> |
| | | </el-popconfirm> |
| | | </template> |
| | | </el-table-column> |
| | | </el-table> |
| | | <div |
| | | class="flex" |
| | | style="justify-content:center;margin-top:20px;" |
| | | > |
| | | <pagination v-show="total>0" :total="total" :page.sync="searchForm.pageIndex" :limit.sync="searchForm.pageSize" |
| | | @pagination="page"/> |
| | | <div class="flex" style="justify-content: center; margin-top: 20px"> |
| | | <pagination |
| | | v-show="total > 0" |
| | | :total="total" |
| | | :page.sync="searchForm.currentPage" |
| | | :limit.sync="searchForm.pageSize" |
| | | @pagination="page" |
| | | /> |
| | | </div> |
| | | <el-dialog width="500px" :title="title" @close="closeHandler" :visible.sync="open" :destroy-on-close="true" |
| | | :append-to-body="true" :close-on-click-modal="false"> |
| | | <el-dialog |
| | | width="500px" |
| | | :title="title" |
| | | @close="closeHandler" |
| | | :visible.sync="open" |
| | | :destroy-on-close="true" |
| | | :append-to-body="true" |
| | | :close-on-click-modal="false" |
| | | > |
| | | <el-form :model="examForm" :rules="examRules" ref="examForm"> |
| | | <el-form-item label="考试名称" :label-width="formLabelWidth" prop="examName"> |
| | | <el-form-item |
| | | label="考试名称" |
| | | :label-width="formLabelWidth" |
| | | prop="examName" |
| | | > |
| | | <el-input v-model="examForm.examName" autocomplete="off"></el-input> |
| | | </el-form-item> |
| | | <el-form-item label="参考班级" :label-width="formLabelWidth" prop="classesId"> |
| | | <el-form-item |
| | | label="参考班级" |
| | | :label-width="formLabelWidth" |
| | | prop="classesId" |
| | | > |
| | | <el-select v-model="examForm.classesId"> |
| | | <el-option v-for="classes in classesList" :key="classes.id" :value="classes.id" :label="classes.className"/> |
| | | <el-option |
| | | v-for="classes in classesList" |
| | | :key="classes.id" |
| | | :value="classes.id" |
| | | :label="classes.className" |
| | | /> |
| | | </el-select> |
| | | </el-form-item> |
| | | <el-form-item label="试卷类型" :label-width="formLabelWidth" prop="examPaperType"> |
| | | <el-select v-model="examForm.examPaperType" @change="getMyExamPaperList"> |
| | | <el-form-item |
| | | label="试卷类型" |
| | | :label-width="formLabelWidth" |
| | | prop="examPaperType" |
| | | > |
| | | <el-select |
| | | v-model="examForm.examPaperType" |
| | | @change="getMyExamPaperList" |
| | | > |
| | | <el-option label="固定试卷" :value="1"></el-option> |
| | | <el-option label="随机试卷" :value="2"></el-option> |
| | | <el-option label="随序试卷" :value="3"></el-option> |
| | | </el-select> |
| | | </el-form-item> |
| | | <el-form-item label="考试试卷" :label-width="formLabelWidth" prop="examPaperId"> |
| | | <el-select v-model="examForm.examPaperId" :disabled="!examForm.examPaperType" placeholder="请先选择试卷类型"> |
| | | <el-option v-for="examPaper in examPaperList" :key="examPaper.id" :value="examPaper.id" |
| | | :label="examPaper.name"/> |
| | | <el-form-item |
| | | label="考试试卷" |
| | | :label-width="formLabelWidth" |
| | | prop="examPaperId" |
| | | > |
| | | <el-select |
| | | @change="handleExamPaperSelect" |
| | | v-model="examForm.examPaperId" |
| | | :disabled="!examForm.examPaperType" |
| | | placeholder="请先选择试卷类型" |
| | | > |
| | | <el-option |
| | | v-for="examPaper in examPaperList" |
| | | :key="examPaper.id" |
| | | :value="examPaper.id" |
| | | :label="examPaper.name" |
| | | /> |
| | | </el-select> |
| | | </el-form-item> |
| | | <el-form-item label="开始时间" :label-width="formLabelWidth" prop="time"> |
| | | <el-form-item v-show="examForm.examPaperId" label="考试时长"> |
| | | <div>{{ selectExamPaper.suggestTime }}分钟</div> |
| | | </el-form-item> |
| | | <el-form-item |
| | | label="开始时间" |
| | | :label-width="formLabelWidth" |
| | | prop="time" |
| | | > |
| | | <el-date-picker |
| | | v-model="examForm.time" |
| | | type="datetimerange" |
| | |
| | | > |
| | | </el-date-picker> |
| | | </el-form-item> |
| | | <el-form-item label="考试地点" :label-width="formLabelWidth" prop="examPlace"> |
| | | <el-form-item |
| | | label="考试地点" |
| | | :label-width="formLabelWidth" |
| | | prop="examPlace" |
| | | > |
| | | <el-input v-model="examForm.examPlace" autocomplete="off"></el-input> |
| | | </el-form-item> |
| | | </el-form> |
| | |
| | | |
| | | <script> |
| | | import Pagination from '@/components/Pagination' |
| | | import { getExams, addExam, editExam, deleteExamById, cancel, recover } from '@/api/exam' |
| | | import { |
| | | getExams, |
| | | addExam, |
| | | editExam, |
| | | deleteExamById, |
| | | cancel, |
| | | recover |
| | | } from '@/api/exam' |
| | | import { myClasses } from '@/api/classes' |
| | | import examPaperAPI from '@/api/examPaper' |
| | | |
| | |
| | | endTime: null, |
| | | time: [] |
| | | }, |
| | | selectExamPaper: {}, |
| | | examRules: { |
| | | examName: [ |
| | | { required: true, message: '请输入考试名称', trigger: 'blur' } |
| | |
| | | searchForm: { |
| | | examName: '', |
| | | subject: null, |
| | | pageIndex: 1, |
| | | currentPage: 1, |
| | | pageSize: 10 |
| | | }, |
| | | tableData: [] |
| | |
| | | methods: { |
| | | // 作废考试 |
| | | cancel (id) { |
| | | cancel(id).then(res => { |
| | | cancel(id).then((res) => { |
| | | this.$message.success(res.data.message) |
| | | this.page() |
| | | }) |
| | | }, |
| | | // 恢复考试 |
| | | recover (id) { |
| | | recover(id).then(res => { |
| | | recover(id).then((res) => { |
| | | this.$message.success(res.data.message) |
| | | this.page() |
| | | }) |
| | |
| | | }, |
| | | markPaper (row) { |
| | | // 跳转阅卷页面 |
| | | this.$router.push({ path: '/exam/mark/paper', query: { examName: row.examName, examId: row.id } }) |
| | | this.$router.push({ |
| | | path: '/exam/mark/paper', |
| | | query: { examName: row.examName, examId: row.id } |
| | | }) |
| | | }, |
| | | timeFormatter (row) { |
| | | return row.startTime + '至' + row.endTime |
| | |
| | | }, |
| | | MyExamPaperList () { |
| | | let param = { |
| | | 'paperType': this.examForm.examPaperType |
| | | paperType: this.examForm.examPaperType |
| | | } |
| | | examPaperAPI.myExamPaperList(param).then(res => { |
| | | examPaperAPI.myExamPaperList(param).then((res) => { |
| | | this.examForm.examPaperId = null |
| | | this.examPaperList = res.data |
| | | }) |
| | |
| | | this.MyExamPaperList() |
| | | }, |
| | | getMyClasses () { |
| | | myClasses().then(res => { |
| | | myClasses().then((res) => { |
| | | this.classesList = res.data.data |
| | | }) |
| | | }, |
| | |
| | | cancelButtonText: '取消', |
| | | type: 'warning' |
| | | }).then(() => { |
| | | deleteExamById(row.id).then(res => { |
| | | deleteExamById(row.id).then((res) => { |
| | | this.$message.success('删除成功') |
| | | this.page() |
| | | }) |
| | |
| | | this.examForm.startTime = this.examForm.time[0] |
| | | this.examForm.endTime = this.examForm.time[1] |
| | | if (this.examForm.id) { |
| | | editExam(this.examForm).then(res => { |
| | | editExam(this.examForm).then((res) => { |
| | | this.open = false |
| | | this.clearForm() |
| | | this.$message.success('操作成功') |
| | | this.page() |
| | | }) |
| | | } else { |
| | | addExam(this.examForm).then(res => { |
| | | addExam(this.examForm).then((res) => { |
| | | this.open = false |
| | | this.clearForm() |
| | | this.$message.success('操作成功') |
| | |
| | | this.title = this.examForm.id ? '修改考试' : '安排考试' |
| | | this.open = true |
| | | }, |
| | | formatterType (row) { |
| | | }, |
| | | formatterType (row) {}, |
| | | page () { |
| | | getExams(this.searchForm).then(res => { |
| | | getExams(this.searchForm).then((res) => { |
| | | this.tableData = res.data.data |
| | | this.total = res.data.total |
| | | }) |
| | |
| | | routerTo (url) { |
| | | this.$router.push(url) |
| | | }, |
| | | handleExamPaperSelect (e) { |
| | | this.selectExamPaper = this.examPaperList.find((o) => o.id === e) |
| | | } |
| | | } |
| | | } |
| | | </script> |