liuyu
22 小时以前 8534025c45b4736975730678b9ccf23570a75f95
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
126
127
128
129
130
131
132
<script lang="ts" setup>
import type { ActionItem, BasicColumn } from '@jnpf/ui/vxeTable';
 
import type { GradeSessionListItem } from './types';
 
import { useRouter } from 'vue-router';
 
import { BasicVxeTable, TableAction, useVxeTable } from '@jnpf/ui/vxeTable';
 
import { getGradeSessionList } from '#/api/x/tms/examGrade';
import { TMS_BTN } from '#/views/x/tms/shared/ui';
 
import '#/views/x/tms/shared/page.css';
 
defineOptions({ name: 'TmsExamGrade' });
 
const router = useRouter();
 
const columns: BasicColumn[] = [
  { title: '试卷编号', dataIndex: 'taskNo', width: 140 },
  { title: '培训主题', dataIndex: 'taskSubject', minWidth: 260 },
  { title: '试卷名称', dataIndex: 'paperName', minWidth: 200 },
  {
    title: '考试时间',
    dataIndex: 'examTime',
    minWidth: 220,
    slots: { default: 'examTime' },
  },
  {
    title: '卷面总分',
    dataIndex: 'totalScore',
    width: 100,
    align: 'center',
    slots: { default: 'totalScore' },
  },
  {
    title: '合格分数',
    dataIndex: 'passScore',
    width: 100,
    align: 'center',
    slots: { default: 'passScore' },
  },
];
 
const [registerTable] = useVxeTable({
  api: fetchList,
  columns,
  immediate: true,
  rowKey: 'id',
  useSearchForm: true,
  formConfig: {
    baseColProps: { span: 6 },
    compact: true,
    schemas: [
      {
        field: 'taskNo',
        label: '试卷编号',
        component: 'Input',
        componentProps: { placeholder: '请输入试卷编号', submitOnPressEnter: true },
      },
      {
        field: 'keyword',
        label: '关键词',
        component: 'Input',
        componentProps: { placeholder: '主题/试卷名称', submitOnPressEnter: true },
      },
    ],
  },
  actionColumn: {
    width: 100,
    title: '操作',
    dataIndex: 'action',
    fixed: 'right',
  },
});
 
async function fetchList(params: Record<string, any>) {
  const page = await getGradeSessionList(params);
  return {
    data: {
      list: Array.isArray(page?.list) ? page.list : [],
      pagination: page?.pagination || { total: 0 },
    },
  };
}
 
function handleEnter(record: GradeSessionListItem) {
  router.push(`/tms/examGrade/session/${record.id}`);
}
 
function getTableActions(record: GradeSessionListItem): ActionItem[] {
  return [{ label: TMS_BTN.grade, onClick: handleEnter.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>
            <div>
              <div class="tms-page-header__title">考试阅卷</div>
              <div class="tms-page-header__sub">选择场次进入答卷列表,对待阅试卷评分。</div>
            </div>
          </template>
          <template #examTime="{ record }">
            <div class="leading-5">
              <div>{{ record.durationMin }} 分钟</div>
              <div class="text-gray-400 text-xs">{{ record.examStart }} 到 {{ record.examEnd }}</div>
            </div>
          </template>
          <template #totalScore="{ record }">
            <div class="leading-5">
              <div class="text-xs text-gray-400">总分</div>
              <div>{{ record.totalScore }}分</div>
            </div>
          </template>
          <template #passScore="{ record }">
            <div class="leading-5">
              <div class="text-xs text-gray-400">合格分</div>
              <div>{{ record.passScore }}分</div>
            </div>
          </template>
          <template #action="{ record }">
            <TableAction :actions="getTableActions(record)" />
          </template>
        </BasicVxeTable>
      </div>
    </div>
  </div>
</template>