feat(training-config): 培训视频上传列表超长默认收起支持展开查看全部

This commit is contained in:
runny committed 2026-09-18 11:19:46 +08:00
1 parent 17f6fae876
commit 7aca1d61f2
6 files changed
+45 -10

No files matched your search

+1 -1
View File
@@ -68,7 +68,7 @@
| 管理端培训模式配置 | 已实现 | Agent 管理表单支持显式开启培训工作区;平台应用说明页支持上传并标记“员工培训视频 / 员工培训试题 PDF”,并可直接把试题 PDF 解析导入题库表单;扫描件 PDF 在 OCR 依赖齐备时也可回退识别 |
| 首页培训推荐入口 | 前端已实现 | 当 Agent 开启培训模式后,工作台首页会在应用列表上方展示培训强入口卡片 |
| 培训记录后端落库 | 已实现 | 已新增培训记录模型、迁移与用户/管理端 API,考试进度、结果、统计与导出均可走后端数据源 |
| 培训配置管理 | 已实现 | `TrainingConfigResource` 增加 `training_level`;管理端按公司级、部门级、班组级卡片独立增删资料;知识库候选仅允许“员工培训”分组内未删除文档的当前版本;员工端按 `safetyStage` 动态展示当前级别资料 |
| 培训配置管理 | 已实现 | `TrainingConfigResource` 增加 `training_level`;管理端按公司级、部门级、班组级卡片独立增删资料;知识库候选仅允许“员工培训”分组内未删除文档的当前版本;员工端按 `safetyStage` 动态展示当前级别资料;培训资料区直接上传的视频列表超过 3 条时默认收起(仅展示前 3 条),底部可展开查看全部/收起,切换培训类型恢复收起、上传新视频后自动展开 |
| 精益培训对象化任务与提醒 | 已实现 | HR 按系统角色或指定用户(并集)发布精益周任务;任务、看板和提醒只处理冻结对象,首次发布与定向催学均复用企微提醒审计幂等去重。学员端“精益管理”按时间树展示全部已发布任务(按任务周期倒序、最新在上),每期任务带状态徽章(进行中/已延期/已完成,由服务端按截止时间与完成记录判定)、任务周期区间与视频缩略图(点击弹窗播放,须播放到结尾才判定观看完成并由服务端持久化,提前关闭或拖拽跳过不计);提交学习感悟前校验:未观看全部已推送视频或感悟字数不达标时拦截并友好提示;任务"已完成"仅在感悟提交后落定。 |
| 精益周任务规则化推送 | 已实现 | 任务周(周一)与截止时间默认按当周计算且**支持修改**(可指定任意自然周与截止时刻,须为周一且截止不早于所选周周一;修改后【发布周任务】/【立即新增任务补推】均作用于所选周任务);培训视频列表分页展示(4 条/页),已推送视频默认勾选、不可取消并带"第X周 MM-DD至MM-DD"周次标签,推过的视频不重复推直至全部推完(跨任务按已推送前缀并集去重,手动新建下一期任务同样继承历史推送游标、绝不从 0 重推首批);【发布周任务】对所选周任务发布并仅当继承游标为 0 时自动推首批,【立即新增任务补推】按游标对所选周任务增推(点击时若表单勾选/规则与已保存任务不一致,自动先保存再推送,避免按旧冻结清单推送误报全部推完);平台排程每周一 09:00(Asia/Shanghai)自动滚动创建当周任务(模板取严格早于当周的最近一期,游标继承进度,并自动追加配置新增视频到冻结列表末尾,前缀与游标不变、从断点只推新视频)并推送下一批,无需人工维护;每批推送成功后立即向受训人员发送企微通知,并对"已延期"(过截止未提交)人员立即发送延期提醒(event_key 幂等防重);学员端任务期号统一采用后端 week_index 口径。规则手册见 [docs/features/training/精益管理周任务规则手册.md](features/training/精益管理周任务规则手册.md) |
| 培训分享入口 | 前端已实现 | 员工培训页培训类型页签行右侧新增分享按钮,仅具备 `training_hr_manage`(培训管理)权限的用户可见;点击弹出分享弹窗,支持复制链接或下载二维码,链接指向 `/chat/<agentId>?training_type=<当前培训类型>` 深链,接收者点击或扫码后在登录页登录,登录成功自动回跳员工培训页并定位到对应培训类型(如“出国规章培训”);文案覆盖 zh-CN/zh-TW/en/th 四语言 |
@@ -10,7 +10,9 @@ import { useI18n } from 'vue-i18n';
import {
BookOpen,
CheckCircle2,
ChevronDown,
ChevronRight,
ChevronUp,
ClipboardCheck,
Edit,
FileQuestion,
@@ -105,6 +107,19 @@ const directVideoResources = computed(() => contentResources.value.filter((resou
resource.resource_type === 'agent_guide'
&& videoGuideCandidates.value.some((guide) => guide.id === resource.agent_guide_id)
)));
// 培训视频上传列表默认收起:超过阈值仅展示前 N 条,底部按钮可展开查看全部,避免视频过多时页面过长
const DIRECT_VIDEO_PREVIEW_COUNT = 3;
const isDirectVideoExpanded = ref(false);
const hasMoreDirectVideos = computed(() => directVideoResources.value.length > DIRECT_VIDEO_PREVIEW_COUNT);
const directVideoVisibleResources = computed(() => (
hasMoreDirectVideos.value && !isDirectVideoExpanded.value
? directVideoResources.value.slice(0, DIRECT_VIDEO_PREVIEW_COUNT)
: directVideoResources.value
));
/** 切换培训视频上传列表展开/收起:收起仅保留前 N 条,其余视频仍在表单资源中参与保存。 */
const toggleDirectVideoExpanded = () => {
isDirectVideoExpanded.value = !isDirectVideoExpanded.value;
};
const contentResources = computed(() => form.value.resources.filter((resource) => resource.resource_type !== 'inline_questions'));
const trainingLevels: TrainingLevel[] = ['company', 'department', 'team'];
const guideGroups = computed(() => {
@@ -452,6 +467,8 @@ const selectConfig = (config: TrainingConfig) => {
questionJsonText.value = JSON.stringify(questions, null, 2);
questionSourceVersionId.value = null;
questionParseMeta.value = null;
// 切换培训类型时培训视频上传列表恢复默认收起,避免上一配置的展开状态带入
isDirectVideoExpanded.value = false;
void loadLeanTask();
};
@@ -740,6 +757,8 @@ const uploadTrainingVideo = async (event: Event) => {
required_duration: 0,
sort_order: form.value.resources.length,
});
// 新上传的视频排在列表末尾,自动展开避免用户以为上传失败找不到新视频
isDirectVideoExpanded.value = true;
msg.success(t('admin.trainingConfig.messages.videoUploaded'));
} catch (error) {
msg.error(error instanceof Error ? error.message : t('admin.trainingConfig.messages.videoUploadFailed'));
@@ -945,11 +964,19 @@ onMounted(() => void load());
</div>
<div class="space-y-3 p-4 md:p-5">
<div v-if="!directVideoResources.length" class="rounded-xl border border-dashed border-default bg-surface-soft/50 px-3 py-8 text-center text-xs text-muted">{{ t('admin.trainingConfig.directVideo.empty') }}</div>
<div v-for="(resource, index) in directVideoResources" v-else :key="resource.id || `direct-video-${index}`" class="grid gap-3 rounded-xl border border-default bg-white p-4 md:grid-cols-[minmax(0,1fr)_180px_auto] md:items-end">
<div class="flex min-w-0 items-center gap-2 text-sm font-medium text-primary"><Video class="h-4 w-4 shrink-0 text-violet-500" /><span class="truncate">{{ resource.title || videoGuideCandidates.find((guide) => guide.id === resource.agent_guide_id)?.file_name || t('admin.trainingConfig.directVideo.unnamed') }}</span></div>
<label class="label-field">{{ t('admin.trainingConfig.fields.requiredDuration') }}<input v-model.number="resource.required_duration" type="number" min="0" class="input-field mt-2" /></label>
<button class="btn-danger btn-sm" type="button" @click="removeResource(resource)"><Trash2 class="h-4 w-4" />{{ t('admin.delete') }}</button>
</div>
<!-- 培训视频上传列表默认收起:超过阈值仅展示前 N 条,底部可展开查看全部 -->
<template v-else>
<div v-for="(resource, index) in directVideoVisibleResources" :key="resource.id || `direct-video-${index}`" class="grid gap-3 rounded-xl border border-default bg-white p-4 md:grid-cols-[minmax(0,1fr)_180px_auto] md:items-end">
<div class="flex min-w-0 items-center gap-2 text-sm font-medium text-primary"><Video class="h-4 w-4 shrink-0 text-violet-500" /><span class="truncate">{{ resource.title || videoGuideCandidates.find((guide) => guide.id === resource.agent_guide_id)?.file_name || t('admin.trainingConfig.directVideo.unnamed') }}</span></div>
<label class="label-field">{{ t('admin.trainingConfig.fields.requiredDuration') }}<input v-model.number="resource.required_duration" type="number" min="0" class="input-field mt-2" /></label>
<button class="btn-danger btn-sm" type="button" @click="removeResource(resource)"><Trash2 class="h-4 w-4" />{{ t('admin.delete') }}</button>
</div>
<button v-if="hasMoreDirectVideos" class="flex w-full items-center justify-center gap-1.5 rounded-xl border border-dashed border-default bg-surface-soft/50 px-3 py-2.5 text-xs font-medium text-secondary transition hover:bg-surface-soft" type="button" @click="toggleDirectVideoExpanded">
<ChevronDown v-if="!isDirectVideoExpanded" class="h-4 w-4" />
<ChevronUp v-else class="h-4 w-4" />
{{ isDirectVideoExpanded ? t('admin.trainingConfig.directVideo.collapseList') : t('admin.trainingConfig.directVideo.expandAll', { count: directVideoResources.length }) }}
</button>
</template>
</div>
</article>
<article
+3 -1
View File
@@ -5063,7 +5063,9 @@
"upload": "Upload Video",
"uploading": "Uploading...",
"empty": "No training videos uploaded",
"unnamed": "Unnamed video"
"unnamed": "Unnamed video",
"expandAll": "Expand all videos ({count})",
"collapseList": "Collapse list"
},
"lean": {
"weekKey": "Task week (Monday)",
+3 -1
View File
@@ -4932,7 +4932,9 @@
"upload": "อัปโหลดวิดีโอ",
"uploading": "กำลังอัปโหลด...",
"empty": "ยังไม่มีวิดีโอการฝึกอบรม",
"unnamed": "วิดีโอไม่มีชื่อ"
"unnamed": "วิดีโอไม่มีชื่อ",
"expandAll": "แสดงวิดีโอทั้งหมด ({count})",
"collapseList": "ย่อรายการ"
},
"lean": {
"weekKey": "สัปดาห์ภารกิจ (วันจันทร์)",
+3 -1
View File
@@ -5090,7 +5090,9 @@
"upload": "上传视频",
"uploading": "上传中...",
"empty": "暂未上传培训视频",
"unnamed": "未命名视频"
"unnamed": "未命名视频",
"expandAll": "展开全部视频(共 {count} 个)",
"collapseList": "收起列表"
},
"lean": {
"weekKey": "任务周(周一)",
+3 -1
View File
@@ -4937,7 +4937,9 @@
"upload": "上傳影片",
"uploading": "上傳中...",
"empty": "尚未上傳培訓影片",
"unnamed": "未命名影片"
"unnamed": "未命名影片",
"expandAll": "展開全部影片(共 {count} 個)",
"collapseList": "收合列表"
},
"lean": {
"weekKey": "任務週(週一)",