| | |
| | | <script lang="ts" setup> |
| | | import type { TrainArchiveDetail } from './types'; |
| | | |
| | | import { computed, onMounted, ref } from 'vue'; |
| | | import { onMounted, ref } from 'vue'; |
| | | |
| | | import { useMessage } from '@jnpf/hooks'; |
| | | import { useUserStore } from '@vben/stores'; |
| | | import { |
| | | Descriptions as ADescriptions, |
| | | DescriptionsItem as ADescriptionsItem, |
| | |
| | | defineOptions({ name: 'TmsTrainArchive' }); |
| | | |
| | | const { createMessage } = useMessage(); |
| | | const userStore = useUserStore(); |
| | | |
| | | const loading = ref(false); |
| | | const detail = ref<TrainArchiveDetail | null>(null); |
| | | |
| | | const userInfo = computed(() => (userStore.getUserInfo || {}) as Record<string, any>); |
| | | |
| | | const workColumns = [ |
| | | { title: '序号', key: 'index', width: 70, align: 'center', customRender: ({ index }: any) => index + 1 }, |
| | |
| | | loadArchive(); |
| | | }); |
| | | |
| | | function resolvePositionName() { |
| | | const list = userInfo.value.positionList; |
| | | if (Array.isArray(list) && list.length) { |
| | | return list.map((o: any) => o.treeName || o.fullName || o.name).filter(Boolean).join('、') || '无'; |
| | | } |
| | | return userInfo.value.positionName || '无'; |
| | | } |
| | | |
| | | async function loadArchive() { |
| | | loading.value = true; |
| | | try { |
| | | const u = userInfo.value; |
| | | detail.value = await getMyTrainArchive({ |
| | | userId: u.userId || u.id, |
| | | userName: u.userName, |
| | | userAccount: u.userAccount, |
| | | organizeName: u.organizeName || u.departmentName, |
| | | positionName: resolvePositionName(), |
| | | }); |
| | | detail.value = await getMyTrainArchive(); |
| | | } catch (e: any) { |
| | | createMessage.error(e?.message || '加载培训档案失败'); |
| | | } finally { |