1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
| <script lang="ts" setup>
| import type { ActionItem, BasicColumn } from '@jnpf/ui/vxeTable';
|
| import type { ExamScoreSummaryItem } from './types';
|
| import { useRouter } from 'vue-router';
|
| import { useMessage } from '@jnpf/hooks';
| import { BasicVxeTable, TableAction, useVxeTable } from '@jnpf/ui/vxeTable';
|
| import { getExamScoreList } from '#/api/x/tms/examScore';
|
| defineOptions({ name: 'TmsExamScore' });
|
| const router = useRouter();
| const { createMessage } = useMessage();
|
| const columns: BasicColumn[] = [
| { title: '培训主题', dataIndex: 'taskSubject', minWidth: 240 },
| { title: '培训编号', dataIndex: 'taskNo', width: 140 },
| {
| title: '试卷名称',
| dataIndex: 'paperName',
| minWidth: 220,
| slots: { default: 'paperName' },
| },
| {
| title: '参考人数',
| dataIndex: 'participantCount',
| width: 90,
| align: 'center',
| },
| {
| title: '不及格数',
| dataIndex: 'failCount',
| width: 90,
| align: 'center',
| slots: { default: 'failCount' },
| },
| { title: '最高分', dataIndex: 'maxScore', width: 80, align: 'center' },
| { title: '最低分', dataIndex: 'minScore', width: 80, align: 'center' },
| { title: '平均分', dataIndex: 'avgScore', width: 80, align: 'center' },
| { title: '及格分', dataIndex: 'passScore', width: 80, align: 'center' },
| { title: '总分', dataIndex: 'totalScore', width: 80, align: 'center' },
| ];
|
| const [registerTable, { getSelectRows }] = useVxeTable({
| api: fetchList,
| columns,
| immediate: true,
| rowKey: 'id',
| rowSelection: { type: 'checkbox' },
| useSearchForm: true,
| formConfig: {
| baseColProps: { span: 6 },
| compact: true,
| schemas: [
| {
| field: 'keyword',
| label: '关键词',
| component: 'Input',
| componentProps: { placeholder: '请输入检索关键字', submitOnPressEnter: true },
| },
| {
| field: 'taskNo',
| label: '培训编号',
| component: 'Input',
| componentProps: { placeholder: '请输入培训编号', submitOnPressEnter: true },
| },
| ],
| },
| actionColumn: {
| width: 110,
| title: '操作',
| dataIndex: 'action',
| fixed: 'right',
| },
| });
|
| async function fetchList(params: Record<string, any>) {
| return { data: await getExamScoreList(params) };
| }
|
| function handleDetail(record: ExamScoreSummaryItem) {
| router.push(`/tms/examScore/detail/${record.id}`);
| }
|
| function handleExport() {
| const rows = getSelectRows?.() || [];
| if (!rows.length) {
| createMessage.warning('请先勾选要导出的考试记录');
| return;
| }
| createMessage.success(`已选择 ${rows.length} 条(导出接口联调后生效)`);
| }
|
| function getTableActions(record: ExamScoreSummaryItem): ActionItem[] {
| return [{ label: '考试详情', onClick: handleDetail.bind(null, record) }];
| }
| </script>
|
| <template>
| <div class="jnpf-content-wrapper">
| <div class="jnpf-content-wrapper-center">
| <div class="jnpf-content-wrapper-content">
| <BasicVxeTable @register="registerTable">
| <template #tableTitle>
| <a-space>
| <a-button type="primary" @click="handleExport">导出考试</a-button>
| </a-space>
| </template>
| <template #paperName="{ record }">
| <span :class="record.paperInvalid ? 'text-gray-400' : ''">{{ record.paperName }}</span>
| </template>
| <template #failCount="{ record }">
| <span :class="record.failCount > 0 ? 'text-red-500' : ''">{{ record.failCount }}</span>
| </template>
| <template #action="{ record }">
| <TableAction :actions="getTableActions(record)" />
| </template>
| </BasicVxeTable>
| </div>
| </div>
| </div>
| </template>
|
|