| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297 |
- <template>
- <div class="app-container">
- <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px">
- <el-form-item label="考试名称" prop="title">
- <el-input
- v-model="queryParams.title"
- placeholder="请输入考试名称"
- clearable
- size="small"
- @keyup.enter.native="handleQuery"
- />
- </el-form-item>
- <!-- <el-form-item label="1公开2部门3定员" prop="openType">-->
- <!-- <el-select v-model="queryParams.openType" placeholder="请选择1公开2部门3定员" clearable size="small">-->
- <!-- <el-option label="请选择字典生成" value="" />-->
- <!-- </el-select>-->
- <!-- </el-form-item>-->
- <el-form-item>
- <el-button type="cyan" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
- <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
- </el-form-item>
- </el-form>
- <el-row :gutter="10" class="mb8">
- <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
- </el-row>
- <el-table v-loading="loading" :data="examList" :height="clientHeight" border>
- <el-table-column
- label="考试名称"
- prop="title"
- show-overflow-tooltip
- />
- <!-- <el-table-column
- label="考试类型"
- align="center"
- >
- <template v-slot="scope">
- {{ scope.row.openType | examOpenType }}
- </template>
- </el-table-column>-->
- <el-table-column
- label="考试时间"
- width="220px"
- align="center"
- >
- <template v-slot="scope">
- <span v-if="scope.row.timeLimit">
- {{ scope.row.startTime }} ~ {{ scope.row.endTime }}
- </span>
- <span v-else>不限时</span>
- </template>
- </el-table-column>
- <el-table-column
- label="考试时长"
- align="center"
- >
- <template v-slot="scope">
- {{ scope.row.totalTime }}分钟
- </template>
- </el-table-column>
- <el-table-column
- label="考试总分"
- prop="totalScore"
- align="center"
- />
- <el-table-column
- label="及格线"
- prop="qualifyScore"
- align="center"
- />
- <el-table-column
- label="操作"
- align="center"
- >
- <template v-slot="scope">
- <el-button v-if="scope.row.state===0" icon="el-icon-caret-right" type="primary" size="mini" @click="handlePre(scope.row.examId)">去考试</el-button>
- <el-button v-if="scope.row.state===1" icon="el-icon-s-release" size="mini" disabled>已禁用</el-button>
- <el-button v-if="scope.row.state===2" icon="el-icon-s-fold" size="mini" disabled>待开始</el-button>
- <el-button v-if="scope.row.state===3" icon="el-icon-s-unfold" size="mini" disabled>已结束</el-button>
- </template>
- </el-table-column>
- </el-table>
- <pagination
- v-show="total>0"
- :total="total"
- :page.sync="queryParams.pageNum"
- :limit.sync="queryParams.pageSize"
- @pagination="getList"
- />
- </div>
- </template>
- <script>
- import { listExam, getExam, delExam, addExam, updateExam, exportExam, importTemplate} from "@/api/training/elearn/exam";
- import { treeselect } from "@/api/system/dept";
- import { getToken } from "@/utils/auth";
- import Treeselect from "@riophae/vue-treeselect";
- import "@riophae/vue-treeselect/dist/vue-treeselect.css";
- import RepoSelect from '@/components/RepoSelect'
- export default {
- name: "ExamList",
- components: { Treeselect,RepoSelect },
- // components: { Editor },
- data() {
- return {
- // 遮罩层
- loading: true,
- // 选中数组
- ids: [],
- // 非单个禁用
- single: true,
- // 非多个禁用
- multiple: true,
- // 显示搜索条件
- showSearch: true,
- // 总条数
- total: 0,
- // 考试表格数据
- examList: [],
- // 已选择的题库
- excludes: [],
- // 弹出层标题
- title: "",
- // 部门树选项
- deptOptions: undefined,
- clientHeight:300,
- // 是否显示弹出层
- open: false,
- // 用户导入参数
- upload: {
- // 是否显示弹出层(用户导入)
- open: false,
- // 弹出层标题(用户导入)
- title: "",
- // 是否禁用上传
- isUploading: false,
- // 是否更新已经存在的用户数据
- updateSupport: 0,
- // 设置上传的请求头部
- headers: { Authorization: "Bearer " + getToken() },
- // 上传的地址
- url: process.env.VUE_APP_BASE_API + "/elearn/exam/importData"
- },
- // 查询参数
- queryParams: {
- examId: null,
- pageNum: 1,
- pageSize: 20,
- title: null,
- content: null,
- openType: null,
- state: null,
- timeLimit: null,
- examStartTime: null,
- examEndTime: null,
- totalScore: null,
- totalTime: null,
- qualifyScore: null,
- createrCode: null,
- createdate: null,
- updaterCode: null,
- updatedate: null,
- deptId: null,
- remarks: null
- },
- // 题库
- repoList: [],
- // 表单参数
- form: {},
- // 表单校验
- rules: {
- }
- };
- },
- watch: {
- filterText(val) {
- this.$refs.tree.filter(val)
- },
- dateValues: {
- handler() {
- this.form.examStartTime = this.dateValues[0]
- this.form.examEndTime = this.dateValues[1]
- }
- },
- // 题库变换
- repoList: {
- handler(val) {
- let totalScore = 0
- this.excludes = []
- for (let i = 0; i<val.length; i++) {
- const item = val[i]
- if (item.radioCount > 0 && item.radioScore>0) {
- totalScore += item.radioCount * item.radioScore
- }
- if (item.multiCount>0 && item.multiScore>0) {
- totalScore += item.multiCount * item.multiScore
- }
- if (item.judgeCount>0 && item.judgeScore>0) {
- totalScore += item.judgeCount * item.judgeScore
- }
- this.excludes.push(item.id)
- }
- // 赋值
- this.form.totalScore = totalScore
- this.form.repoList = val
- this.$forceUpdate()
- },
- deep: true
- }
- },
- created() {
- this.queryParams.examId = this.$route.params.examId
- //设置表格高度对应屏幕高度
- this.$nextTick(() => {
- this.clientHeight = document.body.clientHeight -250
- })
- this.getList();
- },
- methods: {
- /** 查询考试列表 */
- getList() {
- this.loading = true;
- listExam(this.queryParams).then(response => {
- this.examList = response.rows;
- this.total = response.total;
- this.loading = false;
- });
- },
- // 表单重置
- reset() {
- this.form = {
- examId: null,
- title: null,
- content: null,
- openType: null,
- state: null,
- timeLimit: null,
- examStartTime: null,
- examEndTime: null,
- totalScore: null,
- totalTime: null,
- qualifyScore: null,
- delFlag: null,
- createrCode: null,
- createdate: null,
- updaterCode: null,
- updatedate: null,
- deptId: null,
- remarks: null,
- repoList: [],
- };
- this.resetForm("form");
- },
- /** 搜索按钮操作 */
- handleQuery() {
- this.queryParams.pageNum = 1;
- this.getList();
- },
- /** 重置按钮操作 */
- resetQuery() {
- this.resetForm("queryForm");
- this.handleQuery();
- },
- // 开始考试
- handlePre(examId) {
- this.$router.push({ name: 'PreExam', params: { examId: examId }})
- },
- }
- };
- </script>
|