<script lang="ts" setup>
|
import type { TmsRecordDetail } from './types';
|
|
import { onMounted, ref } from 'vue';
|
import { useRoute, useRouter } from 'vue-router';
|
|
import { useMessage } from '@jnpf/hooks';
|
import { Table as ATable } from 'ant-design-vue';
|
|
import { getTmsRecordDetail } from '#/api/x/tms/record';
|
import { TMS_BTN } from '#/views/x/tms/shared/ui';
|
|
import '#/views/x/tms/shared/page.css';
|
|
defineOptions({ name: 'TmsRecordSign' });
|
|
const route = useRoute();
|
const router = useRouter();
|
const { createMessage } = useMessage();
|
|
const loading = ref(false);
|
const detail = ref<TmsRecordDetail | null>(null);
|
|
const signColumns = [
|
{ title: '序号', key: 'index', width: 70, align: 'center', customRender: ({ index }: any) => index + 1 },
|
{ title: '姓名', dataIndex: 'userName', key: 'userName', width: 120 },
|
{ title: '部门', dataIndex: 'deptName', key: 'deptName', minWidth: 140 },
|
{ title: '签到时间', dataIndex: 'signTime', key: 'signTime', width: 180 },
|
{ title: '签到方式', dataIndex: 'signMode', key: 'signMode', width: 120 },
|
];
|
|
onMounted(() => {
|
loadData();
|
});
|
|
async function loadData() {
|
const id = String(route.params.id || '');
|
if (!id) {
|
router.replace('/tms/record');
|
return;
|
}
|
loading.value = true;
|
try {
|
detail.value = await getTmsRecordDetail(id);
|
if (detail.value.archiveStatus === 'archived') {
|
createMessage.warning('已存档记录不可签到');
|
router.replace(`/tms/record/detail/${id}`);
|
}
|
} catch (e: any) {
|
createMessage.error(e?.message || '加载培训记录失败');
|
router.replace('/tms/record');
|
} finally {
|
loading.value = false;
|
}
|
}
|
|
function goBack() {
|
router.push('/tms/record');
|
}
|
</script>
|
|
<template>
|
<div class="jnpf-content-wrapper tms-record-page">
|
<div class="jnpf-content-wrapper-center tms-record-center">
|
<div class="jnpf-content-wrapper-content tms-record-wrap">
|
<a-spin :spinning="loading" class="record-spin">
|
<div v-if="detail" class="record-inner">
|
<div class="tms-page-header">
|
<div>
|
<div class="tms-page-header__title">培训签到</div>
|
<div class="tms-page-header__sub">{{ detail.recordNo }} · {{ detail.subject }}</div>
|
</div>
|
<div class="tms-page-header__actions">
|
<a-button @click="goBack">{{ TMS_BTN.back }}</a-button>
|
</div>
|
</div>
|
|
<a-alert
|
class="tms-page-tip"
|
type="info"
|
show-icon
|
message="管理端补签/扫码签到即将接入"
|
description="当前请学员在「个人培训任务」中完成签到。下方为已同步的签到名单(只读)。"
|
/>
|
|
<div class="section-title">已签到人员</div>
|
<ATable
|
size="middle"
|
bordered
|
row-key="id"
|
:columns="signColumns"
|
:data-source="detail.signList || []"
|
:pagination="false"
|
:locale="{ emptyText: '暂无签到记录' }"
|
/>
|
</div>
|
</a-spin>
|
</div>
|
</div>
|
</div>
|
</template>
|
|
<style scoped>
|
.tms-record-page,
|
.tms-record-center {
|
height: 100%;
|
min-height: 0;
|
}
|
|
.tms-record-wrap {
|
display: flex !important;
|
flex-direction: column;
|
flex: 1 1 0 !important;
|
min-height: 0 !important;
|
height: 100%;
|
overflow: auto !important;
|
background: #fff;
|
}
|
|
.record-spin {
|
display: block;
|
min-height: 100%;
|
width: 100%;
|
}
|
|
.record-inner {
|
padding: 16px 20px 24px;
|
}
|
|
.section-title {
|
font-size: 15px;
|
font-weight: 600;
|
margin: 8px 0 12px;
|
padding-left: 10px;
|
border-left: 3px solid #1677ff;
|
}
|
</style>
|