liuyu
21 小时以前 93c133349a5ccd7a328371fa113dce69d5611f21
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
133
134
135
136
137
<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>