|
|
@@ -15,65 +15,41 @@
|
|
|
:pagination="pagination"
|
|
|
>
|
|
|
<template #bodyCell="{ column, record }">
|
|
|
- <div v-if="examType != 4">
|
|
|
- <template v-if="column.key === 'examName'">
|
|
|
- {{ record.examName }}
|
|
|
- </template>
|
|
|
- <template v-if="column.key === 'examType'">
|
|
|
- {{ examTypeName(record.examType) || '--' }}
|
|
|
- </template>
|
|
|
- <template v-if="column.key === 'startTime'">
|
|
|
- {{ formatDateTime(record.startTime) || '--' }}
|
|
|
- </template>
|
|
|
- <template v-if="column.key === 'endTime'">
|
|
|
- {{ formatDateTime(record.endTime) || '--' }}
|
|
|
- </template>
|
|
|
- <template v-if="column.key === 'status'">
|
|
|
- <a-tag :color="statusTagFormatter(record.status)" size="small">
|
|
|
- {{ statusTextFormatter(record.status) }}
|
|
|
- </a-tag>
|
|
|
- </template>
|
|
|
- <template v-if="column.key === 'action'">
|
|
|
- <router-link
|
|
|
- v-if="record.status == 0"
|
|
|
- :to="{ path: '/student/do', query: { id: record.paperId } }"
|
|
|
- target="_blank"
|
|
|
- >
|
|
|
- <a-button type="link" size="small">填写{{ examName }}</a-button>
|
|
|
- </router-link>
|
|
|
- <router-link
|
|
|
- v-if="record.status == 2"
|
|
|
- :to="{ path: '/student/read', query: { id: record.answerId } }"
|
|
|
- target="_blank"
|
|
|
- >
|
|
|
- <a-button type="link" size="small">查看结果</a-button>
|
|
|
- </router-link>
|
|
|
- </template>
|
|
|
- </div>
|
|
|
- <div v-if="examType == 4">
|
|
|
- <template v-if="column.key === 'name'">
|
|
|
- {{ record.name }}
|
|
|
- </template>
|
|
|
- <template v-if="column.key === 'paperType'">
|
|
|
- {{ paperTypeEnum(record.paperType) }}
|
|
|
- </template>
|
|
|
- <template v-if="column.key === 'action'">
|
|
|
- <router-link
|
|
|
- v-if="!record.status"
|
|
|
- :to="{ path: '/student/do', query: { id: record.id } }"
|
|
|
- target="_blank"
|
|
|
- >
|
|
|
- <a-button type="link" size="small">开始答题</a-button>
|
|
|
- </router-link>
|
|
|
- <router-link
|
|
|
- v-if="record.status == 2"
|
|
|
- :to="{ path: '/student/read', query: { id: record.answerId } }"
|
|
|
- target="_blank"
|
|
|
- >
|
|
|
- <a-button type="link" size="small">查看结果</a-button>
|
|
|
- </router-link>
|
|
|
- </template>
|
|
|
- </div>
|
|
|
+ <template v-if="record.examType && column.key === 'examType'">
|
|
|
+ {{ examTypeName(record.examType) || '--' }}
|
|
|
+ </template>
|
|
|
+ <template v-if="record.startTime && column.key === 'startTime'">
|
|
|
+ {{ formatDateTime(record.startTime) || '--' }}
|
|
|
+ </template>
|
|
|
+ <template v-if="record.endTime && column.key === 'endTime'">
|
|
|
+ {{ formatDateTime(record.endTime) || '--' }}
|
|
|
+ </template>
|
|
|
+
|
|
|
+ <template v-if="record.paperType && column.key === 'paperType'">
|
|
|
+ {{ paperTypeEnum(record.paperType) }}
|
|
|
+ </template>
|
|
|
+
|
|
|
+ <template v-if="column.key === 'status'">
|
|
|
+ <a-tag :color="statusTagFormatter(record.status)" size="small">
|
|
|
+ {{ statusTextFormatter(record.status) }}
|
|
|
+ </a-tag>
|
|
|
+ </template>
|
|
|
+ <template v-if="column.key === 'action'">
|
|
|
+ <router-link
|
|
|
+ v-if="record.status == 0"
|
|
|
+ :to="{ path: '/student/do', query: { id: record.paperId ? record.paperId : record.id } }"
|
|
|
+ target="_blank"
|
|
|
+ >
|
|
|
+ <a-button type="link" size="small">{{ examType == 4 ? `开始答题` : `填写${examName}` }}</a-button>
|
|
|
+ </router-link>
|
|
|
+ <router-link
|
|
|
+ v-if="record.status == 2"
|
|
|
+ :to="{ path: '/student/read', query: { id: record.answerId } }"
|
|
|
+ target="_blank"
|
|
|
+ >
|
|
|
+ <a-button type="link" size="small">查看结果</a-button>
|
|
|
+ </router-link>
|
|
|
+ </template>
|
|
|
</template>
|
|
|
</a-table>
|
|
|
</a-spin>
|
|
|
@@ -89,7 +65,6 @@
|
|
|
import { useRoute } from 'vue-router'
|
|
|
import tool from '@/utils/tool'
|
|
|
import { parseTime } from '@/utils/exam'
|
|
|
- import EventBus from '@/utils/EventBus'
|
|
|
const route = useRoute()
|
|
|
const formatDateTime = (val) => {
|
|
|
if (!val) return ''
|
|
|
@@ -143,18 +118,22 @@
|
|
|
}
|
|
|
]
|
|
|
const taskColumns = computed(() =>
|
|
|
- taskAllColumns.value.filter((r) => r.examType.includes(parseFloat(examType.value)))
|
|
|
+ taskAllColumns.value.filter((r) => r.columnsType.includes(parseFloat(examType.value)))
|
|
|
)
|
|
|
const taskAllColumns = ref([
|
|
|
- { title: '作业名称', dataIndex: 'name', key: 'name', examType: [4] },
|
|
|
- { title: '试卷类型', dataIndex: 'paperType', key: 'paperType', width: 120, examType: [4] },
|
|
|
+ { title: '课程名称', dataIndex: 'courseName', key: 'courseName', columnsType: [4] },
|
|
|
+ { title: '章节名称', dataIndex: 'chapterName', key: 'chapterName', columnsType: [4] },
|
|
|
+ { title: '课时名称', dataIndex: 'hourName', key: 'hourName', columnsType: [4] },
|
|
|
+ { title: '作业名称', dataIndex: 'name', key: 'name', columnsType: [4] },
|
|
|
+ { title: '试卷类型', dataIndex: 'paperType', key: 'paperType', width: 120, columnsType: [4] },
|
|
|
|
|
|
- { title: '问卷名称', dataIndex: 'examName', key: 'examName', examType: [1, 2, 3] },
|
|
|
- { title: '问卷类型', dataIndex: 'examType', key: 'examType', width: 120, examType: [1, 2, 3] },
|
|
|
- { title: '开始时间', dataIndex: 'startTime', key: 'startTime', width: 180, examType: [1, 2, 3] },
|
|
|
- { title: '结束时间', dataIndex: 'endTime', key: 'endTime', width: 180, examType: [1, 2, 3] },
|
|
|
- { title: '状态', dataIndex: 'status', key: 'status', width: 90, examType: [1, 2, 3] },
|
|
|
- { title: '操作', key: 'action', align: 'right', width: 120, examType: [1, 2, 3, 4] }
|
|
|
+ { title: '问卷名称', dataIndex: 'examName', key: 'examName', columnsType: [1, 2, 3] },
|
|
|
+ { title: '问卷类型', dataIndex: 'examType', key: 'examType', width: 120, columnsType: [1, 2, 3] },
|
|
|
+ { title: '开始时间', dataIndex: 'startTime', key: 'startTime', width: 180, columnsType: [1, 2, 3] },
|
|
|
+ { title: '结束时间', dataIndex: 'endTime', key: 'endTime', width: 180, columnsType: [1, 2, 3] },
|
|
|
+
|
|
|
+ { title: '状态', dataIndex: 'status', key: 'status', width: 90, columnsType: [1, 2, 3, 4] },
|
|
|
+ { title: '操作', key: 'action', align: 'right', width: 120, columnsType: [1, 2, 3, 4] }
|
|
|
])
|
|
|
|
|
|
const statusTextFormatter = (status) => {
|
|
|
@@ -182,7 +161,7 @@
|
|
|
examType: examType.value
|
|
|
}
|
|
|
if (examType.value == 4) {
|
|
|
- res = await examPaperApi.pageList(params)
|
|
|
+ res = await examPaperApi.newPageList(params)
|
|
|
} else {
|
|
|
res = await taskApi.pageExamList(params)
|
|
|
}
|
|
|
@@ -210,12 +189,20 @@
|
|
|
// lifecycle
|
|
|
const examType = ref()
|
|
|
const paperType = ref(2)
|
|
|
- EventBus.off('getTaskList', getTaskList)
|
|
|
- EventBus.on('getTaskList', getTaskList)
|
|
|
+ const channel = new BroadcastChannel('getTaskList')
|
|
|
+ channel.onmessage = function (event) {
|
|
|
+ if (event.data.type == 1) {
|
|
|
+ getTaskList()
|
|
|
+ }
|
|
|
+ }
|
|
|
onMounted(() => {
|
|
|
examType.value = route.params && route.params.examType
|
|
|
getTaskList()
|
|
|
})
|
|
|
+ onUnmounted(() => {
|
|
|
+ channel.onmessage = null
|
|
|
+ channel.close()
|
|
|
+ })
|
|
|
</script>
|
|
|
|
|
|
<style lang="less" scoped>
|