feat(安全培训): 新增员工安全培训相关功能
This commit is contained in:
1 parent
cbc3cb959f
commit
8e5c57790c
50 files changed
+3769
-87
No files matched your search
@@ -38,6 +38,31 @@ const uploadError = ref('');
|
||||
const deleteDialogOpen = ref(false);
|
||||
const pendingDeleteGuideId = ref<number | null>(null);
|
||||
|
||||
const safetyVideoUsages = new Set([
|
||||
'training_safety_video',
|
||||
'training_safety_company_video',
|
||||
'training_safety_department_video',
|
||||
'training_safety_team_video',
|
||||
]);
|
||||
|
||||
const isVideoUsage = (usage: string) => usage === 'training_video' || safetyVideoUsages.has(usage);
|
||||
const isPdfUsage = (usage: string) => usage === 'training_exam_pdf' || usage === 'training_safety_pdf';
|
||||
|
||||
/**
|
||||
* 把指南用途编码翻译成管理端可读名称。
|
||||
* AI 触发时机:平台应用说明列表与弹窗下拉都依赖这层映射,新增资料用途时必须统一从这里出文案,避免表格和表单各自写死分叉。
|
||||
*/
|
||||
const getGuideUsageLabel = (usage: string) => {
|
||||
if (usage === 'training_video') return t('admin.platformApps.trainingVideo');
|
||||
if (usage === 'training_exam_pdf') return t('admin.platformApps.trainingExamPdf');
|
||||
if (usage === 'training_safety_company_video') return t('admin.platformApps.trainingSafetyCompanyVideo');
|
||||
if (usage === 'training_safety_department_video') return t('admin.platformApps.trainingSafetyDepartmentVideo');
|
||||
if (usage === 'training_safety_team_video') return t('admin.platformApps.trainingSafetyTeamVideo');
|
||||
if (usage === 'training_safety_video') return t('admin.platformApps.trainingSafetyVideo');
|
||||
if (usage === 'training_safety_pdf') return t('admin.platformApps.trainingSafetyPdf');
|
||||
return t('admin.platformApps.generalGuide');
|
||||
};
|
||||
|
||||
/**
|
||||
* 拉取 Agent 列表并默认选中第一项,再加载其指南。
|
||||
*/
|
||||
@@ -134,10 +159,10 @@ const handleFileUpload = async (event: Event) => {
|
||||
form.value.file_path = res.file_path;
|
||||
form.value.file_type = res.file_type;
|
||||
form.value.file_size = res.file_size;
|
||||
if (form.value.guide_usage === 'training_video' && res.file_type !== 'video') {
|
||||
if (isVideoUsage(form.value.guide_usage) && res.file_type !== 'video') {
|
||||
form.value.guide_usage = 'general';
|
||||
}
|
||||
if (form.value.guide_usage === 'training_exam_pdf' && res.file_type !== 'pdf') {
|
||||
if (isPdfUsage(form.value.guide_usage) && res.file_type !== 'pdf') {
|
||||
form.value.guide_usage = 'general';
|
||||
}
|
||||
if (!form.value.file_name) {
|
||||
@@ -297,9 +322,7 @@ const getIcon = (type: string) => {
|
||||
<div class="text-xs text-muted mt-1 truncate max-w-[200px]">{{ guide.remark }}</div>
|
||||
</td>
|
||||
<td class="px-6 py-4 text-muted">
|
||||
<span v-if="guide.guide_usage === 'training_video'">{{ t('admin.platformApps.trainingVideo') }}</span>
|
||||
<span v-else-if="guide.guide_usage === 'training_exam_pdf'">{{ t('admin.platformApps.trainingExamPdf') }}</span>
|
||||
<span v-else>{{ t('admin.platformApps.generalGuide') }}</span>
|
||||
<span>{{ getGuideUsageLabel(guide.guide_usage || 'general') }}</span>
|
||||
</td>
|
||||
<td class="px-6 py-4">
|
||||
<span class="inline-flex items-center px-2 py-1 rounded-md text-xs font-medium bg-brand-50 text-brand-700 border border-brand-100">
|
||||
@@ -372,6 +395,11 @@ const getIcon = (type: string) => {
|
||||
<option value="general">{{ t('admin.platformApps.generalGuide') }}</option>
|
||||
<option value="training_video" :disabled="form.file_type !== 'video'">{{ t('admin.platformApps.trainingVideo') }}</option>
|
||||
<option value="training_exam_pdf" :disabled="form.file_type !== 'pdf'">{{ t('admin.platformApps.trainingExamPdf') }}</option>
|
||||
<option value="training_safety_company_video" :disabled="form.file_type !== 'video'">{{ t('admin.platformApps.trainingSafetyCompanyVideo') }}</option>
|
||||
<option value="training_safety_department_video" :disabled="form.file_type !== 'video'">{{ t('admin.platformApps.trainingSafetyDepartmentVideo') }}</option>
|
||||
<option value="training_safety_team_video" :disabled="form.file_type !== 'video'">{{ t('admin.platformApps.trainingSafetyTeamVideo') }}</option>
|
||||
<option value="training_safety_video" :disabled="form.file_type !== 'video'">{{ t('admin.platformApps.trainingSafetyVideo') }}</option>
|
||||
<option value="training_safety_pdf" :disabled="form.file_type !== 'pdf'">{{ t('admin.platformApps.trainingSafetyPdf') }}</option>
|
||||
</select>
|
||||
<p class="text-xs text-muted">{{ t('admin.platformApps.guideUsageHint') }}</p>
|
||||
</div>
|
||||
|
||||
Reference in new issue
Block a user