feat(training): 培训模块改造!
This commit is contained in:
1 parent
57652ae581
commit
5f713f2c0c
11 files changed
+226
-51
No files matched your search
@@ -207,7 +207,7 @@ const printReport = async () => {
|
||||
const element = document.getElementById('report-modal-content');
|
||||
const report = currentReportRecord.value;
|
||||
if (!element || !report) return;
|
||||
const fileName = `${report.name}_${report.trainingType === 'onboarding' ? t('chat.training.hr.filters.typeOnboarding') : report.trainingType === 'safety' ? t('chat.training.hr.filters.typeSafety') : report.trainingType}_考试报告.pdf`;
|
||||
const fileName = `${report.name}_${workspace.resolveTrainingTypeName(report.trainingType)}_考试报告.pdf`;
|
||||
|
||||
const opt = {
|
||||
margin: [15, 15, 15, 15] as [number, number, number, number],
|
||||
@@ -660,24 +660,20 @@ const currentSafetyStageText = computed(() => {
|
||||
</div>
|
||||
|
||||
<div v-if="!isCompactMode && workspace.activeView === 'learner'" :class="learnerWorkspaceGridClass">
|
||||
<!-- 增加顶部 Tab 切换:入职培训 / 安全培训 -->
|
||||
<!-- 已发布培训类型由后端配置动态提供。 -->
|
||||
<div class="col-span-full mb-1">
|
||||
<div class="inline-flex rounded-xl border border-default bg-surface-soft p-1">
|
||||
<div class="inline-flex flex-wrap rounded-xl border border-default bg-surface-soft p-1">
|
||||
<button
|
||||
v-for="trainingType in workspace.trainingTypes"
|
||||
:key="trainingType.code"
|
||||
class="flex items-center gap-2 rounded-lg px-6 py-2 text-sm font-medium transition"
|
||||
:class="workspace.learnerTab === 'onboarding' ? 'bg-white text-brand-700 shadow-sm border border-brand-200' : 'text-secondary hover:text-primary'"
|
||||
@click="workspace.learnerTab = 'onboarding'"
|
||||
:class="workspace.learnerTab === trainingType.code ? 'bg-white text-brand-700 shadow-sm border border-brand-200' : 'text-secondary hover:text-primary'"
|
||||
@click="workspace.learnerTab = trainingType.code"
|
||||
>
|
||||
<User class="h-4 w-4" />
|
||||
{{ $t('chat.training.safety.tabs.onboarding') }}
|
||||
</button>
|
||||
<button
|
||||
class="flex items-center gap-2 rounded-lg px-6 py-2 text-sm font-medium transition"
|
||||
:class="workspace.learnerTab === 'safety' ? 'bg-white text-brand-700 shadow-sm border border-brand-200' : 'text-secondary hover:text-primary'"
|
||||
@click="workspace.learnerTab = 'safety'"
|
||||
>
|
||||
<ShieldCheck class="h-4 w-4" />
|
||||
{{ $t('chat.training.safety.tabs.safety') }}
|
||||
<ShieldCheck v-if="trainingType.code === 'safety'" class="h-4 w-4" />
|
||||
<User v-else-if="trainingType.code === 'onboarding'" class="h-4 w-4" />
|
||||
<BookOpen v-else class="h-4 w-4" />
|
||||
{{ trainingType.name }}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
@@ -690,7 +686,7 @@ const currentSafetyStageText = computed(() => {
|
||||
<div class="mt-3 text-base font-semibold text-primary">{{ $t('chat.training.noContent.title') }}</div>
|
||||
<div class="mt-1 text-sm">{{ $t('chat.training.noContent.description') }}</div>
|
||||
</div>
|
||||
<template v-else-if="workspace.learnerTab === 'onboarding'">
|
||||
<template v-else-if="workspace.learnerTab !== 'safety'">
|
||||
<div :class="learnerWorkspaceMainClass">
|
||||
<div :class="progressCardClass">
|
||||
<div class="flex flex-col gap-1.5 lg:flex-row lg:items-start lg:justify-between">
|
||||
@@ -744,6 +740,23 @@ const currentSafetyStageText = computed(() => {
|
||||
<p class="mt-1 text-sm leading-6 text-secondary">{{ $t('chat.training.video.description') }}</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="mt-3">
|
||||
<ul v-if="workspace.publishedTrainingMaterials.length" class="space-y-2">
|
||||
<li
|
||||
v-for="material in workspace.publishedTrainingMaterials"
|
||||
:key="material.id || `${material.resourceType}-${material.sortOrder}`"
|
||||
class="flex items-center justify-between gap-3 rounded-xl border border-slate-100 bg-slate-50 px-3 py-2.5 cursor-pointer transition hover:bg-slate-100"
|
||||
@click="handleMaterialClick(material)"
|
||||
>
|
||||
<div class="flex min-w-0 items-center gap-2 text-sm font-medium text-primary hover:text-brand-600">
|
||||
<Video v-if="material.resource?.fileType === 'video'" class="h-4 w-4 text-brand-500" />
|
||||
<FileText v-else class="h-4 w-4 text-slate-400" />
|
||||
<span class="truncate">{{ material.title || material.resource?.fileName || $t('chat.training.video.playerTitle') }}</span>
|
||||
</div>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<div class="mt-3 relative group cursor-pointer overflow-hidden rounded-2xl border border-default bg-slate-900 shadow-lg aspect-video flex items-center justify-center" @click="showVideoModal = true">
|
||||
<img src="https://coresg-normal.trae.ai/api/ide/v1/text_to_image?prompt=Professional%20corporate%20training%20video%20cover%2C%20high-quality%2C%20modern%20office%20background%2C%20play%20button%20overlay&image_size=landscape_16_9" class="absolute inset-0 w-full h-full object-cover opacity-60 group-hover:scale-105 transition-transform duration-500" />
|
||||
<div class="relative z-10 flex flex-col items-center gap-3">
|
||||
@@ -1443,8 +1456,9 @@ const currentSafetyStageText = computed(() => {
|
||||
class="w-full rounded-xl border border-default bg-surface px-3 py-2.5 text-sm text-primary outline-none transition focus:border-brand-300"
|
||||
>
|
||||
<option value="all">{{ $t('chat.training.hr.filters.allTypes') }}</option>
|
||||
<option value="onboarding">{{ $t('chat.training.hr.filters.typeOnboarding') }}</option>
|
||||
<option value="safety">{{ $t('chat.training.hr.filters.typeSafety') }}</option>
|
||||
<option v-for="trainingType in workspace.trainingTypes" :key="trainingType.code" :value="trainingType.code">
|
||||
{{ trainingType.name }}
|
||||
</option>
|
||||
</select>
|
||||
</label>
|
||||
<label>
|
||||
@@ -1502,7 +1516,7 @@ const currentSafetyStageText = computed(() => {
|
||||
<tr v-for="record in workspace.filteredRecords" :key="record.id" class="odd:bg-white even:bg-surface-soft/30">
|
||||
<td class="border-b border-default px-3 py-2.5 text-secondary">{{ record.joinDate }}</td>
|
||||
<td class="border-b border-default px-3 py-2.5 text-secondary">{{ record.completionDate || '--' }}</td>
|
||||
<td class="border-b border-default px-3 py-2.5 text-secondary">{{ record.trainingType === 'onboarding' ? $t('chat.training.hr.filters.typeOnboarding') : record.trainingType === 'safety' ? $t('chat.training.hr.filters.typeSafety') : (record.trainingType || '--') }}</td>
|
||||
<td class="border-b border-default px-3 py-2.5 text-secondary">{{ workspace.resolveTrainingTypeName(record.trainingType) }}</td>
|
||||
<td class="border-b border-default px-3 py-2.5 text-secondary">{{ record.department }}</td>
|
||||
<td class="border-b border-default px-3 py-2.5 font-medium text-primary">{{ record.name }}</td>
|
||||
<td class="border-b border-default px-3 py-2.5 text-secondary">{{ record.employeeId }}</td>
|
||||
@@ -1606,7 +1620,7 @@ const currentSafetyStageText = computed(() => {
|
||||
<div v-else-if="currentReportRecord">
|
||||
<!-- Header Info -->
|
||||
<div class="report-header-info mb-8 rounded-2xl bg-surface-soft p-6">
|
||||
<h2 class="mb-4 text-center text-2xl font-bold text-primary">{{ currentReportRecord.trainingType === 'onboarding' ? $t('chat.training.hr.filters.typeOnboarding') : currentReportRecord.trainingType === 'safety' ? $t('chat.training.hr.filters.typeSafety') : currentReportRecord.trainingType }} {{ $t('chat.training.hr.report.title') }}</h2>
|
||||
<h2 class="mb-4 text-center text-2xl font-bold text-primary">{{ workspace.resolveTrainingTypeName(currentReportRecord.trainingType) }} {{ $t('chat.training.hr.report.title') }}</h2>
|
||||
<div class="grid grid-cols-2 gap-4 sm:grid-cols-4">
|
||||
<div>
|
||||
<div class="text-xs text-secondary">{{ $t('chat.training.hr.columns.name') }}</div>
|
||||
|
||||
Reference in new issue
Block a user