feat(training): 新增精益培训周任务视频推送与定向提醒闭环
- 后端:新增周任务视频推送服务与定时任务,新增模型迁移 fb26bc033d27 - 配置:WECOM_NOTIFY_EVENTS 追加 training_lean_video_push 事件(dev/test/prod/shared 同步) - 管理端:培训配置页新增定向目标弹窗 LeanTargetModal - 工作台:完成看板提醒按钮按 sent/failed 实发统计如实提示(部分成功/失败/未发送),避免企微发送失败误报成功 - 文档:更新功能清单与技术架构,新增精益管理周任务规则手册;四语言 i18n 同步补齐
This commit is contained in:
1 parent
a0e4351e9a
commit
7927556ee2
34 files changed
+2039
-254
No files matched your search
@@ -22,6 +22,7 @@ import type {
|
||||
LeanTrainingWeeklyTask,
|
||||
LeanTrainingWeeklyTaskPayload,
|
||||
LeanTrainingDashboard,
|
||||
LeanTrainingPushLog,
|
||||
TrainingConfig,
|
||||
TrainingConfigPayload,
|
||||
TrainingResourceCandidates,
|
||||
@@ -471,6 +472,21 @@ export const createOrUpdateAdminLeanTrainingWeeklyTask = (payload: LeanTrainingW
|
||||
export const getAdminLeanTrainingDashboard = () =>
|
||||
requestJson<LeanTrainingDashboard>('/api/admin/lean-training/dashboard', auth());
|
||||
|
||||
/** 按 ID 读取指定周任务详情:发布/补推后刷新所选周任务上下文(dashboard 永远返回最新周,会跳走所选历史周)。 */
|
||||
export const getAdminLeanTrainingWeeklyTask = (taskId: number) =>
|
||||
requestJson<LeanTrainingWeeklyTask>(`/api/admin/lean-training/weekly-tasks/${taskId}`, auth());
|
||||
|
||||
/** HR 手动推送下一批精益培训视频(无需等待每周一排程),返回本轮推送日志。 */
|
||||
export const pushAdminLeanTrainingWeeklyTask = (taskId: number) =>
|
||||
requestJson<LeanTrainingPushLog>(`/api/admin/lean-training/weekly-tasks/${taskId}/push`, {
|
||||
method: 'POST',
|
||||
...auth(),
|
||||
});
|
||||
|
||||
/** 读取指定周任务的分批推送日志(含失败明细),供"推送记录"区块展示。 */
|
||||
export const getAdminLeanTrainingPushLogs = (taskId: number) =>
|
||||
requestJson<LeanTrainingPushLog[]>(`/api/admin/lean-training/weekly-tasks/${taskId}/push-logs`, auth());
|
||||
|
||||
// Users
|
||||
export const listAdminUsers = () => requestJson<AdminUserRow[]>('/api/admin/users', auth());
|
||||
|
||||
|
||||
@@ -20,10 +20,12 @@ import {
|
||||
ListChecks,
|
||||
Plus,
|
||||
Save,
|
||||
Send,
|
||||
Settings2,
|
||||
ShieldCheck,
|
||||
Trash2,
|
||||
Video,
|
||||
X,
|
||||
} from 'lucide-vue-next';
|
||||
import { useMessage } from '@/shared/composables/useMessage';
|
||||
import DeleteConfirmDialog from '@/shared/components/DeleteConfirmDialog.vue';
|
||||
@@ -33,16 +35,20 @@ import {
|
||||
createOrUpdateAdminLeanTrainingWeeklyTask,
|
||||
deleteAdminTrainingConfig,
|
||||
getAdminLeanTrainingDashboard,
|
||||
getAdminLeanTrainingPushLogs,
|
||||
getAdminLeanTrainingWeeklyTask,
|
||||
listAdminTrainingConfigs,
|
||||
listAdminAgents,
|
||||
listAdminTrainingResourceCandidates,
|
||||
listAdminUsers,
|
||||
parseAdminTrainingQuestionBank,
|
||||
pushAdminLeanTrainingWeeklyTask,
|
||||
updateAdminTrainingConfig,
|
||||
uploadAdminAgentGuideFile,
|
||||
} from '../../api/admin.api';
|
||||
import type {
|
||||
GenericTrainingStage,
|
||||
LeanTrainingPushLog,
|
||||
LeanTrainingWeeklyTask,
|
||||
SafetyTrainingStage,
|
||||
TrainingConfig,
|
||||
@@ -53,6 +59,7 @@ import type {
|
||||
} from '../../types/training-config.types';
|
||||
import type { AdminUserRow } from '../../types/admin.types';
|
||||
import TrainingTypeFormModal from './components/TrainingTypeFormModal.vue';
|
||||
import LeanTargetModal from './components/LeanTargetModal.vue';
|
||||
|
||||
const { t } = useI18n();
|
||||
const msg = useMessage();
|
||||
@@ -72,13 +79,19 @@ const candidates = ref({ guides: [], documents: [], training_exam_documents: []
|
||||
const leanTask = ref<LeanTrainingWeeklyTask | null>(null);
|
||||
const leanWeekKey = ref('');
|
||||
const leanDueAt = ref('');
|
||||
const leanWeeklyCount = ref(1);
|
||||
const leanVideoResourceIds = ref<number[]>([]);
|
||||
const leanTargetRoles = ref<string[]>([]);
|
||||
const leanTargetUserIds = ref<number[]>([]);
|
||||
const leanTargetUsers = ref<AdminUserRow[]>([]);
|
||||
const isSavingLeanTask = ref(false);
|
||||
const isPushingLeanTask = ref(false);
|
||||
const leanPushLogs = ref<LeanTrainingPushLog[]>([]);
|
||||
const isUploadingVideo = ref(false);
|
||||
const videoInput = ref<HTMLInputElement | null>(null);
|
||||
// 培训视频列表分页:一页最多 4 条记录(周任务规则)
|
||||
const LEAN_VIDEO_PAGE_SIZE = 4;
|
||||
const leanVideoPage = ref(1);
|
||||
|
||||
const selected = computed(() => configs.value.find((item) => item.id === selectedId.value) || null);
|
||||
const form = ref<TrainingConfigPayload>(emptyForm());
|
||||
@@ -158,7 +171,39 @@ const leanTaskVideoNames = computed(() => new Map(leanVideoResources.value.map((
|
||||
resource.id as number,
|
||||
resource.title || candidates.value.guides.find((guide) => guide.id === resource.agent_guide_id)?.file_name || t('admin.trainingConfig.lean.unnamedVideo'),
|
||||
])));
|
||||
// 培训视频分页展示:一页最多 4 条(周任务规则 1)
|
||||
const leanVideoTotalPages = computed(() => Math.max(1, Math.ceil(leanVideoResources.value.length / LEAN_VIDEO_PAGE_SIZE)));
|
||||
const leanVideoResourcesPaged = computed(() => (
|
||||
leanVideoResources.value.slice((leanVideoPage.value - 1) * LEAN_VIDEO_PAGE_SIZE, leanVideoPage.value * LEAN_VIDEO_PAGE_SIZE)
|
||||
));
|
||||
const leanRoleOptions = computed(() => [...new Set(leanTargetUsers.value.map((user) => user.role).filter(Boolean))].sort());
|
||||
// 已选用户 ID → 用户行映射,用于受训对象列表展示真实姓名/用户名
|
||||
const leanTargetUserMap = computed(() => new Map(leanTargetUsers.value.map((user) => [user.id, user])));
|
||||
const showLeanTargetModal = ref(false);
|
||||
|
||||
/** 已选用户展示名:优先真实姓名,缺失时回退用户名,与弹窗选择列表口径一致。 */
|
||||
const leanTargetUserName = (userId: number): string => {
|
||||
const user = leanTargetUserMap.value.get(userId);
|
||||
if (!user) return `#${userId}`;
|
||||
return user.real_name || user.username;
|
||||
};
|
||||
|
||||
/** 移除单个已选角色(弹窗外快捷操作,未保存前仅影响草稿状态)。 */
|
||||
const removeLeanRole = (role: string) => {
|
||||
leanTargetRoles.value = leanTargetRoles.value.filter((item) => item !== role);
|
||||
};
|
||||
|
||||
/** 移除单个已选员工。 */
|
||||
const removeLeanUser = (userId: number) => {
|
||||
leanTargetUserIds.value = leanTargetUserIds.value.filter((item) => item !== userId);
|
||||
};
|
||||
|
||||
/** 接收受训弹窗确认结果,写回角色与用户 ID 草稿,等待"保存任务"统一提交。 */
|
||||
const handleLeanTargetSave = (payload: { roles: string[]; userIds: number[] }) => {
|
||||
leanTargetRoles.value = payload.roles;
|
||||
leanTargetUserIds.value = payload.userIds;
|
||||
showLeanTargetModal.value = false;
|
||||
};
|
||||
|
||||
function mondayOfCurrentWeek(): string {
|
||||
const today = new Date();
|
||||
@@ -174,6 +219,15 @@ function defaultLeanDueAt(weekKey: string): string {
|
||||
return local.toISOString().slice(0, 16);
|
||||
}
|
||||
|
||||
/** 将后端 UTC ISO 时间转换为 datetime-local 输入框本地值(YYYY-MM-DDTHH:mm),非法值返回空串。 */
|
||||
const toLocalDateTimeInput = (iso: string | null | undefined): string => {
|
||||
if (!iso) return '';
|
||||
const parsed = new Date(iso);
|
||||
if (Number.isNaN(parsed.getTime())) return '';
|
||||
const local = new Date(parsed.getTime() - parsed.getTimezoneOffset() * 60000);
|
||||
return local.toISOString().slice(0, 16);
|
||||
};
|
||||
|
||||
const loadLeanTask = async () => {
|
||||
if (form.value.training_type !== 'lean_management') return;
|
||||
try {
|
||||
@@ -182,35 +236,109 @@ const loadLeanTask = async () => {
|
||||
} catch {
|
||||
leanTask.value = null;
|
||||
}
|
||||
// [RULE] 任务周与截止时间支持修改:已有任务回填其周次与截止(本地时区展示),新任务默认当周(周一 ~ 周日 23:59);保存后按所选周创建/更新
|
||||
leanWeekKey.value = leanTask.value?.week_key || mondayOfCurrentWeek();
|
||||
leanDueAt.value = leanTask.value?.due_at ? leanTask.value.due_at.slice(0, 16) : defaultLeanDueAt(leanWeekKey.value);
|
||||
leanDueAt.value = leanTask.value?.due_at ? toLocalDateTimeInput(leanTask.value.due_at) : defaultLeanDueAt(leanWeekKey.value);
|
||||
leanWeeklyCount.value = leanTask.value?.weekly_count ?? 1;
|
||||
leanVideoResourceIds.value = leanTask.value?.video_resource_ids ? [...leanTask.value.video_resource_ids] : [];
|
||||
leanTargetRoles.value = leanTask.value?.target_roles ? [...leanTask.value.target_roles] : [];
|
||||
leanTargetUserIds.value = leanTask.value?.target_user_ids ? [...leanTask.value.target_user_ids] : [];
|
||||
leanTargetUsers.value = await listAdminUsers();
|
||||
leanVideoPage.value = 1;
|
||||
if (leanTask.value) await loadLeanPushLogs();
|
||||
};
|
||||
|
||||
/** 拉取当前周任务的分批推送日志(含失败明细),供"推送记录"区块展示。 */
|
||||
const loadLeanPushLogs = async () => {
|
||||
if (!leanTask.value) return;
|
||||
try {
|
||||
leanPushLogs.value = await getAdminLeanTrainingPushLogs(leanTask.value.id);
|
||||
} catch {
|
||||
leanPushLogs.value = [];
|
||||
}
|
||||
};
|
||||
|
||||
/** 立即新增任务补推:按现有游标逻辑对新增任务视频增推一批(数量=每周任务数量),无需等待每周一排程;成功后刷新任务与日志。 */
|
||||
const pushLeanTaskNow = async () => {
|
||||
if (!leanTask.value || isPushingLeanTask.value) return;
|
||||
isPushingLeanTask.value = true;
|
||||
try {
|
||||
const log = await pushAdminLeanTrainingWeeklyTask(leanTask.value.id);
|
||||
if (log.status === 'completed') {
|
||||
msg.warning(t('admin.trainingConfig.lean.pushCompleted'));
|
||||
} else {
|
||||
msg.success(t('admin.trainingConfig.lean.pushSuccess', { count: log.pushed_count }));
|
||||
}
|
||||
// [STEP] 补推后按所选周任务刷新(而非 dashboard 最新周),保持表单周次/截止/游标上下文一致
|
||||
try {
|
||||
leanTask.value = await getAdminLeanTrainingWeeklyTask(leanTask.value.id);
|
||||
leanVideoResourceIds.value = leanTask.value?.video_resource_ids ? [...leanTask.value.video_resource_ids] : [];
|
||||
} catch {
|
||||
// 刷新失败不吞掉推送成功结果,游标以推送日志为准
|
||||
}
|
||||
await loadLeanPushLogs();
|
||||
} catch (error) {
|
||||
msg.error(error instanceof Error ? error.message : t('admin.trainingConfig.lean.pushFailed'));
|
||||
} finally {
|
||||
isPushingLeanTask.value = false;
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* 判断视频是否为已推送(锁定)状态:任务游标前缀内的视频已推送给受训员工。
|
||||
* 业务约束:推送过的视频默认勾选且不能取消勾选(周任务规则 5)。
|
||||
*/
|
||||
const isLeanVideoLocked = (resourceId: number): boolean => {
|
||||
const pushedCount = leanTask.value?.pushed_video_count ?? 0;
|
||||
return (leanTask.value?.video_resource_ids || []).slice(0, pushedCount).includes(resourceId);
|
||||
};
|
||||
|
||||
/**
|
||||
* 已推送视频的周次标签:"第N周 MM-DD至MM-DD"(N=任务期号,范围为该任务周)。
|
||||
* 仅已推送视频展示(周任务规则 4),未推送视频返回空字符串。
|
||||
*/
|
||||
const leanVideoWeekLabel = (resourceId: number): string => {
|
||||
if (!isLeanVideoLocked(resourceId) || !leanTask.value) return '';
|
||||
const weekKey = leanTask.value.week_key || '';
|
||||
const weekEnd = leanTask.value.week_end || '';
|
||||
const range = weekKey && weekEnd ? `${weekKey.slice(5)}至${weekEnd.slice(5)}` : weekKey;
|
||||
return t('admin.trainingConfig.lean.weekRangeLabel', { index: leanTask.value.week_index ?? 1, range });
|
||||
};
|
||||
|
||||
/** 培训视频翻页:目标页越界时收敛到有效范围。 */
|
||||
const goLeanVideoPage = (page: number) => {
|
||||
leanVideoPage.value = Math.min(Math.max(1, page), leanVideoTotalPages.value);
|
||||
};
|
||||
|
||||
/** 切换视频选择:已推送(锁定)视频禁止取消勾选;新视频可自由追加/移除,保存后按选择顺序继续分批推送。 */
|
||||
const toggleLeanVideo = (resourceId: number) => {
|
||||
if (leanTask.value?.week_key === leanWeekKey.value) return;
|
||||
if (isLeanVideoLocked(resourceId)) return;
|
||||
leanVideoResourceIds.value = leanVideoResourceIds.value.includes(resourceId)
|
||||
? leanVideoResourceIds.value.filter((id) => id !== resourceId)
|
||||
: [...leanVideoResourceIds.value, resourceId];
|
||||
};
|
||||
|
||||
const saveLeanTask = async () => {
|
||||
if (leanVideoResourceIds.value.length !== 2) {
|
||||
msg.warning(t('admin.trainingConfig.messages.leanVideoCount'));
|
||||
// 任务周必须为周一:date input 允许选任意日期,前端先行拦截,后端同规则兜底校验
|
||||
if (!leanWeekKey.value || new Date(`${leanWeekKey.value}T00:00:00`).getDay() !== 1) {
|
||||
msg.warning(t('admin.trainingConfig.lean.weekMustBeMonday'));
|
||||
return;
|
||||
}
|
||||
isSavingLeanTask.value = true;
|
||||
try {
|
||||
leanTask.value = await createOrUpdateAdminLeanTrainingWeeklyTask({
|
||||
// 任务周/截止时间支持修改:按表单所选周创建或更新,发布/补推均作用于所选周任务(周任务规则 7)
|
||||
week_key: leanWeekKey.value,
|
||||
due_at: new Date(leanDueAt.value).toISOString(),
|
||||
// 未勾选任何视频时传空数组,服务端自动按上传时间倒序冻结全部视频(周任务规则 6)
|
||||
video_resource_ids: leanVideoResourceIds.value,
|
||||
target_roles: leanTargetRoles.value,
|
||||
target_user_ids: leanTargetUserIds.value,
|
||||
weekly_count: leanWeeklyCount.value,
|
||||
});
|
||||
// 保存后回填勾选状态(空选择时服务端可能已自动填充全部视频)
|
||||
leanVideoResourceIds.value = leanTask.value?.video_resource_ids ? [...leanTask.value.video_resource_ids] : [];
|
||||
await loadLeanPushLogs();
|
||||
msg.success(t('admin.trainingConfig.messages.leanTaskSaved'));
|
||||
} catch (error) {
|
||||
msg.error(error instanceof Error ? error.message : t('admin.trainingConfig.messages.saveFailed'));
|
||||
@@ -219,6 +347,13 @@ const saveLeanTask = async () => {
|
||||
}
|
||||
};
|
||||
|
||||
/** 推送批次展示名:视频序号(从 1 起)+ 资源标题。 */
|
||||
const leanPushedVideoLabel = (resourceId: number): string => {
|
||||
const index = leanTask.value?.video_resource_ids.indexOf(resourceId) ?? -1;
|
||||
const name = leanTaskVideoNames.value.get(resourceId) || `#${resourceId}`;
|
||||
return index >= 0 ? `${String(index + 1).padStart(2, '0')} ${name}` : name;
|
||||
};
|
||||
|
||||
/** 创建新增培训类型所需的完整默认配置,确保沿用后端既有字段契约。 */
|
||||
function emptyForm(): TrainingConfigPayload {
|
||||
return {
|
||||
@@ -840,33 +975,97 @@ onMounted(() => void load());
|
||||
</div>
|
||||
<div v-if="form.status !== 'published'" class="rounded-xl border border-amber-200 bg-amber-50 px-4 py-3 text-sm text-amber-800">{{ t('admin.trainingConfig.lean.publishRequired') }}</div>
|
||||
<div v-else class="space-y-5">
|
||||
<div class="grid gap-5 md:grid-cols-2">
|
||||
<div class="grid gap-5 md:grid-cols-3">
|
||||
<!-- 任务周/截止时间支持修改:按所选自然周创建或更新任务,【发布周任务】/【立即新增任务补推】均作用于所选周 -->
|
||||
<label class="label-field">{{ t('admin.trainingConfig.lean.weekKey') }}<input v-model="leanWeekKey" type="date" class="input-field mt-2" /></label>
|
||||
<label class="label-field">{{ t('admin.trainingConfig.lean.dueAt') }}<input v-model="leanDueAt" type="datetime-local" class="input-field mt-2" /></label>
|
||||
<!-- 每周任务数量:每周一 09:00 按该数量从视频列表顺序推送下一批给受训对象 -->
|
||||
<label class="label-field">{{ t('admin.trainingConfig.lean.weeklyCount') }}<input v-model.number="leanWeeklyCount" type="number" min="1" max="50" class="input-field mt-2" /></label>
|
||||
</div>
|
||||
<p class="-mt-2 text-xs text-muted">{{ t('admin.trainingConfig.lean.weeklyCountHint', { pushed: leanTask?.pushed_video_count ?? 0, total: leanVideoResourceIds.length }) }}</p>
|
||||
<div class="rounded-xl border border-default bg-surface-soft/40 p-4">
|
||||
<div class="flex flex-wrap items-center justify-between gap-2">
|
||||
<div><h4 class="text-sm font-semibold text-primary">{{ t('admin.trainingConfig.lean.videosTitle') }}</h4><p class="mt-1 text-xs text-muted">{{ t('admin.trainingConfig.lean.videosHint', { count: leanVideoResourceIds.length }) }}</p></div>
|
||||
<span v-if="leanTask?.week_key === leanWeekKey" class="rounded-full bg-slate-100 px-3 py-1 text-xs font-medium text-slate-600">{{ t('admin.trainingConfig.lean.videosFrozen') }}</span>
|
||||
<span v-if="leanTask" class="rounded-full bg-emerald-50 px-3 py-1 text-xs font-medium text-emerald-700">{{ t('admin.trainingConfig.lean.pushProgress', { pushed: leanTask.pushed_video_count, total: leanTask.video_resource_ids.length }) }}</span>
|
||||
</div>
|
||||
<div v-if="!leanVideoResources.length" class="mt-4 rounded-lg border border-dashed border-default bg-white px-4 py-5 text-sm text-muted">{{ t('admin.trainingConfig.lean.noVideoResources') }}</div>
|
||||
<div v-else class="mt-4 grid gap-3 md:grid-cols-2">
|
||||
<label v-for="resource in leanVideoResources" :key="resource.id" class="flex cursor-pointer items-center gap-3 rounded-xl border bg-white p-4 transition" :class="leanVideoResourceIds.includes(resource.id as number) ? 'border-emerald-400 ring-1 ring-emerald-200' : 'border-default'">
|
||||
<input :checked="leanVideoResourceIds.includes(resource.id as number)" :disabled="leanTask?.week_key === leanWeekKey" type="checkbox" class="h-4 w-4 rounded border-default text-emerald-600 focus:ring-emerald-500" @change="toggleLeanVideo(resource.id as number)" />
|
||||
<span class="min-w-0 flex-1 truncate text-sm text-primary">{{ leanTaskVideoNames.get(resource.id as number) }}</span>
|
||||
</label>
|
||||
</div>
|
||||
<template v-else>
|
||||
<!-- 培训视频分页展示:一页最多 4 条(周任务规则 1);已推送视频锁定勾选并展示周次标签 -->
|
||||
<div class="mt-4 grid gap-3 md:grid-cols-2">
|
||||
<label v-for="resource in leanVideoResourcesPaged" :key="resource.id" class="flex items-center gap-3 rounded-xl border bg-white p-4 transition" :class="leanVideoResourceIds.includes(resource.id as number) ? 'border-emerald-400 ring-1 ring-emerald-200' : 'border-default'" :style="isLeanVideoLocked(resource.id as number) ? 'cursor:not-allowed' : 'cursor:pointer'">
|
||||
<input :checked="leanVideoResourceIds.includes(resource.id as number)" type="checkbox" :disabled="isLeanVideoLocked(resource.id as number)" class="h-4 w-4 rounded border-default text-emerald-600 focus:ring-emerald-500 disabled:opacity-70" @change="toggleLeanVideo(resource.id as number)" />
|
||||
<span class="min-w-0 flex-1 truncate text-sm text-primary">{{ leanTaskVideoNames.get(resource.id as number) }}</span>
|
||||
<!-- 已推送视频展示所属周次:"第N周 MM-DD至MM-DD"(不可取消勾选) -->
|
||||
<span v-if="leanVideoWeekLabel(resource.id as number)" class="shrink-0 rounded-full bg-emerald-50 px-2.5 py-0.5 text-xs font-medium text-emerald-700">{{ leanVideoWeekLabel(resource.id as number) }}</span>
|
||||
</label>
|
||||
</div>
|
||||
<!-- 分页控件:超过一页时展示上一页/下一页与页码概览 -->
|
||||
<div v-if="leanVideoTotalPages > 1" class="mt-3 flex items-center justify-end gap-2 text-xs text-muted">
|
||||
<button class="btn-secondary btn-sm" type="button" :disabled="leanVideoPage <= 1" @click="goLeanVideoPage(leanVideoPage - 1)">{{ t('admin.trainingConfig.lean.videoPagePrev') }}</button>
|
||||
<span>{{ t('admin.trainingConfig.lean.videoPageInfo', { page: leanVideoPage, total: leanVideoTotalPages }) }}</span>
|
||||
<button class="btn-secondary btn-sm" type="button" :disabled="leanVideoPage >= leanVideoTotalPages" @click="goLeanVideoPage(leanVideoPage + 1)">{{ t('admin.trainingConfig.lean.videoPageNext') }}</button>
|
||||
</div>
|
||||
</template>
|
||||
</div>
|
||||
<div class="rounded-xl border border-default bg-surface-soft/40 p-4">
|
||||
<div><h4 class="text-sm font-semibold text-primary">{{ t('admin.trainingConfig.lean.targetsTitle') }}</h4><p class="mt-1 text-xs text-muted">{{ t('admin.trainingConfig.lean.targetsHint') }}</p></div>
|
||||
<div class="mt-4 grid gap-4 md:grid-cols-2">
|
||||
<label class="label-field">{{ t('admin.trainingConfig.lean.targetRoles') }}<select v-model="leanTargetRoles" multiple class="select-field mt-2 min-h-28"><option v-for="role in leanRoleOptions" :key="role" :value="role">{{ role }}</option></select></label>
|
||||
<label class="label-field">{{ t('admin.trainingConfig.lean.targetUsers') }}<select v-model="leanTargetUserIds" multiple class="select-field mt-2 min-h-28"><option v-for="user in leanTargetUsers" :key="user.id" :value="user.id">{{ user.real_name || user.username }} · {{ user.username }}</option></select></label>
|
||||
<div class="flex flex-wrap items-center justify-between gap-2">
|
||||
<div><h4 class="text-sm font-semibold text-primary">{{ t('admin.trainingConfig.lean.targetsTitle') }}</h4><p class="mt-1 text-xs text-muted">{{ t('admin.trainingConfig.lean.targetsHint') }}</p></div>
|
||||
<button class="btn-secondary btn-sm" type="button" @click="showLeanTargetModal = true"><Plus class="h-4 w-4" />{{ t('admin.trainingConfig.lean.addTarget') }}</button>
|
||||
</div>
|
||||
<!-- 已选受训对象列表:角色与员工以 chip 展示,支持快捷移除 -->
|
||||
<div v-if="!leanTargetRoles.length && !leanTargetUserIds.length" class="mt-4 rounded-lg border border-dashed border-default bg-white px-4 py-5 text-sm text-muted">{{ t('admin.trainingConfig.lean.targetEmpty') }}</div>
|
||||
<div v-else class="mt-4 space-y-3">
|
||||
<div v-if="leanTargetRoles.length" class="flex flex-wrap items-center gap-2">
|
||||
<span class="shrink-0 text-xs font-medium text-muted">{{ t('admin.trainingConfig.lean.targetRoles') }}</span>
|
||||
<span v-for="role in leanTargetRoles" :key="role" class="inline-flex items-center gap-1 rounded-full bg-emerald-50 px-3 py-1 text-xs font-medium text-emerald-700">
|
||||
{{ role }}
|
||||
<button type="button" class="rounded-full transition hover:text-emerald-900" :title="t('admin.trainingConfig.lean.removeTarget')" @click="removeLeanRole(role)"><X class="h-3 w-3" /></button>
|
||||
</span>
|
||||
</div>
|
||||
<div v-if="leanTargetUserIds.length" class="flex flex-wrap items-center gap-2">
|
||||
<span class="shrink-0 text-xs font-medium text-muted">{{ t('admin.trainingConfig.lean.targetUsersCount', { count: leanTargetUserIds.length }) }}</span>
|
||||
<span v-for="userId in leanTargetUserIds" :key="userId" class="inline-flex items-center gap-1 rounded-full bg-sky-50 px-3 py-1 text-xs font-medium text-sky-700">
|
||||
{{ leanTargetUserName(userId) }}
|
||||
<button type="button" class="rounded-full transition hover:text-sky-900" :title="t('admin.trainingConfig.lean.removeTarget')" @click="removeLeanUser(userId)"><X class="h-3 w-3" /></button>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
<!-- 添加受训弹窗:按角色 / 按员工多选 -->
|
||||
<LeanTargetModal
|
||||
:visible="showLeanTargetModal"
|
||||
:roles="leanTargetRoles"
|
||||
:user-ids="leanTargetUserIds"
|
||||
:users="leanTargetUsers"
|
||||
:role-options="leanRoleOptions"
|
||||
@close="showLeanTargetModal = false"
|
||||
@save="handleLeanTargetSave"
|
||||
/>
|
||||
</div>
|
||||
<div class="flex flex-wrap items-center justify-between gap-3 rounded-xl border border-emerald-200 bg-emerald-50/50 p-4">
|
||||
<p class="text-sm text-emerald-800">{{ t('admin.trainingConfig.lean.summaryRule', { count: 50 }) }}</p>
|
||||
<button class="btn-primary btn-sm" type="button" :disabled="isSavingLeanTask || !leanWeekKey || !leanDueAt || leanVideoResourceIds.length !== 2 || (!leanTargetRoles.length && !leanTargetUserIds.length)" @click="saveLeanTask"><Save class="h-4 w-4" />{{ isSavingLeanTask ? t('admin.trainingConfig.saving') : t('admin.trainingConfig.lean.saveTask') }}</button>
|
||||
<div class="flex flex-wrap items-center gap-2">
|
||||
<!-- 手动推送:立即按每周任务数量推送下一批视频,无需等待每周一排程 -->
|
||||
<button class="btn-secondary btn-sm" type="button" :disabled="!leanTask || isPushingLeanTask" @click="pushLeanTaskNow"><Send class="h-4 w-4" />{{ isPushingLeanTask ? t('admin.trainingConfig.lean.pushing') : t('admin.trainingConfig.lean.pushNow') }}</button>
|
||||
<button class="btn-primary btn-sm" type="button" :disabled="isSavingLeanTask || !leanWeekKey || !leanDueAt || leanVideoResourceIds.length < 1 || (!leanTargetRoles.length && !leanTargetUserIds.length)" @click="saveLeanTask"><Save class="h-4 w-4" />{{ isSavingLeanTask ? t('admin.trainingConfig.saving') : t('admin.trainingConfig.lean.saveTask') }}</button>
|
||||
</div>
|
||||
</div>
|
||||
<!-- 推送记录:每轮发布/排程/手动推送的批次、成败计数与失败明细 -->
|
||||
<div class="rounded-xl border border-default bg-surface-soft/40 p-4">
|
||||
<h4 class="text-sm font-semibold text-primary">{{ t('admin.trainingConfig.lean.pushLogsTitle') }}</h4>
|
||||
<div v-if="!leanPushLogs.length" class="mt-3 rounded-lg border border-dashed border-default bg-white px-4 py-5 text-sm text-muted">{{ t('admin.trainingConfig.lean.pushLogsEmpty') }}</div>
|
||||
<ul v-else class="mt-3 space-y-3">
|
||||
<li v-for="log in leanPushLogs" :key="log.id" class="rounded-lg border bg-white p-3 text-sm" :class="log.status === 'failed' ? 'border-red-200' : 'border-default'">
|
||||
<div class="flex flex-wrap items-center gap-2">
|
||||
<span class="rounded-full px-2.5 py-0.5 text-xs font-medium" :class="log.status === 'failed' ? 'bg-red-50 text-red-700' : log.status === 'partial' ? 'bg-amber-50 text-amber-700' : 'bg-emerald-50 text-emerald-700'">{{ t(`admin.trainingConfig.lean.pushStatus.${log.status}`) }}</span>
|
||||
<span class="text-xs text-muted">{{ t(`admin.trainingConfig.lean.pushTrigger.${log.trigger}`) }} · {{ log.created_at ? new Date(log.created_at).toLocaleString() : '' }}</span>
|
||||
</div>
|
||||
<p class="mt-2 text-xs text-muted">{{ t('admin.trainingConfig.lean.pushBatch', { count: log.pushed_count, sent: log.sent_count, failed: log.failed_count, recipients: log.recipient_count }) }}</p>
|
||||
<div v-if="log.pushed_resource_ids?.length" class="mt-2 flex flex-wrap gap-1.5">
|
||||
<span v-for="resourceId in log.pushed_resource_ids" :key="resourceId" class="rounded-full bg-slate-100 px-2.5 py-0.5 text-xs text-slate-600">{{ leanPushedVideoLabel(resourceId) }}</span>
|
||||
</div>
|
||||
<p v-if="log.error_message" class="mt-2 rounded bg-red-50 px-2.5 py-1.5 text-xs text-red-700">{{ log.error_message }}</p>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
@@ -0,0 +1,138 @@
|
||||
<script setup lang="ts">
|
||||
/**
|
||||
* features/admin/modules/training-config/components/LeanTargetModal.vue
|
||||
* 用途:精益周任务"受训对象"选择弹窗,支持按角色、按员工两个维度多选(两个范围取并集生效)。
|
||||
* 依赖:vue-i18n、lucide 图标与父级培训配置页面传入的目标状态(角色/用户 ID/用户列表)。
|
||||
* 逻辑:弹窗打开时从 props 快照到本地草稿(取消不污染外部状态);员工支持关键字搜索;
|
||||
* 确认后 emit save({ roles, userIds }),由父级写回表单并随"保存任务"统一落库。
|
||||
*/
|
||||
import { computed, ref, watch } from 'vue';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import { Search } from 'lucide-vue-next';
|
||||
import type { AdminUserRow } from '../../../types/admin.types';
|
||||
|
||||
const props = defineProps<{
|
||||
visible: boolean;
|
||||
roles: string[];
|
||||
userIds: number[];
|
||||
users: AdminUserRow[];
|
||||
roleOptions: string[];
|
||||
}>();
|
||||
|
||||
const emit = defineEmits<{ close: []; save: [payload: { roles: string[]; userIds: number[] }] }>();
|
||||
const { t } = useI18n();
|
||||
|
||||
const draftRoles = ref<string[]>([]);
|
||||
const draftUserIds = ref<number[]>([]);
|
||||
const keyword = ref('');
|
||||
|
||||
// [STEP 1] 打开时同步父级当前选择,避免用户在弹窗内取消后残留草稿
|
||||
watch(() => props.visible, (visible) => {
|
||||
if (visible) {
|
||||
draftRoles.value = [...props.roles];
|
||||
draftUserIds.value = [...props.userIds];
|
||||
keyword.value = '';
|
||||
}
|
||||
});
|
||||
|
||||
// [STEP 2] 员工列表按姓名/用户名/部门模糊过滤,便于在大量员工中快速定位
|
||||
const filteredUsers = computed(() => {
|
||||
const query = keyword.value.trim().toLowerCase();
|
||||
if (!query) return props.users;
|
||||
return props.users.filter((user) => [user.real_name, user.username, user.department]
|
||||
.some((field) => field && field.toLowerCase().includes(query)));
|
||||
});
|
||||
|
||||
const summaryLabel = computed(() => t('admin.trainingConfig.lean.targetSelectedCount', {
|
||||
roles: draftRoles.value.length,
|
||||
users: draftUserIds.value.length,
|
||||
}));
|
||||
|
||||
const toggleRole = (role: string) => {
|
||||
draftRoles.value = draftRoles.value.includes(role)
|
||||
? draftRoles.value.filter((item) => item !== role)
|
||||
: [...draftRoles.value, role];
|
||||
};
|
||||
|
||||
const toggleUser = (userId: number) => {
|
||||
draftUserIds.value = draftUserIds.value.includes(userId)
|
||||
? draftUserIds.value.filter((item) => item !== userId)
|
||||
: [...draftUserIds.value, userId];
|
||||
};
|
||||
|
||||
const handleSave = () => {
|
||||
emit('save', { roles: [...draftRoles.value], userIds: [...draftUserIds.value] });
|
||||
};
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div v-if="props.visible" class="admin-modal-overlay animate-fade-in items-center" @click.self="emit('close')">
|
||||
<div class="admin-modal-panel max-w-2xl max-h-[92vh] scale-100">
|
||||
<div class="px-5 sm:px-8 pt-5 sm:pt-7 pb-4 border-b border-subtle">
|
||||
<h3 class="section-title">{{ t('admin.trainingConfig.lean.targetModalTitle') }}</h3>
|
||||
<p class="mt-1 text-xs text-muted">{{ t('admin.trainingConfig.lean.targetsHint') }}</p>
|
||||
</div>
|
||||
<div class="px-5 sm:px-8 py-5 overflow-y-auto">
|
||||
<div class="grid gap-5 md:grid-cols-2">
|
||||
<!-- 按角色选择 -->
|
||||
<div class="space-y-2">
|
||||
<label class="label-field">{{ t('admin.trainingConfig.lean.targetRoles') }}</label>
|
||||
<div class="space-y-2 rounded-xl border border-default bg-surface p-3">
|
||||
<label
|
||||
v-for="role in props.roleOptions"
|
||||
:key="role"
|
||||
class="flex cursor-pointer items-center gap-3 rounded-lg px-2 py-2 text-sm transition hover:bg-surface-soft"
|
||||
>
|
||||
<input
|
||||
type="checkbox"
|
||||
class="h-4 w-4 rounded border-default text-emerald-600 focus:ring-emerald-500"
|
||||
:checked="draftRoles.includes(role)"
|
||||
@change="toggleRole(role)"
|
||||
/>
|
||||
<span class="text-primary">{{ role }}</span>
|
||||
</label>
|
||||
<p v-if="!props.roleOptions.length" class="px-2 py-3 text-xs text-muted">{{ t('admin.trainingConfig.lean.targetRolesEmpty') }}</p>
|
||||
</div>
|
||||
</div>
|
||||
<!-- 按员工选择 -->
|
||||
<div class="space-y-2">
|
||||
<label class="label-field">{{ t('admin.trainingConfig.lean.targetUsers') }}</label>
|
||||
<div class="relative">
|
||||
<Search class="pointer-events-none absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted" />
|
||||
<input
|
||||
v-model="keyword"
|
||||
type="text"
|
||||
class="input-field pl-9 text-sm"
|
||||
:placeholder="t('admin.trainingConfig.lean.targetSearchPlaceholder')"
|
||||
/>
|
||||
</div>
|
||||
<div class="max-h-64 space-y-1 overflow-y-auto rounded-xl border border-default bg-surface p-2">
|
||||
<label
|
||||
v-for="user in filteredUsers"
|
||||
:key="user.id"
|
||||
class="flex cursor-pointer items-center gap-3 rounded-lg px-2 py-2 text-sm transition hover:bg-surface-soft"
|
||||
>
|
||||
<input
|
||||
type="checkbox"
|
||||
class="h-4 w-4 rounded border-default text-emerald-600 focus:ring-emerald-500"
|
||||
:checked="draftUserIds.includes(user.id)"
|
||||
@change="toggleUser(user.id)"
|
||||
/>
|
||||
<span class="min-w-0 flex-1 truncate text-primary">{{ user.real_name || user.username }}</span>
|
||||
<span class="shrink-0 text-xs text-muted">{{ user.username }}</span>
|
||||
</label>
|
||||
<p v-if="!filteredUsers.length" class="px-2 py-3 text-xs text-muted">{{ t('admin.trainingConfig.lean.targetUsersEmpty') }}</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="admin-modal-footer">
|
||||
<p class="mr-auto text-xs text-muted">{{ summaryLabel }}</p>
|
||||
<button type="button" class="btn-ghost" @click="emit('close')">{{ t('admin.cancel') }}</button>
|
||||
<button type="button" class="btn-primary" @click="handleSave">
|
||||
{{ t('admin.trainingConfig.lean.targetConfirm') }}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
@@ -58,9 +58,30 @@ export interface TrainingConfigPayload {
|
||||
resources: TrainingConfigResource[];
|
||||
}
|
||||
|
||||
/** 精益推送日志:记录每轮(发布/排程/手动)分批推送视频的执行结果与失败明细。 */
|
||||
export interface LeanTrainingPushLog {
|
||||
id: number;
|
||||
weekly_task_id: number;
|
||||
trigger: 'publish' | 'schedule' | 'manual' | string;
|
||||
pushed_resource_ids: number[];
|
||||
pushed_count: number;
|
||||
recipient_count: number;
|
||||
sent_count: number;
|
||||
skipped_count: number;
|
||||
failed_count: number;
|
||||
status: 'sent' | 'partial' | 'failed' | 'completed' | string;
|
||||
error_message: string | null;
|
||||
created_by_id: number | null;
|
||||
created_at: string;
|
||||
}
|
||||
|
||||
export interface LeanTrainingWeeklyTask {
|
||||
id: number;
|
||||
week_key: string;
|
||||
/** 任务周周日(ISO 日期),与 week_key 拼装"第N周 MM-DD至MM-DD"周次标签。 */
|
||||
week_end: string | null;
|
||||
/** 期号:按周次升序编号,最早一周为第 1 期。 */
|
||||
week_index: number;
|
||||
due_at: string;
|
||||
video_resource_ids: number[];
|
||||
target_roles: string[];
|
||||
@@ -68,6 +89,8 @@ export interface LeanTrainingWeeklyTask {
|
||||
videos: Array<{ id: number; name: string }>;
|
||||
status: string;
|
||||
min_summary_length: number;
|
||||
weekly_count: number;
|
||||
pushed_video_count: number;
|
||||
}
|
||||
|
||||
export interface LeanTrainingWeeklyTaskPayload {
|
||||
@@ -76,6 +99,7 @@ export interface LeanTrainingWeeklyTaskPayload {
|
||||
video_resource_ids: number[];
|
||||
target_roles: string[];
|
||||
target_user_ids: number[];
|
||||
weekly_count: number;
|
||||
}
|
||||
|
||||
export interface LeanTrainingDashboard {
|
||||
|
||||
@@ -17,6 +17,8 @@ import type {
|
||||
TrainingStats,
|
||||
LeanTrainingDashboard,
|
||||
LeanTrainingDashboardRow,
|
||||
LeanTrainingMyTask,
|
||||
LeanTrainingTaskStatus,
|
||||
LeanTrainingWeeklyTask,
|
||||
TrainingType,
|
||||
TrainingTypeOption,
|
||||
@@ -25,19 +27,40 @@ import type {
|
||||
type LeanTrainingTaskApi = {
|
||||
id: number; week_key: string; due_at: string; video_resource_ids: number[];
|
||||
target_roles: string[]; target_user_ids: number[];
|
||||
videos: Array<{ id: number; name: string }>; status: string; min_summary_length: number;
|
||||
videos: Array<{ id: number; name: string; file_url?: string | null }>; status: string; min_summary_length: number;
|
||||
weekly_count?: number; pushed_video_count?: number;
|
||||
week_end?: string | null; week_index?: number;
|
||||
};
|
||||
|
||||
type LeanTrainingMyTaskApi = LeanTrainingTaskApi & {
|
||||
task_status: LeanTrainingTaskStatus;
|
||||
completion: { summary_text: string; watched_at: Record<string, string>; completed_at?: string | null } | null;
|
||||
};
|
||||
|
||||
type LeanTrainingDashboardRowApi = {
|
||||
id?: number; user_id: number; employee_id?: string | null; name: string; department?: string | null;
|
||||
videos: Array<{ name: string; watched_at?: string | null }>;
|
||||
summary_text?: string | null; status: 'completed' | 'incomplete'; completed_at?: string | null;
|
||||
// 后端序列化层三态归一:completed=已提交感悟;overdue=过截止未完成;in_progress=进行中
|
||||
summary_text?: string | null; status: 'completed' | 'in_progress' | 'overdue'; completed_at?: string | null;
|
||||
};
|
||||
|
||||
const mapLeanTask = (data: LeanTrainingTaskApi): LeanTrainingWeeklyTask => ({
|
||||
id: data.id, weekKey: data.week_key, dueAt: data.due_at, videoResourceIds: data.video_resource_ids || [],
|
||||
targetRoles: data.target_roles || [], targetUserIds: data.target_user_ids || [],
|
||||
videos: data.videos || [], status: data.status, minSummaryLength: data.min_summary_length,
|
||||
videos: (data.videos || []).map((video) => ({ id: video.id, name: video.name, fileUrl: video.file_url || null })),
|
||||
status: data.status, minSummaryLength: data.min_summary_length,
|
||||
weeklyCount: data.weekly_count, pushedVideoCount: data.pushed_video_count,
|
||||
weekEnd: data.week_end ?? null, weekIndex: data.week_index,
|
||||
});
|
||||
|
||||
const mapLeanMyTask = (data: LeanTrainingMyTaskApi): LeanTrainingMyTask => ({
|
||||
...mapLeanTask(data),
|
||||
taskStatus: data.task_status,
|
||||
completion: data.completion ? {
|
||||
summaryText: data.completion.summary_text,
|
||||
watchedAt: data.completion.watched_at || {},
|
||||
completedAt: data.completion.completed_at || null,
|
||||
} : null,
|
||||
});
|
||||
|
||||
const mapLeanDashboardRow = (data: LeanTrainingDashboardRowApi): LeanTrainingDashboardRow => ({
|
||||
@@ -256,9 +279,17 @@ export async function getMyTrainingTypes(): Promise<TrainingTypeOption[]> {
|
||||
return requestJson<TrainingTypeOption[]>('/api/user/training-types', authHeaders());
|
||||
}
|
||||
|
||||
export async function getCurrentLeanTrainingTask(): Promise<LeanTrainingWeeklyTask | null> {
|
||||
const response = await requestJson<LeanTrainingTaskApi | null>('/api/user/lean-training/current-task', authHeaders());
|
||||
return response ? mapLeanTask(response) : null;
|
||||
export async function getMyLeanTrainingTasks(): Promise<LeanTrainingMyTask[]> {
|
||||
const response = await requestJson<LeanTrainingMyTaskApi[]>('/api/user/lean-training/my-tasks', authHeaders());
|
||||
return (response || []).map(mapLeanMyTask);
|
||||
}
|
||||
|
||||
export async function markMyLeanVideoWatched(weeklyTaskId: number, resourceId: number): Promise<void> {
|
||||
await requestJson<{ watched_at: Record<string, string> }>('/api/user/lean-training/my-tasks/watched', {
|
||||
method: 'POST',
|
||||
...jsonAuthHeaders(),
|
||||
body: JSON.stringify({ weekly_task_id: weeklyTaskId, resource_id: resourceId }),
|
||||
});
|
||||
}
|
||||
|
||||
export async function saveMyLeanTrainingCompletion(payload: { weeklyTaskId: number; watchedAt: Record<string, string>; summaryText: string }): Promise<LeanTrainingDashboardRow> {
|
||||
@@ -268,13 +299,21 @@ export async function saveMyLeanTrainingCompletion(payload: { weeklyTaskId: numb
|
||||
return mapLeanDashboardRow(response);
|
||||
}
|
||||
|
||||
export async function getLeanTrainingDashboard(): Promise<LeanTrainingDashboard> {
|
||||
const response = await requestJson<{ task: LeanTrainingTaskApi | null; completed: LeanTrainingDashboardRowApi[]; incomplete: LeanTrainingDashboardRowApi[] }>('/api/admin/lean-training/dashboard', authHeaders());
|
||||
return { task: response.task ? mapLeanTask(response.task) : null, completed: (response.completed || []).map(mapLeanDashboardRow), incomplete: (response.incomplete || []).map(mapLeanDashboardRow) };
|
||||
export async function getLeanTrainingDashboard(taskId?: number): Promise<LeanTrainingDashboard> {
|
||||
// task_id 为空时后端返回最新一期;periods 为全部期次摘要(期号按周次升序),供管理端下拉切换第几期。
|
||||
const query = taskId ? `?task_id=${taskId}` : '';
|
||||
const response = await requestJson<{ task: LeanTrainingTaskApi | null; completed: LeanTrainingDashboardRowApi[]; incomplete: LeanTrainingDashboardRowApi[]; periods?: Array<{ id: number; week_key: string; index: number }> }>(`/api/admin/lean-training/dashboard${query}`, authHeaders());
|
||||
return {
|
||||
task: response.task ? mapLeanTask(response.task) : null,
|
||||
completed: (response.completed || []).map(mapLeanDashboardRow),
|
||||
incomplete: (response.incomplete || []).map(mapLeanDashboardRow),
|
||||
periods: (response.periods || []).map((period) => ({ id: period.id, weekKey: period.week_key, index: period.index })),
|
||||
};
|
||||
}
|
||||
|
||||
export async function sendLeanTrainingReminders(weeklyTaskId: number, userIds: number[]): Promise<{ created: number; skipped: number; failed: number }> {
|
||||
return requestJson<{ created: number; skipped: number; failed: number }>(`/api/admin/lean-training/weekly-tasks/${weeklyTaskId}/reminders`, {
|
||||
/** HR 对指定成员发起精益培训定向提醒;返回后端实发统计(sent/failed 才是真实送达情况,created 含发送失败)。 */
|
||||
export async function sendLeanTrainingReminders(weeklyTaskId: number, userIds: number[]): Promise<{ created: number; sent: number; skipped: number; failed: number }> {
|
||||
return requestJson<{ created: number; sent: number; skipped: number; failed: number }>(`/api/admin/lean-training/weekly-tasks/${weeklyTaskId}/reminders`, {
|
||||
method: 'POST',
|
||||
...jsonAuthHeaders(),
|
||||
body: JSON.stringify({ user_ids: userIds }),
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
*/
|
||||
import { computed, reactive, ref, watch, type ShallowUnwrapRef } from 'vue';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import { useRoute, useRouter } from 'vue-router';
|
||||
import {
|
||||
BookOpen,
|
||||
Bell,
|
||||
@@ -32,7 +33,7 @@ import FilePreviewModal from '@/shared/components/FilePreviewModal.vue';
|
||||
import { useMessage } from '@/shared/composables/useMessage';
|
||||
import { resolveTrainingExamPdfGuide, type TrainingGuideLike } from '@/features/chat/training/trainingWorkspace.utils';
|
||||
import { getMyTrainingConfig } from '@/features/chat/api/training.api';
|
||||
import type { TrainingAnswerRecord, TrainingRecord, TrainingQuestion } from '@/features/chat/training/training.types';
|
||||
import type { TrainingAnswerRecord, TrainingRecord, TrainingQuestion, LeanTrainingMyTask, LeanTrainingTaskStatus, LeanTrainingVideo } from '@/features/chat/training/training.types';
|
||||
import html2pdf from 'html2pdf.js';
|
||||
import { getAuthHeaders } from '@/shared/utils/auth';
|
||||
|
||||
@@ -73,7 +74,8 @@ const learnerStageIconMap = {
|
||||
result: ShieldCheck,
|
||||
} as const;
|
||||
const currentLearnerStageIndex = computed(() => learnerStageOrder.indexOf(workspace.stage));
|
||||
const showLearnerProgressModule = computed(() => workspace.learnerProgressItems.length > 0);
|
||||
// 进度模块仅在配置了多阶段流程时展示;单阶段培训(如出国规章培训仅视频学习)无进度追踪意义,主区域卡片与右侧栏面板同步隐藏。
|
||||
const showLearnerProgressModule = computed(() => workspace.learnerProgressItems.length > 1);
|
||||
const learnerProgressItems = computed(() => workspace.learnerProgressItems.map((item, index) => {
|
||||
const stageIndex = learnerStageOrder.indexOf(item.stage as typeof learnerStageOrder[number]);
|
||||
const status = stageIndex >= 0 && currentLearnerStageIndex.value >= 0
|
||||
@@ -118,6 +120,12 @@ const handleVideoSeeking = (e: Event) => {
|
||||
};
|
||||
|
||||
const handleVideoEnded = () => {
|
||||
// 精益任务视频:仅当播放到结尾才记录观看完成(配合防拖拽保证按时长完整观看)
|
||||
if (activeLeanVideo.value) {
|
||||
workspace.markLeanVideoWatched(activeLeanVideo.value.taskId, activeLeanVideo.value.resourceId);
|
||||
msg.success(t('chat.training.lean.videoWatchedToast'));
|
||||
activeLeanVideo.value = null;
|
||||
}
|
||||
workspace.showVideoModal = false;
|
||||
workspace.stopMaterialTimer();
|
||||
};
|
||||
@@ -285,6 +293,33 @@ const openWorkspaceView = (view: typeof workspace.activeView) => {
|
||||
setWorkspaceExpanded(true, true);
|
||||
};
|
||||
|
||||
// [STEP] 企微提醒卡片深链支持:/chat/<agentId>?training_type=lean_management&weekly_task_id=<id>
|
||||
// AI 触发时机:员工/HR 从企微“和信AI智能工作台”精益提醒卡片点入时,自动展开精益培训对应页签
|
||||
// (管理员进管理端看板、学员进学员侧学习页),无需手动点页签,保证卡片“点击直达”体验。
|
||||
const route = useRoute();
|
||||
const router = useRouter();
|
||||
let leanJumpConsumed = false;
|
||||
watch(
|
||||
() => [workspace.isTrainingAgent, Boolean(props.currentUser), workspace.canManageTrainingWorkspace] as const,
|
||||
([isTraining, loggedIn]) => {
|
||||
// 仅在培训 Agent 且登录态就绪后消费一次,避免身份权限异步未加载时误判视图归属
|
||||
if (!isTraining || !loggedIn || leanJumpConsumed) return;
|
||||
leanJumpConsumed = true;
|
||||
if (route.query.training_type !== 'lean_management') return;
|
||||
if (workspace.canManageTrainingWorkspace) {
|
||||
workspace.activeView = 'admin';
|
||||
workspace.hrTrainingTab = 'lean';
|
||||
} else {
|
||||
workspace.activeView = 'learner';
|
||||
workspace.learnerTab = 'lean_management';
|
||||
}
|
||||
setWorkspaceExpanded(true, true);
|
||||
// 消费后清理深链参数,避免刷新或分享链接时重复自动展开
|
||||
void router.replace({ query: { ...route.query, training_type: undefined, weekly_task_id: undefined } });
|
||||
},
|
||||
{ immediate: true },
|
||||
);
|
||||
|
||||
/**
|
||||
* 收起培训工作区并回到纯聊天页面。
|
||||
* AI 触发时机:点击“收起工作区”时,必须立即恢复聊天消息区与输入栏,而不是仅折叠局部内容。
|
||||
@@ -512,11 +547,69 @@ const handlePreviewClose = (val: boolean) => {
|
||||
};
|
||||
|
||||
const handleVideoModalClose = () => {
|
||||
// 提前关闭弹窗视为未完成观看:清空精益视频定位,不记录观看
|
||||
activeLeanVideo.value = null;
|
||||
workspace.showVideoModal = false;
|
||||
currentPreviewVideoUrl.value = '';
|
||||
stopVideoCountdown();
|
||||
workspace.stopMaterialTimer();
|
||||
};
|
||||
|
||||
/** 当前弹窗正在播放的精益任务视频定位(非精益视频播放时为 null),用于播放到结尾时记录对应任务与视频。 */
|
||||
const activeLeanVideo = ref<{ taskId: number; resourceId: number } | null>(null);
|
||||
|
||||
/** 精益任务状态徽章样式与文案键映射:进行中 / 已延期 / 已完成。 */
|
||||
const leanStatusMeta: Record<LeanTrainingTaskStatus, { badgeClass: string; labelKey: string }> = {
|
||||
in_progress: { badgeClass: 'border-blue-200 bg-blue-50 text-blue-700', labelKey: 'chat.training.lean.taskStatus.in_progress' },
|
||||
overdue: { badgeClass: 'border-red-200 bg-red-50 text-red-600', labelKey: 'chat.training.lean.taskStatus.overdue' },
|
||||
completed: { badgeClass: 'border-emerald-200 bg-emerald-50 text-emerald-700', labelKey: 'chat.training.lean.taskStatus.completed' },
|
||||
};
|
||||
|
||||
/** 看板总结弹框上下文:员工姓名 + 完整总结文案;为 null 时弹框关闭。 */
|
||||
const summaryModal = ref<{ name: string; text: string } | null>(null);
|
||||
|
||||
/** 总结列预览截断:最多显示 15 个字,超出部分以省略号收尾,点击可弹框查看全文。 */
|
||||
const truncateSummary = (text: string) => (text.length > 15 ? `${text.slice(0, 15)}…` : text);
|
||||
|
||||
/** 打开总结详情弹框:仅当该行有总结文案时可点击(无总结的行显示 "--" 不可点)。 */
|
||||
const openSummaryModal = (name: string, text: string) => {
|
||||
summaryModal.value = { name, text };
|
||||
};
|
||||
|
||||
/** 视频缩略图取首帧地址:追加 #t=0.1 让浏览器在 preload=metadata 下渲染首帧画面。 */
|
||||
const leanThumbSrc = (url?: string | null) => (url ? (url.includes('#') ? url : `${url}#t=0.1`) : '');
|
||||
|
||||
/**
|
||||
* 打开精益任务视频弹窗播放。
|
||||
* AI 触发时机:学员在精益管理时间树上点击任务视频缩略图时调用;无播放地址时给出提示且不打开弹窗。
|
||||
* 注意:此处不记录观看,观看完成仅在视频播放到结尾(handleVideoEnded)时记录。
|
||||
*/
|
||||
const openLeanVideo = (task: LeanTrainingMyTask, video: LeanTrainingVideo) => {
|
||||
if (!video.fileUrl) {
|
||||
msg.warning(t('chat.training.lean.videoUnavailable'));
|
||||
return;
|
||||
}
|
||||
activeLeanVideo.value = { taskId: task.id, resourceId: video.id };
|
||||
workspace.showVideoModal = true;
|
||||
currentPreviewVideoUrl.value = video.fileUrl;
|
||||
};
|
||||
|
||||
/**
|
||||
* 提交精益学习感悟前的友好校验:未看完全部已推送视频或感悟字数不足时仅提示,不发请求。
|
||||
* AI 触发时机:学员点击某期任务的"提交学习感悟"按钮时调用。
|
||||
*/
|
||||
const handleLeanSubmit = (task: LeanTrainingMyTask) => {
|
||||
const watchedCount = Object.keys(workspace.leanWatchedByTask[task.id] || {}).length;
|
||||
if (watchedCount < task.videos.length) {
|
||||
msg.warning(t('chat.training.lean.completeVideosFirst'));
|
||||
return;
|
||||
}
|
||||
if ((workspace.leanSummaryByTask[task.id] || '').trim().length < task.minSummaryLength) {
|
||||
msg.warning(t('chat.training.lean.summaryTooShort', { minSummaryLength: task.minSummaryLength }));
|
||||
return;
|
||||
}
|
||||
void workspace.submitLeanTrainingCompletion(task.id);
|
||||
};
|
||||
const jumpToExamQuestion = (index: number) => {
|
||||
if (!canNavigateExamQuestions.value) return;
|
||||
workspace.syncExamQuestionIndex(index);
|
||||
@@ -743,24 +836,65 @@ 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>
|
||||
<div v-if="workspace.learnerTab === 'lean_management' && workspace.leanTask" class="col-span-full rounded-2xl border border-emerald-200 bg-emerald-50/40 p-4">
|
||||
<div class="flex flex-wrap items-center justify-between gap-2">
|
||||
<div>
|
||||
<div class="text-base font-semibold text-primary">{{ $t('chat.training.lean.learner.title') }}</div>
|
||||
<div class="mt-1 text-xs text-secondary">{{ $t('chat.training.lean.learner.description', { count: workspace.leanTask.videos.length, minSummaryLength: workspace.leanTask.minSummaryLength }) }}</div>
|
||||
<div v-if="workspace.learnerTab === 'lean_management'" class="col-span-full">
|
||||
<div v-if="!workspace.leanMyTasks.length" class="rounded-2xl border border-dashed border-default bg-white px-6 py-12 text-center text-sm text-secondary">
|
||||
{{ $t('chat.training.lean.learner.empty') }}
|
||||
</div>
|
||||
<!-- 时间树:后端按发布周期倒序返回,最新任务在最上方 -->
|
||||
<div v-else class="rounded-2xl border border-emerald-200 bg-emerald-50/40 p-4">
|
||||
<div class="text-base font-semibold text-primary">{{ $t('chat.training.lean.learner.title') }}</div>
|
||||
<div class="relative mt-4">
|
||||
<div class="absolute bottom-3 left-[7px] top-3 w-px bg-emerald-200" aria-hidden="true"></div>
|
||||
<div v-for="(task, index) in workspace.leanMyTasks" :key="task.id" class="relative pl-7" :class="index > 0 ? 'pt-4' : ''">
|
||||
<span class="absolute left-0 top-7 h-[15px] w-[15px] rounded-full border-[3px] bg-white" :class="task.taskStatus === 'completed' ? 'border-emerald-500' : task.taskStatus === 'overdue' ? 'border-red-400' : 'border-blue-500'" aria-hidden="true"></span>
|
||||
<article class="rounded-2xl border border-default bg-white p-4">
|
||||
<div class="flex flex-wrap items-start justify-between gap-2">
|
||||
<div>
|
||||
<!-- 期号优先用后端 weekIndex(按周次升序,最早为第 1 期),与管理端口径一致;旧数据兜底按返回顺序倒推编号 -->
|
||||
<div class="text-sm font-semibold text-primary">{{ $t('chat.training.lean.learner.taskTitle', { index: task.weekIndex ?? workspace.leanMyTasks.length - index }) }}</div>
|
||||
<div class="mt-1 text-xs text-secondary">{{ $t('chat.training.lean.learner.description', { count: task.videos.length, minSummaryLength: task.minSummaryLength }) }}</div>
|
||||
</div>
|
||||
<div class="flex flex-wrap items-center gap-2">
|
||||
<span class="rounded-full border px-3 py-1 text-xs font-medium" :class="leanStatusMeta[task.taskStatus].badgeClass">{{ $t(leanStatusMeta[task.taskStatus].labelKey) }}</span>
|
||||
<span class="rounded-full bg-surface-soft px-3 py-1 text-xs text-secondary">{{ $t('chat.training.lean.learner.taskPeriod', { start: task.weekKey, end: task.dueAt.slice(0, 10) }) }}</span>
|
||||
</div>
|
||||
</div>
|
||||
<!-- 任务视频缩略图:点击弹出播放器完成学习并记录观看 -->
|
||||
<div class="mt-3 grid gap-3 md:grid-cols-2">
|
||||
<div v-for="video in task.videos" :key="video.id" class="overflow-hidden rounded-xl border border-default bg-surface-soft">
|
||||
<button type="button" class="group relative block h-32 w-full" @click="openLeanVideo(task, video)">
|
||||
<video v-if="video.fileUrl" :src="leanThumbSrc(video.fileUrl)" preload="metadata" muted playsinline class="h-full w-full object-cover"></video>
|
||||
<div v-else class="flex h-full w-full items-center justify-center text-secondary"><Video class="h-8 w-8" /></div>
|
||||
<span class="absolute inset-0 flex items-center justify-center transition group-hover:bg-slate-900/20">
|
||||
<PlayCircle class="h-9 w-9 text-white drop-shadow" />
|
||||
</span>
|
||||
<!-- 观看完成标记:服务端持久化,刷新后仍显示 -->
|
||||
<span v-if="(workspace.leanWatchedByTask[task.id] || {})[String(video.id)]" class="absolute top-2 right-2 rounded-full bg-emerald-500 px-2 py-0.5 text-xs font-medium text-white shadow">{{ $t('chat.training.lean.videoWatchedBadge') }}</span>
|
||||
</button>
|
||||
<div class="p-3">
|
||||
<div class="flex items-center gap-2 text-sm font-medium text-primary"><Video class="h-4 w-4 shrink-0 text-emerald-600" /><span class="truncate">{{ video.name }}</span></div>
|
||||
<div class="mt-1 text-xs" :class="(workspace.leanWatchedByTask[task.id] || {})[String(video.id)] ? 'text-emerald-600' : 'text-secondary'">
|
||||
{{ (workspace.leanWatchedByTask[task.id] || {})[String(video.id)] ? $t('chat.training.lean.watchedAt', { time: ((workspace.leanWatchedByTask[task.id] || {})[String(video.id)] || '').slice(0, 16).replace('T', ' ') }) : $t('chat.training.lean.markVideoWatched') }}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- 已完成:只读展示已提交感悟与完成时间;进行中/已延期:可继续编辑并提交 -->
|
||||
<div v-if="task.taskStatus === 'completed' && task.completion" class="mt-3 rounded-xl bg-emerald-50/60 p-3">
|
||||
<div class="text-xs font-medium text-emerald-700">{{ $t('chat.training.lean.learner.completedSummary') }}<template v-if="task.completion.completedAt"> · {{ $t('chat.training.lean.learner.completedAt', { time: task.completion.completedAt.slice(0, 16).replace('T', ' ') }) }}</template></div>
|
||||
<p class="mt-1 whitespace-pre-wrap text-sm text-primary">{{ task.completion.summaryText }}</p>
|
||||
</div>
|
||||
<template v-else>
|
||||
<textarea v-model="workspace.leanSummaryByTask[task.id]" rows="4" class="mt-3 w-full rounded-xl border border-default bg-white p-3 text-sm" :placeholder="$t('chat.training.lean.summaryPlaceholder', { minSummaryLength: task.minSummaryLength })" />
|
||||
<div class="mt-2 flex items-center justify-between gap-3">
|
||||
<span class="text-xs" :class="(workspace.leanSummaryByTask[task.id] || '').length >= task.minSummaryLength ? 'text-emerald-600' : 'text-amber-600'">{{ $t('chat.training.lean.summaryLength', { current: (workspace.leanSummaryByTask[task.id] || '').length, minSummaryLength: task.minSummaryLength }) }}</span>
|
||||
<!-- 未看完视频/字数不足时不静默禁用,点击由 handleLeanSubmit 给出友好提示 -->
|
||||
<button type="button" class="rounded-xl bg-emerald-600 px-4 py-2 text-sm font-medium text-white" @click="handleLeanSubmit(task)">{{ $t('chat.training.lean.submitSummary') }}</button>
|
||||
</div>
|
||||
</template>
|
||||
</article>
|
||||
</div>
|
||||
</div>
|
||||
<div class="rounded-full bg-white px-3 py-1 text-xs font-medium text-emerald-700">{{ $t('chat.training.lean.dueAt', { time: workspace.leanTask.dueAt.slice(0, 16).replace('T', ' ') }) }}</div>
|
||||
</div>
|
||||
<div class="mt-4 grid gap-3 md:grid-cols-2">
|
||||
<button v-for="video in workspace.leanTask.videos" :key="video.id" type="button" class="rounded-xl border border-default bg-white p-3 text-left hover:border-emerald-400" @click="workspace.markLeanVideoWatched(video.id)">
|
||||
<div class="flex items-center gap-2 text-sm font-medium text-primary"><Video class="h-4 w-4 text-emerald-600" />{{ video.name }}</div>
|
||||
<div class="mt-1 text-xs text-secondary">{{ workspace.leanWatchedAt[String(video.id)] ? $t('chat.training.lean.watchedAt', { time: (workspace.leanWatchedAt[String(video.id)] || '').slice(0, 19).replace('T', ' ') }) : $t('chat.training.lean.markVideoWatched') }}</div>
|
||||
</button>
|
||||
</div>
|
||||
<textarea v-model="workspace.leanSummaryText" rows="4" class="mt-3 w-full rounded-xl border border-default bg-white p-3 text-sm" :placeholder="$t('chat.training.lean.summaryPlaceholder', { minSummaryLength: workspace.leanTask.minSummaryLength })" />
|
||||
<div class="mt-2 flex items-center justify-between gap-3">
|
||||
<span class="text-xs" :class="workspace.leanSummaryText.length >= workspace.leanTask.minSummaryLength ? 'text-emerald-600' : 'text-amber-600'">{{ $t('chat.training.lean.summaryLength', { current: workspace.leanSummaryText.length, minSummaryLength: workspace.leanTask.minSummaryLength }) }}</span>
|
||||
<button type="button" class="rounded-xl bg-emerald-600 px-4 py-2 text-sm font-medium text-white disabled:cursor-not-allowed disabled:opacity-50" :disabled="workspace.leanSummaryText.trim().length < workspace.leanTask.minSummaryLength || Object.keys(workspace.leanWatchedAt).length < workspace.leanTask.videos.length" @click="workspace.submitLeanTrainingCompletion">{{ $t('chat.training.lean.submitSummary') }}</button>
|
||||
</div>
|
||||
</div>
|
||||
<template v-if="workspace.learnerTab !== 'safety' && workspace.learnerTab !== 'lean_management'">
|
||||
@@ -1092,8 +1226,8 @@ const currentSafetyStageText = computed(() => {
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 考试题目面板 (在考试或结果阶段展示) -->
|
||||
<div v-else :class="questionNavPanelClass">
|
||||
<!-- 考试题目面板 (在考试或结果阶段展示;单阶段培训无考试流程,不渲染任何侧栏面板) -->
|
||||
<div v-else-if="showLearnerProgressModule" :class="questionNavPanelClass">
|
||||
<div class="flex items-center gap-2">
|
||||
<ClipboardCheck class="h-4 w-4 text-brand-600" />
|
||||
<div class="text-sm font-semibold text-primary">{{ $t('chat.training.examQuestionCard.title') }}</div>
|
||||
@@ -1137,8 +1271,8 @@ const currentSafetyStageText = computed(() => {
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<!-- 安全培训视图 -->
|
||||
<template v-else>
|
||||
<!-- 安全培训视图(仅安全培训进入该分支;精益管理走独立精益任务卡片,避免误渲染三级安全教育内容) -->
|
||||
<template v-else-if="workspace.learnerTab === 'safety'">
|
||||
<div :class="learnerWorkspaceMainClass">
|
||||
<!-- 进度卡片 -->
|
||||
<div :class="progressCardClass">
|
||||
@@ -1486,40 +1620,55 @@ const currentSafetyStageText = computed(() => {
|
||||
</div>
|
||||
|
||||
<div v-else-if="!isCompactMode" class="space-y-4 p-4 md:p-5">
|
||||
<!-- 管理端内容页签:全部培训=现有统计/筛选/主表;精益管理=精益看板(单任务,状态列区分三态)。 -->
|
||||
<div>
|
||||
<div class="inline-flex flex-wrap rounded-xl border border-default bg-surface-soft p-1">
|
||||
<button
|
||||
v-for="tab in [{ key: 'all', label: 'chat.training.hr.tabs.allTraining' }, { key: 'lean', label: 'chat.training.hr.tabs.leanManagement' }]"
|
||||
:key="tab.key"
|
||||
class="flex items-center gap-2 rounded-lg px-6 py-2 text-sm font-medium transition"
|
||||
:class="workspace.hrTrainingTab === tab.key ? 'bg-white text-brand-700 shadow-sm border border-brand-200' : 'text-secondary hover:text-primary'"
|
||||
@click="workspace.hrTrainingTab = tab.key as 'all' | 'lean'"
|
||||
>
|
||||
{{ $t(tab.label) }}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="grid gap-3 sm:grid-cols-2 xl:grid-cols-5">
|
||||
<div class="rounded-2xl border border-default bg-white p-3.5 shadow-sm">
|
||||
<div class="flex items-center justify-center gap-2 text-center">
|
||||
<div class="text-sm text-muted">{{ $t('chat.training.hr.stats.total') }}</div>
|
||||
<div class="text-2xl font-semibold text-primary">{{ workspace.stats.total }}</div>
|
||||
<div class="text-2xl font-semibold text-primary">{{ workspace.hrTrainingTab === 'lean' ? workspace.leanStats.total : workspace.stats.total }}</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="rounded-2xl border border-default bg-white p-3.5 shadow-sm">
|
||||
<div class="flex items-center justify-center gap-2 text-center">
|
||||
<div class="text-sm text-muted">{{ $t('chat.training.hr.stats.passed') }}</div>
|
||||
<div class="text-2xl font-semibold text-emerald-600">{{ workspace.stats.passed }}</div>
|
||||
<div class="text-sm text-muted">{{ $t(workspace.hrTrainingTab === 'lean' ? 'chat.training.lean.status.completed' : 'chat.training.hr.stats.passed') }}</div>
|
||||
<div class="text-2xl font-semibold text-emerald-600">{{ workspace.hrTrainingTab === 'lean' ? workspace.leanStats.passed : workspace.stats.passed }}</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="rounded-2xl border border-default bg-white p-3.5 shadow-sm">
|
||||
<div class="flex items-center justify-center gap-2 text-center">
|
||||
<div class="text-sm text-muted">{{ $t('chat.training.hr.stats.failed') }}</div>
|
||||
<div class="text-2xl font-semibold text-amber-600">{{ workspace.stats.failed }}</div>
|
||||
<div class="text-sm text-muted">{{ $t(workspace.hrTrainingTab === 'lean' ? 'chat.training.lean.status.overdue' : 'chat.training.hr.stats.failed') }}</div>
|
||||
<div class="text-2xl font-semibold text-amber-600">{{ workspace.hrTrainingTab === 'lean' ? workspace.leanStats.failed : workspace.stats.failed }}</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="rounded-2xl border border-default bg-white p-3.5 shadow-sm">
|
||||
<div class="flex items-center justify-center gap-2 text-center">
|
||||
<div class="text-sm text-muted">{{ $t('chat.training.hr.stats.inProgress') }}</div>
|
||||
<div class="text-2xl font-semibold text-blue-600">{{ workspace.stats.inProgress }}</div>
|
||||
<div class="text-2xl font-semibold text-blue-600">{{ workspace.hrTrainingTab === 'lean' ? workspace.leanStats.inProgress : workspace.stats.inProgress }}</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="rounded-2xl border border-default bg-white p-3.5 shadow-sm">
|
||||
<div class="flex items-center justify-center gap-2 text-center">
|
||||
<div class="text-sm text-muted">{{ $t('chat.training.hr.stats.passRate') }}</div>
|
||||
<div class="text-2xl font-semibold text-primary">{{ workspace.stats.passRate }}%</div>
|
||||
<div class="text-sm text-muted">{{ $t(workspace.hrTrainingTab === 'lean' ? 'chat.training.lean.dashboard.passRate' : 'chat.training.hr.stats.passRate') }}</div>
|
||||
<div class="text-2xl font-semibold text-primary">{{ workspace.hrTrainingTab === 'lean' ? workspace.leanStats.passRate : workspace.stats.passRate }}%</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="rounded-2xl border border-default bg-white p-4 shadow-sm">
|
||||
<div v-if="workspace.hrTrainingTab === 'all'" class="rounded-2xl border border-default bg-white p-4 shadow-sm">
|
||||
<div class="flex flex-col gap-3">
|
||||
<div class="grid gap-3 xl:grid-cols-[minmax(0,1.2fr)_minmax(0,1fr)_minmax(0,1fr)_minmax(0,1fr)_auto] xl:items-center">
|
||||
<label>
|
||||
@@ -1631,65 +1780,83 @@ const currentSafetyStageText = computed(() => {
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div v-if="workspace.canViewLeanDashboard && workspace.leanDashboard.task" class="rounded-2xl border border-emerald-200 bg-emerald-50/40 p-4 shadow-sm">
|
||||
<!-- 精益管理页签内容:仅当页签切到 lean 且当前用户可见时展示;看板保持单期任务,状态列区分已完成/已延期/进行中。 -->
|
||||
<div v-if="workspace.hrTrainingTab === 'lean' && workspace.canViewLeanDashboard && workspace.leanDashboard.task" class="rounded-2xl border border-emerald-200 bg-emerald-50/40 p-4 shadow-sm">
|
||||
<div class="flex flex-wrap items-start justify-between gap-3">
|
||||
<div>
|
||||
<div class="flex items-center gap-2 text-base font-semibold text-primary">
|
||||
<BookOpen class="h-4 w-4 text-emerald-600" />
|
||||
{{ $t('chat.training.lean.dashboard.title') }}
|
||||
</div>
|
||||
<div class="mt-1 text-xs text-secondary">{{ $t('chat.training.lean.dashboard.week', { week: workspace.leanDashboard.task.weekKey }) }}</div>
|
||||
<div class="mt-1 flex flex-wrap items-center gap-2 text-xs text-secondary">
|
||||
<span>{{ $t('chat.training.lean.dashboard.week', { week: workspace.leanDashboard.task.weekKey }) }}</span>
|
||||
<span class="rounded-full bg-white px-2.5 py-1 font-medium text-emerald-700">{{ $t('chat.training.lean.dashboard.count', { count: workspace.leanRows.length }) }}</span>
|
||||
<!-- 期次下拉:期号按周次升序区分第几期任务,切换后重拉对应期看板与精益统计。 -->
|
||||
<select
|
||||
v-if="workspace.leanDashboard.periods.length"
|
||||
class="rounded-lg border border-default bg-white px-2 py-1 text-xs font-medium text-primary"
|
||||
:value="workspace.leanDashboardTaskId ?? workspace.leanDashboard.task.id"
|
||||
@change="workspace.selectLeanDashboardPeriod(Number(($event.target as HTMLSelectElement).value))"
|
||||
>
|
||||
<option v-for="period in workspace.leanDashboard.periods" :key="period.id" :value="period.id">{{ $t('chat.training.lean.dashboard.periodLabel', { index: period.index }) }}({{ period.weekKey }})</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="rounded-full bg-white px-3 py-1 text-xs font-medium text-emerald-700">{{ $t('chat.training.lean.dueAt', { time: workspace.leanDashboard.task.dueAt.slice(0, 16).replace('T', ' ') }) }}</div>
|
||||
</div>
|
||||
|
||||
<div class="mt-4 grid gap-4 xl:grid-cols-2">
|
||||
<div v-for="group in [{ key: 'completed', rows: workspace.leanDashboard.completed }, { key: 'incomplete', rows: workspace.leanDashboard.incomplete }]" :key="group.key" class="overflow-hidden rounded-2xl border border-default bg-white">
|
||||
<div class="flex items-center justify-between border-b border-default px-4 py-3" :class="group.key === 'completed' ? 'bg-emerald-50/70' : 'bg-amber-50/70'">
|
||||
<div class="text-sm font-semibold text-primary">{{ $t(`chat.training.lean.dashboard.${group.key}`) }}</div>
|
||||
<div class="rounded-full bg-white px-2.5 py-1 text-xs font-medium text-secondary">{{ $t('chat.training.lean.dashboard.count', { count: group.rows.length }) }}</div>
|
||||
</div>
|
||||
<div class="overflow-x-auto">
|
||||
<table class="min-w-[900px] border-collapse text-sm">
|
||||
<thead class="bg-surface-soft">
|
||||
<tr>
|
||||
<th class="border-b border-default px-3 py-2.5 text-left font-semibold text-primary">{{ $t('chat.training.lean.columns.employeeId') }}</th>
|
||||
<th class="border-b border-default px-3 py-2.5 text-left font-semibold text-primary">{{ $t('chat.training.lean.columns.name') }}</th>
|
||||
<th class="border-b border-default px-3 py-2.5 text-left font-semibold text-primary">{{ $t('chat.training.lean.columns.department') }}</th>
|
||||
<th class="border-b border-default px-3 py-2.5 text-left font-semibold text-primary">{{ $t('chat.training.lean.columns.videoName') }}</th>
|
||||
<th class="border-b border-default px-3 py-2.5 text-left font-semibold text-primary">{{ $t('chat.training.lean.columns.watchedAt') }}</th>
|
||||
<th class="border-b border-default px-3 py-2.5 text-left font-semibold text-primary">{{ $t('chat.training.lean.columns.status') }}</th>
|
||||
<th class="border-b border-default px-3 py-2.5 text-left font-semibold text-primary">{{ $t('chat.training.lean.columns.summary') }}</th>
|
||||
<th v-if="group.key === 'incomplete'" class="border-b border-default px-3 py-2.5 text-left font-semibold text-primary">{{ $t('chat.training.lean.columns.action') }}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr v-for="row in group.rows" :key="row.userId" class="odd:bg-white even:bg-surface-soft/30">
|
||||
<td class="border-b border-default px-3 py-2.5 text-secondary">{{ row.employeeId || '--' }}</td>
|
||||
<td class="border-b border-default px-3 py-2.5 font-medium text-primary">{{ row.name }}</td>
|
||||
<td class="border-b border-default px-3 py-2.5 text-secondary">{{ row.department || '--' }}</td>
|
||||
<td class="border-b border-default px-3 py-2.5 text-secondary"><div v-for="video in row.videos" :key="video.name" class="whitespace-nowrap">{{ video.name }}</div><span v-if="!row.videos.length">--</span></td>
|
||||
<td class="border-b border-default px-3 py-2.5 text-secondary"><div v-for="video in row.videos" :key="`${video.name}-${video.watchedAt}`" class="whitespace-nowrap">{{ video.watchedAt ? video.watchedAt.slice(0, 19).replace('T', ' ') : '--' }}</div><span v-if="!row.videos.length">--</span></td>
|
||||
<td class="border-b border-default px-3 py-2.5"><span class="inline-flex rounded-full px-2.5 py-1 text-xs font-semibold" :class="row.status === 'completed' ? 'bg-emerald-50 text-emerald-700' : 'bg-amber-50 text-amber-700'">{{ $t(`chat.training.lean.status.${row.status}`) }}</span></td>
|
||||
<td class="border-b border-default px-3 py-2.5 text-secondary"><div class="min-w-48 whitespace-pre-wrap break-words">{{ row.summaryText || '--' }}</div></td>
|
||||
<td v-if="group.key === 'incomplete'" class="border-b border-default px-3 py-2.5">
|
||||
<button
|
||||
type="button"
|
||||
class="inline-flex items-center gap-1.5 rounded-lg bg-amber-500 px-2.5 py-1.5 text-xs font-medium text-white transition hover:bg-amber-600 disabled:cursor-not-allowed disabled:opacity-60"
|
||||
:disabled="workspace.leanReminderLoading[row.userId]"
|
||||
@click="workspace.remindLeanTrainingMember(row.userId)"
|
||||
>
|
||||
<Bell class="h-3.5 w-3.5" />
|
||||
{{ workspace.leanReminderLoading[row.userId] ? $t('chat.training.lean.reminder.sending') : $t('chat.training.lean.reminder.action') }}
|
||||
</button>
|
||||
</td>
|
||||
</tr>
|
||||
<tr v-if="group.rows.length === 0">
|
||||
<td :colspan="group.key === 'incomplete' ? 8 : 7" class="px-4 py-6 text-center text-sm text-muted">{{ $t('chat.training.lean.dashboard.empty') }}</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<!-- 用户复测要求:不再分"已完成/未完成"双列,合为单一明细表,仅通过状态列区分已完成/已延期/进行中。 -->
|
||||
<div class="mt-4 overflow-hidden rounded-2xl border border-default bg-white">
|
||||
<div class="overflow-x-auto">
|
||||
<table class="w-full min-w-[900px] border-collapse text-sm">
|
||||
<thead class="bg-surface-soft">
|
||||
<tr>
|
||||
<th class="border-b border-default px-3 py-2.5 text-left font-semibold text-primary">{{ $t('chat.training.lean.columns.employeeId') }}</th>
|
||||
<th class="border-b border-default px-3 py-2.5 text-left font-semibold text-primary">{{ $t('chat.training.lean.columns.name') }}</th>
|
||||
<th class="border-b border-default px-3 py-2.5 text-left font-semibold text-primary">{{ $t('chat.training.lean.columns.department') }}</th>
|
||||
<th class="border-b border-default px-3 py-2.5 text-left font-semibold text-primary">{{ $t('chat.training.lean.columns.videoName') }}</th>
|
||||
<th class="border-b border-default px-3 py-2.5 text-left font-semibold text-primary">{{ $t('chat.training.lean.columns.watchedAt') }}</th>
|
||||
<th class="border-b border-default px-3 py-2.5 text-left font-semibold text-primary">{{ $t('chat.training.lean.columns.status') }}</th>
|
||||
<th class="border-b border-default px-3 py-2.5 text-left font-semibold text-primary">{{ $t('chat.training.lean.columns.summary') }}</th>
|
||||
<th class="border-b border-default px-3 py-2.5 text-left font-semibold text-primary">{{ $t('chat.training.lean.columns.action') }}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr v-for="row in workspace.leanRows" :key="row.userId" class="odd:bg-white even:bg-surface-soft/30">
|
||||
<td class="whitespace-nowrap border-b border-default px-3 py-2.5 text-secondary">{{ row.employeeId || '--' }}</td>
|
||||
<td class="whitespace-nowrap border-b border-default px-3 py-2.5 font-medium text-primary">{{ row.name }}</td>
|
||||
<td class="whitespace-nowrap border-b border-default px-3 py-2.5 text-secondary">{{ row.department || '--' }}</td>
|
||||
<td class="border-b border-default px-3 py-2.5 text-secondary"><div v-for="video in row.videos" :key="video.name" class="whitespace-nowrap">{{ video.name }}</div><span v-if="!row.videos.length">--</span></td>
|
||||
<!-- [RULE] 观看时间仅展示到分钟(slice(0,16) 去掉秒),与产品要求一致。 -->
|
||||
<td class="border-b border-default px-3 py-2.5 text-secondary"><div v-for="video in row.videos" :key="`${video.name}-${video.watchedAt}`" class="whitespace-nowrap">{{ video.watchedAt ? video.watchedAt.slice(0, 16).replace('T', ' ') : '--' }}</div><span v-if="!row.videos.length">--</span></td>
|
||||
<!-- 状态徽章三态:已完成(绿)/已延期(红)/进行中(蓝),文案统一中文(含其余三语言),禁止回显原始键。 -->
|
||||
<td class="border-b border-default px-3 py-2.5"><span class="inline-flex rounded-full px-2.5 py-1 text-xs font-semibold" :class="row.status === 'completed' ? 'bg-emerald-50 text-emerald-700' : row.status === 'overdue' ? 'bg-red-50 text-red-700' : 'bg-blue-50 text-blue-700'">{{ $t(`chat.training.lean.status.${row.status}`) }}</span></td>
|
||||
<!-- [RULE] 总结列最多显示 15 个字:超出截断并显示省略号,点击弹框查看全部文案;无总结显示 "--"。
|
||||
常显虚线下划线提示可点击(用户复测反馈点击无效,实为部署版本差异,此处强化可点性视觉)。 -->
|
||||
<td class="border-b border-default px-3 py-2.5 text-secondary">
|
||||
<button v-if="row.summaryText" type="button" class="max-w-56 cursor-pointer text-left whitespace-pre-wrap break-words underline decoration-dotted decoration-secondary/60 underline-offset-2 transition hover:decoration-solid hover:text-primary" :title="$t('chat.training.lean.summaryModal.viewHint')" @click="openSummaryModal(row.name, row.summaryText)">{{ truncateSummary(row.summaryText) }}</button>
|
||||
<span v-else>--</span>
|
||||
</td>
|
||||
<!-- 仅未完成(进行中/已延期)提供提醒操作,已完成无需催办。 -->
|
||||
<td class="border-b border-default px-3 py-2.5">
|
||||
<button
|
||||
v-if="row.status !== 'completed'"
|
||||
type="button"
|
||||
class="inline-flex whitespace-nowrap items-center gap-1.5 rounded-lg bg-amber-500 px-2.5 py-1.5 text-xs font-medium text-white transition hover:bg-amber-600 disabled:cursor-not-allowed disabled:opacity-60"
|
||||
:disabled="workspace.leanReminderLoading[row.userId]"
|
||||
@click="workspace.remindLeanTrainingMember(row.userId)"
|
||||
>
|
||||
<Bell class="h-3.5 w-3.5" />
|
||||
{{ workspace.leanReminderLoading[row.userId] ? $t('chat.training.lean.reminder.sending') : $t('chat.training.lean.reminder.action') }}
|
||||
</button>
|
||||
<span v-else class="text-secondary">--</span>
|
||||
</td>
|
||||
</tr>
|
||||
<tr v-if="!workspace.leanRows.length">
|
||||
<td colspan="8" class="px-4 py-6 text-center text-sm text-muted">{{ $t('chat.training.lean.dashboard.empty') }}</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -1845,10 +2012,35 @@ const currentSafetyStageText = computed(() => {
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- 总结详情弹框:看板总结列最多预览 15 字,点击后在此查看完整文案(点击遮罩或关闭按钮关闭)。 -->
|
||||
<div v-if="summaryModal" class="fixed inset-0 z-[110] flex items-center justify-center bg-slate-950/80 p-4 backdrop-blur-sm" @click.self="summaryModal = null">
|
||||
<div class="w-full max-w-lg rounded-2xl bg-white p-5 shadow-2xl">
|
||||
<div class="flex items-start justify-between gap-3">
|
||||
<div>
|
||||
<h3 class="text-base font-semibold text-primary">{{ $t('chat.training.lean.summaryModal.title') }}</h3>
|
||||
<p class="mt-0.5 text-xs text-secondary">{{ summaryModal.name }}</p>
|
||||
</div>
|
||||
<button type="button" class="flex h-8 w-8 shrink-0 items-center justify-center rounded-full text-secondary transition hover:bg-surface-soft hover:text-primary" :aria-label="$t('chat.training.lean.summaryModal.close')" @click="summaryModal = null">
|
||||
<XCircle class="h-5 w-5" />
|
||||
</button>
|
||||
</div>
|
||||
<div class="mt-4 max-h-96 overflow-y-auto whitespace-pre-wrap break-words rounded-xl bg-surface-soft/60 p-4 text-sm leading-relaxed text-secondary">{{ summaryModal.text }}</div>
|
||||
</div>
|
||||
</div>
|
||||
</Teleport>
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
/* 期次下拉自绘右置箭头:与全局 .select-field 同思路但尺寸紧凑(text-xs 头部场景)。
|
||||
[FIX] 用户复测反馈箭头压住日期数字:appearance-none 移除原生箭头,箭头整体右移贴边
|
||||
(距右缘 0.3rem),配合 pr-8 预留 2rem 空间,确保与文案完全无重叠。 */
|
||||
.lean-period-select {
|
||||
background-image: linear-gradient(45deg, transparent 50%, currentColor 50%), linear-gradient(135deg, currentColor 50%, transparent 50%);
|
||||
background-position: calc(100% - 0.55rem) 50%, calc(100% - 0.3rem) 50%;
|
||||
background-repeat: no-repeat;
|
||||
background-size: 0.3rem 0.3rem, 0.3rem 0.3rem;
|
||||
}
|
||||
|
||||
.report-pdf-page {
|
||||
width: 100%;
|
||||
max-width: 794px;
|
||||
|
||||
@@ -15,10 +15,11 @@ import {
|
||||
getMyTrainingProgress,
|
||||
getMyTrainingTypes,
|
||||
getTrainingStats,
|
||||
getCurrentLeanTrainingTask,
|
||||
getMyLeanTrainingTasks,
|
||||
getLeanTrainingDashboard,
|
||||
sendLeanTrainingReminders,
|
||||
listTrainingRecords,
|
||||
markMyLeanVideoWatched,
|
||||
saveMyTrainingProgress,
|
||||
saveMyLeanTrainingCompletion,
|
||||
} from '@/features/chat/api/training.api';
|
||||
@@ -41,7 +42,8 @@ import type {
|
||||
TrainingTypeOption,
|
||||
TrainingWorkspaceView,
|
||||
LeanTrainingDashboard,
|
||||
LeanTrainingWeeklyTask,
|
||||
LeanTrainingDashboardRow,
|
||||
LeanTrainingMyTask,
|
||||
} from '@/features/chat/training/training.types';
|
||||
import {
|
||||
SAFETY_STAGE_GUIDE_USAGE_MAP,
|
||||
@@ -115,11 +117,18 @@ export function useTrainingWorkspace(options: UseTrainingWorkspaceOptions) {
|
||||
const isAdminViewer = computed(() => Boolean(currentUser.value?.feature_permissions?.training_hr_manage));
|
||||
const canViewLeanDashboard = computed(() => isAdminViewer.value);
|
||||
const canManageTrainingWorkspace = computed(() => isAdminViewer.value);
|
||||
const leanTask = ref<LeanTrainingWeeklyTask | null>(null);
|
||||
const leanDashboard = ref<LeanTrainingDashboard>({ task: null, completed: [], incomplete: [] });
|
||||
/** 学员端精益周任务列表(后端按发布周期倒序,最新在前),并附每期任务状态与完成信息。 */
|
||||
const leanMyTasks = ref<LeanTrainingMyTask[]>([]);
|
||||
const leanDashboard = ref<LeanTrainingDashboard>({ task: null, completed: [], incomplete: [], periods: [] });
|
||||
/** 管理端内容页签:all=全部培训(现有统计/筛选/主表);lean=精益管理(精益看板单任务,按状态列区分三态)。 */
|
||||
const hrTrainingTab = ref<'all' | 'lean'>('all');
|
||||
/** 管理端精益看板当前选中的期次任务 ID;为空表示最新一期,切换后重新拉取对应期看板。 */
|
||||
const leanDashboardTaskId = ref<number | null>(null);
|
||||
const leanReminderLoading = ref<Record<number, boolean>>({});
|
||||
const leanSummaryText = ref('');
|
||||
const leanWatchedAt = ref<Record<string, string>>({});
|
||||
/** 按任务 ID 分组的感悟草稿,支持时间树上多期任务并行编辑。 */
|
||||
const leanSummaryByTask = ref<Record<number, string>>({});
|
||||
/** 按任务 ID 分组的观看记录(资源 ID -> 观看时间),提交时随感悟一并交由服务端校验。 */
|
||||
const leanWatchedByTask = ref<Record<number, Record<string, string>>>({});
|
||||
const defaultActiveView = computed<TrainingWorkspaceView>(() => (canManageTrainingWorkspace.value ? 'admin' : 'learner'));
|
||||
const activeView = ref<TrainingWorkspaceView>('learner');
|
||||
const learnerTab = ref<TrainingType>('onboarding');
|
||||
@@ -175,6 +184,28 @@ export function useTrainingWorkspace(options: UseTrainingWorkspaceOptions) {
|
||||
passRate: 0,
|
||||
averageScore: 0,
|
||||
});
|
||||
/** 精益看板合并行:已完成+未完成名单合为单表遍历,状态列区分已完成/已延期/进行中三态。 */
|
||||
const leanRows = computed<LeanTrainingDashboardRow[]>(() => [...leanDashboard.value.completed, ...leanDashboard.value.incomplete]);
|
||||
/**
|
||||
* 精益管理页签统计:按看板行三态(completed/in_progress/overdue)实际计数,供统计卡片随页签切换数据源。
|
||||
* total=参训人数(已完成+未完成名单行数);passed=已完成;failed=已延期;inProgress=进行中;passRate=完成率。
|
||||
*/
|
||||
const leanStats = computed<TrainingStats>(() => {
|
||||
// [STEP 1] 合并已完成/未完成两组行后按后端归一的三态计数,避免只扫 incomplete 组漏算已延期。
|
||||
const rows = [...leanDashboard.value.completed, ...leanDashboard.value.incomplete];
|
||||
const total = rows.length;
|
||||
const completedCount = rows.filter((row) => row.status === 'completed').length;
|
||||
const overdueCount = rows.filter((row) => row.status === 'overdue').length;
|
||||
const inProgressCount = rows.filter((row) => row.status === 'in_progress').length;
|
||||
return {
|
||||
total,
|
||||
passed: completedCount,
|
||||
failed: overdueCount,
|
||||
inProgress: inProgressCount,
|
||||
passRate: total > 0 ? Math.round((completedCount / total) * 100) : 0,
|
||||
averageScore: 0,
|
||||
};
|
||||
});
|
||||
let persistQueue: Promise<void> = Promise.resolve();
|
||||
|
||||
watch(isTrainingAgent, (enabled) => {
|
||||
@@ -793,36 +824,84 @@ export function useTrainingWorkspace(options: UseTrainingWorkspaceOptions) {
|
||||
}
|
||||
};
|
||||
|
||||
/** 读取精益周任务与受权限约束的完成/未完成名单。 */
|
||||
const loadLeanTraining = async () => {
|
||||
if (!isTrainingAgent.value || !hasAuthenticatedUser.value) return;
|
||||
/** 拉取管理端精益看板(按 leanDashboardTaskId 指定期次,空则最新一期),失败时清空兜底。 */
|
||||
const loadLeanDashboard = async () => {
|
||||
if (!canViewLeanDashboard.value) return;
|
||||
try {
|
||||
leanTask.value = await getCurrentLeanTrainingTask();
|
||||
if (canViewLeanDashboard.value) leanDashboard.value = await getLeanTrainingDashboard();
|
||||
leanDashboard.value = await getLeanTrainingDashboard(leanDashboardTaskId.value ?? undefined);
|
||||
} catch {
|
||||
leanTask.value = null;
|
||||
leanDashboard.value = { task: null, completed: [], incomplete: [] };
|
||||
leanDashboard.value = { task: null, completed: [], incomplete: [], periods: [] };
|
||||
}
|
||||
};
|
||||
|
||||
/** 标记视频已完整观看并记录观看时间,供精益周任务提交时一并交由服务端校验。 */
|
||||
const markLeanVideoWatched = (resourceId: number) => {
|
||||
leanWatchedAt.value[String(resourceId)] = new Date().toISOString();
|
||||
/** 切换精益看板期次:记录任务 ID 后仅重拉看板与精益统计,不动学员任务列表。 */
|
||||
const selectLeanDashboardPeriod = async (taskId: number) => {
|
||||
if (leanDashboardTaskId.value === taskId) return;
|
||||
leanDashboardTaskId.value = taskId;
|
||||
await loadLeanDashboard();
|
||||
};
|
||||
|
||||
/** 提交精益学习感悟;服务端校验两个视频与至少 50 字,成功后刷新个人和管理看板。 */
|
||||
const submitLeanTrainingCompletion = async () => {
|
||||
if (!leanTask.value) return;
|
||||
await saveMyLeanTrainingCompletion({ weeklyTaskId: leanTask.value.id, watchedAt: leanWatchedAt.value, summaryText: leanSummaryText.value });
|
||||
/** 读取学员端全部已发布精益周任务(含状态与播放地址),并以服务端完成记录回填各任务的感悟/观看草稿。 */
|
||||
const loadLeanTraining = async () => {
|
||||
if (!isTrainingAgent.value || !hasAuthenticatedUser.value) return;
|
||||
try {
|
||||
leanMyTasks.value = await getMyLeanTrainingTasks();
|
||||
// [STEP 1] 回填草稿:已完成任务还原当时提交的感悟与观看时间;进行中/已延期任务保留已有观看记录,避免刷新后丢失。
|
||||
const summaries: Record<number, string> = {};
|
||||
const watched: Record<number, Record<string, string>> = {};
|
||||
leanMyTasks.value.forEach((task) => {
|
||||
summaries[task.id] = task.completion?.summaryText || '';
|
||||
watched[task.id] = { ...(task.completion?.watchedAt || {}) };
|
||||
});
|
||||
leanSummaryByTask.value = summaries;
|
||||
leanWatchedByTask.value = watched;
|
||||
await loadLeanDashboard();
|
||||
} catch {
|
||||
leanMyTasks.value = [];
|
||||
leanDashboard.value = { task: null, completed: [], incomplete: [], periods: [] };
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* 记录某期任务的指定视频已完成观看:本地即时生效,并异步持久化到服务端(刷新后仍保留)。
|
||||
* AI 触发时机:学员在精益管理时间树上点击任务视频并完整播放到结尾时调用;已有观看记录的资源保留首次时间不覆盖。
|
||||
*/
|
||||
const markLeanVideoWatched = (taskId: number, resourceId: number) => {
|
||||
const taskWatched = leanWatchedByTask.value[taskId] || {};
|
||||
if (taskWatched[String(resourceId)]) return;
|
||||
leanWatchedByTask.value = { ...leanWatchedByTask.value, [taskId]: { ...taskWatched, [String(resourceId)]: new Date().toISOString() } };
|
||||
// 持久化失败不阻塞本地状态;下次刷新列表会以服务端记录为准,未持久化的视频需重新完整观看
|
||||
void markMyLeanVideoWatched(taskId, resourceId).catch(() => {});
|
||||
};
|
||||
|
||||
/**
|
||||
* 提交指定周任务的学习感悟;服务端校验该任务已推送视频全部完成且达到最少字数,成功后刷新任务列表与看板。
|
||||
*/
|
||||
const submitLeanTrainingCompletion = async (taskId: number) => {
|
||||
await saveMyLeanTrainingCompletion({ weeklyTaskId: taskId, watchedAt: leanWatchedByTask.value[taskId] || {}, summaryText: leanSummaryByTask.value[taskId] || '' });
|
||||
await loadLeanTraining();
|
||||
};
|
||||
|
||||
/**
|
||||
* HR 对看板中未完成成员发起定向提醒,并按服务端实发统计如实提示。
|
||||
* AI 触发时机:HR 在精益培训完成名单点击行内【提醒】按钮时调用。
|
||||
* 核心逻辑:后端 created 计数包含"企微发送失败"的提醒(仅代表已尝试),
|
||||
* 成功提示必须以 sent(企微受理成功)为准,failed>0 时明确告知失败,避免误报已送达。
|
||||
*/
|
||||
const remindLeanTrainingMember = async (userId: number) => {
|
||||
if (!leanDashboard.value.task || leanReminderLoading.value[userId]) return;
|
||||
leanReminderLoading.value[userId] = true;
|
||||
try {
|
||||
const result = await sendLeanTrainingReminders(leanDashboard.value.task.id, [userId]);
|
||||
msg.success(t('chat.training.lean.reminder.success', { count: result.created }));
|
||||
if (result.sent > 0 && result.failed > 0) {
|
||||
msg.warning(t('chat.training.lean.reminder.partial', { sent: result.sent, failed: result.failed }));
|
||||
} else if (result.sent > 0) {
|
||||
msg.success(t('chat.training.lean.reminder.success', { count: result.sent }));
|
||||
} else if (result.failed > 0) {
|
||||
msg.error(t('chat.training.lean.reminder.sendFailed', { count: result.failed }));
|
||||
} else {
|
||||
msg.warning(t('chat.training.lean.reminder.notSent'));
|
||||
}
|
||||
await loadLeanTraining();
|
||||
} catch (error) {
|
||||
msg.error(error instanceof BusinessError ? error.message : t('chat.training.lean.reminder.failed'));
|
||||
@@ -1214,11 +1293,11 @@ export function useTrainingWorkspace(options: UseTrainingWorkspaceOptions) {
|
||||
isAdminViewer,
|
||||
canViewLeanDashboard,
|
||||
canManageTrainingWorkspace,
|
||||
leanTask,
|
||||
leanDashboard,
|
||||
leanReminderLoading,
|
||||
leanSummaryText,
|
||||
leanWatchedAt,
|
||||
leanSummaryByTask,
|
||||
leanWatchedByTask,
|
||||
leanMyTasks,
|
||||
isHydrated,
|
||||
trainingConfigLoading,
|
||||
hasPublishedTrainingConfig,
|
||||
@@ -1274,6 +1353,11 @@ export function useTrainingWorkspace(options: UseTrainingWorkspaceOptions) {
|
||||
departmentOptions,
|
||||
filteredRecords,
|
||||
stats,
|
||||
hrTrainingTab,
|
||||
leanStats,
|
||||
leanRows,
|
||||
leanDashboardTaskId,
|
||||
selectLeanDashboardPeriod,
|
||||
learnerChatPrompt,
|
||||
newSessionReminderMessage,
|
||||
shouldShowNewSessionReminder,
|
||||
|
||||
@@ -140,6 +140,22 @@ export interface TrainingStats {
|
||||
averageScore: number;
|
||||
}
|
||||
|
||||
export interface LeanTrainingVideo {
|
||||
id: number;
|
||||
name: string;
|
||||
/** MinIO 公开播放地址,供缩略图首帧与弹窗播放使用 */
|
||||
fileUrl?: string | null;
|
||||
}
|
||||
|
||||
/** 学员视角任务状态:in_progress=进行中;overdue=已延期(过截止未完成);completed=已完成 */
|
||||
export type LeanTrainingTaskStatus = 'in_progress' | 'overdue' | 'completed';
|
||||
|
||||
export interface LeanTrainingCompletionBrief {
|
||||
summaryText: string;
|
||||
watchedAt: Record<string, string>;
|
||||
completedAt: string | null;
|
||||
}
|
||||
|
||||
export interface LeanTrainingWeeklyTask {
|
||||
id: number;
|
||||
weekKey: string;
|
||||
@@ -147,9 +163,21 @@ export interface LeanTrainingWeeklyTask {
|
||||
videoResourceIds: number[];
|
||||
targetRoles: string[];
|
||||
targetUserIds: number[];
|
||||
videos: Array<{ id: number; name: string }>;
|
||||
videos: LeanTrainingVideo[];
|
||||
status: string;
|
||||
minSummaryLength: number;
|
||||
weeklyCount?: number;
|
||||
pushedVideoCount?: number;
|
||||
/** 任务周周日(ISO 日期),供前端拼装"第N周 MM-DD至MM-DD"周次区间标签。 */
|
||||
weekEnd?: string | null;
|
||||
/** 期号:按周次升序编号,最早一周为第 1 期,与管理端口径一致。 */
|
||||
weekIndex?: number;
|
||||
}
|
||||
|
||||
/** 学员端时间树任务项:周任务 + 任务状态 + 完成信息 */
|
||||
export interface LeanTrainingMyTask extends LeanTrainingWeeklyTask {
|
||||
taskStatus: LeanTrainingTaskStatus;
|
||||
completion: LeanTrainingCompletionBrief | null;
|
||||
}
|
||||
|
||||
export interface LeanTrainingDashboardRow {
|
||||
@@ -160,12 +188,21 @@ export interface LeanTrainingDashboardRow {
|
||||
department?: string | null;
|
||||
videos: Array<{ name: string; watchedAt?: string | null }>;
|
||||
summaryText?: string | null;
|
||||
status: 'completed' | 'incomplete';
|
||||
/** 管理端三态:completed=已完成(感悟已提交);in_progress=进行中;overdue=已延期(过截止未完成),由后端序列化层归一 */
|
||||
status: 'completed' | 'in_progress' | 'overdue';
|
||||
completedAt?: string | null;
|
||||
}
|
||||
|
||||
/** 精益看板期次摘要:index 为期号(按周次升序,最早为第 1 期),供管理端下拉区分第几期任务。 */
|
||||
export interface LeanTrainingPeriod {
|
||||
id: number;
|
||||
weekKey: string;
|
||||
index: number;
|
||||
}
|
||||
|
||||
export interface LeanTrainingDashboard {
|
||||
task: LeanTrainingWeeklyTask | null;
|
||||
completed: LeanTrainingDashboardRow[];
|
||||
incomplete: LeanTrainingDashboardRow[];
|
||||
periods: LeanTrainingPeriod[];
|
||||
}
|
||||
@@ -4955,7 +4955,7 @@
|
||||
"reviewTitle": "Review & Checklist",
|
||||
"reviewDesc": "Configure review points, pre-exam checklists, and guided chat questions",
|
||||
"leanTitle": "Lean Weekly Task",
|
||||
"leanDesc": "Choose two videos for a calendar week and set its Sunday deadline"
|
||||
"leanDesc": "Choose the weekly video list, set videos per week, and configure the deadline for that week"
|
||||
},
|
||||
"guideGroups": {
|
||||
"company": "Company-level Safety Training",
|
||||
@@ -5022,15 +5022,51 @@
|
||||
"lean": {
|
||||
"weekKey": "Task week (Monday)",
|
||||
"dueAt": "Due time",
|
||||
"weekMustBeMonday": "The task week must be a Monday",
|
||||
"weeklyCount": "Videos per week",
|
||||
"weeklyCountHint": "Every Monday 09:00, the next batch of this many videos is pushed in selection order ({pushed}/{total} pushed); trainees get access immediately after publishing",
|
||||
"videosTitle": "Required training videos",
|
||||
"videosHint": "{count}/2 videos selected",
|
||||
"videosHint": "{count} videos selected (pushed weekly in batches by selection order)",
|
||||
"targetsTitle": "Training targets",
|
||||
"targetsHint": "Select roles or users; both scopes are combined.",
|
||||
"targetRoles": "Target roles",
|
||||
"targetUsers": "Target users",
|
||||
"videosFrozen": "Videos for this week are frozen",
|
||||
"noVideoResources": "Save at least two video resources in Training Materials first",
|
||||
"summaryRule": "Employees must watch both videos and submit a learning reflection of at least {count} characters",
|
||||
"addTarget": "Add trainees",
|
||||
"targetEmpty": "No training targets selected yet. Click \"Add trainees\" to configure by role or employee.",
|
||||
"targetModalTitle": "Add training targets",
|
||||
"targetSearchPlaceholder": "Search name / username / department",
|
||||
"targetSelectedCount": "{roles} roles · {users} employees selected",
|
||||
"targetUsersCount": "Target users ({count})",
|
||||
"targetRolesEmpty": "No roles available",
|
||||
"targetUsersEmpty": "No matching employees found",
|
||||
"removeTarget": "Remove",
|
||||
"targetConfirm": "Confirm",
|
||||
"noVideoResources": "Save at least one video resource in Training Materials first",
|
||||
"summaryRule": "Employees must watch the assigned videos and submit a learning reflection of at least {count} characters",
|
||||
"pushNow": "Push new-task supplement now",
|
||||
"pushing": "Pushing…",
|
||||
"weekRangeLabel": "Week {index} · {range}",
|
||||
"videoPagePrev": "Previous",
|
||||
"videoPageNext": "Next",
|
||||
"videoPageInfo": "Page {page} / {total}",
|
||||
"pushCompleted": "All videos have been pushed",
|
||||
"pushSuccess": "Pushed {count} videos and notified trainees",
|
||||
"pushFailed": "Video push failed, please retry later",
|
||||
"pushLogsTitle": "Push logs",
|
||||
"pushLogsEmpty": "No push logs yet",
|
||||
"pushProgress": "{pushed}/{total} videos pushed",
|
||||
"pushBatch": "Pushed {count} videos · sent {sent} · failed {failed} · {recipients} recipients",
|
||||
"pushStatus": {
|
||||
"sent": "All sent",
|
||||
"partial": "Partially failed",
|
||||
"failed": "Push failed",
|
||||
"completed": "Fully pushed"
|
||||
},
|
||||
"pushTrigger": {
|
||||
"publish": "On publish",
|
||||
"schedule": "Weekly schedule",
|
||||
"manual": "Manual push"
|
||||
},
|
||||
"saveTask": "Publish weekly task",
|
||||
"publishRequired": "Save and publish the Lean Management configuration before creating a weekly task",
|
||||
"unnamedVideo": "Unnamed video"
|
||||
@@ -5050,7 +5086,7 @@
|
||||
"parseFailed": "Question bank parsing failed",
|
||||
"saved": "Training configuration saved",
|
||||
"deleted": "Training configuration deleted",
|
||||
"leanVideoCount": "Select exactly two training videos",
|
||||
"leanVideoCount": "Select at least one training video",
|
||||
"leanTaskSaved": "Lean weekly task published",
|
||||
"videoFileRequired": "Please select a video file",
|
||||
"trainingAgentRequired": "The Employee Training agent was not found, so a video resource cannot be created",
|
||||
|
||||
@@ -1016,11 +1016,26 @@
|
||||
"lean": {
|
||||
"learner": {
|
||||
"title": "Lean Management Weekly Training",
|
||||
"description": "Complete {count} required videos and submit a learning reflection of at least {minSummaryLength} characters this week."
|
||||
"taskTitle": "Session {index}",
|
||||
"description": "Complete {count} required videos and submit a learning reflection of at least {minSummaryLength} characters for this session.",
|
||||
"taskPeriod": "Task period: {start} to {end}",
|
||||
"completedSummary": "Learning Reflection",
|
||||
"completedAt": "Completed at: {time}",
|
||||
"empty": "No lean training tasks yet"
|
||||
},
|
||||
"taskStatus": {
|
||||
"in_progress": "In Progress",
|
||||
"overdue": "Overdue",
|
||||
"completed": "Completed"
|
||||
},
|
||||
"videoUnavailable": "This video has no playable URL yet",
|
||||
"dueAt": "Due {time}",
|
||||
"watchedAt": "Watched: {time}",
|
||||
"markVideoWatched": "Click to record video completion",
|
||||
"videoWatchedToast": "Video watching completed",
|
||||
"videoWatchedBadge": "Completed",
|
||||
"completeVideosFirst": "Please watch all required videos of this session in full before submitting your reflection",
|
||||
"summaryTooShort": "The learning reflection must be at least {minSummaryLength} characters. Please keep writing",
|
||||
"summaryPlaceholder": "Enter this week's learning reflection (at least {minSummaryLength} characters)",
|
||||
"summaryLength": "{current}/{minSummaryLength} characters",
|
||||
"submitSummary": "Submit Learning Reflection",
|
||||
@@ -1030,7 +1045,9 @@
|
||||
"completed": "Completed",
|
||||
"incomplete": "Incomplete",
|
||||
"count": "{count} people",
|
||||
"empty": "No personnel data"
|
||||
"empty": "No personnel data",
|
||||
"passRate": "Completion Rate",
|
||||
"periodLabel": "Period {index}"
|
||||
},
|
||||
"columns": {
|
||||
"employeeId": "Employee ID",
|
||||
@@ -1046,13 +1063,23 @@
|
||||
},
|
||||
"status": {
|
||||
"completed": "Completed",
|
||||
"in_progress": "In Progress",
|
||||
"overdue": "Overdue",
|
||||
"incomplete": "Incomplete"
|
||||
},
|
||||
"reminder": {
|
||||
"action": "Remind",
|
||||
"sending": "Sending...",
|
||||
"success": "Reminder sent ({count} people)",
|
||||
"partial": "Reminder sent ({sent} people), {failed} failed. See the WeCom notify audit in the admin console for details.",
|
||||
"sendFailed": "Failed to send reminder ({count} people). Check the WeCom notification settings, or see the notify audit in the admin console.",
|
||||
"notSent": "No reminder sent: the member may have completed the training or is not bound to WeCom.",
|
||||
"failed": "Failed to send reminder. Please try again later."
|
||||
},
|
||||
"summaryModal": {
|
||||
"title": "Summary Details",
|
||||
"viewHint": "Click to view the full summary",
|
||||
"close": "Close"
|
||||
}
|
||||
},
|
||||
"video": {
|
||||
@@ -1120,6 +1147,10 @@
|
||||
"rule4": "HR can view statistics and export Excel from the same chat page."
|
||||
},
|
||||
"hr": {
|
||||
"tabs": {
|
||||
"allTraining": "All Training",
|
||||
"leanManagement": "Lean Management"
|
||||
},
|
||||
"stats": {
|
||||
"total": "Participants",
|
||||
"passed": "Passed",
|
||||
|
||||
@@ -4824,7 +4824,7 @@
|
||||
"reviewTitle": "ทบทวนและรายการตรวจสอบ",
|
||||
"reviewDesc": "กำหนดประเด็นทบทวน รายการก่อนสอบ และคำถามแนะนำในการสนทนา",
|
||||
"leanTitle": "ภารกิจ Lean รายสัปดาห์",
|
||||
"leanDesc": "เลือกวิดีโอสองรายการสำหรับสัปดาห์และกำหนดเวลาสิ้นสุดวันอาทิตย์"
|
||||
"leanDesc": "เลือกรายการวิดีโอประจำสัปดาห์ กำหนดจำนวนวิดีโอต่อสัปดาห์ และตั้งเส้นตายของสัปดาห์นั้น"
|
||||
},
|
||||
"guideGroups": {
|
||||
"company": "การฝึกอบรมความปลอดภัยระดับบริษัท",
|
||||
@@ -4891,15 +4891,51 @@
|
||||
"lean": {
|
||||
"weekKey": "สัปดาห์ภารกิจ (วันจันทร์)",
|
||||
"dueAt": "เวลาครบกำหนด",
|
||||
"weekMustBeMonday": "สัปดาห์ของงานต้องเป็นวันจันทร์",
|
||||
"weeklyCount": "จำนวนวิดีโอต่อสัปดาห์",
|
||||
"weeklyCountHint": "ทุกวันจันทร์ 09:00 ระบบจะส่งวิดีโอชุดถัดไปตามจำนวนนี้ตามลำดับที่เลือก (ส่งแล้ว {pushed}/{total}) ผู้เข้าอบรมเริ่มเรียนได้ทันทีหลังเผยแพร่",
|
||||
"videosTitle": "วิดีโอการฝึกอบรมที่กำหนด",
|
||||
"videosHint": "เลือกแล้ว {count}/2 วิดีโอ",
|
||||
"videosHint": "เลือกแล้ว {count} วิดีโอ (ส่งเป็นชุดรายสัปดาห์ตามลำดับที่เลือก)",
|
||||
"targetsTitle": "กลุ่มผู้เข้ารับการฝึกอบรม",
|
||||
"targetsHint": "เลือกตามบทบาทหรือผู้ใช้ที่ระบุ โดยรวมทั้งสองขอบเขต",
|
||||
"targetRoles": "บทบาทที่ระบุ",
|
||||
"targetUsers": "ผู้ใช้ที่ระบุ",
|
||||
"videosFrozen": "วิดีโอของสัปดาห์นี้ถูกล็อกแล้ว",
|
||||
"noVideoResources": "โปรดบันทึกทรัพยากรวิดีโออย่างน้อยสองรายการในเอกสารฝึกอบรมก่อน",
|
||||
"summaryRule": "พนักงานต้องดูวิดีโอทั้งสองและส่งความเห็นการเรียนรู้อย่างน้อย {count} อักขระ",
|
||||
"addTarget": "เพิ่มผู้เข้ารับการฝึกอบรม",
|
||||
"targetEmpty": "ยังไม่ได้เลือกกลุ่มผู้เข้ารับการฝึกอบรม โปรดคลิก \"เพิ่มผู้เข้ารับการฝึกอบรม\" เพื่อกำหนดตามบทบาทหรือพนักงาน",
|
||||
"targetModalTitle": "เพิ่มกลุ่มผู้เข้ารับการฝึกอบรม",
|
||||
"targetSearchPlaceholder": "ค้นหาชื่อ / ชื่อผู้ใช้ / แผนก",
|
||||
"targetSelectedCount": "เลือกแล้ว {roles} บทบาท · {users} พนักงาน",
|
||||
"targetUsersCount": "ผู้ใช้ที่ระบุ ({count})",
|
||||
"targetRolesEmpty": "ไม่มีบทบาทให้เลือก",
|
||||
"targetUsersEmpty": "ไม่พบพนักงานที่ตรงกัน",
|
||||
"removeTarget": "นำออก",
|
||||
"targetConfirm": "ยืนยัน",
|
||||
"noVideoResources": "โปรดบันทึกทรัพยากรวิดีโออย่างน้อยหนึ่งรายการในเอกสารฝึกอบรมก่อน",
|
||||
"summaryRule": "พนักงานต้องดูวิดีโอที่กำหนดและส่งความเห็นการเรียนรู้อย่างน้อย {count} อักขระ",
|
||||
"pushNow": "เพิ่มงานใหม่และส่งเพิ่มทันที",
|
||||
"pushing": "กำลังส่ง…",
|
||||
"weekRangeLabel": "สัปดาห์ที่ {index} {range}",
|
||||
"videoPagePrev": "ก่อนหน้า",
|
||||
"videoPageNext": "ถัดไป",
|
||||
"videoPageInfo": "หน้า {page} / {total}",
|
||||
"pushCompleted": "ส่งวิดีโอครบทุกรายการแล้ว",
|
||||
"pushSuccess": "ส่งวิดีโอ {count} รายการและแจ้งผู้เข้าอบรมแล้ว",
|
||||
"pushFailed": "การส่งวิดีโอล้มเหลว โปรดลองอีกครั้งภายหลัง",
|
||||
"pushLogsTitle": "บันทึกการส่ง",
|
||||
"pushLogsEmpty": "ยังไม่มีบันทึกการส่ง",
|
||||
"pushProgress": "ส่งแล้ว {pushed}/{total} วิดีโอ",
|
||||
"pushBatch": "ส่ง {count} วิดีโอ · สำเร็จ {sent} · ล้มเหลว {failed} · ผู้รับ {recipients} คน",
|
||||
"pushStatus": {
|
||||
"sent": "สำเร็จทั้งหมด",
|
||||
"partial": "ล้มเหลวบางส่วน",
|
||||
"failed": "การส่งล้มเหลว",
|
||||
"completed": "ส่งครบแล้ว"
|
||||
},
|
||||
"pushTrigger": {
|
||||
"publish": "ส่งเมื่อเผยแพร่",
|
||||
"schedule": "ตารางรายสัปดาห์",
|
||||
"manual": "ส่งด้วยตนเอง"
|
||||
},
|
||||
"saveTask": "เผยแพร่ภารกิจรายสัปดาห์",
|
||||
"publishRequired": "โปรดบันทึกและเผยแพร่การกำหนดค่า Lean Management ก่อนสร้างภารกิจรายสัปดาห์",
|
||||
"unnamedVideo": "วิดีโอไม่มีชื่อ"
|
||||
@@ -4919,7 +4955,7 @@
|
||||
"parseFailed": "วิเคราะห์คลังข้อสอบไม่สำเร็จ",
|
||||
"saved": "บันทึกการกำหนดค่าแล้ว",
|
||||
"deleted": "ลบการกำหนดค่าแล้ว",
|
||||
"leanVideoCount": "โปรดเลือกวิดีโอการฝึกอบรมให้ครบสองรายการ",
|
||||
"leanVideoCount": "โปรดเลือกวิดีโอการฝึกอบรมอย่างน้อยหนึ่งรายการ",
|
||||
"leanTaskSaved": "เผยแพร่ภารกิจ Lean รายสัปดาห์แล้ว",
|
||||
"videoFileRequired": "โปรดเลือกไฟล์วิดีโอ",
|
||||
"trainingAgentRequired": "ไม่พบ Agent การฝึกอบรมพนักงาน จึงไม่สามารถสร้างทรัพยากรวิดีโอได้",
|
||||
|
||||
@@ -1016,11 +1016,26 @@
|
||||
"lean": {
|
||||
"learner": {
|
||||
"title": "การอบรมการจัดการแบบลีนประจำสัปดาห์",
|
||||
"description": "สัปดาห์นี้ต้องดูวิดีโอที่กำหนด {count} รายการและส่งสรุปการเรียนรู้อย่างน้อย {minSummaryLength} ตัวอักษร"
|
||||
"taskTitle": "รอบที่ {index}",
|
||||
"description": "รอบนี้ต้องดูวิดีโอที่กำหนด {count} รายการและส่งสรุปการเรียนรู้อย่างน้อย {minSummaryLength} ตัวอักษร",
|
||||
"taskPeriod": "รอบงาน: {start} ถึง {end}",
|
||||
"completedSummary": "สรุปการเรียนรู้",
|
||||
"completedAt": "เสร็จสิ้นเมื่อ: {time}",
|
||||
"empty": "ยังไม่มีงานอบรมลีน"
|
||||
},
|
||||
"taskStatus": {
|
||||
"in_progress": "กำลังดำเนินการ",
|
||||
"overdue": "เกินกำหนด",
|
||||
"completed": "เสร็จสิ้น"
|
||||
},
|
||||
"videoUnavailable": "วิดีโอนี้ยังไม่มีลิงก์สำหรับเล่น",
|
||||
"dueAt": "กำหนดส่ง {time}",
|
||||
"watchedAt": "ดูแล้ว: {time}",
|
||||
"markVideoWatched": "คลิกเพื่อบันทึกว่าดูวิดีโอเสร็จแล้ว",
|
||||
"videoWatchedToast": "ดูวิดีโอครบแล้ว",
|
||||
"videoWatchedBadge": "เสร็จสิ้น",
|
||||
"completeVideosFirst": "กรุณาดูวิดีโอที่กำหนดของรอบนี้ให้ครบก่อนส่งสรุปการเรียนรู้",
|
||||
"summaryTooShort": "สรุปการเรียนรู้ต้องมีอย่างน้อย {minSummaryLength} ตัวอักษร กรุณาเขียนต่อ",
|
||||
"summaryPlaceholder": "กรอกสรุปการเรียนรู้ประจำสัปดาห์ (อย่างน้อย {minSummaryLength} ตัวอักษร)",
|
||||
"summaryLength": "{current}/{minSummaryLength} ตัวอักษร",
|
||||
"submitSummary": "ส่งสรุปการเรียนรู้",
|
||||
@@ -1030,7 +1045,9 @@
|
||||
"completed": "รายชื่อผู้เสร็จสิ้น",
|
||||
"incomplete": "รายชื่อผู้ยังไม่เสร็จ",
|
||||
"count": "{count} คน",
|
||||
"empty": "ไม่มีข้อมูลบุคลากร"
|
||||
"empty": "ไม่มีข้อมูลบุคลากร",
|
||||
"passRate": "อัตราความสำเร็จ",
|
||||
"periodLabel": "รอบที่ {index}"
|
||||
},
|
||||
"columns": {
|
||||
"employeeId": "รหัสพนักงาน",
|
||||
@@ -1046,13 +1063,23 @@
|
||||
},
|
||||
"status": {
|
||||
"completed": "เสร็จสิ้น",
|
||||
"in_progress": "กำลังดำเนินการ",
|
||||
"overdue": "เกินกำหนด",
|
||||
"incomplete": "ยังไม่เสร็จ"
|
||||
},
|
||||
"reminder": {
|
||||
"action": "เตือน",
|
||||
"sending": "กำลังส่ง...",
|
||||
"success": "ส่งการเตือนแล้ว ({count} คน)",
|
||||
"partial": "ส่งการเตือนแล้ว ({sent} คน) แต่ {failed} คนส่งไม่สำเร็จ โปรดตรวจสอบบันทึกการแจ้งเตือน WeCom ในหน้าผู้ดูแลระบบ",
|
||||
"sendFailed": "ส่งการเตือนไม่สำเร็จ ({count} คน) โปรดตรวจสอบการตั้งค่าการแจ้งเตือน WeCom หรือดูบันทึกการแจ้งเตือนในหน้าผู้ดูแลระบบ",
|
||||
"notSent": "ยังไม่ได้ส่งการเตือน: สมาชิกอาจเรียนเสร็จแล้วหรือยังไม่ได้ผูกบัญชี WeCom",
|
||||
"failed": "ส่งการเตือนไม่สำเร็จ โปรดลองอีกครั้งภายหลัง"
|
||||
},
|
||||
"summaryModal": {
|
||||
"title": "รายละเอียดสรุป",
|
||||
"viewHint": "คลิกเพื่อดูสรุปทั้งหมด",
|
||||
"close": "ปิด"
|
||||
}
|
||||
},
|
||||
"video": {
|
||||
@@ -1120,6 +1147,10 @@
|
||||
"rule4": "HR สามารถดูสถิติและส่งออก Excel ได้จากหน้าแชตเดียวกัน"
|
||||
},
|
||||
"hr": {
|
||||
"tabs": {
|
||||
"allTraining": "การอบรมทั้งหมด",
|
||||
"leanManagement": "การจัดการแบบลีน"
|
||||
},
|
||||
"stats": {
|
||||
"total": "จำนวนผู้เข้าอบรม",
|
||||
"passed": "ผ่านแล้ว",
|
||||
|
||||
@@ -4980,7 +4980,7 @@
|
||||
"reviewTitle": "复盘与清单",
|
||||
"reviewDesc": "配置培训完成后的复盘重点、考前清单与聊天引导问题",
|
||||
"leanTitle": "精益周任务",
|
||||
"leanDesc": "为指定自然周选择两个视频并设置周日截止时间"
|
||||
"leanDesc": "为指定自然周选择视频列表、设置每周推送数量并配置周截止时间"
|
||||
},
|
||||
"guideGroups": {
|
||||
"company": "公司级安全培训",
|
||||
@@ -5047,15 +5047,51 @@
|
||||
"lean": {
|
||||
"weekKey": "任务周(周一)",
|
||||
"dueAt": "截止时间",
|
||||
"weekMustBeMonday": "任务周必须选择周一",
|
||||
"weeklyCount": "每周任务数量",
|
||||
"weeklyCountHint": "每周一 09:00 按该数量从视频列表顺序推送下一批(已推送 {pushed}/{total}),受训员工发布后立即可学",
|
||||
"videosTitle": "指定培训视频",
|
||||
"videosHint": "已选择 {count}/2 个视频",
|
||||
"videosHint": "已选择 {count} 个视频(按选择顺序每周分批推送)",
|
||||
"targetsTitle": "受训对象",
|
||||
"targetsHint": "按角色或指定用户选择,两个范围取并集",
|
||||
"targetRoles": "指定角色",
|
||||
"targetUsers": "指定用户",
|
||||
"videosFrozen": "当前周视频已冻结",
|
||||
"noVideoResources": "请先在培训资料中保存至少两个视频资源",
|
||||
"summaryRule": "员工需完成两个视频观看并提交不少于 {count} 字的学习感悟",
|
||||
"addTarget": "添加受训",
|
||||
"targetEmpty": "尚未选择受训对象,请点击\"添加受训\"按角色或员工配置",
|
||||
"targetModalTitle": "添加受训对象",
|
||||
"targetSearchPlaceholder": "搜索姓名 / 用户名 / 部门",
|
||||
"targetSelectedCount": "已选 {roles} 个角色 · {users} 名员工",
|
||||
"targetUsersCount": "指定用户({count})",
|
||||
"targetRolesEmpty": "暂无可选角色",
|
||||
"targetUsersEmpty": "未找到匹配员工",
|
||||
"removeTarget": "移除",
|
||||
"targetConfirm": "确认添加",
|
||||
"noVideoResources": "请先在培训资料中保存至少一个视频资源",
|
||||
"summaryRule": "员工需完成指定视频观看并提交不少于 {count} 字的学习感悟",
|
||||
"pushNow": "立即新增任务补推",
|
||||
"pushing": "推送中…",
|
||||
"weekRangeLabel": "第{index}周 {range}",
|
||||
"videoPagePrev": "上一页",
|
||||
"videoPageNext": "下一页",
|
||||
"videoPageInfo": "第 {page} / {total} 页",
|
||||
"pushCompleted": "全部视频已推送完毕",
|
||||
"pushSuccess": "已推送 {count} 个视频并通知受训员工",
|
||||
"pushFailed": "视频推送失败,请稍后重试",
|
||||
"pushLogsTitle": "推送记录",
|
||||
"pushLogsEmpty": "暂无推送记录",
|
||||
"pushProgress": "已推送 {pushed}/{total} 个视频",
|
||||
"pushBatch": "推送 {count} 个视频 · 发送 {sent} · 失败 {failed} · 接收 {recipients} 人",
|
||||
"pushStatus": {
|
||||
"sent": "全部成功",
|
||||
"partial": "部分失败",
|
||||
"failed": "推送失败",
|
||||
"completed": "已全部推送"
|
||||
},
|
||||
"pushTrigger": {
|
||||
"publish": "发布推送",
|
||||
"schedule": "每周排程",
|
||||
"manual": "手动推送"
|
||||
},
|
||||
"saveTask": "发布周任务",
|
||||
"publishRequired": "请先保存并发布精益管理培训配置,再创建周任务",
|
||||
"unnamedVideo": "未命名视频"
|
||||
@@ -5075,7 +5111,7 @@
|
||||
"parseFailed": "题库解析失败",
|
||||
"saved": "培训配置已保存",
|
||||
"deleted": "培训配置已删除",
|
||||
"leanVideoCount": "请恰好选择两个培训视频",
|
||||
"leanVideoCount": "请至少选择一个培训视频",
|
||||
"leanTaskSaved": "精益周任务已发布",
|
||||
"videoFileRequired": "请选择视频文件",
|
||||
"trainingAgentRequired": "未找到员工培训 Agent,无法创建视频资源",
|
||||
|
||||
@@ -1050,11 +1050,26 @@
|
||||
"lean": {
|
||||
"learner": {
|
||||
"title": "精益管理周度培训",
|
||||
"description": "本周需完成 {count} 个指定视频,并提交不少于 {minSummaryLength} 字的学习感悟。"
|
||||
"taskTitle": "第 {index} 期",
|
||||
"description": "本期需完成 {count} 个指定视频,并提交不少于 {minSummaryLength} 字的学习感悟。",
|
||||
"taskPeriod": "任务周期:{start} 至 {end}",
|
||||
"completedSummary": "学习感悟",
|
||||
"completedAt": "完成时间:{time}",
|
||||
"empty": "暂无精益培训任务"
|
||||
},
|
||||
"taskStatus": {
|
||||
"in_progress": "进行中",
|
||||
"overdue": "已延期",
|
||||
"completed": "已完成"
|
||||
},
|
||||
"videoUnavailable": "该视频暂无可播放地址",
|
||||
"dueAt": "截止 {time}",
|
||||
"watchedAt": "已观看:{time}",
|
||||
"markVideoWatched": "点击记录观看完成",
|
||||
"videoWatchedToast": "视频观看完成",
|
||||
"videoWatchedBadge": "已完成",
|
||||
"completeVideosFirst": "请先完整观看本期全部任务视频,再提交学习感悟",
|
||||
"summaryTooShort": "学习感悟不少于 {minSummaryLength} 字,请继续补充",
|
||||
"summaryPlaceholder": "请填写本周学习感悟(不少于 {minSummaryLength} 字)",
|
||||
"summaryLength": "{current}/{minSummaryLength} 字",
|
||||
"submitSummary": "提交学习感悟",
|
||||
@@ -1064,7 +1079,9 @@
|
||||
"completed": "已完成名单",
|
||||
"incomplete": "未完成名单",
|
||||
"count": "共 {count} 人",
|
||||
"empty": "暂无人员数据"
|
||||
"empty": "暂无人员数据",
|
||||
"passRate": "完成率",
|
||||
"periodLabel": "第 {index} 期"
|
||||
},
|
||||
"columns": {
|
||||
"employeeId": "工号",
|
||||
@@ -1080,13 +1097,23 @@
|
||||
},
|
||||
"status": {
|
||||
"completed": "已完成",
|
||||
"in_progress": "进行中",
|
||||
"overdue": "已延期",
|
||||
"incomplete": "未完成"
|
||||
},
|
||||
"reminder": {
|
||||
"action": "提醒",
|
||||
"sending": "发送中...",
|
||||
"success": "已发送提醒({count} 人)",
|
||||
"partial": "已发送提醒({sent} 人),{failed} 人发送失败,请在管理端企微通知审计中查看原因",
|
||||
"sendFailed": "提醒发送失败({count} 人),请检查企业微信通知配置,或在管理端企微通知审计中查看原因",
|
||||
"notSent": "未发送提醒:对方可能已完成培训或未绑定企业微信",
|
||||
"failed": "提醒发送失败,请稍后重试"
|
||||
},
|
||||
"summaryModal": {
|
||||
"title": "总结详情",
|
||||
"viewHint": "点击查看全部总结",
|
||||
"close": "关闭"
|
||||
}
|
||||
},
|
||||
"video": {
|
||||
@@ -1223,6 +1250,10 @@
|
||||
}
|
||||
},
|
||||
"hr": {
|
||||
"tabs": {
|
||||
"allTraining": "全部培训",
|
||||
"leanManagement": "精益管理"
|
||||
},
|
||||
"stats": {
|
||||
"total": "参训人数",
|
||||
"passed": "已通过",
|
||||
|
||||
@@ -4829,7 +4829,7 @@
|
||||
"reviewTitle": "複盤與清單",
|
||||
"reviewDesc": "配置培訓完成後的複盤重點、考前清單與聊天引導問題",
|
||||
"leanTitle": "精益每週任務",
|
||||
"leanDesc": "為指定自然週選擇兩部影片並設定週日截止時間"
|
||||
"leanDesc": "為指定自然週選擇影片清單、設定每週推送數量並配置週截止時間"
|
||||
},
|
||||
"guideGroups": {
|
||||
"company": "公司級安全培訓",
|
||||
@@ -4896,15 +4896,51 @@
|
||||
"lean": {
|
||||
"weekKey": "任務週(週一)",
|
||||
"dueAt": "截止時間",
|
||||
"weekMustBeMonday": "任務週必須選擇週一",
|
||||
"weeklyCount": "每週任務數量",
|
||||
"weeklyCountHint": "每週一 09:00 按該數量從影片清單順序推送下一批(已推送 {pushed}/{total}),受訓員工發布後立即可學",
|
||||
"videosTitle": "指定培訓影片",
|
||||
"videosHint": "已選擇 {count}/2 部影片",
|
||||
"videosHint": "已選擇 {count} 部影片(按選擇順序每週分批推送)",
|
||||
"targetsTitle": "受訓對象",
|
||||
"targetsHint": "依角色或指定使用者選擇,兩個範圍取聯集",
|
||||
"targetRoles": "指定角色",
|
||||
"targetUsers": "指定使用者",
|
||||
"videosFrozen": "目前週影片已凍結",
|
||||
"noVideoResources": "請先在培訓資料中儲存至少兩部影片資源",
|
||||
"summaryRule": "員工須完成兩部影片觀看並提交不少於 {count} 字的學習感悟",
|
||||
"addTarget": "新增受訓",
|
||||
"targetEmpty": "尚未選擇受訓對象,請點擊「新增受訓」按角色或員工配置",
|
||||
"targetModalTitle": "新增受訓對象",
|
||||
"targetSearchPlaceholder": "搜尋姓名 / 使用者名稱 / 部門",
|
||||
"targetSelectedCount": "已選 {roles} 個角色 · {users} 位員工",
|
||||
"targetUsersCount": "指定使用者({count})",
|
||||
"targetRolesEmpty": "暫無可選角色",
|
||||
"targetUsersEmpty": "未找到符合的員工",
|
||||
"removeTarget": "移除",
|
||||
"targetConfirm": "確認新增",
|
||||
"noVideoResources": "請先在培訓資料中儲存至少一部影片資源",
|
||||
"summaryRule": "員工須完成指定影片觀看並提交不少於 {count} 字的學習感悟",
|
||||
"pushNow": "立即新增任務補推",
|
||||
"pushing": "推送中…",
|
||||
"weekRangeLabel": "第{index}週 {range}",
|
||||
"videoPagePrev": "上一頁",
|
||||
"videoPageNext": "下一頁",
|
||||
"videoPageInfo": "第 {page} / {total} 頁",
|
||||
"pushCompleted": "全部影片已推送完畢",
|
||||
"pushSuccess": "已推送 {count} 部影片並通知受訓員工",
|
||||
"pushFailed": "影片推送失敗,請稍後重試",
|
||||
"pushLogsTitle": "推送記錄",
|
||||
"pushLogsEmpty": "暫無推送記錄",
|
||||
"pushProgress": "已推送 {pushed}/{total} 部影片",
|
||||
"pushBatch": "推送 {count} 部影片 · 發送 {sent} · 失敗 {failed} · 接收 {recipients} 人",
|
||||
"pushStatus": {
|
||||
"sent": "全部成功",
|
||||
"partial": "部分失敗",
|
||||
"failed": "推送失敗",
|
||||
"completed": "已全部推送"
|
||||
},
|
||||
"pushTrigger": {
|
||||
"publish": "發布推送",
|
||||
"schedule": "每週排程",
|
||||
"manual": "手動推送"
|
||||
},
|
||||
"saveTask": "發佈每週任務",
|
||||
"publishRequired": "請先儲存並發佈精益管理培訓配置,再建立每週任務",
|
||||
"unnamedVideo": "未命名影片"
|
||||
@@ -4924,7 +4960,7 @@
|
||||
"parseFailed": "題庫解析失敗",
|
||||
"saved": "培訓配置已儲存",
|
||||
"deleted": "培訓配置已刪除",
|
||||
"leanVideoCount": "請剛好選擇兩部培訓影片",
|
||||
"leanVideoCount": "請至少選擇一部培訓影片",
|
||||
"leanTaskSaved": "精益每週任務已發佈",
|
||||
"videoFileRequired": "請選擇影片檔案",
|
||||
"trainingAgentRequired": "未找到員工培訓 Agent,無法建立影片資源",
|
||||
|
||||
@@ -1016,11 +1016,26 @@
|
||||
"lean": {
|
||||
"learner": {
|
||||
"title": "精益管理週度培訓",
|
||||
"description": "本週需完成 {count} 個指定影片,並提交不少於 {minSummaryLength} 字的學習心得。"
|
||||
"taskTitle": "第 {index} 期",
|
||||
"description": "本期需完成 {count} 個指定影片,並提交不少於 {minSummaryLength} 字的學習心得。",
|
||||
"taskPeriod": "任務週期:{start} 至 {end}",
|
||||
"completedSummary": "學習心得",
|
||||
"completedAt": "完成時間:{time}",
|
||||
"empty": "暫無精益培訓任務"
|
||||
},
|
||||
"taskStatus": {
|
||||
"in_progress": "進行中",
|
||||
"overdue": "已延期",
|
||||
"completed": "已完成"
|
||||
},
|
||||
"videoUnavailable": "該影片暫無可播放地址",
|
||||
"dueAt": "截止 {time}",
|
||||
"watchedAt": "已觀看:{time}",
|
||||
"markVideoWatched": "點擊記錄完成觀看",
|
||||
"videoWatchedToast": "影片觀看完成",
|
||||
"videoWatchedBadge": "已完成",
|
||||
"completeVideosFirst": "請先完整觀看本期全部任務影片,再提交學習心得",
|
||||
"summaryTooShort": "學習心得不少於 {minSummaryLength} 字,請繼續補充",
|
||||
"summaryPlaceholder": "請填寫本週學習心得(不少於 {minSummaryLength} 字)",
|
||||
"summaryLength": "{current}/{minSummaryLength} 字",
|
||||
"submitSummary": "提交學習心得",
|
||||
@@ -1030,7 +1045,9 @@
|
||||
"completed": "已完成名單",
|
||||
"incomplete": "未完成名單",
|
||||
"count": "共 {count} 人",
|
||||
"empty": "暫無人員資料"
|
||||
"empty": "暫無人員資料",
|
||||
"passRate": "完成率",
|
||||
"periodLabel": "第 {index} 期"
|
||||
},
|
||||
"columns": {
|
||||
"employeeId": "工號",
|
||||
@@ -1046,13 +1063,23 @@
|
||||
},
|
||||
"status": {
|
||||
"completed": "已完成",
|
||||
"in_progress": "進行中",
|
||||
"overdue": "已延期",
|
||||
"incomplete": "未完成"
|
||||
},
|
||||
"reminder": {
|
||||
"action": "提醒",
|
||||
"sending": "發送中...",
|
||||
"success": "已發送提醒({count} 人)",
|
||||
"partial": "已發送提醒({sent} 人),{failed} 人發送失敗,請在管理端企微通知審計中查看原因",
|
||||
"sendFailed": "提醒發送失敗({count} 人),請檢查企業微信通知配置,或在管理端企微通知審計中查看原因",
|
||||
"notSent": "未發送提醒:對方可能已完成培訓或未綁定企業微信",
|
||||
"failed": "提醒發送失敗,請稍後重試"
|
||||
},
|
||||
"summaryModal": {
|
||||
"title": "總結詳情",
|
||||
"viewHint": "點擊查看全部總結",
|
||||
"close": "關閉"
|
||||
}
|
||||
},
|
||||
"video": {
|
||||
@@ -1120,6 +1147,10 @@
|
||||
"rule4": "HR 管理端可在同一聊天頁查看統計並匯出 Excel。"
|
||||
},
|
||||
"hr": {
|
||||
"tabs": {
|
||||
"allTraining": "全部培訓",
|
||||
"leanManagement": "精益管理"
|
||||
},
|
||||
"stats": {
|
||||
"total": "參訓人數",
|
||||
"passed": "已通過",
|
||||
|
||||
Reference in new issue
Block a user