feat(training): 新增精益培训视频与周任务管理
This commit is contained in:
1 parent
e5ede471fd
commit
a69814c409
32 files changed
+1619
-55
No files matched your search
@@ -70,6 +70,7 @@ GUNICORN_WORKERS=20
|
||||
# 企业微信通知配置(如果不使用企业微信通知,留空即可)
|
||||
# WECOM_NOTIFY_BASE_URL:历史内网/端口地址,仅作兼容;textcard 跳转优先 WECOM_PUBLIC_BASE_URL
|
||||
WECOM_NOTIFY_BASE_URL=http://ai.well-trust.com:8890/
|
||||
WECOM_NOTIFY_EVENTS=permission_request_approved,permission_request_rejected,permission_batch_updated,task_completed,schedule_completed,password_reset,contract_payment_warning,training_lean_overdue,training_lean_task_initial,training_lean_targeted_reminder
|
||||
WECOM_PUBLIC_BASE_URL=https://ai.well-trust.com
|
||||
|
||||
# --- 5. 数据库与基础设施 ---
|
||||
|
||||
+1
-1
@@ -138,7 +138,7 @@ WECOM_TRUSTED_DOMAIN=
|
||||
WECOM_PUBLIC_BASE_URL=
|
||||
WECOM_NOTIFY_ENABLED=true
|
||||
WECOM_NOTIFY_BASE_URL=
|
||||
WECOM_NOTIFY_EVENTS=permission_request_approved,permission_request_rejected,permission_batch_updated,task_completed,schedule_completed,password_reset,contract_payment_warning
|
||||
WECOM_NOTIFY_EVENTS=permission_request_approved,permission_request_rejected,permission_batch_updated,task_completed,schedule_completed,password_reset,contract_payment_warning,training_lean_overdue,training_lean_task_initial,training_lean_targeted_reminder
|
||||
WECOM_FEEDBACK_NOTIFY_ENABLED=true
|
||||
WECOM_FEEDBACK_NOTIFY_BASE_URL=http://ai.well-trust.com:8881
|
||||
# 企业微信群机器人 webhook,按环境写入 .env.<env> 或部署平台变量;不要提交真实 URL。
|
||||
|
||||
@@ -70,6 +70,7 @@ GUNICORN_WORKERS=6
|
||||
# 企业微信通知配置(如果不使用企业微信通知,留空即可)
|
||||
# WECOM_NOTIFY_BASE_URL:历史内网/端口地址,仅作兼容;textcard 跳转优先 WECOM_PUBLIC_BASE_URL
|
||||
WECOM_NOTIFY_BASE_URL=http://ait.well-trust.com:8890/
|
||||
WECOM_NOTIFY_EVENTS=permission_request_approved,permission_request_rejected,permission_batch_updated,task_completed,schedule_completed,password_reset,contract_payment_warning,training_lean_overdue,training_lean_task_initial,training_lean_targeted_reminder
|
||||
WECOM_PUBLIC_BASE_URL=https://ait.well-trust.com
|
||||
HXOPS_PUBLIC_BASE_URL=https://ait.well-trust.com
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
"""
|
||||
"""
|
||||
backend/app/__init__.py
|
||||
|
||||
用途:应用工厂:创建 Flask 应用、挂载全局异常与响应处理。
|
||||
@@ -114,6 +114,11 @@ def create_app(config_name='default'):
|
||||
ensure_default_contract_payment_schedules()
|
||||
except Exception as exc: # pragma: no cover - 表未就绪时容忍
|
||||
logger.warning('Failed to ensure contract-payment schedules: %s', exc)
|
||||
try:
|
||||
from app.services.lean_training_schedule_seed import ensure_default_lean_training_schedule
|
||||
ensure_default_lean_training_schedule()
|
||||
except Exception as exc: # pragma: no cover - 表未就绪时容忍
|
||||
logger.warning('Failed to ensure lean-training schedule: %s', exc)
|
||||
else:
|
||||
logger.info('Skip startup schedule seeding: schedule_tasks table is not ready')
|
||||
from app.services.fixed_assets_snapshot import FixedAssetsSnapshotService
|
||||
|
||||
@@ -13,7 +13,8 @@ from io import BytesIO
|
||||
from flask import Blueprint, jsonify, request, send_file
|
||||
|
||||
from app.core.auth.jwt import get_current_user
|
||||
from app.core.errors import ForbiddenError, UnauthorizedError
|
||||
from app.core.errors import ForbiddenError, UnauthorizedError, ValidationError
|
||||
from app.core.response import ok
|
||||
from app.services.training_service import (
|
||||
export_training_records_excel,
|
||||
get_user_training_record,
|
||||
@@ -23,6 +24,16 @@ from app.services.training_service import (
|
||||
upsert_user_training_record,
|
||||
)
|
||||
from app.services.training_config_service import get_published_config, list_training_type_codes
|
||||
from app.services.lean_training_service import (
|
||||
create_or_update_weekly_task,
|
||||
get_current_weekly_task,
|
||||
list_dashboard,
|
||||
save_completion,
|
||||
)
|
||||
from app.services.lean_training_reminder_service import (
|
||||
send_initial_target_notifications,
|
||||
send_targeted_reminders,
|
||||
)
|
||||
|
||||
training_user_bp = Blueprint("training_user", __name__)
|
||||
training_admin_bp = Blueprint("training_admin", __name__)
|
||||
@@ -49,6 +60,14 @@ def _require_training_admin():
|
||||
return user
|
||||
|
||||
|
||||
def _require_lean_training_manager():
|
||||
"""确保当前用户具备 HR 培训管理权限,可维护精益任务、对象、看板和提醒。"""
|
||||
user = _require_user()
|
||||
if not user.can_manage_training():
|
||||
raise ForbiddenError("Lean training manager privilege required")
|
||||
return user
|
||||
|
||||
|
||||
@training_user_bp.route("/training-record", methods=["GET"])
|
||||
def get_my_training_record():
|
||||
"""读取当前用户的培训进度;未创建时返回 null data。"""
|
||||
@@ -86,6 +105,19 @@ def save_my_training_record():
|
||||
return jsonify(serialize_training_record(record))
|
||||
|
||||
|
||||
@training_user_bp.route("/lean-training/current-task", methods=["GET"])
|
||||
def get_my_lean_training_task():
|
||||
"""返回当前精益周任务,供员工端展示本周两个指定视频与总结门槛。"""
|
||||
return ok(get_current_weekly_task(_require_user()))
|
||||
|
||||
|
||||
@training_user_bp.route("/lean-training/completions", methods=["PUT"])
|
||||
def save_my_lean_training_completion():
|
||||
"""保存当前员工精益周任务完成事实,服务端强制校验视频和 50 字总结。"""
|
||||
user = _require_user()
|
||||
return ok(save_completion(user, request.get_json(silent=True) or {}))
|
||||
|
||||
|
||||
@training_admin_bp.route("/training-records", methods=["GET"])
|
||||
def list_admin_training_records():
|
||||
"""列出培训记录,支持关键字、部门、状态筛选。"""
|
||||
@@ -148,3 +180,39 @@ def export_admin_training_records():
|
||||
download_name=file_name,
|
||||
mimetype="application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
|
||||
)
|
||||
|
||||
|
||||
@training_admin_bp.route("/lean-training/weekly-tasks", methods=["POST"])
|
||||
def create_admin_lean_training_weekly_task():
|
||||
"""创建或调整精益周任务;仅精益培训管理员可选择本周两个视频。"""
|
||||
user = _require_lean_training_manager()
|
||||
task = create_or_update_weekly_task(request.get_json(silent=True) or {}, user.id)
|
||||
send_initial_target_notifications(task["id"])
|
||||
return ok(task, status=201)
|
||||
|
||||
|
||||
@training_admin_bp.route("/lean-training/weekly-tasks/<int:task_id>/reminders", methods=["POST"])
|
||||
def create_admin_lean_training_targeted_reminders(task_id: int):
|
||||
_require_lean_training_manager()
|
||||
payload = request.get_json(silent=True) or {}
|
||||
raw_user_ids = payload.get("user_ids")
|
||||
if not isinstance(raw_user_ids, list) or not raw_user_ids:
|
||||
raise ValidationError("user_ids must be a non-empty list", details={"field": "user_ids"})
|
||||
try:
|
||||
user_ids = list({int(user_id) for user_id in raw_user_ids})
|
||||
except (TypeError, ValueError) as exc:
|
||||
raise ValidationError("user_ids contains invalid user", details={"field": "user_ids"}) from exc
|
||||
if any(user_id <= 0 for user_id in user_ids):
|
||||
raise ValidationError("user_ids contains invalid user", details={"field": "user_ids"})
|
||||
try:
|
||||
return ok(send_targeted_reminders(task_id, user_ids))
|
||||
except ValueError as exc:
|
||||
raise ValidationError(str(exc)) from exc
|
||||
|
||||
|
||||
@training_admin_bp.route("/lean-training/dashboard", methods=["GET"])
|
||||
def get_admin_lean_training_dashboard():
|
||||
"""读取 HR 可见的精益培训完成和未完成名单,仅展示任务指定对象。"""
|
||||
_require_lean_training_manager()
|
||||
raw_task_id = request.args.get("task_id", type=int)
|
||||
return ok(list_dashboard(raw_task_id))
|
||||
@@ -530,7 +530,7 @@ class Config:
|
||||
WECOM_PUBLIC_BASE_URL = os.getenv('WECOM_PUBLIC_BASE_URL')
|
||||
WECOM_NOTIFY_ENABLED = os.getenv('WECOM_NOTIFY_ENABLED', 'true').lower() == 'true'
|
||||
WECOM_NOTIFY_BASE_URL = os.getenv('WECOM_NOTIFY_BASE_URL')
|
||||
WECOM_NOTIFY_EVENTS = os.getenv('WECOM_NOTIFY_EVENTS', 'task_completed,schedule_completed,password_reset,contract_payment_warning')
|
||||
WECOM_NOTIFY_EVENTS = os.getenv('WECOM_NOTIFY_EVENTS', 'task_completed,schedule_completed,password_reset,contract_payment_warning,training_lean_overdue,training_lean_task_initial,training_lean_targeted_reminder')
|
||||
WECOM_FEEDBACK_NOTIFY_ENABLED = os.getenv('WECOM_FEEDBACK_NOTIFY_ENABLED', 'true').lower() == 'true'
|
||||
WECOM_FEEDBACK_NOTIFY_BASE_URL = os.getenv('WECOM_FEEDBACK_NOTIFY_BASE_URL')
|
||||
WECOM_FEEDBACK_BOT_WEBHOOK = os.getenv('WECOM_FEEDBACK_BOT_WEBHOOK')
|
||||
|
||||
@@ -192,7 +192,14 @@ from app.models.shipping_inventory_preparation import (
|
||||
ShippingInventoryPreparationSourceAttempt,
|
||||
)
|
||||
from app.models.shipping_inventory_mapping import ShippingInventoryMapping
|
||||
from app.models.training import TrainingRecord, TrainingConfig, TrainingConfigResource
|
||||
from app.models.training import (
|
||||
LeanTrainingCompletion,
|
||||
LeanTrainingReminder,
|
||||
LeanTrainingWeeklyTask,
|
||||
TrainingConfig,
|
||||
TrainingConfigResource,
|
||||
TrainingRecord,
|
||||
)
|
||||
from app.models.user import LoginAudit, User, UserDefaultAgent, UserFavoriteAgent, UserHomepageConfig
|
||||
from app.models.voucher_check import VoucherCheckInvoiceState, VoucherCheckRunItem
|
||||
from app.models.contract_payment import (
|
||||
|
||||
@@ -11,7 +11,7 @@ from __future__ import annotations
|
||||
from datetime import date, datetime
|
||||
from typing import Optional
|
||||
|
||||
from sqlalchemy import Boolean, Date, DateTime, ForeignKey, Integer, JSON, String, UniqueConstraint
|
||||
from sqlalchemy import Boolean, Date, DateTime, ForeignKey, Integer, JSON, String, Text, UniqueConstraint
|
||||
from sqlalchemy.orm import Mapped, mapped_column, relationship
|
||||
|
||||
from app.models.base import Base
|
||||
@@ -94,3 +94,78 @@ class TrainingConfigResource(Base):
|
||||
config: Mapped[TrainingConfig] = relationship("TrainingConfig", back_populates="resources")
|
||||
agent_guide = relationship("AgentGuide", foreign_keys=[agent_guide_id])
|
||||
kb_document_version = relationship("KbDocumentVersion", foreign_keys=[kb_document_version_id])
|
||||
|
||||
|
||||
class LeanTrainingWeeklyTask(Base):
|
||||
"""
|
||||
精益管理周度培训任务。
|
||||
|
||||
用途:冻结每个自然周由 HR 指定的两个视频和受训对象,作为员工完成状态和提醒扫描的统一事实源。
|
||||
依赖:TrainingConfigResource、TrainingConfig、User。
|
||||
逻辑:配置页创建或更新任务;员工提交观看与总结时关联本表;提醒服务只扫描已发布周任务。
|
||||
"""
|
||||
|
||||
__tablename__ = "lean_training_weekly_tasks"
|
||||
__table_args__ = (UniqueConstraint("week_key", name="uq_lean_training_week_key"),)
|
||||
|
||||
id: Mapped[int] = mapped_column(primary_key=True)
|
||||
config_id: Mapped[int] = mapped_column(ForeignKey("training_configs.id"), nullable=False, index=True)
|
||||
week_key: Mapped[str] = mapped_column(String(10), nullable=False, index=True)
|
||||
due_at: Mapped[datetime] = mapped_column(DateTime, nullable=False, index=True)
|
||||
video_resource_ids: Mapped[list] = mapped_column(JSON, nullable=False)
|
||||
target_roles: Mapped[list] = mapped_column(JSON, nullable=False, default=list)
|
||||
target_user_ids: Mapped[list] = mapped_column(JSON, nullable=False, default=list)
|
||||
status: Mapped[str] = mapped_column(String(20), nullable=False, default="published", index=True)
|
||||
created_by_id: Mapped[Optional[int]] = mapped_column(ForeignKey("users.id"), nullable=True)
|
||||
created_at: Mapped[datetime] = mapped_column(DateTime, nullable=False, default=datetime.utcnow)
|
||||
updated_at: Mapped[datetime] = mapped_column(DateTime, nullable=False, default=datetime.utcnow, onupdate=datetime.utcnow)
|
||||
|
||||
config: Mapped[TrainingConfig] = relationship("TrainingConfig", foreign_keys=[config_id])
|
||||
|
||||
|
||||
class LeanTrainingCompletion(Base):
|
||||
"""
|
||||
精益管理周度学习完成事实。
|
||||
|
||||
用途:保存员工对周度两个指定视频的观看时间及不少于 50 字的学习感悟。
|
||||
依赖:LeanTrainingWeeklyTask、User。
|
||||
逻辑:员工只能写入本人的记录;服务端依据视频集合和总结长度判定完成,管理看板与提醒任务读取该事实。
|
||||
"""
|
||||
|
||||
__tablename__ = "lean_training_completions"
|
||||
__table_args__ = (UniqueConstraint("weekly_task_id", "user_id", name="uq_lean_training_task_user"),)
|
||||
|
||||
id: Mapped[int] = mapped_column(primary_key=True)
|
||||
weekly_task_id: Mapped[int] = mapped_column(ForeignKey("lean_training_weekly_tasks.id"), nullable=False, index=True)
|
||||
user_id: Mapped[int] = mapped_column(ForeignKey("users.id"), nullable=False, index=True)
|
||||
watched_at_json: Mapped[dict | None] = mapped_column(JSON, nullable=True)
|
||||
summary_text: Mapped[Optional[str]] = mapped_column(Text, nullable=True)
|
||||
summary_char_count: Mapped[int] = mapped_column(Integer, nullable=False, default=0)
|
||||
status: Mapped[str] = mapped_column(String(20), nullable=False, default="in_progress", index=True)
|
||||
completed_at: Mapped[Optional[datetime]] = mapped_column(DateTime, nullable=True, index=True)
|
||||
created_at: Mapped[datetime] = mapped_column(DateTime, nullable=False, default=datetime.utcnow)
|
||||
updated_at: Mapped[datetime] = mapped_column(DateTime, nullable=False, default=datetime.utcnow, onupdate=datetime.utcnow)
|
||||
|
||||
|
||||
class LeanTrainingReminder(Base):
|
||||
"""
|
||||
精益管理提醒发送审计。
|
||||
|
||||
用途:对指派、逾期轮次和班组长定向提醒去重并保留发送结果。
|
||||
依赖:LeanTrainingWeeklyTask、User、企微通知审计 trace_id。
|
||||
逻辑:扫描服务先写 pending 行,再调用企微服务更新最终状态,数据库唯一约束防止重复排程产生重复消息。
|
||||
"""
|
||||
|
||||
__tablename__ = "lean_training_reminders"
|
||||
__table_args__ = (UniqueConstraint("weekly_task_id", "recipient_user_id", "event_key", name="uq_lean_training_reminder_event"),)
|
||||
|
||||
id: Mapped[int] = mapped_column(primary_key=True)
|
||||
weekly_task_id: Mapped[int] = mapped_column(ForeignKey("lean_training_weekly_tasks.id"), nullable=False, index=True)
|
||||
recipient_user_id: Mapped[int] = mapped_column(ForeignKey("users.id"), nullable=False, index=True)
|
||||
event_key: Mapped[str] = mapped_column(String(64), nullable=False)
|
||||
status: Mapped[str] = mapped_column(String(20), nullable=False, default="pending", index=True)
|
||||
trace_id: Mapped[Optional[str]] = mapped_column(String(64), nullable=True, index=True)
|
||||
error_message: Mapped[Optional[str]] = mapped_column(String(255), nullable=True)
|
||||
sent_at: Mapped[Optional[datetime]] = mapped_column(DateTime, nullable=True)
|
||||
created_at: Mapped[datetime] = mapped_column(DateTime, nullable=False, default=datetime.utcnow)
|
||||
updated_at: Mapped[datetime] = mapped_column(DateTime, nullable=False, default=datetime.utcnow, onupdate=datetime.utcnow)
|
||||
@@ -0,0 +1,180 @@
|
||||
"""
|
||||
backend/app/services/lean_training_reminder_service.py
|
||||
|
||||
用途:执行精益管理周度培训的企微提醒生成与发送。
|
||||
依赖:精益培训任务/完成/提醒模型、User、wecom_notify。
|
||||
逻辑:排程按周日截止、周一/周三/周五催学规则写入幂等提醒,再由统一企微服务发送并落审计。
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from datetime import datetime, timezone
|
||||
|
||||
from sqlalchemy import select
|
||||
from sqlalchemy.exc import IntegrityError
|
||||
|
||||
from app.extensions import db
|
||||
from app.models import LeanTrainingCompletion, LeanTrainingReminder, LeanTrainingWeeklyTask, User
|
||||
from app.services.lean_training_service import target_user_ids_for_task
|
||||
from app.services.wecom_notify import send_wecom_event_message
|
||||
from app.services.schedule.timezone_util import resolve_schedule_tzinfo, utc_now_naive
|
||||
|
||||
|
||||
def _send_reminder(
|
||||
*,
|
||||
task: LeanTrainingWeeklyTask,
|
||||
recipient: User,
|
||||
event_key: str,
|
||||
event_type: str,
|
||||
title: str,
|
||||
content: str,
|
||||
current: datetime,
|
||||
) -> str:
|
||||
reminder = db.session.execute(
|
||||
select(LeanTrainingReminder).where(
|
||||
LeanTrainingReminder.weekly_task_id == task.id,
|
||||
LeanTrainingReminder.recipient_user_id == recipient.id,
|
||||
LeanTrainingReminder.event_key == event_key,
|
||||
)
|
||||
).scalar_one_or_none()
|
||||
if reminder:
|
||||
return "skipped"
|
||||
reminder = LeanTrainingReminder(
|
||||
weekly_task_id=task.id,
|
||||
recipient_user_id=recipient.id,
|
||||
event_key=event_key,
|
||||
)
|
||||
try:
|
||||
with db.session.begin_nested():
|
||||
db.session.add(reminder)
|
||||
db.session.flush()
|
||||
except IntegrityError:
|
||||
return "skipped"
|
||||
result = send_wecom_event_message(
|
||||
event_type=event_type,
|
||||
user=recipient,
|
||||
title=title,
|
||||
content=content,
|
||||
jump_path="/workspace",
|
||||
jump_params={"training_type": "lean_management", "weekly_task_id": task.id},
|
||||
)
|
||||
reminder.trace_id = result.get("trace_id")
|
||||
if result.get("ok"):
|
||||
reminder.status = "sent"
|
||||
reminder.sent_at = current
|
||||
return "sent"
|
||||
reminder.status = "skipped" if result.get("reason") in {"event_disabled", "notify_disabled", "user_unbound"} else "failed"
|
||||
reminder.error_message = str(result.get("reason") or "send_failed")[:255]
|
||||
return reminder.status
|
||||
|
||||
|
||||
def send_initial_target_notifications(task_id: int, *, now: datetime | None = None) -> dict[str, int]:
|
||||
"""向 HR 指定的在职受训对象发送任务发布提醒,审计唯一键保证重复发布不重复推送。"""
|
||||
task = db.session.get(LeanTrainingWeeklyTask, task_id)
|
||||
if not task or task.status != "published":
|
||||
return {"created": 0, "sent": 0, "skipped": 0, "failed": 0}
|
||||
current = now or utc_now_naive()
|
||||
totals = {"created": 0, "sent": 0, "skipped": 0, "failed": 0}
|
||||
recipients = db.session.execute(select(User).where(User.id.in_(target_user_ids_for_task(task)))).scalars().all()
|
||||
for recipient in recipients:
|
||||
result = _send_reminder(
|
||||
task=task,
|
||||
recipient=recipient,
|
||||
event_key="task-initial",
|
||||
event_type="training_lean_task_initial",
|
||||
title="精益管理培训任务已发布",
|
||||
content="您已被指定参加本周精益管理培训,请观看两个指定视频并提交不少于50字的学习感悟。",
|
||||
current=current,
|
||||
)
|
||||
totals["created"] += result != "skipped"
|
||||
totals[result] += 1
|
||||
db.session.commit()
|
||||
return totals
|
||||
|
||||
|
||||
def send_targeted_reminders(task_id: int, user_ids: list[int], *, now: datetime | None = None) -> dict[str, int]:
|
||||
"""由 HR 对本周指定且尚未完成的员工发起定向提醒,不允许跨任务对象发送。"""
|
||||
task = db.session.get(LeanTrainingWeeklyTask, task_id)
|
||||
if not task or task.status != "published":
|
||||
raise ValueError("Lean training weekly task not found")
|
||||
current = now or utc_now_naive()
|
||||
completed_user_ids = set(
|
||||
db.session.execute(
|
||||
select(LeanTrainingCompletion.user_id).where(
|
||||
LeanTrainingCompletion.weekly_task_id == task.id,
|
||||
LeanTrainingCompletion.status == "completed",
|
||||
)
|
||||
).scalars()
|
||||
)
|
||||
recipients = db.session.execute(
|
||||
select(User).where(User.id.in_(user_ids), User.status == "active")
|
||||
).scalars().all()
|
||||
recipients_by_id = {recipient.id: recipient for recipient in recipients}
|
||||
unavailable_ids = sorted(set(user_ids) - set(recipients_by_id))
|
||||
if unavailable_ids:
|
||||
raise ValueError("Some reminder recipients are unavailable")
|
||||
forbidden_ids = sorted(set(user_ids) - target_user_ids_for_task(task))
|
||||
if forbidden_ids:
|
||||
raise ValueError("Some reminder recipients are outside the task target")
|
||||
totals = {"created": 0, "sent": 0, "skipped": 0, "failed": 0}
|
||||
for recipient in recipients:
|
||||
if recipient.id in completed_user_ids:
|
||||
totals["skipped"] += 1
|
||||
continue
|
||||
result = _send_reminder(
|
||||
task=task,
|
||||
recipient=recipient,
|
||||
event_key="targeted",
|
||||
event_type="training_lean_targeted_reminder",
|
||||
title="精益管理培训定向提醒",
|
||||
content="您尚未完成本周精益管理培训,请观看两个指定视频并提交不少于50字的学习感悟。",
|
||||
current=current,
|
||||
)
|
||||
totals["created"] += result != "skipped"
|
||||
totals[result] += 1
|
||||
db.session.commit()
|
||||
return totals
|
||||
|
||||
|
||||
def _event_key(task: LeanTrainingWeeklyTask, now: datetime) -> str | None:
|
||||
"""按周日截止后的周一、周三、周五计算本轮逾期提醒唯一键。"""
|
||||
if now <= task.due_at:
|
||||
return None
|
||||
local_now = now.replace(tzinfo=timezone.utc).astimezone(resolve_schedule_tzinfo("Asia/Shanghai"))
|
||||
weekday = local_now.weekday()
|
||||
if weekday not in {0, 2, 4}:
|
||||
return None
|
||||
return f"overdue-{local_now.date().isoformat()}"
|
||||
|
||||
|
||||
def run_lean_training_reminders(*, now: datetime | None = None) -> dict[str, int]:
|
||||
"""扫描未完成人员并发送本轮提醒,重复运行由唯一约束确保不重复推送。"""
|
||||
current = now or utc_now_naive()
|
||||
tasks = db.session.execute(select(LeanTrainingWeeklyTask).where(LeanTrainingWeeklyTask.status == "published")).scalars().all()
|
||||
created = sent = skipped = failed = 0
|
||||
for task in tasks:
|
||||
event_key = _event_key(task, current)
|
||||
if not event_key:
|
||||
continue
|
||||
completed_user_ids = set(db.session.execute(select(LeanTrainingCompletion.user_id).where(LeanTrainingCompletion.weekly_task_id == task.id, LeanTrainingCompletion.status == "completed")).scalars())
|
||||
target_user_ids = target_user_ids_for_task(task)
|
||||
users = db.session.execute(select(User).where(User.id.in_(target_user_ids - completed_user_ids))).scalars().all() if target_user_ids else []
|
||||
for user in users:
|
||||
result = _send_reminder(
|
||||
task=task,
|
||||
recipient=user,
|
||||
event_key=event_key,
|
||||
event_type="training_lean_overdue",
|
||||
title="精益管理培训逾期提醒",
|
||||
content="本周精益管理培训尚未完成,请观看两个指定视频并提交不少于50字的学习感悟。",
|
||||
current=current,
|
||||
)
|
||||
created += result != "skipped"
|
||||
if result == "sent":
|
||||
sent += 1
|
||||
elif result == "failed":
|
||||
failed += 1
|
||||
else:
|
||||
skipped += 1
|
||||
db.session.commit()
|
||||
return {"created": created, "sent": sent, "skipped": skipped, "failed": failed}
|
||||
@@ -0,0 +1,30 @@
|
||||
"""
|
||||
backend/app/services/lean_training_schedule_seed.py
|
||||
|
||||
用途:幂等创建精益培训逾期提醒的默认排程。
|
||||
依赖:ScheduleTask、User、上海时区 next_run 计算。
|
||||
逻辑:应用启动时在存在管理员和排程表后创建每日扫描任务,管理员可在排程中心停用或调整。
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from datetime import datetime
|
||||
|
||||
from app import db
|
||||
from app.models import ScheduleTask, User
|
||||
from app.services.schedule.timezone_util import compute_next_run_at
|
||||
|
||||
|
||||
def ensure_default_lean_training_schedule(*, commit: bool = True) -> list[ScheduleTask]:
|
||||
"""幂等创建每日 09:00 精益培训提醒扫描任务。"""
|
||||
owner = db.session.query(User).filter(User.role == "admin").order_by(User.id.asc()).first()
|
||||
if not owner or db.session.query(ScheduleTask).filter_by(schedule_no="SCH-LEAN-TRAINING-REMINDER").first():
|
||||
return []
|
||||
now = datetime.utcnow()
|
||||
task = ScheduleTask(schedule_no="SCH-LEAN-TRAINING-REMINDER", name="精益管理培训逾期提醒", schedule_type="platform_job", owner_user_id=owner.id, cron_expr="0 9 * * *", schedule_timezone="Asia/Shanghai", platform_api_path="lean-training-reminder", job_params={}, kb_sync_enabled=False, notify_user_ids_json=[], notify_enabled=False, enabled=True, next_run_at=compute_next_run_at("0 9 * * *", timezone_name="Asia/Shanghai") or now, created_by=owner.id, updated_by=owner.id, created_at=now, updated_at=now)
|
||||
db.session.add(task)
|
||||
if commit:
|
||||
db.session.commit()
|
||||
else:
|
||||
db.session.flush()
|
||||
return [task]
|
||||
@@ -0,0 +1,237 @@
|
||||
"""
|
||||
backend/app/services/lean_training_service.py
|
||||
|
||||
用途:精益管理培训的周任务、员工提交、看板和提醒规则服务。
|
||||
依赖:TrainingConfig/Resource、精益培训模型、User、统一 ValidationError。
|
||||
逻辑:管理端冻结每周两个视频;员工提交观看事实与学习感悟;服务端按 50 字门槛判定完成,管理看板只读取已授权范围。
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from datetime import date, datetime, time
|
||||
from typing import Any
|
||||
|
||||
from sqlalchemy import or_, select
|
||||
|
||||
from app.core.errors import NotFoundError, ValidationError
|
||||
from app.extensions import db
|
||||
from app.models import (
|
||||
LeanTrainingCompletion,
|
||||
LeanTrainingWeeklyTask,
|
||||
TrainingConfig,
|
||||
TrainingConfigResource,
|
||||
User,
|
||||
)
|
||||
from app.services.schedule.timezone_util import resolve_schedule_tzinfo, to_utc_naive, utc_now_naive
|
||||
|
||||
LEAN_TRAINING_TYPE = "lean_management"
|
||||
MIN_SUMMARY_LENGTH = 50
|
||||
|
||||
|
||||
def _get_lean_config() -> TrainingConfig:
|
||||
"""读取已发布精益培训配置,未配置时阻止创建周任务。"""
|
||||
config = db.session.execute(
|
||||
select(TrainingConfig).where(
|
||||
TrainingConfig.training_type == LEAN_TRAINING_TYPE,
|
||||
TrainingConfig.status == "published",
|
||||
).order_by(TrainingConfig.id.desc())
|
||||
).scalars().first()
|
||||
if not config:
|
||||
raise ValidationError("Lean training published config is required")
|
||||
return config
|
||||
|
||||
|
||||
def _normalize_video_ids(value: Any, config: TrainingConfig) -> list[int]:
|
||||
"""校验周任务必须绑定当前精益配置下恰好两个视频资源。"""
|
||||
if not isinstance(value, list) or len(value) != 2 or len({str(item) for item in value}) != 2:
|
||||
raise ValidationError("Exactly two lean training videos are required", details={"field": "video_resource_ids"})
|
||||
resource_map = {
|
||||
resource.id: resource
|
||||
for resource in config.resources
|
||||
if resource.resource_type == "agent_guide" and resource.agent_guide and str(resource.agent_guide.file_type or "").lower().startswith("video")
|
||||
}
|
||||
ids: list[int] = []
|
||||
for item in value:
|
||||
try:
|
||||
resource_id = int(item)
|
||||
except (TypeError, ValueError) as exc:
|
||||
raise ValidationError("video_resource_ids contains invalid resource", details={"field": "video_resource_ids"}) from exc
|
||||
if resource_id not in resource_map:
|
||||
raise ValidationError("Selected resource is not a lean training video")
|
||||
ids.append(resource_id)
|
||||
return ids
|
||||
|
||||
|
||||
def _normalize_target_roles(value: Any) -> list[str]:
|
||||
"""校验 HR 按角色指定的精益周任务对象,角色值必须为非空且去重的系统角色。"""
|
||||
if value is None:
|
||||
return []
|
||||
if not isinstance(value, list):
|
||||
raise ValidationError("target_roles must be a list", details={"field": "target_roles"})
|
||||
roles = sorted({str(item).strip() for item in value if str(item).strip()})
|
||||
if len(roles) != len({str(item).strip() for item in value}):
|
||||
raise ValidationError("target_roles contains invalid role", details={"field": "target_roles"})
|
||||
return roles
|
||||
|
||||
|
||||
def _normalize_target_user_ids(value: Any) -> list[int]:
|
||||
"""校验 HR 指定的精益周任务对象,所有用户必须为在职系统用户。"""
|
||||
if value is None:
|
||||
return []
|
||||
if not isinstance(value, list):
|
||||
raise ValidationError("target_user_ids must be a list", details={"field": "target_user_ids"})
|
||||
try:
|
||||
user_ids = sorted({int(item) for item in value})
|
||||
except (TypeError, ValueError) as exc:
|
||||
raise ValidationError("target_user_ids contains invalid user", details={"field": "target_user_ids"}) from exc
|
||||
if any(user_id <= 0 for user_id in user_ids):
|
||||
raise ValidationError("target_user_ids contains invalid user", details={"field": "target_user_ids"})
|
||||
found_ids = set(db.session.execute(select(User.id).where(User.id.in_(user_ids), User.status == "active")).scalars()) if user_ids else set()
|
||||
if found_ids != set(user_ids):
|
||||
raise ValidationError("target_user_ids contains unavailable user", details={"field": "target_user_ids"})
|
||||
return user_ids
|
||||
|
||||
|
||||
def target_user_ids_for_task(task: LeanTrainingWeeklyTask) -> set[int]:
|
||||
"""返回周任务的在职受训对象,角色和用户指定对象按并集处理。"""
|
||||
predicates = []
|
||||
if task.target_user_ids:
|
||||
predicates.append(User.id.in_(list(task.target_user_ids)))
|
||||
if task.target_roles:
|
||||
predicates.append(User.role.in_(list(task.target_roles)))
|
||||
if not predicates:
|
||||
return set()
|
||||
return set(db.session.execute(select(User.id).where(User.status == "active", or_(*predicates))).scalars())
|
||||
|
||||
|
||||
def is_task_targeted_to_user(task: LeanTrainingWeeklyTask, user: User) -> bool:
|
||||
"""判断员工是否属于周任务对象,角色匹配或显式指定任一成立即可学习。"""
|
||||
return user.status == "active" and (user.id in set(task.target_user_ids or []) or user.role in set(task.target_roles or []))
|
||||
|
||||
|
||||
def serialize_weekly_task(task: LeanTrainingWeeklyTask) -> dict[str, Any]:
|
||||
"""序列化精益周任务,返回视频标题和完成规则供管理端与员工端使用。"""
|
||||
resources = db.session.execute(
|
||||
select(TrainingConfigResource).where(TrainingConfigResource.id.in_(task.video_resource_ids or []))
|
||||
).scalars().all()
|
||||
titles = {resource.id: resource.title or (resource.agent_guide.file_name if resource.agent_guide else "") for resource in resources}
|
||||
return {
|
||||
"id": task.id,
|
||||
"week_key": task.week_key,
|
||||
"due_at": task.due_at.isoformat(),
|
||||
"video_resource_ids": list(task.video_resource_ids or []),
|
||||
"target_roles": list(task.target_roles or []),
|
||||
"target_user_ids": list(task.target_user_ids or []),
|
||||
"videos": [{"id": resource_id, "name": titles.get(resource_id, "")} for resource_id in task.video_resource_ids or []],
|
||||
"status": task.status,
|
||||
"min_summary_length": MIN_SUMMARY_LENGTH,
|
||||
}
|
||||
|
||||
|
||||
def create_or_update_weekly_task(data: dict[str, Any], user_id: int) -> dict[str, Any]:
|
||||
"""创建或更新指定周的两个视频任务,并由 HR 按角色或用户冻结受训对象。"""
|
||||
config = _get_lean_config()
|
||||
week_key = str(data.get("week_key") or "").strip()
|
||||
try:
|
||||
week_start = date.fromisoformat(week_key)
|
||||
except ValueError as exc:
|
||||
raise ValidationError("week_key must be YYYY-MM-DD", details={"field": "week_key"}) from exc
|
||||
if week_start.weekday() != 0:
|
||||
raise ValidationError("week_key must be the Monday of its week", details={"field": "week_key"})
|
||||
try:
|
||||
due_at = to_utc_naive(datetime.fromisoformat(str(data.get("due_at") or "").replace("Z", "+00:00")))
|
||||
except ValueError as exc:
|
||||
raise ValidationError("due_at is invalid", details={"field": "due_at"}) from exc
|
||||
shanghai_tz = resolve_schedule_tzinfo("Asia/Shanghai")
|
||||
minimum_due_at = to_utc_naive(datetime.combine(week_start, time.min, shanghai_tz))
|
||||
if due_at < minimum_due_at:
|
||||
raise ValidationError("due_at must not precede week_key", details={"field": "due_at"})
|
||||
if due_at < utc_now_naive() and not bool(data.get("allow_historical")):
|
||||
raise ValidationError("due_at must be in the future", details={"field": "due_at"})
|
||||
existing = db.session.execute(select(LeanTrainingWeeklyTask).where(LeanTrainingWeeklyTask.week_key == week_key)).scalar_one_or_none()
|
||||
video_ids = _normalize_video_ids(data.get("video_resource_ids"), config) if not existing else list(existing.video_resource_ids or [])
|
||||
target_roles = _normalize_target_roles(data.get("target_roles"))
|
||||
target_user_ids = _normalize_target_user_ids(data.get("target_user_ids"))
|
||||
if not target_roles and not target_user_ids:
|
||||
raise ValidationError("At least one target role or user is required", details={"field": "target_roles"})
|
||||
task = existing or LeanTrainingWeeklyTask(config_id=config.id, week_key=week_key, created_by_id=user_id)
|
||||
task.due_at = due_at
|
||||
task.video_resource_ids = video_ids
|
||||
task.target_roles = target_roles
|
||||
task.target_user_ids = target_user_ids
|
||||
task.status = "published"
|
||||
db.session.add(task)
|
||||
db.session.commit()
|
||||
return serialize_weekly_task(task)
|
||||
|
||||
|
||||
def get_current_weekly_task(user: User) -> dict[str, Any] | None:
|
||||
"""返回当前员工被指定的最新已发布周任务,未被指定时不暴露任务内容。"""
|
||||
tasks = db.session.execute(
|
||||
select(LeanTrainingWeeklyTask).where(LeanTrainingWeeklyTask.status == "published").order_by(LeanTrainingWeeklyTask.week_key.desc())
|
||||
).scalars().all()
|
||||
task = next((item for item in tasks if is_task_targeted_to_user(item, user)), None)
|
||||
return serialize_weekly_task(task) if task else None
|
||||
|
||||
|
||||
def save_completion(user: User, data: dict[str, Any]) -> dict[str, Any]:
|
||||
"""保存员工精益学习事实并强制校验两项观看与不少于 50 字总结。"""
|
||||
task_id = int(data.get("weekly_task_id") or 0)
|
||||
task = db.session.get(LeanTrainingWeeklyTask, task_id)
|
||||
if not task or task.status != "published":
|
||||
raise NotFoundError("Lean training weekly task not found")
|
||||
if not is_task_targeted_to_user(task, user):
|
||||
raise NotFoundError("Lean training weekly task not found")
|
||||
watched = data.get("watched_at")
|
||||
if not isinstance(watched, dict) or not all(str(resource_id) in watched and watched[str(resource_id)] for resource_id in task.video_resource_ids):
|
||||
raise ValidationError("Both required videos must be watched", details={"field": "watched_at"})
|
||||
summary = str(data.get("summary_text") or "").strip()
|
||||
char_count = len(summary)
|
||||
if char_count < MIN_SUMMARY_LENGTH:
|
||||
raise ValidationError("Learning summary must contain at least 50 characters", details={"field": "summary_text", "min_length": MIN_SUMMARY_LENGTH, "actual_length": char_count})
|
||||
completion = db.session.execute(
|
||||
select(LeanTrainingCompletion).where(LeanTrainingCompletion.weekly_task_id == task.id, LeanTrainingCompletion.user_id == user.id)
|
||||
).scalar_one_or_none() or LeanTrainingCompletion(weekly_task_id=task.id, user_id=user.id)
|
||||
completion.watched_at_json = {str(key): str(value) for key, value in watched.items()}
|
||||
completion.summary_text = summary
|
||||
completion.summary_char_count = char_count
|
||||
completion.status = "completed"
|
||||
completion.completed_at = completion.completed_at or utc_now_naive()
|
||||
db.session.add(completion)
|
||||
db.session.commit()
|
||||
return serialize_completion(completion, task, user)
|
||||
|
||||
|
||||
def serialize_completion(completion: LeanTrainingCompletion, task: LeanTrainingWeeklyTask, user: User) -> dict[str, Any]:
|
||||
"""组合看板所需人员、视频观看、总结和完成状态字段。"""
|
||||
return {
|
||||
"id": completion.id,
|
||||
"user_id": user.id,
|
||||
"employee_id": user.employee_id,
|
||||
"name": user.real_name or user.username,
|
||||
"department": user.department,
|
||||
"videos": [
|
||||
{"name": next((resource.title or (resource.agent_guide.file_name if resource.agent_guide else "") for resource in task.config.resources if resource.id == resource_id), ""), "watched_at": (completion.watched_at_json or {}).get(str(resource_id))}
|
||||
for resource_id in task.video_resource_ids
|
||||
],
|
||||
"summary_text": completion.summary_text,
|
||||
"status": completion.status,
|
||||
"completed_at": completion.completed_at.isoformat() if completion.completed_at else None,
|
||||
}
|
||||
|
||||
|
||||
def list_dashboard(task_id: int | None) -> dict[str, Any]:
|
||||
"""返回 HR 可查看的精益看板,仅统计当前周任务已冻结的受训对象。"""
|
||||
task = db.session.get(LeanTrainingWeeklyTask, task_id) if task_id else db.session.execute(select(LeanTrainingWeeklyTask).order_by(LeanTrainingWeeklyTask.week_key.desc())).scalars().first()
|
||||
if not task:
|
||||
return {"task": None, "completed": [], "incomplete": []}
|
||||
target_user_ids = target_user_ids_for_task(task)
|
||||
users = db.session.execute(select(User).where(User.id.in_(target_user_ids)).order_by(User.department, User.employee_id)).scalars().all() if target_user_ids else []
|
||||
completions = {item.user_id: item for item in db.session.execute(select(LeanTrainingCompletion).where(LeanTrainingCompletion.weekly_task_id == task.id)).scalars().all()}
|
||||
completed: list[dict[str, Any]] = []
|
||||
incomplete: list[dict[str, Any]] = []
|
||||
for user in users:
|
||||
item = completions.get(user.id)
|
||||
row = serialize_completion(item, task, user) if item else {"user_id": user.id, "employee_id": user.employee_id, "name": user.real_name or user.username, "department": user.department, "videos": [], "summary_text": None, "status": "incomplete", "completed_at": None}
|
||||
(completed if row["status"] == "completed" else incomplete).append(row)
|
||||
return {"task": serialize_weekly_task(task), "completed": completed, "incomplete": incomplete}
|
||||
@@ -150,11 +150,16 @@ def _register_builtin_platform_jobs() -> None:
|
||||
run_contract_payment_sync_schedule,
|
||||
run_contract_payment_weekly_alert_schedule,
|
||||
)
|
||||
from app.services.schedule.lean_training_job import run_lean_training_reminder_schedule
|
||||
|
||||
register_platform_job(PlatformJobDefinition(
|
||||
key="contract-payment-sync", label="合同付款 OA 同步", handler=run_contract_payment_sync_schedule,
|
||||
description="同步 OA 合同归档、验收归档和厂商预付款请款作业。", category="contract_payment",
|
||||
))
|
||||
register_platform_job(PlatformJobDefinition(
|
||||
key="lean-training-reminder", label="精益管理培训逾期提醒", handler=run_lean_training_reminder_schedule,
|
||||
description="周日截止后,于周一、周三、周五向未完成员工推送精益培训提醒。", category="training",
|
||||
))
|
||||
register_platform_job(PlatformJobDefinition(
|
||||
key="contract-payment-alert-scan", label="合同付款预警扫描", handler=run_contract_payment_alert_schedule,
|
||||
description="每日扫描四阶段付款节点,只生成待发送预警记录。", category="contract_payment",
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
"""
|
||||
backend/app/services/schedule/lean_training_job.py
|
||||
|
||||
用途:将精益培训逾期提醒接入平台排程契约。
|
||||
依赖:ScheduleTask/ScheduleRun、lean_training_reminder_service。
|
||||
逻辑:平台调度器调用本入口;本入口执行提醒扫描并返回标准七元组执行结果。
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from app.models import ScheduleRun, ScheduleTask
|
||||
from app.services.lean_training_reminder_service import run_lean_training_reminders
|
||||
from app.services.schedule.job_registry import ScheduleExecuteResult
|
||||
|
||||
|
||||
def run_lean_training_reminder_schedule(task: ScheduleTask, run: ScheduleRun) -> ScheduleExecuteResult:
|
||||
"""执行精益培训提醒扫描并返回发送统计,供排程运行记录和运维页面展示。"""
|
||||
_ = task, run
|
||||
result = run_lean_training_reminders()
|
||||
total = result["created"] + result["skipped"]
|
||||
failed = result["failed"]
|
||||
return total, result["sent"], failed, result["skipped"], [result], [], [{"step": "lean_training_reminder", "status": "success" if not failed else "partial", "detail": result}]
|
||||
@@ -0,0 +1,88 @@
|
||||
"""新增精益管理培训周任务、完成事实和提醒审计。"""
|
||||
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
|
||||
|
||||
revision = "p1a2b3c4d5e6"
|
||||
down_revision = "n8f9a0b1c2d3"
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
|
||||
def upgrade() -> None:
|
||||
"""创建精益培训业务表。"""
|
||||
op.create_table(
|
||||
"lean_training_weekly_tasks",
|
||||
sa.Column("id", sa.Integer(), nullable=False),
|
||||
sa.Column("config_id", sa.Integer(), nullable=False),
|
||||
sa.Column("week_key", sa.String(length=10), nullable=False),
|
||||
sa.Column("due_at", sa.DateTime(), nullable=False),
|
||||
sa.Column("video_resource_ids", sa.JSON(), nullable=False),
|
||||
sa.Column("target_roles", sa.JSON(), nullable=False),
|
||||
sa.Column("target_user_ids", sa.JSON(), nullable=False),
|
||||
sa.Column("status", sa.String(length=20), nullable=False),
|
||||
sa.Column("created_by_id", sa.Integer(), nullable=True),
|
||||
sa.Column("created_at", sa.DateTime(), nullable=False),
|
||||
sa.Column("updated_at", sa.DateTime(), nullable=False),
|
||||
sa.ForeignKeyConstraint(["config_id"], ["training_configs.id"]),
|
||||
sa.ForeignKeyConstraint(["created_by_id"], ["users.id"]),
|
||||
sa.PrimaryKeyConstraint("id"),
|
||||
sa.UniqueConstraint("week_key", name="uq_lean_training_week_key"),
|
||||
)
|
||||
op.create_index("ix_lean_training_weekly_tasks_config_id", "lean_training_weekly_tasks", ["config_id"])
|
||||
op.create_index("ix_lean_training_weekly_tasks_week_key", "lean_training_weekly_tasks", ["week_key"])
|
||||
op.create_index("ix_lean_training_weekly_tasks_due_at", "lean_training_weekly_tasks", ["due_at"])
|
||||
op.create_index("ix_lean_training_weekly_tasks_status", "lean_training_weekly_tasks", ["status"])
|
||||
|
||||
op.create_table(
|
||||
"lean_training_completions",
|
||||
sa.Column("id", sa.Integer(), nullable=False),
|
||||
sa.Column("weekly_task_id", sa.Integer(), nullable=False),
|
||||
sa.Column("user_id", sa.Integer(), nullable=False),
|
||||
sa.Column("watched_at_json", sa.JSON(), nullable=True),
|
||||
sa.Column("summary_text", sa.Text(), nullable=True),
|
||||
sa.Column("summary_char_count", sa.Integer(), nullable=False),
|
||||
sa.Column("status", sa.String(length=20), nullable=False),
|
||||
sa.Column("completed_at", sa.DateTime(), nullable=True),
|
||||
sa.Column("created_at", sa.DateTime(), nullable=False),
|
||||
sa.Column("updated_at", sa.DateTime(), nullable=False),
|
||||
sa.ForeignKeyConstraint(["weekly_task_id"], ["lean_training_weekly_tasks.id"]),
|
||||
sa.ForeignKeyConstraint(["user_id"], ["users.id"]),
|
||||
sa.PrimaryKeyConstraint("id"),
|
||||
sa.UniqueConstraint("weekly_task_id", "user_id", name="uq_lean_training_task_user"),
|
||||
)
|
||||
op.create_index("ix_lean_training_completions_weekly_task_id", "lean_training_completions", ["weekly_task_id"])
|
||||
op.create_index("ix_lean_training_completions_user_id", "lean_training_completions", ["user_id"])
|
||||
op.create_index("ix_lean_training_completions_status", "lean_training_completions", ["status"])
|
||||
op.create_index("ix_lean_training_completions_completed_at", "lean_training_completions", ["completed_at"])
|
||||
|
||||
op.create_table(
|
||||
"lean_training_reminders",
|
||||
sa.Column("id", sa.Integer(), nullable=False),
|
||||
sa.Column("weekly_task_id", sa.Integer(), nullable=False),
|
||||
sa.Column("recipient_user_id", sa.Integer(), nullable=False),
|
||||
sa.Column("event_key", sa.String(length=64), nullable=False),
|
||||
sa.Column("status", sa.String(length=20), nullable=False),
|
||||
sa.Column("trace_id", sa.String(length=64), nullable=True),
|
||||
sa.Column("error_message", sa.String(length=255), nullable=True),
|
||||
sa.Column("sent_at", sa.DateTime(), nullable=True),
|
||||
sa.Column("created_at", sa.DateTime(), nullable=False),
|
||||
sa.Column("updated_at", sa.DateTime(), nullable=False),
|
||||
sa.ForeignKeyConstraint(["weekly_task_id"], ["lean_training_weekly_tasks.id"]),
|
||||
sa.ForeignKeyConstraint(["recipient_user_id"], ["users.id"]),
|
||||
sa.PrimaryKeyConstraint("id"),
|
||||
sa.UniqueConstraint("weekly_task_id", "recipient_user_id", "event_key", name="uq_lean_training_reminder_event"),
|
||||
)
|
||||
op.create_index("ix_lean_training_reminders_weekly_task_id", "lean_training_reminders", ["weekly_task_id"])
|
||||
op.create_index("ix_lean_training_reminders_recipient_user_id", "lean_training_reminders", ["recipient_user_id"])
|
||||
op.create_index("ix_lean_training_reminders_event_key", "lean_training_reminders", ["event_key"])
|
||||
op.create_index("ix_lean_training_reminders_status", "lean_training_reminders", ["status"])
|
||||
op.create_index("ix_lean_training_reminders_trace_id", "lean_training_reminders", ["trace_id"])
|
||||
|
||||
|
||||
def downgrade() -> None:
|
||||
"""删除精益培训新增表。"""
|
||||
op.drop_table("lean_training_reminders")
|
||||
op.drop_table("lean_training_completions")
|
||||
op.drop_table("lean_training_weekly_tasks")
|
||||
@@ -171,6 +171,11 @@
|
||||
- 学员侧仅在后台返回有效 `progress_items` 时渲染培训进度模块;若未配置任何进度项,则整个进度模块隐藏,不显示默认占位内容。
|
||||
- 入职培训、安全培训等存量培训类型需自动补齐预设进度说明与步骤引导文案,保证改造前后的学员体验一致。
|
||||
|
||||
### 3.x 精益培训班组通知
|
||||
|
||||
- 精益周任务由具备培训 HR 管理权限的人员按系统角色或指定用户发布,角色对象与用户对象取并集;员工仅能看到被指定的任务。
|
||||
- 精益周任务首次发布时,向全部在职指定对象发送任务初始通知;HR 可向指定对象中的未完成员工发起定向提醒。通知发送须复用企微事件通道与精益培训提醒审计,防止重复推送。
|
||||
|
||||
### 3.x.1 Excel/CSV 知识库分段补充需求
|
||||
|
||||
- Excel/CSV 清洗以完整原始数据行为不可拆分单元,按表格字符上限组合,避免在字段中间截断。
|
||||
|
||||
+2
-1
@@ -55,7 +55,7 @@
|
||||
| 功能项 | 状态 | 说明 |
|
||||
| -------------------------- | ---------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| Chat 内培训工作区 | 前端已实现 | 在培训 Agent 聊天页顶部提供视频学习、知识点复盘、逐题考试、成绩结算的一体化工作区 |
|
||||
| Chat 内 HR 管理面板 | 已实现 | 仅具备培训 HR 管理权限的用户可在同一聊天页查看真实培训统计、筛选记录并导出 Excel;权限支持角色默认值与前端用户配置共同控制 |
|
||||
| Chat 内 HR 管理面板 | 已实现 | 仅具备培训 HR 管理权限的用户可在同一聊天页查看真实培训统计、筛选记录并导出 Excel;具备精益培训管理或班组管理权限时,可查看受权限范围限制的精益完成/未完成名单,完整展示工号、姓名、部门、班组、职务、视频名称、观看时间、状态与学习总结;权限支持角色默认值与前端用户配置共同控制 |
|
||||
| Chat 附件发送前预览 | 已实现 | 附件列表显示在输入框上方,展示文件类型、名称、真实大小和逐文件处理状态;支持右上角删除,上传中保护删除,发货通知保留解析重试与重复处理入口 |
|
||||
| 培训题库后台配置 | 已实现 | Agent 管理表单支持维护及格线、复盘要点、考前清单与题库;员工培训页优先读取 `extra_config.training_config`,未配置时才回退前端默认题库 |
|
||||
| 培训聊天常见问题分角色配置 | 已实现 | Agent 管理表单支持分别维护普通员工与 HR 管理员进入“员工培训”聊天页时看到的常见问题;聊天欢迎区会按 `training_hr_manage` 权限自动切换对应问题集 |
|
||||
@@ -64,6 +64,7 @@
|
||||
| 首页培训推荐入口 | 前端已实现 | 当 Agent 开启培训模式后,工作台首页会在应用列表上方展示培训强入口卡片 |
|
||||
| 培训记录后端落库 | 已实现 | 已新增培训记录模型、迁移与用户/管理端 API,考试进度、结果、统计与导出均可走后端数据源 |
|
||||
| 培训配置管理 | 已实现 | `TrainingConfigResource` 增加 `training_level`;管理端按公司级、部门级、班组级卡片独立增删资料;知识库候选仅允许“员工培训”分组内未删除文档的当前版本;员工端按 `safetyStage` 动态展示当前级别资料 |
|
||||
| 精益培训对象化任务与提醒 | 已实现 | HR 按系统角色或指定用户(并集)发布精益周任务;任务、看板和提醒只处理冻结对象,首次发布与定向催学均复用企微提醒审计幂等去重。 |
|
||||
| 培训主链推荐架构 | 已文档化 | 推荐采用“受控考试主链 + Dify 辅助问答/ChatBI”的混合方案;培训 Agent 对接 Dify 时会额外透传后台账号 `role`,便于区分学员/HR 问答分支,见 [docs/新人入职培训Agent_推荐落地方案.md](新人入职培训Agent_推荐落地方案.md) |
|
||||
| 培训业务闭环整改清单 | 已文档化 | 见[docs/新人入职培训Agent_闭环整改清单.md](新人入职培训Agent_闭环整改清单.md) |
|
||||
|
||||
|
||||
@@ -1300,6 +1300,8 @@ Dify
|
||||
- 管理后台用户编辑表单可对单个用户显式授予或关闭该权限
|
||||
- 前端只根据登录态里的 `feature_permissions.training_hr_manage` 决定是否展示 `HR 管理` 标签;后端仍做强校验,避免仅靠前端隐藏导致越权。
|
||||
|
||||
- 精益周任务不依赖用户的 `team`、`job_title`、`is_team_leader` 字段,也不使用精益专属权限;任务模型冻结 `target_roles` 与 `target_user_ids`,受训对象按角色或用户并集计算,看板和提醒均只处理冻结对象。
|
||||
|
||||
### 19.5 培训资料维护
|
||||
|
||||
- 后台继续复用 `AgentGuide` 资料模型承载培训素材,不单独新建一套上传体系。
|
||||
@@ -1330,6 +1332,8 @@ Dify
|
||||
2. 若未命中发布配置,再兼容读取 `extra_config.training_config`
|
||||
3. 对入职培训、安全培训的存量配置,后端序列化阶段自动补默认进度说明和步骤引导文案,避免旧数据出现空白
|
||||
- 学员侧通用培训进度模块只根据 `progress_items` 动态渲染;当该数组为空时,整个进度模块隐藏,避免显示静态默认流程。
|
||||
- 精益管理培训使用 `lean_management` 独立任务模型:HR 每周发布两个视频、截止时间及角色/用户对象,员工提交两个观看事实及不少于 50 字学习感悟;`LeanTrainingWeeklyTask`、`LeanTrainingCompletion`、`LeanTrainingReminder` 分别承载任务、完成事实和通知幂等审计。
|
||||
- 精益任务、看板与定向提醒统一使用 `training_hr_manage` 强校验;首次发布向在职指定对象发送初始企微通知,逾期提醒按上海时区周一、周三、周五执行。
|
||||
- 题库题量改为后台可配后,前端分数计算改为“按当前题量折算百分制”,不再硬编码每题 5 分。
|
||||
- 管理端支持从已上传并标记为 `training_exam_pdf` 的指南 PDF 解析题库:
|
||||
1. 后端按 `guide_id` 读取 PDF 文本
|
||||
|
||||
@@ -18,7 +18,14 @@ import type {
|
||||
UsageReport,
|
||||
UsageRangeKey,
|
||||
} from '../types/report.types';
|
||||
import type { TrainingConfig, TrainingConfigPayload, TrainingResourceCandidates } from '../types/training-config.types';
|
||||
import type {
|
||||
LeanTrainingWeeklyTask,
|
||||
LeanTrainingWeeklyTaskPayload,
|
||||
LeanTrainingDashboard,
|
||||
TrainingConfig,
|
||||
TrainingConfigPayload,
|
||||
TrainingResourceCandidates,
|
||||
} from '../types/training-config.types';
|
||||
|
||||
const auth = () => ({ headers: getAuthHeaders() });
|
||||
const jsonAuth = () => ({ headers: { 'Content-Type': 'application/json', ...getAuthHeaders() } });
|
||||
@@ -454,6 +461,16 @@ export const deleteAdminTrainingConfig = (id: number) =>
|
||||
...auth(),
|
||||
});
|
||||
|
||||
export const createOrUpdateAdminLeanTrainingWeeklyTask = (payload: LeanTrainingWeeklyTaskPayload) =>
|
||||
requestJson<LeanTrainingWeeklyTask>('/api/admin/lean-training/weekly-tasks', {
|
||||
method: 'POST',
|
||||
...jsonAuth(),
|
||||
body: JSON.stringify(payload),
|
||||
});
|
||||
|
||||
export const getAdminLeanTrainingDashboard = () =>
|
||||
requestJson<LeanTrainingDashboard>('/api/admin/lean-training/dashboard', auth());
|
||||
|
||||
// Users
|
||||
export const listAdminUsers = () => requestJson<AdminUserRow[]>('/api/admin/users', auth());
|
||||
|
||||
|
||||
@@ -29,14 +29,21 @@ import { useMessage } from '@/shared/composables/useMessage';
|
||||
import DeleteConfirmDialog from '@/shared/components/DeleteConfirmDialog.vue';
|
||||
import {
|
||||
createAdminTrainingConfig,
|
||||
createAdminAgentGuide,
|
||||
createOrUpdateAdminLeanTrainingWeeklyTask,
|
||||
deleteAdminTrainingConfig,
|
||||
getAdminLeanTrainingDashboard,
|
||||
listAdminTrainingConfigs,
|
||||
listAdminAgents,
|
||||
listAdminTrainingResourceCandidates,
|
||||
listAdminUsers,
|
||||
parseAdminTrainingQuestionBank,
|
||||
updateAdminTrainingConfig,
|
||||
uploadAdminAgentGuideFile,
|
||||
} from '../../api/admin.api';
|
||||
import type {
|
||||
GenericTrainingStage,
|
||||
LeanTrainingWeeklyTask,
|
||||
SafetyTrainingStage,
|
||||
TrainingConfig,
|
||||
TrainingConfigPayload,
|
||||
@@ -44,6 +51,7 @@ import type {
|
||||
TrainingLevel,
|
||||
TrainingProgressItem,
|
||||
} from '../../types/training-config.types';
|
||||
import type { AdminUserRow } from '../../types/admin.types';
|
||||
import TrainingTypeFormModal from './components/TrainingTypeFormModal.vue';
|
||||
|
||||
const { t } = useI18n();
|
||||
@@ -61,9 +69,29 @@ const questionSourceVersionId = ref<number | null>(null);
|
||||
const isParsingQuestions = ref(false);
|
||||
const questionParseMeta = ref<{ mode: string; fileName: string; skipped: number[] } | null>(null);
|
||||
const candidates = ref({ guides: [], documents: [], training_exam_documents: [] } as Awaited<ReturnType<typeof listAdminTrainingResourceCandidates>>);
|
||||
const leanTask = ref<LeanTrainingWeeklyTask | null>(null);
|
||||
const leanWeekKey = ref('');
|
||||
const leanDueAt = ref('');
|
||||
const leanVideoResourceIds = ref<number[]>([]);
|
||||
const leanTargetRoles = ref<string[]>([]);
|
||||
const leanTargetUserIds = ref<number[]>([]);
|
||||
const leanTargetUsers = ref<AdminUserRow[]>([]);
|
||||
const isSavingLeanTask = ref(false);
|
||||
const isUploadingVideo = ref(false);
|
||||
const videoInput = ref<HTMLInputElement | null>(null);
|
||||
|
||||
const selected = computed(() => configs.value.find((item) => item.id === selectedId.value) || null);
|
||||
const form = ref<TrainingConfigPayload>(emptyForm());
|
||||
const isSafetyConfig = computed(() => form.value.training_type === 'safety');
|
||||
const supportsDirectVideoUpload = computed(() => (
|
||||
['lean_management', 'overseas_regulations', 'overseas_regulations_training', 'overseas_training'].includes(form.value.training_type)
|
||||
|| form.value.name.includes('出国规章')
|
||||
));
|
||||
const videoGuideCandidates = computed(() => candidates.value.guides.filter((guide) => guide.file_type.toLowerCase() === 'video'));
|
||||
const directVideoResources = computed(() => contentResources.value.filter((resource) => (
|
||||
resource.resource_type === 'agent_guide'
|
||||
&& videoGuideCandidates.value.some((guide) => guide.id === resource.agent_guide_id)
|
||||
)));
|
||||
const contentResources = computed(() => form.value.resources.filter((resource) => resource.resource_type !== 'inline_questions'));
|
||||
const trainingLevels: TrainingLevel[] = ['company', 'department', 'team'];
|
||||
const guideGroups = computed(() => {
|
||||
@@ -97,7 +125,8 @@ const sectionItems = computed(() => [
|
||||
{ id: 'resources', label: t('admin.trainingConfig.sections.resourcesTitle'), icon: Library },
|
||||
{ id: 'exam', label: t('admin.trainingConfig.sections.examTitle'), icon: FileQuestion },
|
||||
{ id: 'review', label: t('admin.trainingConfig.sections.reviewTitle'), icon: ClipboardCheck },
|
||||
]);
|
||||
{ id: 'lean', label: t('admin.trainingConfig.sections.leanTitle'), icon: Video },
|
||||
].filter((item) => item.id !== 'lean' || form.value.training_type === 'lean_management'));
|
||||
const publishedCount = computed(() => configs.value.filter((config) => config.status === 'published').length);
|
||||
const resourceCount = computed(() => contentResources.value.length);
|
||||
const configuredLevelCount = computed(() => trainingLevels.filter((level) => resourcesByLevel(level).length > 0).length);
|
||||
@@ -120,6 +149,75 @@ const progressItems = computed(() => {
|
||||
const settings = form.value.settings as TrainingConfigSettings;
|
||||
return Array.isArray(settings.progress_items) ? settings.progress_items : [];
|
||||
});
|
||||
const leanVideoResources = computed(() => form.value.resources.filter((resource) => {
|
||||
if (resource.resource_type !== 'agent_guide' || !resource.id || !resource.agent_guide_id) return false;
|
||||
const guide = candidates.value.guides.find((item) => item.id === resource.agent_guide_id);
|
||||
return Boolean(guide?.file_type?.toLowerCase().startsWith('video'));
|
||||
}));
|
||||
const leanTaskVideoNames = computed(() => new Map(leanVideoResources.value.map((resource) => [
|
||||
resource.id as number,
|
||||
resource.title || candidates.value.guides.find((guide) => guide.id === resource.agent_guide_id)?.file_name || t('admin.trainingConfig.lean.unnamedVideo'),
|
||||
])));
|
||||
const leanRoleOptions = computed(() => [...new Set(leanTargetUsers.value.map((user) => user.role).filter(Boolean))].sort());
|
||||
|
||||
function mondayOfCurrentWeek(): string {
|
||||
const today = new Date();
|
||||
const monday = new Date(today);
|
||||
monday.setDate(today.getDate() - ((today.getDay() + 6) % 7));
|
||||
return monday.toISOString().slice(0, 10);
|
||||
}
|
||||
|
||||
function defaultLeanDueAt(weekKey: string): string {
|
||||
const due = new Date(`${weekKey}T23:59:00`);
|
||||
due.setDate(due.getDate() + 6);
|
||||
const local = new Date(due.getTime() - due.getTimezoneOffset() * 60000);
|
||||
return local.toISOString().slice(0, 16);
|
||||
}
|
||||
|
||||
const loadLeanTask = async () => {
|
||||
if (form.value.training_type !== 'lean_management') return;
|
||||
try {
|
||||
const dashboard = await getAdminLeanTrainingDashboard();
|
||||
leanTask.value = dashboard.task;
|
||||
} catch {
|
||||
leanTask.value = null;
|
||||
}
|
||||
leanWeekKey.value = leanTask.value?.week_key || mondayOfCurrentWeek();
|
||||
leanDueAt.value = leanTask.value?.due_at ? leanTask.value.due_at.slice(0, 16) : defaultLeanDueAt(leanWeekKey.value);
|
||||
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();
|
||||
};
|
||||
|
||||
const toggleLeanVideo = (resourceId: number) => {
|
||||
if (leanTask.value?.week_key === leanWeekKey.value) 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'));
|
||||
return;
|
||||
}
|
||||
isSavingLeanTask.value = true;
|
||||
try {
|
||||
leanTask.value = await createOrUpdateAdminLeanTrainingWeeklyTask({
|
||||
week_key: leanWeekKey.value,
|
||||
due_at: new Date(leanDueAt.value).toISOString(),
|
||||
video_resource_ids: leanVideoResourceIds.value,
|
||||
target_roles: leanTargetRoles.value,
|
||||
target_user_ids: leanTargetUserIds.value,
|
||||
});
|
||||
msg.success(t('admin.trainingConfig.messages.leanTaskSaved'));
|
||||
} catch (error) {
|
||||
msg.error(error instanceof Error ? error.message : t('admin.trainingConfig.messages.saveFailed'));
|
||||
} finally {
|
||||
isSavingLeanTask.value = false;
|
||||
}
|
||||
};
|
||||
|
||||
/** 创建新增培训类型所需的完整默认配置,确保沿用后端既有字段契约。 */
|
||||
function emptyForm(): TrainingConfigPayload {
|
||||
@@ -181,6 +279,7 @@ const selectConfig = (config: TrainingConfig) => {
|
||||
questionJsonText.value = JSON.stringify(questions, null, 2);
|
||||
questionSourceVersionId.value = null;
|
||||
questionParseMeta.value = null;
|
||||
void loadLeanTask();
|
||||
};
|
||||
|
||||
/** 从已选择的员工培训知识库当前 PDF 解析题库,并将结果回填到可继续手工编辑的 JSON。 */
|
||||
@@ -428,6 +527,54 @@ const updateResourceType = (resource: TrainingConfigPayload['resources'][number]
|
||||
resource.kb_document_version_id = undefined;
|
||||
};
|
||||
|
||||
const openVideoUpload = () => videoInput.value?.click();
|
||||
|
||||
const uploadTrainingVideo = async (event: Event) => {
|
||||
const input = event.target as HTMLInputElement;
|
||||
const file = input.files?.[0];
|
||||
input.value = '';
|
||||
if (!file) return;
|
||||
if (!file.type.startsWith('video/')) {
|
||||
msg.warning(t('admin.trainingConfig.messages.videoFileRequired'));
|
||||
return;
|
||||
}
|
||||
isUploadingVideo.value = true;
|
||||
try {
|
||||
const trainingAgent = (await listAdminAgents()).find((agent) => (
|
||||
agent.handler_config?.content_profile === 'training'
|
||||
|| agent.extra_config?.training_workspace_enabled === true
|
||||
|| agent.extra_config?.training_mode === true
|
||||
|| agent.extra_config?.training_agent === true
|
||||
));
|
||||
if (!trainingAgent) throw new Error(t('admin.trainingConfig.messages.trainingAgentRequired'));
|
||||
const uploaded = await uploadAdminAgentGuideFile(file);
|
||||
const created = await createAdminAgentGuide({
|
||||
agent_id: trainingAgent.id,
|
||||
file_name: uploaded.file_name,
|
||||
file_path: uploaded.file_path,
|
||||
file_type: uploaded.file_type,
|
||||
file_size: uploaded.file_size,
|
||||
guide_usage: 'training_video',
|
||||
sort_order: candidates.value.guides.length,
|
||||
status: 1,
|
||||
}) as { id: number };
|
||||
candidates.value = await listAdminTrainingResourceCandidates();
|
||||
form.value.resources.push({
|
||||
resource_type: 'agent_guide',
|
||||
agent_guide_id: created.id,
|
||||
training_level: 'company',
|
||||
title: uploaded.file_name,
|
||||
required_duration: 0,
|
||||
sort_order: form.value.resources.length,
|
||||
});
|
||||
msg.success(t('admin.trainingConfig.messages.videoUploaded'));
|
||||
} catch (error) {
|
||||
msg.error(error instanceof Error ? error.message : t('admin.trainingConfig.messages.videoUploadFailed'));
|
||||
} finally {
|
||||
isUploadingVideo.value = false;
|
||||
}
|
||||
};
|
||||
|
||||
const scrollToSection = (sectionId: string) => {
|
||||
activeSection.value = sectionId;
|
||||
document.getElementById(`training-section-${sectionId}`)?.scrollIntoView({ behavior: 'smooth', block: 'start' });
|
||||
@@ -614,7 +761,26 @@ onMounted(() => void load());
|
||||
<p class="mt-1 text-xs text-muted">{{ t('admin.trainingConfig.resourcesEmptyHint') }}</p>
|
||||
</div>
|
||||
<div class="flex flex-col gap-5">
|
||||
<article v-if="supportsDirectVideoUpload" class="w-full overflow-hidden rounded-2xl border border-violet-200 bg-surface shadow-sm">
|
||||
<div class="flex flex-col gap-3 border-b border-violet-200 bg-violet-50/80 px-5 py-4 sm:flex-row sm:items-center sm:justify-between">
|
||||
<div>
|
||||
<h4 class="text-base font-bold text-primary">{{ t('admin.trainingConfig.directVideo.title') }}</h4>
|
||||
<p class="mt-1 text-xs text-muted">{{ t('admin.trainingConfig.directVideo.hint') }}</p>
|
||||
</div>
|
||||
<button class="btn-secondary btn-sm" type="button" :disabled="isUploadingVideo" @click="openVideoUpload"><Plus class="h-4 w-4" />{{ isUploadingVideo ? t('admin.trainingConfig.directVideo.uploading') : t('admin.trainingConfig.directVideo.upload') }}</button>
|
||||
<input ref="videoInput" type="file" accept="video/*" class="hidden" @change="uploadTrainingVideo" />
|
||||
</div>
|
||||
<div class="space-y-3 p-4 md:p-5">
|
||||
<div v-if="!directVideoResources.length" class="rounded-xl border border-dashed border-default bg-surface-soft/50 px-3 py-8 text-center text-xs text-muted">{{ t('admin.trainingConfig.directVideo.empty') }}</div>
|
||||
<div v-for="(resource, index) in directVideoResources" v-else :key="resource.id || `direct-video-${index}`" class="grid gap-3 rounded-xl border border-default bg-white p-4 md:grid-cols-[minmax(0,1fr)_180px_auto] md:items-end">
|
||||
<div class="flex min-w-0 items-center gap-2 text-sm font-medium text-primary"><Video class="h-4 w-4 shrink-0 text-violet-500" /><span class="truncate">{{ resource.title || videoGuideCandidates.find((guide) => guide.id === resource.agent_guide_id)?.file_name || t('admin.trainingConfig.directVideo.unnamed') }}</span></div>
|
||||
<label class="label-field">{{ t('admin.trainingConfig.fields.requiredDuration') }}<input v-model.number="resource.required_duration" type="number" min="0" class="input-field mt-2" /></label>
|
||||
<button class="btn-danger btn-sm" type="button" @click="removeResource(resource)"><Trash2 class="h-4 w-4" />{{ t('admin.delete') }}</button>
|
||||
</div>
|
||||
</div>
|
||||
</article>
|
||||
<article
|
||||
v-if="isSafetyConfig"
|
||||
v-for="(level, levelIndex) in trainingLevels"
|
||||
:key="level"
|
||||
class="w-full overflow-hidden rounded-2xl border bg-surface shadow-sm"
|
||||
@@ -667,6 +833,44 @@ onMounted(() => void load());
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<section v-if="form.training_type === 'lean_management'" id="training-section-lean" class="surface-panel scroll-mt-20 p-5 md:p-7">
|
||||
<div class="mb-6 flex items-start gap-3">
|
||||
<span class="flex h-10 w-10 shrink-0 items-center justify-center rounded-xl bg-emerald-50 text-emerald-600"><Video class="h-5 w-5" /></span>
|
||||
<div><h3 class="text-base font-bold text-primary">{{ t('admin.trainingConfig.sections.leanTitle') }}</h3><p class="mt-1 text-sm text-muted">{{ t('admin.trainingConfig.sections.leanDesc') }}</p></div>
|
||||
</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">
|
||||
<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>
|
||||
</div>
|
||||
<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>
|
||||
</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>
|
||||
</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>
|
||||
</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>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<section id="training-section-exam" class="surface-panel scroll-mt-20 p-5 md:p-7">
|
||||
<div class="mb-6 flex items-start justify-between gap-4">
|
||||
<div class="flex items-start gap-3">
|
||||
|
||||
@@ -58,6 +58,30 @@ export interface TrainingConfigPayload {
|
||||
resources: TrainingConfigResource[];
|
||||
}
|
||||
|
||||
export interface LeanTrainingWeeklyTask {
|
||||
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;
|
||||
}
|
||||
|
||||
export interface LeanTrainingWeeklyTaskPayload {
|
||||
week_key: string;
|
||||
due_at: string;
|
||||
video_resource_ids: number[];
|
||||
target_roles: string[];
|
||||
target_user_ids: number[];
|
||||
}
|
||||
|
||||
export interface LeanTrainingDashboard {
|
||||
task: LeanTrainingWeeklyTask | null;
|
||||
}
|
||||
|
||||
export interface TrainingResourceCandidates {
|
||||
guides: Array<{
|
||||
id: number;
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
/**
|
||||
* features/chat/api/training.api.ts
|
||||
* 用途:培训工作区专用 HTTP API,负责员工进度读取/保存、HR 记录查询、统计和导出。
|
||||
* 用途:培训工作区专用 HTTP API,负责员工进度读取/保存、HR 记录查询、统计导出和精益任务提醒。
|
||||
* 依赖:shared/api/client、auth headers、training.types。
|
||||
* 逻辑:把后端 training 领域的 snake_case 返回值统一映射成前端工作区需要的 camelCase 结构。
|
||||
* 逻辑:把后端 training 领域的 snake_case 返回值统一映射成前端工作区需要的 camelCase 结构,并提交精益未完成人员提醒请求。
|
||||
*/
|
||||
import { requestJson } from '@/shared/api/client';
|
||||
import { getAuthHeaders } from '@/shared/utils/auth';
|
||||
@@ -15,10 +15,37 @@ import type {
|
||||
TrainingRecord,
|
||||
TrainingStage,
|
||||
TrainingStats,
|
||||
LeanTrainingDashboard,
|
||||
LeanTrainingDashboardRow,
|
||||
LeanTrainingWeeklyTask,
|
||||
TrainingType,
|
||||
TrainingTypeOption,
|
||||
} from '../training/training.types';
|
||||
|
||||
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;
|
||||
};
|
||||
|
||||
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;
|
||||
};
|
||||
|
||||
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,
|
||||
});
|
||||
|
||||
const mapLeanDashboardRow = (data: LeanTrainingDashboardRowApi): LeanTrainingDashboardRow => ({
|
||||
id: data.id, userId: data.user_id, employeeId: data.employee_id, name: data.name, department: data.department,
|
||||
videos: (data.videos || []).map((item) => ({ name: item.name, watchedAt: item.watched_at })),
|
||||
summaryText: data.summary_text, status: data.status, completedAt: data.completed_at,
|
||||
});
|
||||
|
||||
type TrainingRecordApi = {
|
||||
id: number;
|
||||
user_id?: number;
|
||||
@@ -229,6 +256,31 @@ 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 saveMyLeanTrainingCompletion(payload: { weeklyTaskId: number; watchedAt: Record<string, string>; summaryText: string }): Promise<LeanTrainingDashboardRow> {
|
||||
const response = await requestJson<LeanTrainingDashboardRowApi>('/api/user/lean-training/completions', {
|
||||
method: 'PUT', ...jsonAuthHeaders(), body: JSON.stringify({ weekly_task_id: payload.weeklyTaskId, watched_at: payload.watchedAt, summary_text: payload.summaryText }),
|
||||
});
|
||||
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 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`, {
|
||||
method: 'POST',
|
||||
...jsonAuthHeaders(),
|
||||
body: JSON.stringify({ user_ids: userIds }),
|
||||
});
|
||||
}
|
||||
|
||||
export async function getMyTrainingProgress(type: string = 'onboarding'): Promise<TrainingProgressRecord | null> {
|
||||
const data = await requestJson<TrainingRecordApi | null>(`/api/user/training-record?type=${encodeURIComponent(type)}`, authHeaders());
|
||||
return data ? mapTrainingProgressRecord(data) : null;
|
||||
|
||||
@@ -11,6 +11,7 @@ import { computed, reactive, ref, watch, type ShallowUnwrapRef } from 'vue';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import {
|
||||
BookOpen,
|
||||
Bell,
|
||||
CheckCircle2,
|
||||
ChevronDown,
|
||||
ChevronUp,
|
||||
@@ -33,9 +34,9 @@ import { resolveTrainingExamPdfGuide, type TrainingGuideLike } from '@/features/
|
||||
import { getMyTrainingConfig } from '@/features/chat/api/training.api';
|
||||
import type { TrainingAnswerRecord, TrainingRecord, TrainingQuestion } from '@/features/chat/training/training.types';
|
||||
import html2pdf from 'html2pdf.js';
|
||||
|
||||
import { getAuthHeaders } from '@/shared/utils/auth';
|
||||
|
||||
|
||||
const props = defineProps<{
|
||||
currentAgent: Record<string, unknown> | null;
|
||||
currentUser: Record<string, unknown> | null;
|
||||
@@ -326,7 +327,7 @@ const applyDefaultExpandedState = () => {
|
||||
|
||||
// 监听 Agent/角色切换,重置本地展开态:培训角色首次进入默认展开工作区。
|
||||
watch(
|
||||
() => [props.currentAgent?.id, workspace.isAdminViewer],
|
||||
() => [props.currentAgent?.id, workspace.canManageTrainingWorkspace],
|
||||
() => {
|
||||
userExpandedOverride.value = null;
|
||||
applyDefaultExpandedState();
|
||||
@@ -414,6 +415,40 @@ const isMaterialCompleted = (material: any) => {
|
||||
};
|
||||
|
||||
const currentPreviewVideoUrl = ref('');
|
||||
const activeNonSafetyVideoId = ref<number | null>(null);
|
||||
const nonSafetyVideoMaterials = computed(() => workspace.publishedTrainingMaterials.filter((material) => (
|
||||
material.resource?.fileType === 'video' && Boolean(material.resource.fileUrl)
|
||||
)));
|
||||
const activeNonSafetyVideo = computed(() => (
|
||||
nonSafetyVideoMaterials.value.find((material) => material.id === activeNonSafetyVideoId.value)
|
||||
|| nonSafetyVideoMaterials.value[0]
|
||||
|| null
|
||||
));
|
||||
|
||||
const selectNonSafetyVideo = (material: { id?: number | null; resource?: { fileUrl?: string } | null }) => {
|
||||
if (!material.resource?.fileUrl) return;
|
||||
if (workspace.currentViewingMaterialId !== material.id) {
|
||||
workspace.stopMaterialTimer();
|
||||
}
|
||||
activeNonSafetyVideoId.value = material.id ?? null;
|
||||
workspace.currentViewingMaterialId = material.id ?? null;
|
||||
};
|
||||
|
||||
const startNonSafetyVideoTimer = () => {
|
||||
if (activeNonSafetyVideo.value?.id != null) {
|
||||
workspace.startMaterialTimer(activeNonSafetyVideo.value.id);
|
||||
}
|
||||
};
|
||||
|
||||
const stopNonSafetyVideoTimer = () => {
|
||||
workspace.stopMaterialTimer();
|
||||
};
|
||||
|
||||
watch([() => workspace.learnerTab, nonSafetyVideoMaterials], () => {
|
||||
if (!nonSafetyVideoMaterials.value.some((material) => material.id === activeNonSafetyVideoId.value)) {
|
||||
activeNonSafetyVideoId.value = nonSafetyVideoMaterials.value[0]?.id ?? null;
|
||||
}
|
||||
}, { immediate: true });
|
||||
|
||||
const videoCountdownSeconds = ref(0);
|
||||
let videoCountdownTimer: ReturnType<typeof setInterval> | null = null;
|
||||
@@ -533,7 +568,7 @@ const currentSafetyStageText = computed(() => {
|
||||
{{ $t('chat.training.tabs.learner') }}
|
||||
</button>
|
||||
<button
|
||||
v-if="workspace.isAdminViewer"
|
||||
v-if="workspace.canManageTrainingWorkspace"
|
||||
type="button"
|
||||
class="rounded-full px-3 py-1.5 text-xs font-medium transition"
|
||||
:class="workspace.activeView === 'admin' ? 'bg-brand-600 text-white' : 'bg-surface-soft text-secondary hover:bg-slate-100'"
|
||||
@@ -546,7 +581,7 @@ const currentSafetyStageText = computed(() => {
|
||||
|
||||
<div class="flex flex-wrap items-center justify-end gap-2">
|
||||
<button
|
||||
v-if="trainingExamPdfGuide"
|
||||
v-if="trainingExamPdfGuide && workspace.learnerTab === 'safety'"
|
||||
type="button"
|
||||
class="inline-flex h-9 items-center gap-2 rounded-xl border border-default bg-white px-3.5 text-xs font-medium leading-none text-secondary transition hover:bg-surface-soft"
|
||||
@click="emit('open-guide', Number(trainingExamPdfGuide.id))"
|
||||
@@ -555,7 +590,7 @@ const currentSafetyStageText = computed(() => {
|
||||
<span class="leading-none">{{ $t('chat.training.actions.viewExamPdf') }}</span>
|
||||
</button>
|
||||
<button
|
||||
v-if="workspace.stage === 'video'"
|
||||
v-if="workspace.learnerTab === 'safety' && workspace.safetyViewStage !== 'exam' && workspace.safetyViewStage !== 'result'"
|
||||
type="button"
|
||||
class="inline-flex min-h-9 items-center gap-2 rounded-xl border border-brand-200 bg-brand-50 px-3 py-2 text-xs font-medium text-brand-700 transition hover:bg-brand-100"
|
||||
@click="showVideoModal = true"
|
||||
@@ -619,7 +654,7 @@ const currentSafetyStageText = computed(() => {
|
||||
{{ $t('chat.training.tabs.learner') }}
|
||||
</button>
|
||||
<button
|
||||
v-if="workspace.isAdminViewer"
|
||||
v-if="workspace.canManageTrainingWorkspace"
|
||||
type="button"
|
||||
class="rounded-full px-3 py-1.5 text-xs font-medium transition"
|
||||
:class="workspace.activeView === 'admin' ? 'bg-brand-600 text-white' : 'bg-surface-soft text-secondary hover:bg-slate-100'"
|
||||
@@ -632,7 +667,7 @@ const currentSafetyStageText = computed(() => {
|
||||
|
||||
<div class="flex flex-wrap items-center justify-end gap-2">
|
||||
<button
|
||||
v-if="trainingExamPdfGuide"
|
||||
v-if="trainingExamPdfGuide && workspace.learnerTab === 'safety'"
|
||||
type="button"
|
||||
class="inline-flex h-9 items-center gap-2 rounded-xl border border-default bg-white px-3.5 text-xs font-medium leading-none text-secondary transition hover:bg-surface-soft"
|
||||
@click="emit('open-guide', Number(trainingExamPdfGuide.id))"
|
||||
@@ -708,7 +743,27 @@ const currentSafetyStageText = computed(() => {
|
||||
<div class="mt-3 text-base font-semibold text-primary">{{ $t('chat.training.noContent.title') }}</div>
|
||||
<div class="mt-1 text-sm">{{ $t('chat.training.noContent.description') }}</div>
|
||||
</div>
|
||||
<template v-else-if="workspace.learnerTab !== 'safety'">
|
||||
<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>
|
||||
<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'">
|
||||
<div :class="learnerWorkspaceMainClass">
|
||||
<div v-if="showLearnerProgressModule" :class="progressCardClass">
|
||||
<div class="flex flex-col gap-1.5 lg:flex-row lg:items-start lg:justify-between">
|
||||
@@ -762,31 +817,34 @@ const currentSafetyStageText = computed(() => {
|
||||
<p v-if="learnerStepIntroDescription" class="mt-1 whitespace-pre-line text-sm leading-6 text-secondary">{{ learnerStepIntroDescription }}</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="mt-3">
|
||||
<ul v-if="workspace.publishedTrainingMaterials.length" class="space-y-2">
|
||||
<li
|
||||
v-for="material in workspace.publishedTrainingMaterials"
|
||||
:key="material.id || `${material.resourceType}-${material.sortOrder}`"
|
||||
class="flex items-center justify-between gap-3 rounded-xl border border-slate-100 bg-slate-50 px-3 py-2.5 cursor-pointer transition hover:bg-slate-100"
|
||||
@click="handleMaterialClick(material)"
|
||||
>
|
||||
<div class="flex min-w-0 items-center gap-2 text-sm font-medium text-primary hover:text-brand-600">
|
||||
<Video v-if="material.resource?.fileType === 'video'" class="h-4 w-4 text-brand-500" />
|
||||
<FileText v-else class="h-4 w-4 text-slate-400" />
|
||||
<span class="truncate">{{ material.title || material.resource?.fileName || $t('chat.training.video.playerTitle') }}</span>
|
||||
</div>
|
||||
</li>
|
||||
</ul>
|
||||
<div v-if="activeNonSafetyVideo" class="mt-3 overflow-hidden rounded-2xl border border-default bg-black shadow-lg">
|
||||
<video
|
||||
:key="activeNonSafetyVideo.id ?? activeNonSafetyVideo.resource?.fileUrl"
|
||||
controls
|
||||
playsinline
|
||||
preload="metadata"
|
||||
class="aspect-video w-full"
|
||||
:src="activeNonSafetyVideo.resource?.fileUrl"
|
||||
@play="startNonSafetyVideoTimer"
|
||||
@pause="stopNonSafetyVideoTimer"
|
||||
@ended="stopNonSafetyVideoTimer"
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div class="mt-3 relative group cursor-pointer overflow-hidden rounded-2xl border border-default bg-slate-900 shadow-lg aspect-video flex items-center justify-center" @click="showVideoModal = true">
|
||||
<img src="https://coresg-normal.trae.ai/api/ide/v1/text_to_image?prompt=Professional%20corporate%20training%20video%20cover%2C%20high-quality%2C%20modern%20office%20background%2C%20play%20button%20overlay&image_size=landscape_16_9" class="absolute inset-0 w-full h-full object-cover opacity-60 group-hover:scale-105 transition-transform duration-500" />
|
||||
<div class="relative z-10 flex flex-col items-center gap-3">
|
||||
<div class="h-16 w-16 flex items-center justify-center rounded-full bg-white/20 backdrop-blur-md border border-white/30 group-hover:bg-brand-600 group-hover:border-brand-500 transition-all duration-300">
|
||||
<PlayCircle class="h-8 w-8 text-white fill-white/20" />
|
||||
</div>
|
||||
<span class="text-white font-medium drop-shadow-md">{{ $t('chat.training.video.playerTitle') }}</span>
|
||||
</div>
|
||||
<div v-else class="mt-3 rounded-2xl border border-dashed border-default bg-surface-soft px-4 py-10 text-center text-sm text-muted">
|
||||
{{ $t('chat.training.video.empty') }}
|
||||
</div>
|
||||
<div v-if="nonSafetyVideoMaterials.length > 1" class="mt-3 grid gap-2 sm:grid-cols-2">
|
||||
<button
|
||||
v-for="(material, index) in nonSafetyVideoMaterials"
|
||||
:key="material.id || `${material.resourceType}-${material.sortOrder}`"
|
||||
type="button"
|
||||
class="flex min-w-0 items-center gap-2 rounded-xl border px-3 py-2.5 text-left text-sm transition"
|
||||
:class="activeNonSafetyVideo?.id === material.id ? 'border-brand-300 bg-brand-50 text-brand-700' : 'border-default bg-white text-primary hover:border-brand-200'"
|
||||
@click="selectNonSafetyVideo(material)"
|
||||
>
|
||||
<Video class="h-4 w-4 shrink-0" />
|
||||
<span class="min-w-0 flex-1 truncate">{{ material.title || material.resource?.fileName || `${$t('chat.training.video.playerTitle')} ${index + 1}` }}</span>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -1572,6 +1630,69 @@ const currentSafetyStageText = computed(() => {
|
||||
</table>
|
||||
</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">
|
||||
<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>
|
||||
<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>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
/**
|
||||
* features/chat/composables/useTrainingWorkspace.ts
|
||||
* 用途:封装员工培训 Agent 的工作区状态,包括学员考试流、进度持久化与 HR 真实统计导出。
|
||||
* 用途:封装员工培训 Agent 的工作区状态,包括学员考试流、进度持久化、HR 真实统计导出与精益定向提醒。
|
||||
* 依赖:Vue reactivity、vue-i18n、training.api,以及 training.types。
|
||||
* 逻辑:仅在培训 Agent 下启用;学员端按“视频 -> 知识点 -> 一题一答 -> 结算”推进,并把进度同步到后端;
|
||||
* 非安全培训页额外按后台配置动态渲染进度项与步骤说明文案。
|
||||
* 非安全培训页额外按后台配置动态渲染进度项与步骤说明文案;精益管理面板通过独立状态提交未完成人员提醒。
|
||||
*/
|
||||
import { computed, ref, watch, type ComputedRef } from 'vue';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
@@ -15,8 +15,12 @@ import {
|
||||
getMyTrainingProgress,
|
||||
getMyTrainingTypes,
|
||||
getTrainingStats,
|
||||
getCurrentLeanTrainingTask,
|
||||
getLeanTrainingDashboard,
|
||||
sendLeanTrainingReminders,
|
||||
listTrainingRecords,
|
||||
saveMyTrainingProgress,
|
||||
saveMyLeanTrainingCompletion,
|
||||
} from '@/features/chat/api/training.api';
|
||||
import type {
|
||||
SafetyProgressState,
|
||||
@@ -36,6 +40,8 @@ import type {
|
||||
TrainingType,
|
||||
TrainingTypeOption,
|
||||
TrainingWorkspaceView,
|
||||
LeanTrainingDashboard,
|
||||
LeanTrainingWeeklyTask,
|
||||
} from '@/features/chat/training/training.types';
|
||||
import {
|
||||
SAFETY_STAGE_GUIDE_USAGE_MAP,
|
||||
@@ -107,7 +113,14 @@ export function useTrainingWorkspace(options: UseTrainingWorkspaceOptions) {
|
||||
});
|
||||
const hasAuthenticatedUser = computed(() => Boolean(String(currentUser.value?.username || '').trim()));
|
||||
const isAdminViewer = computed(() => Boolean(currentUser.value?.feature_permissions?.training_hr_manage));
|
||||
const defaultActiveView = computed<TrainingWorkspaceView>(() => (isAdminViewer.value ? 'admin' : 'learner'));
|
||||
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 leanReminderLoading = ref<Record<number, boolean>>({});
|
||||
const leanSummaryText = ref('');
|
||||
const leanWatchedAt = ref<Record<string, string>>({});
|
||||
const defaultActiveView = computed<TrainingWorkspaceView>(() => (canManageTrainingWorkspace.value ? 'admin' : 'learner'));
|
||||
const activeView = ref<TrainingWorkspaceView>('learner');
|
||||
const learnerTab = ref<TrainingType>('onboarding');
|
||||
const trainingTypes = ref<TrainingTypeOption[]>([
|
||||
@@ -172,7 +185,7 @@ export function useTrainingWorkspace(options: UseTrainingWorkspaceOptions) {
|
||||
});
|
||||
|
||||
watch(
|
||||
[isTrainingAgent, isAdminViewer],
|
||||
[isTrainingAgent, canManageTrainingWorkspace],
|
||||
([enabled]) => {
|
||||
if (!enabled) return;
|
||||
activeView.value = defaultActiveView.value;
|
||||
@@ -780,6 +793,44 @@ export function useTrainingWorkspace(options: UseTrainingWorkspaceOptions) {
|
||||
}
|
||||
};
|
||||
|
||||
/** 读取精益周任务与受权限约束的完成/未完成名单。 */
|
||||
const loadLeanTraining = async () => {
|
||||
if (!isTrainingAgent.value || !hasAuthenticatedUser.value) return;
|
||||
try {
|
||||
leanTask.value = await getCurrentLeanTrainingTask();
|
||||
if (canViewLeanDashboard.value) leanDashboard.value = await getLeanTrainingDashboard();
|
||||
} catch {
|
||||
leanTask.value = null;
|
||||
leanDashboard.value = { task: null, completed: [], incomplete: [] };
|
||||
}
|
||||
};
|
||||
|
||||
/** 标记视频已完整观看并记录观看时间,供精益周任务提交时一并交由服务端校验。 */
|
||||
const markLeanVideoWatched = (resourceId: number) => {
|
||||
leanWatchedAt.value[String(resourceId)] = new Date().toISOString();
|
||||
};
|
||||
|
||||
/** 提交精益学习感悟;服务端校验两个视频与至少 50 字,成功后刷新个人和管理看板。 */
|
||||
const submitLeanTrainingCompletion = async () => {
|
||||
if (!leanTask.value) return;
|
||||
await saveMyLeanTrainingCompletion({ weeklyTaskId: leanTask.value.id, watchedAt: leanWatchedAt.value, summaryText: leanSummaryText.value });
|
||||
await loadLeanTraining();
|
||||
};
|
||||
|
||||
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 }));
|
||||
await loadLeanTraining();
|
||||
} catch (error) {
|
||||
msg.error(error instanceof BusinessError ? error.message : t('chat.training.lean.reminder.failed'));
|
||||
} finally {
|
||||
leanReminderLoading.value[userId] = false;
|
||||
}
|
||||
};
|
||||
|
||||
watch(
|
||||
[
|
||||
currentAgent,
|
||||
@@ -812,6 +863,7 @@ export function useTrainingWorkspace(options: UseTrainingWorkspaceOptions) {
|
||||
void loadTrainingTypes();
|
||||
void loadTrainingConfig();
|
||||
void loadTrainingProgress();
|
||||
void loadLeanTraining();
|
||||
},
|
||||
{ immediate: true },
|
||||
);
|
||||
@@ -1160,6 +1212,13 @@ export function useTrainingWorkspace(options: UseTrainingWorkspaceOptions) {
|
||||
return {
|
||||
isTrainingAgent,
|
||||
isAdminViewer,
|
||||
canViewLeanDashboard,
|
||||
canManageTrainingWorkspace,
|
||||
leanTask,
|
||||
leanDashboard,
|
||||
leanReminderLoading,
|
||||
leanSummaryText,
|
||||
leanWatchedAt,
|
||||
isHydrated,
|
||||
trainingConfigLoading,
|
||||
hasPublishedTrainingConfig,
|
||||
@@ -1230,6 +1289,10 @@ export function useTrainingWorkspace(options: UseTrainingWorkspaceOptions) {
|
||||
restartExam,
|
||||
setSafetyStage,
|
||||
exportRecords,
|
||||
loadLeanTraining,
|
||||
markLeanVideoWatched,
|
||||
submitLeanTrainingCompletion,
|
||||
remindLeanTrainingMember,
|
||||
showVideoModal,
|
||||
videoUrl,
|
||||
startMaterialTimer,
|
||||
|
||||
@@ -139,3 +139,33 @@ export interface TrainingStats {
|
||||
passRate: number;
|
||||
averageScore: number;
|
||||
}
|
||||
|
||||
export interface LeanTrainingWeeklyTask {
|
||||
id: number;
|
||||
weekKey: string;
|
||||
dueAt: string;
|
||||
videoResourceIds: number[];
|
||||
targetRoles: string[];
|
||||
targetUserIds: number[];
|
||||
videos: Array<{ id: number; name: string }>;
|
||||
status: string;
|
||||
minSummaryLength: number;
|
||||
}
|
||||
|
||||
export interface LeanTrainingDashboardRow {
|
||||
id?: number;
|
||||
userId: number;
|
||||
employeeId?: string | null;
|
||||
name: string;
|
||||
department?: string | null;
|
||||
videos: Array<{ name: string; watchedAt?: string | null }>;
|
||||
summaryText?: string | null;
|
||||
status: 'completed' | 'incomplete';
|
||||
completedAt?: string | null;
|
||||
}
|
||||
|
||||
export interface LeanTrainingDashboard {
|
||||
task: LeanTrainingWeeklyTask | null;
|
||||
completed: LeanTrainingDashboardRow[];
|
||||
incomplete: LeanTrainingDashboardRow[];
|
||||
}
|
||||
@@ -1212,10 +1212,15 @@
|
||||
"username": "Username",
|
||||
"email": "Email",
|
||||
"department": "Department",
|
||||
"team": "Team",
|
||||
"jobTitle": "Job title",
|
||||
"isTeamLeader": "Team leader",
|
||||
"role": "Role",
|
||||
"featurePermissions": "Feature Permissions",
|
||||
"trainingHrManage": "Training HR Admin",
|
||||
"trainingHrManageHint": "Allows this user to open the employee training agent HR Management view for stats, filtering, and Excel export.",
|
||||
"trainingLeanManage": "Lean training full management",
|
||||
"trainingLeanTeamManage": "Lean training team management",
|
||||
"contractPaymentAccess": "Contract payment alert access",
|
||||
"contractPaymentAccessHint": "Allows this user to open the contract payment workbench (ledger, review, weekly batches) and trigger sync or scans.",
|
||||
"password": "Password",
|
||||
@@ -4974,7 +4979,9 @@
|
||||
"examTitle": "Question Bank",
|
||||
"examDesc": "Maintain structured question data for controlled examinations",
|
||||
"reviewTitle": "Review & Checklist",
|
||||
"reviewDesc": "Configure review points, pre-exam checklists, and guided chat questions"
|
||||
"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"
|
||||
},
|
||||
"guideGroups": {
|
||||
"company": "Company-level Safety Training",
|
||||
@@ -5001,6 +5008,7 @@
|
||||
"progressItemLabel": "Progress item label",
|
||||
"progressHintText": "Training progress note",
|
||||
"stepIntroText": "Training step guide copy",
|
||||
"requiredDuration": "Required time (minutes)",
|
||||
"summaryPoints": "Review points",
|
||||
"summaryChecklist": "Pre-exam checklist",
|
||||
"employeeQuestions": "Employee FAQs",
|
||||
@@ -5029,6 +5037,30 @@
|
||||
"guide": "Guide resource",
|
||||
"document": "Knowledge document"
|
||||
},
|
||||
"directVideo": {
|
||||
"title": "Training Videos",
|
||||
"hint": "Upload videos directly. Uploaded videos are automatically added to this training configuration.",
|
||||
"upload": "Upload Video",
|
||||
"uploading": "Uploading...",
|
||||
"empty": "No training videos uploaded",
|
||||
"unnamed": "Unnamed video"
|
||||
},
|
||||
"lean": {
|
||||
"weekKey": "Task week (Monday)",
|
||||
"dueAt": "Due time",
|
||||
"videosTitle": "Required training videos",
|
||||
"videosHint": "{count}/2 videos selected",
|
||||
"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",
|
||||
"saveTask": "Publish weekly task",
|
||||
"publishRequired": "Save and publish the Lean Management configuration before creating a weekly task",
|
||||
"unnamedVideo": "Unnamed video"
|
||||
},
|
||||
"messages": {
|
||||
"loadFailed": "Failed to load training configurations",
|
||||
"saveFailed": "Failed to save training configuration",
|
||||
@@ -5043,7 +5075,13 @@
|
||||
"parseSuccess": "Parsed {count} questions. Review before saving.",
|
||||
"parseFailed": "Question bank parsing failed",
|
||||
"saved": "Training configuration saved",
|
||||
"deleted": "Training configuration deleted"
|
||||
"deleted": "Training configuration deleted",
|
||||
"leanVideoCount": "Select exactly two training videos",
|
||||
"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",
|
||||
"videoUploaded": "Training video uploaded and added to configuration resources",
|
||||
"videoUploadFailed": "Failed to upload training video"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1019,11 +1019,54 @@
|
||||
"defaultLearnerName": "Current learner",
|
||||
"noContent": { "loading": "Loading training content...", "title": "No training content", "description": "The administrator has not published the current training configuration yet." },
|
||||
"unknownDepartment": "Department pending",
|
||||
"lean": {
|
||||
"learner": {
|
||||
"title": "Lean Management Weekly Training",
|
||||
"description": "Complete {count} required videos and submit a learning reflection of at least {minSummaryLength} characters this week."
|
||||
},
|
||||
"dueAt": "Due {time}",
|
||||
"watchedAt": "Watched: {time}",
|
||||
"markVideoWatched": "Click to record video completion",
|
||||
"summaryPlaceholder": "Enter this week's learning reflection (at least {minSummaryLength} characters)",
|
||||
"summaryLength": "{current}/{minSummaryLength} characters",
|
||||
"submitSummary": "Submit Learning Reflection",
|
||||
"dashboard": {
|
||||
"title": "Lean Training Completion Lists",
|
||||
"week": "Training week: {week}",
|
||||
"completed": "Completed",
|
||||
"incomplete": "Incomplete",
|
||||
"count": "{count} people",
|
||||
"empty": "No personnel data"
|
||||
},
|
||||
"columns": {
|
||||
"employeeId": "Employee ID",
|
||||
"name": "Name",
|
||||
"department": "Department",
|
||||
"team": "Team",
|
||||
"jobTitle": "Job Title",
|
||||
"videoName": "Video Name",
|
||||
"watchedAt": "Watch Time",
|
||||
"status": "Status",
|
||||
"summary": "Summary",
|
||||
"action": "Action"
|
||||
},
|
||||
"status": {
|
||||
"completed": "Completed",
|
||||
"incomplete": "Incomplete"
|
||||
},
|
||||
"reminder": {
|
||||
"action": "Remind",
|
||||
"sending": "Sending...",
|
||||
"success": "Reminder sent ({count} people)",
|
||||
"failed": "Failed to send reminder. Please try again later."
|
||||
}
|
||||
},
|
||||
"video": {
|
||||
"title": "Step 1: Watch the training video",
|
||||
"description": "Employees first complete the onboarding video, then move on to the knowledge review and exam.",
|
||||
"completeAction": "I finished watching the video",
|
||||
"playerTitle": "Video player slot",
|
||||
"empty": "No playable training video is configured yet",
|
||||
"playerHint": "This area can later connect to an enterprise video URL or internal player. The frontend container and completion action are already prepared."
|
||||
},
|
||||
"summary": {
|
||||
|
||||
@@ -1212,10 +1212,15 @@
|
||||
"username": "ชื่อผู้ใช้",
|
||||
"email": "อีเมล",
|
||||
"department": "แผนก",
|
||||
"team": "ทีม",
|
||||
"jobTitle": "ตำแหน่งงาน",
|
||||
"isTeamLeader": "หัวหน้าทีม",
|
||||
"role": "บทบาท",
|
||||
"featurePermissions": "สิทธิ์ฟีเจอร์",
|
||||
"trainingHrManage": "จัดการ HR การฝึกอบรม",
|
||||
"trainingHrManageHint": "เมื่อเปิดแล้ว ผู้ใช้นี้จะเข้าใช้มุมมอง HR 管理 ใน employee training agent เพื่อดูสถิติ คัดกรองข้อมูล และส่งออก Excel ได้",
|
||||
"trainingLeanManage": "จัดการการฝึกอบรม Lean ทั้งหมด",
|
||||
"trainingLeanTeamManage": "จัดการการฝึกอบรม Lean ระดับทีม",
|
||||
"contractPaymentAccess": "สิทธิ์แจ้งเตือนการชำระเงินตามสัญญา",
|
||||
"contractPaymentAccessHint": "เมื่อเปิดแล้ว ผู้ใช้นี้จะเข้าโต๊ะทำงานแจ้งเตือนการชำระเงินตามสัญญา (บัญชีสัญญา รายการรอยืนยัน และชุดสรุปรายสัปดาห์) และสั่งซิงค์หรือสแกนได้",
|
||||
"password": "รหัสผ่าน",
|
||||
@@ -4843,7 +4848,9 @@
|
||||
"examTitle": "คลังข้อสอบ",
|
||||
"examDesc": "ดูแลข้อมูลคำถามแบบมีโครงสร้างสำหรับการสอบที่ควบคุม",
|
||||
"reviewTitle": "ทบทวนและรายการตรวจสอบ",
|
||||
"reviewDesc": "กำหนดประเด็นทบทวน รายการก่อนสอบ และคำถามแนะนำในการสนทนา"
|
||||
"reviewDesc": "กำหนดประเด็นทบทวน รายการก่อนสอบ และคำถามแนะนำในการสนทนา",
|
||||
"leanTitle": "ภารกิจ Lean รายสัปดาห์",
|
||||
"leanDesc": "เลือกวิดีโอสองรายการสำหรับสัปดาห์และกำหนดเวลาสิ้นสุดวันอาทิตย์"
|
||||
},
|
||||
"guideGroups": {
|
||||
"company": "การฝึกอบรมความปลอดภัยระดับบริษัท",
|
||||
@@ -4870,6 +4877,7 @@
|
||||
"progressItemLabel": "ชื่อรายการความคืบหน้า",
|
||||
"progressHintText": "คำอธิบายความคืบหน้าการฝึกอบรม",
|
||||
"stepIntroText": "ข้อความแนะนำขั้นตอนการฝึกอบรม",
|
||||
"requiredDuration": "เวลาที่ต้องใช้ (นาที)",
|
||||
"summaryPoints": "ประเด็นทบทวน",
|
||||
"summaryChecklist": "รายการก่อนสอบ",
|
||||
"employeeQuestions": "คำถามที่พบบ่อยของพนักงาน",
|
||||
@@ -4898,6 +4906,30 @@
|
||||
"guide": "ทรัพยากรคู่มือ",
|
||||
"document": "เอกสารคลังความรู้"
|
||||
},
|
||||
"directVideo": {
|
||||
"title": "วิดีโอการฝึกอบรม",
|
||||
"hint": "อัปโหลดวิดีโอโดยตรง และวิดีโอจะถูกเพิ่มในทรัพยากรการกำหนดค่านี้โดยอัตโนมัติ",
|
||||
"upload": "อัปโหลดวิดีโอ",
|
||||
"uploading": "กำลังอัปโหลด...",
|
||||
"empty": "ยังไม่มีวิดีโอการฝึกอบรม",
|
||||
"unnamed": "วิดีโอไม่มีชื่อ"
|
||||
},
|
||||
"lean": {
|
||||
"weekKey": "สัปดาห์ภารกิจ (วันจันทร์)",
|
||||
"dueAt": "เวลาครบกำหนด",
|
||||
"videosTitle": "วิดีโอการฝึกอบรมที่กำหนด",
|
||||
"videosHint": "เลือกแล้ว {count}/2 วิดีโอ",
|
||||
"targetsTitle": "กลุ่มผู้เข้ารับการฝึกอบรม",
|
||||
"targetsHint": "เลือกตามบทบาทหรือผู้ใช้ที่ระบุ โดยรวมทั้งสองขอบเขต",
|
||||
"targetRoles": "บทบาทที่ระบุ",
|
||||
"targetUsers": "ผู้ใช้ที่ระบุ",
|
||||
"videosFrozen": "วิดีโอของสัปดาห์นี้ถูกล็อกแล้ว",
|
||||
"noVideoResources": "โปรดบันทึกทรัพยากรวิดีโออย่างน้อยสองรายการในเอกสารฝึกอบรมก่อน",
|
||||
"summaryRule": "พนักงานต้องดูวิดีโอทั้งสองและส่งความเห็นการเรียนรู้อย่างน้อย {count} อักขระ",
|
||||
"saveTask": "เผยแพร่ภารกิจรายสัปดาห์",
|
||||
"publishRequired": "โปรดบันทึกและเผยแพร่การกำหนดค่า Lean Management ก่อนสร้างภารกิจรายสัปดาห์",
|
||||
"unnamedVideo": "วิดีโอไม่มีชื่อ"
|
||||
},
|
||||
"messages": {
|
||||
"loadFailed": "โหลดการกำหนดค่าไม่สำเร็จ",
|
||||
"saveFailed": "บันทึกการกำหนดค่าไม่สำเร็จ",
|
||||
@@ -4912,7 +4944,13 @@
|
||||
"parseSuccess": "วิเคราะห์ได้ {count} ข้อ โปรดตรวจสอบก่อนบันทึก",
|
||||
"parseFailed": "วิเคราะห์คลังข้อสอบไม่สำเร็จ",
|
||||
"saved": "บันทึกการกำหนดค่าแล้ว",
|
||||
"deleted": "ลบการกำหนดค่าแล้ว"
|
||||
"deleted": "ลบการกำหนดค่าแล้ว",
|
||||
"leanVideoCount": "โปรดเลือกวิดีโอการฝึกอบรมให้ครบสองรายการ",
|
||||
"leanTaskSaved": "เผยแพร่ภารกิจ Lean รายสัปดาห์แล้ว",
|
||||
"videoFileRequired": "โปรดเลือกไฟล์วิดีโอ",
|
||||
"trainingAgentRequired": "ไม่พบ Agent การฝึกอบรมพนักงาน จึงไม่สามารถสร้างทรัพยากรวิดีโอได้",
|
||||
"videoUploaded": "อัปโหลดวิดีโอการฝึกอบรมและเพิ่มในทรัพยากรการกำหนดค่าแล้ว",
|
||||
"videoUploadFailed": "อัปโหลดวิดีโอการฝึกอบรมไม่สำเร็จ"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1019,11 +1019,54 @@
|
||||
"defaultLearnerName": "ผู้เรียนปัจจุบัน",
|
||||
"noContent": { "loading": "กำลังโหลดเนื้อหาการฝึกอบรม...", "title": "ยังไม่มีเนื้อหาการฝึกอบรม", "description": "ผู้ดูแลระบบยังไม่ได้เผยแพร่การกำหนดค่าการฝึกอบรมปัจจุบัน" },
|
||||
"unknownDepartment": "ยังไม่ได้ระบุแผนก",
|
||||
"lean": {
|
||||
"learner": {
|
||||
"title": "การอบรมการจัดการแบบลีนประจำสัปดาห์",
|
||||
"description": "สัปดาห์นี้ต้องดูวิดีโอที่กำหนด {count} รายการและส่งสรุปการเรียนรู้อย่างน้อย {minSummaryLength} ตัวอักษร"
|
||||
},
|
||||
"dueAt": "กำหนดส่ง {time}",
|
||||
"watchedAt": "ดูแล้ว: {time}",
|
||||
"markVideoWatched": "คลิกเพื่อบันทึกว่าดูวิดีโอเสร็จแล้ว",
|
||||
"summaryPlaceholder": "กรอกสรุปการเรียนรู้ประจำสัปดาห์ (อย่างน้อย {minSummaryLength} ตัวอักษร)",
|
||||
"summaryLength": "{current}/{minSummaryLength} ตัวอักษร",
|
||||
"submitSummary": "ส่งสรุปการเรียนรู้",
|
||||
"dashboard": {
|
||||
"title": "รายชื่อผลการอบรมลีน",
|
||||
"week": "สัปดาห์อบรม: {week}",
|
||||
"completed": "รายชื่อผู้เสร็จสิ้น",
|
||||
"incomplete": "รายชื่อผู้ยังไม่เสร็จ",
|
||||
"count": "{count} คน",
|
||||
"empty": "ไม่มีข้อมูลบุคลากร"
|
||||
},
|
||||
"columns": {
|
||||
"employeeId": "รหัสพนักงาน",
|
||||
"name": "ชื่อ",
|
||||
"department": "แผนก",
|
||||
"team": "ทีม",
|
||||
"jobTitle": "ตำแหน่ง",
|
||||
"videoName": "ชื่อวิดีโอ",
|
||||
"watchedAt": "เวลาที่รับชม",
|
||||
"status": "สถานะ",
|
||||
"summary": "สรุป",
|
||||
"action": "การดำเนินการ"
|
||||
},
|
||||
"status": {
|
||||
"completed": "เสร็จสิ้น",
|
||||
"incomplete": "ยังไม่เสร็จ"
|
||||
},
|
||||
"reminder": {
|
||||
"action": "เตือน",
|
||||
"sending": "กำลังส่ง...",
|
||||
"success": "ส่งการเตือนแล้ว ({count} คน)",
|
||||
"failed": "ส่งการเตือนไม่สำเร็จ โปรดลองอีกครั้งภายหลัง"
|
||||
}
|
||||
},
|
||||
"video": {
|
||||
"title": "ขั้นตอน 1: ดูวิดีโออบรม",
|
||||
"description": "พนักงานใหม่ต้องดูวิดีโออบรมก่อน แล้วจึงเข้าสู่การทบทวนความรู้และการสอบ",
|
||||
"completeAction": "ฉันดูวิดีโอเสร็จแล้ว",
|
||||
"playerTitle": "ตำแหน่งตัวเล่นวิดีโอ",
|
||||
"empty": "ยังไม่ได้กำหนดวิดีโอการฝึกอบรมที่เล่นได้",
|
||||
"playerHint": "ส่วนนี้สามารถเชื่อมต่อกับลิงก์วิดีโอภายในบริษัทหรือเครื่องเล่นภายในได้ในภายหลัง"
|
||||
},
|
||||
"summary": {
|
||||
|
||||
@@ -1346,10 +1346,15 @@
|
||||
"username": "用户名",
|
||||
"email": "邮箱",
|
||||
"department": "部门",
|
||||
"team": "班组",
|
||||
"jobTitle": "职务",
|
||||
"isTeamLeader": "班组长",
|
||||
"role": "角色",
|
||||
"featurePermissions": "功能权限",
|
||||
"trainingHrManage": "培训 HR 管理",
|
||||
"trainingHrManageHint": "勾选后可进入员工培训 Agent 的【HR 管理】视图,查看统计、筛选记录并导出 Excel。",
|
||||
"trainingLeanManage": "精益培训全量管理",
|
||||
"trainingLeanTeamManage": "精益培训班组管理",
|
||||
"contractPaymentAccess": "合同付款预警访问",
|
||||
"contractPaymentAccessHint": "勾选后可进入工作台合同付款预警(台账、待确认、周汇总),并触发同步与扫描。",
|
||||
"password": "密码",
|
||||
@@ -4999,7 +5004,9 @@
|
||||
"examTitle": "考试题库",
|
||||
"examDesc": "维护受控考试使用的结构化题目数据",
|
||||
"reviewTitle": "复盘与清单",
|
||||
"reviewDesc": "配置培训完成后的复盘重点、考前清单与聊天引导问题"
|
||||
"reviewDesc": "配置培训完成后的复盘重点、考前清单与聊天引导问题",
|
||||
"leanTitle": "精益周任务",
|
||||
"leanDesc": "为指定自然周选择两个视频并设置周日截止时间"
|
||||
},
|
||||
"guideGroups": {
|
||||
"company": "公司级安全培训",
|
||||
@@ -5026,6 +5033,7 @@
|
||||
"progressItemLabel": "进度项名称",
|
||||
"progressHintText": "培训进度说明",
|
||||
"stepIntroText": "培训步骤引导文案",
|
||||
"requiredDuration": "所需时间(分钟)",
|
||||
"summaryPoints": "复盘要点",
|
||||
"summaryChecklist": "考前清单",
|
||||
"employeeQuestions": "员工常见问题",
|
||||
@@ -5054,6 +5062,30 @@
|
||||
"guide": "指南资源",
|
||||
"document": "知识库文档"
|
||||
},
|
||||
"directVideo": {
|
||||
"title": "培训视频",
|
||||
"hint": "可直接上传视频,上传后自动加入当前培训配置资源。",
|
||||
"upload": "上传视频",
|
||||
"uploading": "上传中...",
|
||||
"empty": "暂未上传培训视频",
|
||||
"unnamed": "未命名视频"
|
||||
},
|
||||
"lean": {
|
||||
"weekKey": "任务周(周一)",
|
||||
"dueAt": "截止时间",
|
||||
"videosTitle": "指定培训视频",
|
||||
"videosHint": "已选择 {count}/2 个视频",
|
||||
"targetsTitle": "受训对象",
|
||||
"targetsHint": "按角色或指定用户选择,两个范围取并集",
|
||||
"targetRoles": "指定角色",
|
||||
"targetUsers": "指定用户",
|
||||
"videosFrozen": "当前周视频已冻结",
|
||||
"noVideoResources": "请先在培训资料中保存至少两个视频资源",
|
||||
"summaryRule": "员工需完成两个视频观看并提交不少于 {count} 字的学习感悟",
|
||||
"saveTask": "发布周任务",
|
||||
"publishRequired": "请先保存并发布精益管理培训配置,再创建周任务",
|
||||
"unnamedVideo": "未命名视频"
|
||||
},
|
||||
"messages": {
|
||||
"loadFailed": "加载培训配置失败",
|
||||
"saveFailed": "保存培训配置失败",
|
||||
@@ -5068,7 +5100,13 @@
|
||||
"parseSuccess": "已解析 {count} 道题目,请复核后保存",
|
||||
"parseFailed": "题库解析失败",
|
||||
"saved": "培训配置已保存",
|
||||
"deleted": "培训配置已删除"
|
||||
"deleted": "培训配置已删除",
|
||||
"leanVideoCount": "请恰好选择两个培训视频",
|
||||
"leanTaskSaved": "精益周任务已发布",
|
||||
"videoFileRequired": "请选择视频文件",
|
||||
"trainingAgentRequired": "未找到员工培训 Agent,无法创建视频资源",
|
||||
"videoUploaded": "培训视频已上传并加入配置资源",
|
||||
"videoUploadFailed": "培训视频上传失败"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1053,11 +1053,54 @@
|
||||
"defaultLearnerName": "当前学员",
|
||||
"noContent": { "loading": "正在加载培训内容...", "title": "暂无培训内容", "description": "管理员尚未发布当前培训配置,请稍后再试。" },
|
||||
"unknownDepartment": "待补充部门",
|
||||
"lean": {
|
||||
"learner": {
|
||||
"title": "精益管理周度培训",
|
||||
"description": "本周需完成 {count} 个指定视频,并提交不少于 {minSummaryLength} 字的学习感悟。"
|
||||
},
|
||||
"dueAt": "截止 {time}",
|
||||
"watchedAt": "已观看:{time}",
|
||||
"markVideoWatched": "点击记录观看完成",
|
||||
"summaryPlaceholder": "请填写本周学习感悟(不少于 {minSummaryLength} 字)",
|
||||
"summaryLength": "{current}/{minSummaryLength} 字",
|
||||
"submitSummary": "提交学习感悟",
|
||||
"dashboard": {
|
||||
"title": "精益培训完成名单",
|
||||
"week": "培训周次:{week}",
|
||||
"completed": "已完成名单",
|
||||
"incomplete": "未完成名单",
|
||||
"count": "共 {count} 人",
|
||||
"empty": "暂无人员数据"
|
||||
},
|
||||
"columns": {
|
||||
"employeeId": "工号",
|
||||
"name": "姓名",
|
||||
"department": "部门",
|
||||
"team": "班组",
|
||||
"jobTitle": "职务",
|
||||
"videoName": "视频名称",
|
||||
"watchedAt": "观看时间",
|
||||
"status": "状态",
|
||||
"summary": "总结",
|
||||
"action": "操作"
|
||||
},
|
||||
"status": {
|
||||
"completed": "已完成",
|
||||
"incomplete": "未完成"
|
||||
},
|
||||
"reminder": {
|
||||
"action": "提醒",
|
||||
"sending": "发送中...",
|
||||
"success": "已发送提醒({count} 人)",
|
||||
"failed": "提醒发送失败,请稍后重试"
|
||||
}
|
||||
},
|
||||
"video": {
|
||||
"title": "第一步:观看培训视频",
|
||||
"description": "员工先完成入职培训视频学习,再进入知识点复盘和考试环节。",
|
||||
"completeAction": "我已完成视频学习",
|
||||
"playerTitle": "视频播放位",
|
||||
"empty": "暂未配置可播放的培训视频",
|
||||
"playerHint": "这里可接入企业视频链接或内部播放器。当前前端已预留完整容器与学习完成按钮。"
|
||||
},
|
||||
"summary": {
|
||||
|
||||
@@ -1217,10 +1217,15 @@
|
||||
"username": "用戶名",
|
||||
"email": "郵箱",
|
||||
"department": "部門",
|
||||
"team": "班組",
|
||||
"jobTitle": "職務",
|
||||
"isTeamLeader": "班組長",
|
||||
"role": "角色",
|
||||
"featurePermissions": "功能權限",
|
||||
"trainingHrManage": "培訓 HR 管理",
|
||||
"trainingHrManageHint": "勾選後可進入員工培訓 Agent 的【HR 管理】視圖,查看統計、篩選記錄並匯出 Excel。",
|
||||
"trainingLeanManage": "精益培訓全量管理",
|
||||
"trainingLeanTeamManage": "精益培訓班組管理",
|
||||
"contractPaymentAccess": "合約付款預警存取",
|
||||
"contractPaymentAccessHint": "勾選後可進入工作臺合約付款預警(臺帳、待確認、週彙總),並觸發同步與掃描。",
|
||||
"password": "密碼",
|
||||
@@ -4848,7 +4853,9 @@
|
||||
"examTitle": "考試題庫",
|
||||
"examDesc": "維護受控考試使用的結構化題目資料",
|
||||
"reviewTitle": "複盤與清單",
|
||||
"reviewDesc": "配置培訓完成後的複盤重點、考前清單與聊天引導問題"
|
||||
"reviewDesc": "配置培訓完成後的複盤重點、考前清單與聊天引導問題",
|
||||
"leanTitle": "精益每週任務",
|
||||
"leanDesc": "為指定自然週選擇兩部影片並設定週日截止時間"
|
||||
},
|
||||
"guideGroups": {
|
||||
"company": "公司級安全培訓",
|
||||
@@ -4875,6 +4882,7 @@
|
||||
"progressItemLabel": "進度項名稱",
|
||||
"progressHintText": "培訓進度說明",
|
||||
"stepIntroText": "培訓步驟引導文案",
|
||||
"requiredDuration": "所需時間(分鐘)",
|
||||
"summaryPoints": "複盤要點",
|
||||
"summaryChecklist": "考前清單",
|
||||
"employeeQuestions": "員工常見問題",
|
||||
@@ -4903,6 +4911,30 @@
|
||||
"guide": "指南資源",
|
||||
"document": "知識庫文件"
|
||||
},
|
||||
"directVideo": {
|
||||
"title": "培訓影片",
|
||||
"hint": "可直接上傳影片;上傳後會自動加入目前培訓配置資源。",
|
||||
"upload": "上傳影片",
|
||||
"uploading": "上傳中...",
|
||||
"empty": "尚未上傳培訓影片",
|
||||
"unnamed": "未命名影片"
|
||||
},
|
||||
"lean": {
|
||||
"weekKey": "任務週(週一)",
|
||||
"dueAt": "截止時間",
|
||||
"videosTitle": "指定培訓影片",
|
||||
"videosHint": "已選擇 {count}/2 部影片",
|
||||
"targetsTitle": "受訓對象",
|
||||
"targetsHint": "依角色或指定使用者選擇,兩個範圍取聯集",
|
||||
"targetRoles": "指定角色",
|
||||
"targetUsers": "指定使用者",
|
||||
"videosFrozen": "目前週影片已凍結",
|
||||
"noVideoResources": "請先在培訓資料中儲存至少兩部影片資源",
|
||||
"summaryRule": "員工須完成兩部影片觀看並提交不少於 {count} 字的學習感悟",
|
||||
"saveTask": "發佈每週任務",
|
||||
"publishRequired": "請先儲存並發佈精益管理培訓配置,再建立每週任務",
|
||||
"unnamedVideo": "未命名影片"
|
||||
},
|
||||
"messages": {
|
||||
"loadFailed": "載入培訓配置失敗",
|
||||
"saveFailed": "儲存培訓配置失敗",
|
||||
@@ -4917,7 +4949,13 @@
|
||||
"parseSuccess": "已解析 {count} 道題目,請複核後儲存",
|
||||
"parseFailed": "題庫解析失敗",
|
||||
"saved": "培訓配置已儲存",
|
||||
"deleted": "培訓配置已刪除"
|
||||
"deleted": "培訓配置已刪除",
|
||||
"leanVideoCount": "請剛好選擇兩部培訓影片",
|
||||
"leanTaskSaved": "精益每週任務已發佈",
|
||||
"videoFileRequired": "請選擇影片檔案",
|
||||
"trainingAgentRequired": "未找到員工培訓 Agent,無法建立影片資源",
|
||||
"videoUploaded": "培訓影片已上傳並加入配置資源",
|
||||
"videoUploadFailed": "培訓影片上傳失敗"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1019,11 +1019,54 @@
|
||||
"defaultLearnerName": "當前學員",
|
||||
"noContent": { "loading": "正在載入培訓內容...", "title": "暫無培訓內容", "description": "管理員尚未發布當前培訓配置,請稍後再試。" },
|
||||
"unknownDepartment": "待補充部門",
|
||||
"lean": {
|
||||
"learner": {
|
||||
"title": "精益管理週度培訓",
|
||||
"description": "本週需完成 {count} 個指定影片,並提交不少於 {minSummaryLength} 字的學習心得。"
|
||||
},
|
||||
"dueAt": "截止 {time}",
|
||||
"watchedAt": "已觀看:{time}",
|
||||
"markVideoWatched": "點擊記錄完成觀看",
|
||||
"summaryPlaceholder": "請填寫本週學習心得(不少於 {minSummaryLength} 字)",
|
||||
"summaryLength": "{current}/{minSummaryLength} 字",
|
||||
"submitSummary": "提交學習心得",
|
||||
"dashboard": {
|
||||
"title": "精益培訓完成名單",
|
||||
"week": "培訓週次:{week}",
|
||||
"completed": "已完成名單",
|
||||
"incomplete": "未完成名單",
|
||||
"count": "共 {count} 人",
|
||||
"empty": "暫無人員資料"
|
||||
},
|
||||
"columns": {
|
||||
"employeeId": "工號",
|
||||
"name": "姓名",
|
||||
"department": "部門",
|
||||
"team": "班組",
|
||||
"jobTitle": "職務",
|
||||
"videoName": "影片名稱",
|
||||
"watchedAt": "觀看時間",
|
||||
"status": "狀態",
|
||||
"summary": "總結",
|
||||
"action": "操作"
|
||||
},
|
||||
"status": {
|
||||
"completed": "已完成",
|
||||
"incomplete": "未完成"
|
||||
},
|
||||
"reminder": {
|
||||
"action": "提醒",
|
||||
"sending": "發送中...",
|
||||
"success": "已發送提醒({count} 人)",
|
||||
"failed": "提醒發送失敗,請稍後重試"
|
||||
}
|
||||
},
|
||||
"video": {
|
||||
"title": "第一步:觀看培訓影片",
|
||||
"description": "員工先完成入職培訓影片學習,再進入知識點複盤與考試環節。",
|
||||
"completeAction": "我已完成影片學習",
|
||||
"playerTitle": "影片播放區",
|
||||
"empty": "尚未配置可播放的培訓影片",
|
||||
"playerHint": "此處可接入企業影片連結或內部播放器。當前前端已預留完整容器與完成按鈕。"
|
||||
},
|
||||
"summary": {
|
||||
|
||||
Reference in new issue
Block a user