已参加考试列表

This commit is contained in:
18571350067 2022-02-26 09:32:06 +08:00
parent 698c2e719f
commit 893e9c9762
1 changed files with 68 additions and 80 deletions

View File

@ -1,11 +1,7 @@
<template> <template>
<a-card :bordered="false" :loading="loading"> <a-card :bordered="false" :loading="loading">
<div class="table-page-search-wrapper"> <div class="table-page-search-wrapper">
<SearchCom <SearchCom :form="queryParam" :list="queryOptions" @search="handleRefresh" @reset="
:form="queryParam"
:list="queryOptions"
@search="handleRefresh"
@reset="
() => { () => {
queryParam = {} queryParam = {}
handleRefresh() handleRefresh()
@ -15,12 +11,7 @@
</br> </br>
<a-tabs :default-active-key="activeTab" @change="(key)=>{activeTab = key}"> <a-tabs :default-active-key="activeTab" @change="(key)=>{activeTab = key}">
<a-tab-pane key="1" tab="预约考试"> <a-tab-pane key="1" tab="预约考试">
<s-table <s-table ref="examTable" :pageSize="5" :columns="examColumns" :data="loadExamData" :rowKey="record => record.id">
ref="examTable"
:pageSize="5"
:columns="examColumns"
:data="loadExamData"
:rowKey="record => record.id">
<span slot="index" slot-scope="text, record, index"> <span slot="index" slot-scope="text, record, index">
{{ index + 1 }} {{ index + 1 }}
</span> </span>
@ -34,22 +25,20 @@
{{ record.examTime }}分钟 {{ record.examTime }}分钟
</template> </template>
<span slot="action" slot-scope="text, record"> <span slot="action" slot-scope="text, record">
<a v-if="record.examCondition === 2" @click="handlerMarker(record)">预约考试</a> <a v-if="record.examCondition === 2" @click="handlerMarker(record)">预约考试</a>
<a v-if="record.examCondition === 1" @click="handlerGoReport(record)">查看详情</a> <a v-if="record.examCondition === 1" @click="handlerGoReport(record)">查看详情</a>
<a v-if="record.examCondition === 3" @click="handlerGoExam(record)">进入考试</a> <a v-if="record.examCondition === 3" @click="handlerGoExam(record)">进入考试</a>
</span> </span>
</s-table> </s-table>
</a-tab-pane> </a-tab-pane>
<a-tab-pane key="2" tab="已参加考试"> <a-tab-pane key="2" tab="已参加考试">
<s-table <s-table ref="examDoneTable" :pageSize="5" :columns="examDoneColumns" :data="loadExamDoneData" :rowKey="record => record.id">
ref="examDoneTable"
:pageSize="5"
:columns="examDoneColumns"
:data="loadExamDoneData"
:rowKey="record => record.id">
<span slot="index" slot-scope="text, record, index"> <span slot="index" slot-scope="text, record, index">
{{ index + 1 }} {{ index + 1 }}
</span> </span>
<template slot="testType" slot-scope="text, record">
<a-tag>record.candidateNo</a-tag>
</template>
<template slot="testType" slot-scope="text, record"> <template slot="testType" slot-scope="text, record">
<a-tag v-if="record.testType == '1'" color="red">线上</a-tag> <a-tag v-if="record.testType == '1'" color="red">线上</a-tag>
</template> </template>
@ -72,165 +61,164 @@
</template> </template>
<script> <script>
import { STable, SearchCom } from '@/components' import { STable, SearchCom } from '@/components';
import { reqExamList, reqExamAttendList, reqExamSubscribe } from '@/api/myexam/exam' import { reqExamList, reqExamAttendList, reqExamSubscribe } from '@/api/myexam/exam';
import { dictionaryDropDown } from '@/api/sys/dictionaryItem' import { dictionaryDropDown } from '@/api/sys/dictionaryItem';
import { dictToTree } from '@/utils/util' import { dictToTree } from '@/utils/util';
import { dictGet } from '@/api/project/project' import { dictGet } from '@/api/project/project';
export default { export default {
components: { STable, SearchCom }, components: { STable, SearchCom },
data () { data() {
return { return {
loading: false, loading: false,
activeTab: '1', activeTab: '1',
queryParam: { queryParam: {
examClassify: '' // examClassify: '', //
}, },
queryOptions: [ queryOptions: [
{ type: 'select-dic-tree', placeholder: '课程分类', key: 'examClassify', options: [] } { type: 'select-dic-tree', placeholder: '课程分类', key: 'examClassify', options: [] },
], ],
examColumns: [ examColumns: [
{ {
title: '序号', title: '序号',
width: '80px', width: '80px',
scopedSlots: { customRender: 'index' }, scopedSlots: { customRender: 'index' },
align: 'center' align: 'center',
}, },
{ {
title: '考试科目', title: '考试科目',
dataIndex: 'projectName' dataIndex: 'projectName',
}, },
{ {
title: '准考证号', title: '准考证号',
dataIndex: 'candidateNo' dataIndex: 'candidateNo',
}, },
{ {
title: '考试形式', title: '考试形式',
dataIndex: 'testType', dataIndex: 'testType',
scopedSlots: { customRender: 'testType' } scopedSlots: { customRender: 'testType' },
}, },
{ {
title: '考试时间', title: '考试时间',
dataIndex: 'examSdate' dataIndex: 'examSdate',
}, },
{ {
title: '考试时长', title: '考试时长',
dataIndex: 'examTime', dataIndex: 'examTime',
scopedSlots: { customRender: 'examTime' } scopedSlots: { customRender: 'examTime' },
}, },
{ {
title: '考试资格', title: '考试资格',
dataIndex: 'zige', dataIndex: 'zige',
scopedSlots: { customRender: 'zige' } scopedSlots: { customRender: 'zige' },
}, },
{ {
title: '操作', title: '操作',
width: '150px', width: '150px',
dataIndex: 'action', dataIndex: 'action',
scopedSlots: { customRender: 'action' } scopedSlots: { customRender: 'action' },
} },
], ],
examDoneColumns: [ examDoneColumns: [
{ {
title: '序号', title: '序号',
width: '80px', width: '80px',
scopedSlots: { customRender: 'index' }, scopedSlots: { customRender: 'index' },
align: 'center' align: 'center',
}, },
{ {
title: '考试科目', title: '考试科目',
dataIndex: 'projectName' dataIndex: 'projectName',
}, },
{ {
title: '准考证号', title: '准考证号',
dataIndex: 'candidateNo' dataIndex: 'candidateNo',
}, },
{ {
title: '考试形式', title: '考试形式',
dataIndex: 'testType', dataIndex: 'testType',
scopedSlots: { customRender: 'testType' } scopedSlots: { customRender: 'testType' },
}, },
{ {
title: '答卷时间', title: '答卷时间',
dataIndex: 'practiceSdate' dataIndex: 'submitTime',
}, },
{ {
title: '考试时长', title: '考试时长',
dataIndex: 'examTime', dataIndex: 'examTime',
scopedSlots: { customRender: 'examTime' } scopedSlots: { customRender: 'examTime' },
}, },
{ {
title: '考试成绩', title: '考试成绩',
dataIndex: 'score' dataIndex: 'score',
}, },
{ {
title: '操作', title: '操作',
width: '150px', width: '150px',
dataIndex: 'action', dataIndex: 'action',
scopedSlots: { customRender: 'action' } scopedSlots: { customRender: 'action' },
} },
], ],
loadExamData: parameter => { loadExamData: parameter => {
return reqExamList(Object.assign(parameter, this.queryParam)).then(res => { return reqExamList(Object.assign(parameter, this.queryParam)).then(res => {
return res return res;
}) });
}, },
loadExamDoneData: parameter => { loadExamDoneData: parameter => {
return reqExamAttendList(Object.assign(parameter, this.queryParam)).then(res => { return reqExamAttendList(Object.assign(parameter, this.queryParam)).then(res => {
return res return res;
}) });
} },
} };
}, },
mounted () { mounted() {
this.dictionaryDropDown() this.dictionaryDropDown();
}, },
methods: { methods: {
dictionaryDropDown () { dictionaryDropDown() {
dictGet({ type: 1 }).then((res) => { dictGet({ type: 1 }).then(res => {
this.queryOptions[0].options = res.data this.queryOptions[0].options = res.data;
this.loading = false this.loading = false;
}) });
}, },
// //
handleRefresh () { handleRefresh() {
const { activeTab } = this const { activeTab } = this;
console.log('activeTab', activeTab) console.log('activeTab', activeTab);
if (activeTab === '1') { if (activeTab === '1') {
this.$refs.examTable.refresh() this.$refs.examTable.refresh();
} else { } else {
this.$refs.examDoneTable.refresh() this.$refs.examDoneTable.refresh();
} }
}, },
// //
handlerMarker (data) { handlerMarker(data) {
const _this = this const _this = this;
this.$confirm({ this.$confirm({
title: '提示', title: '提示',
content: '确定要预约考试吗?', content: '确定要预约考试吗?',
onOk () { onOk() {
reqExamSubscribe({ projectId: data.id }).then(res => { reqExamSubscribe({ projectId: data.id }).then(res => {
_this.$message.success('预约成功!') _this.$message.success('预约成功!');
_this.handleRefresh() _this.handleRefresh();
}) });
}, },
onCancel () {} onCancel() {},
}) });
}, },
handlerGoExam (row) { handlerGoExam(row) {
// 5(...) // 5(...)
// const diff = new Date().getTime() - new Date(examSdate).getTime() // const diff = new Date().getTime() - new Date(examSdate).getTime()
// if(diff > -1000*60*5){} // if(diff > -1000*60*5){}
this.$router.push({ path: '/myexamDetail', query: { type: 'exam', projectId: row.id } }) this.$router.push({ path: '/myexamDetail', query: { type: 'exam', projectId: row.id } });
}, },
handlerGoReport (row) { handlerGoReport(row) {
this.$router.push({ path: '/myreport', query: { type: 'exam', reportId: row.report.id } }) this.$router.push({ path: '/myreport', query: { type: 'exam', reportId: row.report.id } });
} },
} },
} };
</script> </script>
<style lang="less" scoped> <style lang="less" scoped>
</style> </style>