题库维护。刷题软件数据后台
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
ss-tiku-manage-web/src/views/Customer/ExamRecord/index.vue

163 lines
4.7 KiB

1 month ago
<template>
<div>
<el-form :model="searchForm" inline @submit.prevent>
<el-form-item>
<el-input
v-model="searchForm.userName"
placeholder="请输入姓名"
clearable
@keyup.enter="handleQuery"
/>
</el-form-item>
<el-form-item>
<el-input
v-model="searchForm.phone"
placeholder="请输入手机号"
clearable
@keyup.enter="handleQuery"
/>
</el-form-item>
<el-form-item>
<el-input
v-model="searchForm.idcard"
placeholder="请输入身份证号"
clearable
@keyup.enter="handleQuery"
/>
</el-form-item>
<el-form-item>
<el-select
1 month ago
v-model="searchForm.carTypeId"
1 month ago
placeholder="选择考试类型"
clearable
filterable
@change="handleQuery"
>
<el-option
v-for="item in carTypeOptions"
:key="item.carTypeId"
:label="item.carName"
:value="item.carTypeId"
/>
</el-select>
</el-form-item>
<el-form-item>
<el-select
v-model="searchForm.subject"
placeholder="选择科目"
clearable
filterable
@change="handleQuery"
>
<el-option label="科一" :value="1" />
<el-option label="科四" :value="4" />
</el-select>
</el-form-item>
<el-form-item>
<el-date-picker
v-model="searchForm.examTime"
type="daterange"
1 month ago
format="YYYY-MM-DD"
value-format="YYYY-MM-DD"
1 month ago
range-separator="-"
start-placeholder="考试日期"
end-placeholder="日期"
1 month ago
@change="handleQuery"
1 month ago
/>
</el-form-item>
<el-form-item>
<el-button @click="handleQuery" v-hasPermi="['customer:exam-record:list']">搜索</el-button>
<el-button @click="handleExport" v-hasPermi="['customer:exam-record:export']">
导出
</el-button>
</el-form-item>
</el-form>
<el-table v-loading="loading" :data="tableList" border stripe>
<el-table-column type="index" width="50" />
<el-table-column label="姓名" prop="userName" />
<el-table-column label="手机号码" prop="phone" width="120" />
<el-table-column label="身份证号" prop="idcard" min-width="120" />
1 month ago
<el-table-column label="考试类型" prop="carTypeName" min-width="120" />
1 month ago
<el-table-column label="考试科目" prop="subject" min-width="120" />
<el-table-column label="考试得分" prop="score" min-width="120" />
<el-table-column label="交卷时间" prop="createTime" min-width="120" />
<el-table-column label="考试时长" prop="testTimeStr" min-width="120" />
</el-table>
<Pagination
:total="total"
v-model:page="searchForm.pageNo"
v-model:limit="searchForm.pageSize"
@pagination="getList"
/>
</div>
</template>
<script setup name="ExamRecord">
import { removeNullField } from '@/utils'
import * as ExamRecordApi from '@/api/customer/examRecord.js'
1 month ago
import download from '@/utils/download'
1 month ago
import { getCustomerExamCarType } from '@/api/customer/customer.js'
const carTypeOptions = ref([])
const searchForm = ref({
userName: undefined,
1 month ago
carTypeId: undefined,
1 month ago
pageNo: 1,
pageSize: 20
})
onMounted(() => {
getCustomerExamCarType().then((res) => {
carTypeOptions.value = res
})
handleQuery()
})
/** 搜索按钮操作 */
const handleQuery = () => {
searchForm.value.pageNo = 1
getList()
}
const loading = ref(false)
const tableList = ref([])
const total = ref(0)
/** 查询列表 */
const getList = async () => {
loading.value = true
try {
if (searchForm.value.examTime && searchForm.value.examTime.length > 0) {
1 month ago
searchForm.value.startTime = searchForm.value.examTime[0] + ' 00:00:00'
searchForm.value.endTime = searchForm.value.examTime[1] + ' 23:59:59'
1 month ago
} else {
searchForm.value.startTime = undefined
searchForm.value.endTime = undefined
}
const data = await ExamRecordApi.getRecordPage(removeNullField(searchForm.value))
tableList.value = data.list
total.value = data.total
} finally {
loading.value = false
}
}
function handleExport() {
const params = removeNullField(searchForm.value)
if (params.examTime && params.examTime.length > 0) {
1 month ago
params.startTime = params.examTime[0] + ' 00:00:00'
params.endTime = params.examTime[1] + ' 23:59:59'
1 month ago
} else {
params.startTime = undefined
params.endTime = undefined
}
ExamRecordApi.exportRecord(params).then((res) => {
1 month ago
download.excel(res, '考试成绩.xls')
1 month ago
})
}
</script>
<style lang="scss" scoped></style>