feat(i18n): 将前端用户可见中文硬编码改为四语言
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
1 parent
dce915ea30
commit
ac7b53a523
105 files changed
+2928
-647
No files matched your search
@@ -2,10 +2,11 @@
|
||||
/**
|
||||
* features/chat/components/ChatAssetHistoryDialog.vue
|
||||
* 用途:展示固定资产履历候选文件列表,并复用既有文件预览弹窗打开具体履历。
|
||||
* 依赖:聊天页 useChatPage 提供的查询状态与打开预览回调。
|
||||
* 依赖:vue-i18n、聊天页 useChatPage 提供的查询状态与打开预览回调。
|
||||
* 逻辑:用户点击资产编号后打开;先显示检索状态,再列出共享盘匹配文件,点击单条文件进入预览。
|
||||
*/
|
||||
import { computed } from 'vue';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import { ExternalLink, FileText, Loader2, X } from 'lucide-vue-next';
|
||||
import type { AssetHistoryFileItem } from '../types/chat.types';
|
||||
|
||||
@@ -24,7 +25,8 @@ const emit = defineEmits<{
|
||||
openPreview: [item: AssetHistoryFileItem];
|
||||
}>();
|
||||
|
||||
const titleText = computed(() => props.assetId || props.assetName || '资产履历');
|
||||
const { t } = useI18n();
|
||||
const titleText = computed(() => props.assetId || props.assetName || t('chat.assetHistory.title'));
|
||||
</script>
|
||||
|
||||
<template>
|
||||
@@ -36,17 +38,17 @@ const titleText = computed(() => props.assetId || props.assetName || '资产履
|
||||
<div class="dialog-panel flex max-h-[88vh] w-[min(96vw,900px)] max-w-[900px] flex-col">
|
||||
<div class="dialog-header">
|
||||
<div>
|
||||
<h3 class="section-title">资产履历</h3>
|
||||
<p class="section-desc mt-1">当前资产:{{ titleText }}</p>
|
||||
<h3 class="section-title">{{ $t('chat.assetHistory.title') }}</h3>
|
||||
<p class="section-desc mt-1">{{ $t('chat.assetHistory.currentAsset', { name: titleText }) }}</p>
|
||||
</div>
|
||||
<button type="button" class="btn-icon-ds" aria-label="关闭" @click="emit('close')">
|
||||
<button type="button" class="btn-icon-ds" :aria-label="$t('common.close')" @click="emit('close')">
|
||||
<X class="h-5 w-5" />
|
||||
</button>
|
||||
</div>
|
||||
<div class="dialog-body flex min-h-0 flex-1 flex-col gap-4 border-t-0 pt-4">
|
||||
<div v-if="loading" class="flex h-56 items-center justify-center text-sm text-muted">
|
||||
<Loader2 class="mr-2 h-5 w-5 animate-spin text-brand-500" />
|
||||
正在检索共享盘履历文件...
|
||||
{{ $t('chat.assetHistory.searching') }}
|
||||
</div>
|
||||
<div v-else-if="error" class="rounded-xl border border-red-200 bg-red-50 px-4 py-3 text-sm text-red-700">
|
||||
{{ error }}
|
||||
@@ -55,7 +57,7 @@ const titleText = computed(() => props.assetId || props.assetName || '资产履
|
||||
v-else-if="items.length === 0"
|
||||
class="flex h-56 items-center justify-center rounded-2xl border border-dashed border-default bg-surface-soft text-sm text-muted"
|
||||
>
|
||||
未找到匹配的履历文件
|
||||
{{ $t('chat.assetHistory.empty') }}
|
||||
</div>
|
||||
<div v-else class="min-h-0 flex-1 overflow-auto rounded-2xl border border-default bg-surface">
|
||||
<div
|
||||
@@ -70,9 +72,9 @@ const titleText = computed(() => props.assetId || props.assetName || '资产履
|
||||
</div>
|
||||
<div class="mt-1 break-all text-xs text-secondary">{{ item.relative_path }}</div>
|
||||
<div class="mt-2 flex flex-wrap gap-3 text-xs text-muted">
|
||||
<span v-if="item.modified_at">修改时间:{{ item.modified_at }}</span>
|
||||
<span v-if="item.size_bytes">大小:{{ Math.max(1, Math.round(item.size_bytes / 1024)) }} KB</span>
|
||||
<span v-if="item.match_reason">匹配方式:{{ item.match_reason }}</span>
|
||||
<span v-if="item.modified_at">{{ $t('chat.assetHistory.modifiedAt', { time: item.modified_at }) }}</span>
|
||||
<span v-if="item.size_bytes">{{ $t('chat.assetHistory.sizeKb', { size: Math.max(1, Math.round(item.size_bytes / 1024)) }) }}</span>
|
||||
<span v-if="item.match_reason">{{ $t('chat.assetHistory.matchReason', { reason: item.match_reason }) }}</span>
|
||||
</div>
|
||||
</div>
|
||||
<button
|
||||
@@ -81,7 +83,7 @@ const titleText = computed(() => props.assetId || props.assetName || '资产履
|
||||
@click="emit('openPreview', item)"
|
||||
>
|
||||
<ExternalLink class="h-4 w-4" />
|
||||
查看履历
|
||||
{{ $t('chat.assetHistory.viewFile') }}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
/**
|
||||
* features/chat/components/ChatGuideModal.vue
|
||||
* Agent 学习之窗:指南目录与视频 / PDF / 图片预览。
|
||||
* 用途:Agent 学习之窗弹窗,展示指南目录与视频 / PDF / 图片预览。
|
||||
* 依赖:lucide-vue-next、useChatGuides.AgentGuide、vue-i18n($t)。
|
||||
* 逻辑:由 Chat 页打开;目录折叠/展开与空态文案走 chat.guide.* / chat.learningWindow。
|
||||
*/
|
||||
<script setup lang="ts">
|
||||
import { BookOpen, FileText, Image as ImageIcon, PanelLeftClose, PanelLeftOpen, Play, X } from 'lucide-vue-next';
|
||||
@@ -27,7 +29,7 @@ defineProps<{
|
||||
<div class="flex shrink-0 items-center justify-between border-b border-default bg-surface px-6 py-4">
|
||||
<h3 class="flex items-center gap-2 text-lg font-bold text-primary">
|
||||
<BookOpen class="h-5 w-5 text-brand-600" />
|
||||
{{ agentName }} - 学习之窗
|
||||
{{ agentName }} - {{ $t('chat.learningWindow') }}
|
||||
</h3>
|
||||
<div class="flex items-center gap-3">
|
||||
<button
|
||||
@@ -36,7 +38,7 @@ defineProps<{
|
||||
@click="showSidebar = !showSidebar"
|
||||
>
|
||||
<component :is="showSidebar ? PanelLeftClose : PanelLeftOpen" class="h-4 w-4" />
|
||||
{{ showSidebar ? '收起目录' : '展开目录' }}
|
||||
{{ showSidebar ? $t('chat.guide.collapseToc') : $t('chat.guide.expandToc') }}
|
||||
</button>
|
||||
<div class="h-5 w-px bg-default" />
|
||||
<button
|
||||
@@ -104,7 +106,7 @@ defineProps<{
|
||||
</template>
|
||||
<div v-else class="flex flex-col items-center gap-3 text-muted">
|
||||
<BookOpen class="h-12 w-12 opacity-20" />
|
||||
<p class="text-sm">请选择左侧指南进行查阅</p>
|
||||
<p class="text-sm">{{ $t('chat.guide.selectHint') }}</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -520,7 +520,7 @@ watch(
|
||||
class="rounded-full border border-default bg-surface-soft px-3 py-1 font-medium text-secondary transition-colors hover:bg-surface-soft/70"
|
||||
@click="emit('use-shipping-suggested-prompt')"
|
||||
>
|
||||
{{ shippingSuggestedPrompt || '推荐问题' }}
|
||||
{{ shippingSuggestedPrompt || $t('chat.recommendedQuestion') }}
|
||||
</button>
|
||||
<span>{{ t('chat.shippingNoticeConfirmBatchHint') }}</span>
|
||||
</div>
|
||||
@@ -557,7 +557,7 @@ watch(
|
||||
<button
|
||||
type="button"
|
||||
:disabled="isThinking || isUploadingAttachments"
|
||||
title="附件"
|
||||
:title="$t('chat.attachmentsUi.title')"
|
||||
class="flex h-9 w-9 items-center justify-center rounded-lg text-muted transition-colors hover:text-brand-600 disabled:cursor-not-allowed disabled:opacity-50"
|
||||
@click="toggleAttachmentMenu"
|
||||
>
|
||||
@@ -574,7 +574,7 @@ watch(
|
||||
@click="selectAttachmentLocal"
|
||||
>
|
||||
<Paperclip class="h-4 w-4 text-brand-500" />
|
||||
上传本地文件
|
||||
{{ $t('chat.attachmentsUi.uploadLocal') }}
|
||||
</button>
|
||||
<button
|
||||
v-if="attachmentPolicy.canRemote"
|
||||
@@ -583,7 +583,7 @@ watch(
|
||||
@click="selectAttachmentUrl"
|
||||
>
|
||||
<Link2 class="h-4 w-4 text-brand-500" />
|
||||
粘贴 URL
|
||||
{{ $t('chat.attachmentsUi.pasteUrl') }}
|
||||
</button>
|
||||
<div v-if="showAttachmentUrlPanel" class="px-3 py-2">
|
||||
<div class="flex items-center gap-2">
|
||||
@@ -591,7 +591,7 @@ watch(
|
||||
ref="attachmentUrlInputRef"
|
||||
v-model="attachmentUrlInput"
|
||||
:disabled="isThinking || isUploadingAttachments"
|
||||
placeholder="粘贴附件 URL(http/https)"
|
||||
:placeholder="$t('chat.attachmentsUi.urlPlaceholder')"
|
||||
class="flex-1 rounded-lg border border-default bg-surface-soft px-3 py-2 text-xs text-secondary placeholder-slate-400 focus:outline-none focus:ring-0"
|
||||
@keydown.enter.prevent="submitRemoteUrl"
|
||||
/>
|
||||
@@ -599,7 +599,7 @@ watch(
|
||||
type="button"
|
||||
:disabled="isThinking || isUploadingAttachments"
|
||||
class="flex h-9 w-9 items-center justify-center rounded-lg border border-default text-muted transition-colors hover:bg-surface-soft disabled:cursor-not-allowed disabled:opacity-50"
|
||||
title="添加"
|
||||
:title="$t('chat.attachmentsUi.add')"
|
||||
@click="submitRemoteUrl"
|
||||
>
|
||||
<Check class="h-4 w-4" />
|
||||
@@ -608,7 +608,7 @@ watch(
|
||||
type="button"
|
||||
:disabled="isThinking || isUploadingAttachments"
|
||||
class="flex h-9 w-9 items-center justify-center rounded-lg border border-default text-muted transition-colors hover:bg-surface-soft disabled:cursor-not-allowed disabled:opacity-50"
|
||||
title="取消"
|
||||
:title="$t('chat.attachmentsUi.cancel')"
|
||||
@click="closeAttachmentMenu"
|
||||
>
|
||||
<X class="h-4 w-4" />
|
||||
|
||||
@@ -75,7 +75,7 @@ onBeforeUnmount(() => {
|
||||
@click="emit('open-guide')"
|
||||
>
|
||||
<BookOpen class="h-4 w-4" />
|
||||
学习之窗
|
||||
{{ $t('chat.learningWindow') }}
|
||||
</button>
|
||||
</div>
|
||||
<div class="flex items-center gap-1">
|
||||
|
||||
@@ -1,9 +1,12 @@
|
||||
/**
|
||||
* features/chat/components/ChatQueryPreviewDialog.vue
|
||||
* Text2SQL 查询结果全量预览弹窗 UI。
|
||||
* 依赖:vue-i18n、useChatQueryPreview 状态。
|
||||
* 逻辑:列名匹配仍兼容服务端中文表头与本地化后的展示标签,避免切语言后丢失资产编号/图片交互。
|
||||
*/
|
||||
<script setup lang="ts">
|
||||
import { computed } from 'vue';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import { Loader2, X } from 'lucide-vue-next';
|
||||
import type { QueryPreviewState } from '../composables/useChatQueryPreview';
|
||||
|
||||
@@ -22,15 +25,32 @@ const emit = defineEmits<{
|
||||
'open-asset-image': [payload: { assetId: string; assetName: string }];
|
||||
}>();
|
||||
|
||||
const { t } = useI18n();
|
||||
|
||||
/** 判断列是否命中资产编号(服务端中文表头或本地化标签)。 */
|
||||
function matchesAssetIdColumn(column: string): boolean {
|
||||
return column === '资产编号' || column === t('chat.assetColumns.assetId');
|
||||
}
|
||||
|
||||
/** 判断列是否命中资产名称。 */
|
||||
function matchesAssetNameColumn(column: string): boolean {
|
||||
return column === '资产名称' || column === t('chat.assetColumns.assetName');
|
||||
}
|
||||
|
||||
/** 判断列是否命中图片。 */
|
||||
function matchesImageColumn(column: string): boolean {
|
||||
return column === '图片' || column === t('chat.assetColumns.image');
|
||||
}
|
||||
|
||||
const totalPages = computed(() =>
|
||||
Math.max(1, Math.ceil((props.state.total || 0) / (props.state.pageSize || 100))),
|
||||
);
|
||||
const assetIdColumnIndex = computed(() => props.state.columns.findIndex((column) => column === '资产编号'));
|
||||
const assetNameColumnIndex = computed(() => props.state.columns.findIndex((column) => column === '资产名称'));
|
||||
const imageColumnIndex = computed(() => props.state.columns.findIndex((column) => column === '图片'));
|
||||
const assetIdColumnIndex = computed(() => props.state.columns.findIndex((column) => matchesAssetIdColumn(column)));
|
||||
const assetNameColumnIndex = computed(() => props.state.columns.findIndex((column) => matchesAssetNameColumn(column)));
|
||||
const imageColumnIndex = computed(() => props.state.columns.findIndex((column) => matchesImageColumn(column)));
|
||||
|
||||
function isHighlightColumn(column: string): boolean {
|
||||
return column === '资产编号' || column === '图片';
|
||||
return matchesAssetIdColumn(column) || matchesImageColumn(column);
|
||||
}
|
||||
|
||||
function normalizeCellText(cell: unknown): string {
|
||||
@@ -68,16 +88,16 @@ function emitAssetAction(row: unknown[], cellIndex: number): void {
|
||||
<div class="dialog-panel flex max-h-[88vh] w-[min(96vw,1280px)] max-w-[1280px] flex-col">
|
||||
<div class="dialog-header">
|
||||
<div>
|
||||
<h3 class="section-title">查询结果全量预览</h3>
|
||||
<h3 class="section-title">{{ $t('chat.queryPreview.title') }}</h3>
|
||||
<p class="section-desc mt-1">{{ state.query || state.title }}</p>
|
||||
</div>
|
||||
<button type="button" class="btn-icon-ds" aria-label="关闭" @click="emit('close')">
|
||||
<button type="button" class="btn-icon-ds" :aria-label="$t('common.close')" @click="emit('close')">
|
||||
<X class="h-5 w-5" />
|
||||
</button>
|
||||
</div>
|
||||
<div class="dialog-body flex min-h-0 flex-1 flex-col gap-4 border-t-0 pt-4">
|
||||
<div class="flex flex-wrap items-center justify-between gap-3 rounded-xl border border-default bg-surface-soft px-4 py-3 text-sm text-secondary">
|
||||
<div>共 {{ state.total || 0 }} 条,当前第 {{ state.page }} / {{ totalPages }} 页</div>
|
||||
<div>{{ $t('chat.queryPreview.summary', { total: state.total || 0, page: state.page, pages: totalPages }) }}</div>
|
||||
<div class="flex items-center gap-2">
|
||||
<button
|
||||
type="button"
|
||||
@@ -85,7 +105,7 @@ function emitAssetAction(row: unknown[], cellIndex: number): void {
|
||||
:disabled="loading || state.page <= 1"
|
||||
@click="emit('change-page', -1)"
|
||||
>
|
||||
上一页
|
||||
{{ $t('chat.queryPreview.prev') }}
|
||||
</button>
|
||||
<button
|
||||
type="button"
|
||||
@@ -93,7 +113,7 @@ function emitAssetAction(row: unknown[], cellIndex: number): void {
|
||||
:disabled="loading || state.page >= totalPages"
|
||||
@click="emit('change-page', 1)"
|
||||
>
|
||||
下一页
|
||||
{{ $t('chat.queryPreview.next') }}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
@@ -105,7 +125,7 @@ function emitAssetAction(row: unknown[], cellIndex: number): void {
|
||||
<Loader2 class="h-6 w-6 animate-spin text-brand-500" />
|
||||
</div>
|
||||
<div v-else-if="!state.columns.length" class="flex h-56 items-center justify-center text-sm text-muted">
|
||||
暂无可预览数据
|
||||
{{ $t('chat.queryPreview.empty') }}
|
||||
</div>
|
||||
<table v-else class="min-w-full border-collapse text-sm">
|
||||
<thead class="sticky top-0 z-10 bg-slate-50">
|
||||
|
||||
@@ -167,7 +167,7 @@ const userInitial = (fallback: string) => {
|
||||
@click="emit('open-guide')"
|
||||
>
|
||||
<BookOpen class="h-4 w-4" />
|
||||
学习之窗
|
||||
{{ $t('chat.learningWindow') }}
|
||||
</button>
|
||||
</div>
|
||||
<span v-if="agentDescription" class="mt-1 block cursor-help truncate text-[11px] text-muted">
|
||||
@@ -278,7 +278,7 @@ const userInitial = (fallback: string) => {
|
||||
class="flex h-10 min-w-[2.5rem] items-center justify-center rounded-full bg-brand-600 px-3 text-sm font-bold text-white shadow-sm shadow-brand-500/20 transition-colors hover:bg-brand-700"
|
||||
@click="showUserDropdown = !showUserDropdown"
|
||||
>
|
||||
退出
|
||||
{{ $t('chat.exitShort') }}
|
||||
</button>
|
||||
|
||||
<div
|
||||
|
||||
@@ -72,7 +72,7 @@ async function handleQueryPreviewAssetImage(assetId: string, assetName: string)
|
||||
>
|
||||
<div class="flex items-center gap-2 rounded-full border border-brand-200 bg-white/95 px-4 py-2 text-sm text-brand-700 shadow-lg backdrop-blur">
|
||||
<Loader2 class="h-4 w-4 animate-spin text-brand-500" />
|
||||
<span>正在搜索该资产的履历资料,请耐心等待...</span>
|
||||
<span>{{ page.t('chat.assetHistory.searchingToast') }}</span>
|
||||
</div>
|
||||
</div>
|
||||
<div
|
||||
@@ -81,7 +81,7 @@ async function handleQueryPreviewAssetImage(assetId: string, assetName: string)
|
||||
>
|
||||
<div class="flex items-center gap-2 rounded-full border border-brand-200 bg-white/95 px-4 py-2 text-sm text-brand-700 shadow-lg backdrop-blur">
|
||||
<Loader2 class="h-4 w-4 animate-spin text-brand-500" />
|
||||
<span>正在搜索该资产的图片资料,请耐心等待...</span>
|
||||
<span>{{ page.t('chat.assetImage.searchingToast') }}</span>
|
||||
</div>
|
||||
</div>
|
||||
<ChatLeaveAgentDialog
|
||||
|
||||
@@ -1,5 +1,12 @@
|
||||
<script setup lang="ts">
|
||||
/**
|
||||
* features/chat/components/ToolRunProgressCard.vue
|
||||
* 用途:展示文件检核等 Agent 异步 tool_run 的实时进度、知识库同步态与 Excel 下载。
|
||||
* 依赖:vue-i18n、lucide 图标、getAuthHeaders、toolRunProgress.api。
|
||||
* 逻辑:由聊天消息列表在绑定 run_id 后挂载;轮询结果经 props.run 传入,本组件只负责展示与下载。
|
||||
*/
|
||||
import { ref } from 'vue';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import { AlertCircle, CheckCircle2, Clock3, Download, Loader2 } from 'lucide-vue-next';
|
||||
import { getAuthHeaders } from '@/shared/utils/auth';
|
||||
import type { ToolRunProgress } from '../api/toolRunProgress.api';
|
||||
@@ -12,19 +19,26 @@ const props = defineProps<{
|
||||
fallbackTitle?: string;
|
||||
}>();
|
||||
|
||||
const { t } = useI18n();
|
||||
const downloadingExcel = ref(false);
|
||||
const downloadError = ref('');
|
||||
|
||||
/**
|
||||
* 将后端 run.status 映射为本地化状态文案。
|
||||
* 核心逻辑:命中已知状态码用 i18n;未知状态回退原始值,再回退“等待中”。
|
||||
* @param status - 任务状态码
|
||||
* @returns 面向用户的状态标签
|
||||
*/
|
||||
const statusLabel = (status?: string) => {
|
||||
const map: Record<string, string> = {
|
||||
running: '执行中',
|
||||
success: '已完成',
|
||||
partial_failed: '部分失败',
|
||||
failed: '失败',
|
||||
cancelled: '已取消',
|
||||
canceled: '已取消',
|
||||
running: t('chat.toolRun.statusRunning'),
|
||||
success: t('chat.toolRun.statusSuccess'),
|
||||
partial_failed: t('chat.toolRun.statusPartialFailed'),
|
||||
failed: t('chat.toolRun.statusFailed'),
|
||||
cancelled: t('chat.toolRun.statusCancelled'),
|
||||
canceled: t('chat.toolRun.statusCancelled'),
|
||||
};
|
||||
return map[String(status || '')] || status || '等待中';
|
||||
return map[String(status || '')] || status || t('chat.toolRun.statusWaiting');
|
||||
};
|
||||
|
||||
const formatTime = (value?: string | null) => {
|
||||
@@ -52,21 +66,30 @@ const percent = () => {
|
||||
return Math.max(0, Math.min(value, 100));
|
||||
};
|
||||
|
||||
/**
|
||||
* 组装知识库同步徽标文案与样式。
|
||||
* 核心逻辑:按 sync_status 分桶映射 tone/icon;未知状态带上原始 status。
|
||||
* @param status - knowledge_base.sync_status
|
||||
*/
|
||||
const kbSyncMeta = (status?: string | null) => {
|
||||
const value = String(status || '').toLowerCase();
|
||||
if (value === 'success') {
|
||||
return { label: '知识库已同步', tone: 'border-emerald-200 bg-emerald-50 text-emerald-700', icon: 'success' };
|
||||
return { label: t('chat.toolRun.kbSynced'), tone: 'border-emerald-200 bg-emerald-50 text-emerald-700', icon: 'success' };
|
||||
}
|
||||
if (value === 'failed') {
|
||||
return { label: '知识库同步失败', tone: 'border-rose-200 bg-rose-50 text-rose-700', icon: 'failed' };
|
||||
return { label: t('chat.toolRun.kbSyncFailed'), tone: 'border-rose-200 bg-rose-50 text-rose-700', icon: 'failed' };
|
||||
}
|
||||
if (['queued', 'cleaning', 'syncing'].includes(value)) {
|
||||
return { label: '知识库同步中', tone: 'border-sky-200 bg-sky-50 text-sky-700', icon: 'syncing' };
|
||||
return { label: t('chat.toolRun.kbSyncing'), tone: 'border-sky-200 bg-sky-50 text-sky-700', icon: 'syncing' };
|
||||
}
|
||||
if (value === 'skipped') {
|
||||
return { label: '知识库未同步', tone: 'border-slate-200 bg-slate-50 text-slate-600', icon: 'skipped' };
|
||||
return { label: t('chat.toolRun.kbNotSynced'), tone: 'border-slate-200 bg-slate-50 text-slate-600', icon: 'skipped' };
|
||||
}
|
||||
return { label: `知识库:${status || '未知'}`, tone: 'border-slate-200 bg-slate-50 text-slate-600', icon: 'skipped' };
|
||||
return {
|
||||
label: t('chat.toolRun.kbUnknown', { status: status || t('chat.toolRun.kbStatusUnknown') }),
|
||||
tone: 'border-slate-200 bg-slate-50 text-slate-600',
|
||||
icon: 'skipped',
|
||||
};
|
||||
};
|
||||
|
||||
const parseDownloadFilename = (disposition: string | null, fallback: string) => {
|
||||
@@ -99,7 +122,7 @@ const downloadExcel = async () => {
|
||||
const res = await fetch(url, { headers: getAuthHeaders() });
|
||||
if (!res.ok) {
|
||||
const body = await res.json().catch(() => ({}));
|
||||
throw new Error(stringifyDownloadError(body, `下载失败:${res.status}`));
|
||||
throw new Error(stringifyDownloadError(body, t('chat.toolRun.downloadFailedStatus', { status: res.status })));
|
||||
}
|
||||
const blob = await res.blob();
|
||||
const filename = parseDownloadFilename(
|
||||
@@ -115,7 +138,7 @@ const downloadExcel = async () => {
|
||||
document.body.removeChild(link);
|
||||
URL.revokeObjectURL(objectUrl);
|
||||
} catch (e: any) {
|
||||
downloadError.value = e?.message || '下载 Excel 失败';
|
||||
downloadError.value = e?.message || t('chat.toolRun.downloadFailed');
|
||||
} finally {
|
||||
downloadingExcel.value = false;
|
||||
}
|
||||
@@ -133,20 +156,20 @@ const downloadExcel = async () => {
|
||||
<CheckCircle2 v-else-if="run?.status === 'success'" class="h-4 w-4 text-emerald-600" />
|
||||
<AlertCircle v-else-if="run?.status === 'failed' || run?.status === 'partial_failed'" class="h-4 w-4 text-amber-600" />
|
||||
<Clock3 v-else class="h-4 w-4 text-sky-600" />
|
||||
{{ run?.title || fallbackTitle || '任务进度' }}
|
||||
{{ run?.title || fallbackTitle || $t('chat.toolRun.fallbackTitle') }}
|
||||
</div>
|
||||
<p class="mt-1 text-xs text-slate-500">
|
||||
<template v-if="run">
|
||||
批次:{{ run.run_no }} · 状态:{{ statusLabel(run.status) }}
|
||||
<span v-if="run.error_message" class="ml-2 text-rose-700">错误信息:{{ run.error_message }}</span>
|
||||
{{ $t('chat.toolRun.batch', { runNo: run.run_no }) }} · {{ $t('chat.toolRun.status', { status: statusLabel(run.status) }) }}
|
||||
<span v-if="run.error_message" class="ml-2 text-rose-700">{{ $t('chat.toolRun.errorMessage', { message: run.error_message }) }}</span>
|
||||
</template>
|
||||
<template v-else-if="loading || waiting">正在等待检核任务启动...</template>
|
||||
<template v-else-if="loading || waiting">{{ $t('chat.toolRun.waitingStart') }}</template>
|
||||
<template v-else-if="error">{{ error }}</template>
|
||||
</p>
|
||||
<p v-if="run?.status === 'running' && run.current_step" class="mt-1 text-xs text-sky-700">
|
||||
当前阶段:{{ run.current_step.label || run.current_step.step }}
|
||||
<span v-if="run.current_step.row_id"> · 当前记录:{{ run.current_step.row_id }}</span>
|
||||
<span v-if="run.current_step.started_at"> · 阶段开始:{{ formatTime(run.current_step.started_at) }}</span>
|
||||
{{ $t('chat.toolRun.currentStep', { step: run.current_step.label || run.current_step.step }) }}
|
||||
<span v-if="run.current_step.row_id"> · {{ $t('chat.toolRun.currentRow', { rowId: run.current_step.row_id }) }}</span>
|
||||
<span v-if="run.current_step.started_at"> · {{ $t('chat.toolRun.stepStarted', { time: formatTime(run.current_step.started_at) }) }}</span>
|
||||
</p>
|
||||
</div>
|
||||
<div class="flex shrink-0 flex-wrap items-center justify-end gap-2">
|
||||
@@ -171,7 +194,7 @@ const downloadExcel = async () => {
|
||||
>
|
||||
<Loader2 v-if="downloadingExcel" class="h-3.5 w-3.5 animate-spin" />
|
||||
<Download v-else class="h-3.5 w-3.5" />
|
||||
{{ downloadingExcel ? '下载中...' : '下载 Excel' }}
|
||||
{{ downloadingExcel ? $t('chat.toolRun.downloading') : $t('chat.toolRun.downloadExcel') }}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
@@ -188,47 +211,47 @@ const downloadExcel = async () => {
|
||||
></div>
|
||||
</div>
|
||||
<div class="flex flex-wrap items-center justify-between gap-2 text-xs text-slate-500">
|
||||
<span>进度 {{ percent() }}%</span>
|
||||
<span>开始:{{ formatTime(run.started_at) }} · 完成:{{ formatTime(run.finished_at) }}</span>
|
||||
<span>{{ $t('chat.toolRun.progress', { percent: percent() }) }}</span>
|
||||
<span>{{ $t('chat.toolRun.startedAt', { time: formatTime(run.started_at) }) }} · {{ $t('chat.toolRun.finishedAt', { time: formatTime(run.finished_at) }) }}</span>
|
||||
</div>
|
||||
|
||||
<div class="grid grid-cols-2 gap-1.5 sm:grid-cols-4 lg:grid-cols-8">
|
||||
<div class="rounded-lg bg-white/80 px-2 py-1.5">
|
||||
<div class="whitespace-nowrap text-xs text-slate-500">总数</div>
|
||||
<div class="whitespace-nowrap text-xs text-slate-500">{{ $t('chat.toolRun.total') }}</div>
|
||||
<div class="text-base font-bold text-slate-800">{{ run.total_count }}</div>
|
||||
</div>
|
||||
<div class="rounded-lg bg-white/80 px-2 py-1.5">
|
||||
<div class="whitespace-nowrap text-xs text-slate-500">已处理</div>
|
||||
<div class="whitespace-nowrap text-xs text-slate-500">{{ $t('chat.toolRun.processed') }}</div>
|
||||
<div class="text-base font-bold text-sky-700">{{ run.processed_count }}</div>
|
||||
</div>
|
||||
<div class="rounded-lg bg-white/80 px-2 py-1.5">
|
||||
<div class="whitespace-nowrap text-xs text-slate-500">成功</div>
|
||||
<div class="whitespace-nowrap text-xs text-slate-500">{{ $t('chat.toolRun.success') }}</div>
|
||||
<div class="text-base font-bold text-emerald-700">{{ run.success_count }}</div>
|
||||
</div>
|
||||
<div class="rounded-lg bg-white/80 px-2 py-1.5">
|
||||
<div class="whitespace-nowrap text-xs text-slate-500">失败</div>
|
||||
<div class="whitespace-nowrap text-xs text-slate-500">{{ $t('chat.toolRun.failed') }}</div>
|
||||
<div class="text-base font-bold text-rose-700">{{ run.failed_count }}</div>
|
||||
</div>
|
||||
<div class="rounded-lg bg-white/80 px-2 py-1.5">
|
||||
<div class="whitespace-nowrap text-xs text-slate-500">跳过</div>
|
||||
<div class="whitespace-nowrap text-xs text-slate-500">{{ $t('chat.toolRun.skipped') }}</div>
|
||||
<div class="text-base font-bold text-amber-700">{{ run.skipped_count }}</div>
|
||||
</div>
|
||||
<div class="rounded-lg bg-white/80 px-2 py-1.5">
|
||||
<div class="whitespace-nowrap text-xs text-slate-500">合格笔数</div>
|
||||
<div class="whitespace-nowrap text-xs text-slate-500">{{ $t('chat.toolRun.qualified') }}</div>
|
||||
<div class="text-base font-bold text-emerald-700">{{ run.judgement?.qualified_count ?? 0 }}</div>
|
||||
</div>
|
||||
<div class="rounded-lg bg-white/80 px-2 py-1.5">
|
||||
<div class="whitespace-nowrap text-xs text-slate-500">不合格笔数</div>
|
||||
<div class="whitespace-nowrap text-xs text-slate-500">{{ $t('chat.toolRun.unqualified') }}</div>
|
||||
<div class="text-base font-bold text-rose-700">{{ run.judgement?.unqualified_count ?? 0 }}</div>
|
||||
</div>
|
||||
<div class="rounded-lg bg-white/80 px-2 py-1.5">
|
||||
<div class="whitespace-nowrap text-xs text-slate-500">人工判定笔数</div>
|
||||
<div class="whitespace-nowrap text-xs text-slate-500">{{ $t('chat.toolRun.manual') }}</div>
|
||||
<div class="text-base font-bold text-amber-700">{{ run.judgement?.manual_count ?? 0 }}</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div v-if="run.knowledge_base?.error_message" class="rounded-xl bg-amber-50 px-3 py-2 text-xs text-amber-700">
|
||||
知识库同步错误:{{ run.knowledge_base.error_message }}
|
||||
{{ $t('chat.toolRun.kbSyncError', { message: run.knowledge_base.error_message }) }}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -236,7 +259,7 @@ const downloadExcel = async () => {
|
||||
<div class="h-2.5 overflow-hidden rounded-full bg-slate-200">
|
||||
<div class="h-full w-1/3 animate-pulse rounded-full bg-gradient-to-r from-sky-400 to-emerald-400" />
|
||||
</div>
|
||||
<p class="text-xs text-slate-500">检核启动后,这里会显示实时进度。</p>
|
||||
<p class="text-xs text-slate-500">{{ $t('chat.toolRun.waitingHint') }}</p>
|
||||
</div>
|
||||
</section>
|
||||
</template>
|
||||
@@ -6,6 +6,7 @@
|
||||
*/
|
||||
<script setup lang="ts">
|
||||
import { computed, nextTick, ref, watch } from 'vue';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import { Check, Copy, Download, Edit2, Eye, LayoutGrid, MessageSquareText, RotateCw, X } from 'lucide-vue-next';
|
||||
import { useAuthStore } from '@/features/auth/stores/auth.store';
|
||||
import LeaveMessageBlock, { type LeaveMessageHandlers } from './LeaveMessageBlock.vue';
|
||||
@@ -85,6 +86,7 @@ const emit = defineEmits<{
|
||||
}>();
|
||||
|
||||
const authStore = useAuthStore();
|
||||
const { t } = useI18n();
|
||||
const INLINE_DOWNLOAD_ALLOWED_EMPLOYEE_ID = '17070141';
|
||||
const RESTRICTED_INLINE_DOWNLOAD_FILE_NAME = '资产明细全量导出表.csv';
|
||||
|
||||
@@ -149,56 +151,57 @@ interface InlineFileEntry {
|
||||
table: InlinePreviewTable;
|
||||
}
|
||||
|
||||
const FIXED_ASSET_HEADER_LABELS: Record<string, string> = {
|
||||
id: '序号',
|
||||
asset_id: '资产编号',
|
||||
asset_no: '资产编号',
|
||||
asset_name: '资产名称',
|
||||
currency_amount: '本币金额(元)',
|
||||
specification: '规格型号',
|
||||
account_period: '账套',
|
||||
operating_center_code: '账套',
|
||||
custodian_person: '保管人',
|
||||
custodian_name: '保管人',
|
||||
custodian_dept: '保管部门',
|
||||
department_name: '保管部门',
|
||||
image: '图片',
|
||||
picture: '图片',
|
||||
storage_location: '存放位置名称',
|
||||
location_name: '存放位置名称',
|
||||
asset_status: '资产状态',
|
||||
reserved_field: '预留残值',
|
||||
residual_value: '预留残值',
|
||||
supplier: '供应商',
|
||||
vendor_name: '供应商',
|
||||
asset_nature: '资产性质',
|
||||
nature: '资产性质',
|
||||
amount_local: '本币金额(元)',
|
||||
unit_price: '本币金额(元)',
|
||||
quantity: '数量',
|
||||
unit: '计量单位',
|
||||
unit_of_measurement: '计量单位',
|
||||
acquisition_date: '取得时间',
|
||||
acquired_date: '取得时间',
|
||||
accounting_date: '入账日期',
|
||||
recorded_date: '入账日期',
|
||||
created_at: '创建时间',
|
||||
created_time: '创建时间',
|
||||
updated_at: '更新时间',
|
||||
snapshot_time: '快照时间',
|
||||
/** 英文字段名 → chat.assetColumns.* key(展示用;匹配仍用 aliases 中的中英文别名) */
|
||||
const FIXED_ASSET_HEADER_KEYS: Record<string, string> = {
|
||||
id: 'chat.assetColumns.id',
|
||||
asset_id: 'chat.assetColumns.assetId',
|
||||
asset_no: 'chat.assetColumns.assetId',
|
||||
asset_name: 'chat.assetColumns.assetName',
|
||||
currency_amount: 'chat.assetColumns.currencyAmount',
|
||||
specification: 'chat.assetColumns.specification',
|
||||
account_period: 'chat.assetColumns.accountPeriod',
|
||||
operating_center_code: 'chat.assetColumns.accountPeriod',
|
||||
custodian_person: 'chat.assetColumns.custodianPerson',
|
||||
custodian_name: 'chat.assetColumns.custodianPerson',
|
||||
custodian_dept: 'chat.assetColumns.custodianDept',
|
||||
department_name: 'chat.assetColumns.custodianDept',
|
||||
image: 'chat.assetColumns.image',
|
||||
picture: 'chat.assetColumns.image',
|
||||
storage_location: 'chat.assetColumns.storageLocation',
|
||||
location_name: 'chat.assetColumns.storageLocation',
|
||||
asset_status: 'chat.assetColumns.assetStatus',
|
||||
reserved_field: 'chat.assetColumns.residualValue',
|
||||
residual_value: 'chat.assetColumns.residualValue',
|
||||
supplier: 'chat.assetColumns.supplier',
|
||||
vendor_name: 'chat.assetColumns.supplier',
|
||||
asset_nature: 'chat.assetColumns.assetNature',
|
||||
nature: 'chat.assetColumns.assetNature',
|
||||
amount_local: 'chat.assetColumns.currencyAmount',
|
||||
unit_price: 'chat.assetColumns.currencyAmount',
|
||||
quantity: 'chat.assetColumns.quantity',
|
||||
unit: 'chat.assetColumns.unit',
|
||||
unit_of_measurement: 'chat.assetColumns.unit',
|
||||
acquisition_date: 'chat.assetColumns.acquisitionDate',
|
||||
acquired_date: 'chat.assetColumns.acquisitionDate',
|
||||
accounting_date: 'chat.assetColumns.accountingDate',
|
||||
recorded_date: 'chat.assetColumns.accountingDate',
|
||||
created_at: 'chat.assetColumns.createdAt',
|
||||
created_time: 'chat.assetColumns.createdAt',
|
||||
updated_at: 'chat.assetColumns.updatedAt',
|
||||
snapshot_time: 'chat.assetColumns.snapshotTime',
|
||||
};
|
||||
const FIXED_ASSET_CANONICAL_COLUMNS = [
|
||||
{ key: 'id', label: '序号', aliases: ['id', '序号'] },
|
||||
{ key: 'asset_id', label: '资产编号', aliases: ['asset_id', 'asset_no', '资产编号'] },
|
||||
{ key: 'asset_name', label: '资产名称', aliases: ['asset_name', '资产名称'] },
|
||||
{ key: 'custodian_person', label: '保管人', aliases: ['custodian_person', 'custodian_name', '保管人', '保管人姓名'] },
|
||||
{ key: 'custodian_dept', label: '保管部门', aliases: ['custodian_dept', 'department_name', '保管部门', '保管部门名称'] },
|
||||
{ key: 'image', label: '图片', aliases: ['image', 'picture', '图片'] },
|
||||
{ key: 'account_period', label: '账套', aliases: ['account_period', 'operating_center_code', '账套'] },
|
||||
{ key: 'supplier', label: '供应商', aliases: ['supplier', 'vendor_name', '供应商', '供应厂商'] },
|
||||
{ key: 'asset_status', label: '资产状态', aliases: ['asset_status', '资产状态'] },
|
||||
{ key: 'quantity', label: '数量', aliases: ['quantity', '数量'] },
|
||||
{ key: 'acquisition_date', label: '取得时间', aliases: ['acquisition_date', 'acquired_date', '取得时间', '取得日期'] },
|
||||
{ key: 'id', labelKey: 'chat.assetColumns.id', aliases: ['id', '序号'] },
|
||||
{ key: 'asset_id', labelKey: 'chat.assetColumns.assetId', aliases: ['asset_id', 'asset_no', '资产编号'] },
|
||||
{ key: 'asset_name', labelKey: 'chat.assetColumns.assetName', aliases: ['asset_name', '资产名称'] },
|
||||
{ key: 'custodian_person', labelKey: 'chat.assetColumns.custodianPerson', aliases: ['custodian_person', 'custodian_name', '保管人', '保管人姓名'] },
|
||||
{ key: 'custodian_dept', labelKey: 'chat.assetColumns.custodianDept', aliases: ['custodian_dept', 'department_name', '保管部门', '保管部门名称'] },
|
||||
{ key: 'image', labelKey: 'chat.assetColumns.image', aliases: ['image', 'picture', '图片'] },
|
||||
{ key: 'account_period', labelKey: 'chat.assetColumns.accountPeriod', aliases: ['account_period', 'operating_center_code', '账套'] },
|
||||
{ key: 'supplier', labelKey: 'chat.assetColumns.supplier', aliases: ['supplier', 'vendor_name', '供应商', '供应厂商'] },
|
||||
{ key: 'asset_status', labelKey: 'chat.assetColumns.assetStatus', aliases: ['asset_status', '资产状态'] },
|
||||
{ key: 'quantity', labelKey: 'chat.assetColumns.quantity', aliases: ['quantity', '数量'] },
|
||||
{ key: 'acquisition_date', labelKey: 'chat.assetColumns.acquisitionDate', aliases: ['acquisition_date', 'acquired_date', '取得时间', '取得日期'] },
|
||||
] as const;
|
||||
const INLINE_DIALOG_PAGE_SIZE = 15;
|
||||
|
||||
@@ -238,14 +241,15 @@ function parseCsvLine(line: string): string[] {
|
||||
}
|
||||
|
||||
/**
|
||||
* 将固定资产 CSV 的英文列名转换成面向业务展示的中文列名。
|
||||
* 将固定资产 CSV 的英文列名转换成面向业务展示的本地化列名。
|
||||
* 核心逻辑:优先命中已知字段映射;未知字段保留原值,避免误伤其他 Agent 的文件。
|
||||
* @param header - CSV 原始表头。
|
||||
* @returns 中文表头或原始表头。
|
||||
* @returns 本地化表头或原始表头。
|
||||
*/
|
||||
function localizeInlineTableHeader(header: string): string {
|
||||
const normalizedHeader = String(header || '').trim().toLowerCase();
|
||||
return FIXED_ASSET_HEADER_LABELS[normalizedHeader] || header || '-';
|
||||
const key = FIXED_ASSET_HEADER_KEYS[normalizedHeader];
|
||||
return key ? t(key) : (header || '-');
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -268,14 +272,14 @@ function formatInlineDateOnly(value: string): string {
|
||||
|
||||
/**
|
||||
* 统一表格中的空值展示。
|
||||
* 核心逻辑:对空串、短横线、null/none 等占位值统一显示“无”,但保留数字 0 与正常文本。
|
||||
* 核心逻辑:对空串、短横线、null/none 等占位值统一显示本地化“无”,但保留数字 0 与正常文本。
|
||||
* @param value - 原始单元格值。
|
||||
* @returns 归一化后的展示值。
|
||||
*/
|
||||
function normalizeInlineTableCell(value: string): string {
|
||||
const normalized = String(value ?? '').trim();
|
||||
if (!normalized) return '无';
|
||||
if (['-', '--', 'null', 'none', 'n/a', 'na'].includes(normalized.toLowerCase())) return '无';
|
||||
if (!normalized) return t('chat.assetColumns.empty');
|
||||
if (['-', '--', 'null', 'none', 'n/a', 'na'].includes(normalized.toLowerCase())) return t('chat.assetColumns.empty');
|
||||
return normalized;
|
||||
}
|
||||
|
||||
@@ -338,7 +342,7 @@ function serializeCsvRows(rows: string[][]): string {
|
||||
* @returns 规范化后的表头与数据行。
|
||||
*/
|
||||
function buildFixedAssetInlineTable(rawHeaders: string[], dataRows: string[][]): InlinePreviewTable {
|
||||
const headers = FIXED_ASSET_CANONICAL_COLUMNS.map((column) => column.label);
|
||||
const headers = FIXED_ASSET_CANONICAL_COLUMNS.map((column) => t(column.labelKey));
|
||||
const canonicalHeaders = FIXED_ASSET_CANONICAL_COLUMNS.map((column) => column.key);
|
||||
const allRows = dataRows.map((row, rowIndex) => FIXED_ASSET_CANONICAL_COLUMNS.map((column) => {
|
||||
if (column.key === 'id') return String(rowIndex + 1);
|
||||
@@ -352,7 +356,7 @@ function buildFixedAssetInlineTable(rawHeaders: string[], dataRows: string[][]):
|
||||
if (normalizedImageValue) {
|
||||
return normalizeInlineTableCell(normalizedImageValue);
|
||||
}
|
||||
return normalizedAssetId ? '查看' : '无';
|
||||
return normalizedAssetId ? t('chat.assetColumns.view') : t('chat.assetColumns.empty');
|
||||
}
|
||||
const columnIndex = findInlineTableHeaderIndex(rawHeaders, [...column.aliases]);
|
||||
const rawValue = columnIndex >= 0 ? row[columnIndex] ?? '' : '';
|
||||
@@ -573,7 +577,10 @@ function canOpenInlineAssetHistory(cellIndex: number, cellValue: string): boolea
|
||||
}
|
||||
|
||||
function isInlineHighlightHeader(header: string): boolean {
|
||||
return header === '资产编号' || header === '图片';
|
||||
return header === t('chat.assetColumns.assetId')
|
||||
|| header === t('chat.assetColumns.image')
|
||||
|| header === '资产编号'
|
||||
|| header === '图片';
|
||||
}
|
||||
|
||||
async function openInlineAssetHistory(row: string[], cellIndex: number): Promise<void> {
|
||||
@@ -911,7 +918,7 @@ function handleInlineDownload(file: InlineDownloadFile): void {
|
||||
<Download class="h-3.5 w-3.5" />
|
||||
{{ $t('chat.inlineFile.download') }}
|
||||
</button>
|
||||
<button type="button" class="btn-icon-ds" aria-label="关闭" @click="closeInlinePreviewDialog">
|
||||
<button type="button" class="btn-icon-ds" :aria-label="$t('common.close')" @click="closeInlinePreviewDialog">
|
||||
<X class="h-5 w-5" />
|
||||
</button>
|
||||
</div>
|
||||
|
||||
@@ -79,7 +79,7 @@ const { message, index, handlers } = defineProps<{
|
||||
@change="handlers.syncLeaveDuration(handlers.getLeaveFormPayload(message)!.form)"
|
||||
>
|
||||
<option value="" disabled>{{ $t('chat.selectLeaveType') }}</option>
|
||||
<option v-for="leaveType in LEAVE_TYPES" :key="leaveType.value" :value="leaveType.value">{{ leaveType.label }}</option>
|
||||
<option v-for="leaveType in LEAVE_TYPES" :key="leaveType.value" :value="leaveType.value">{{ $t(leaveType.labelKey) }}</option>
|
||||
</select>
|
||||
</label>
|
||||
<label class="space-y-1.5">
|
||||
|
||||
@@ -60,20 +60,20 @@ const emit = defineEmits<{
|
||||
<div class="flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between">
|
||||
<div>
|
||||
<div class="text-[11px] font-bold uppercase tracking-[0.15em] text-brand-600/80">
|
||||
第三步:逐题考试
|
||||
{{ $t('chat.training.stepExamTitle') }}
|
||||
</div>
|
||||
<h3 class="mt-1 text-lg font-bold text-slate-800">
|
||||
第 {{ currentQuestionIndex + 1 }} / {{ totalCount }} 题
|
||||
{{ $t('chat.training.exam.questionCounter', { current: currentQuestionIndex + 1, total: totalCount }) }}
|
||||
</h3>
|
||||
</div>
|
||||
<div class="flex flex-wrap gap-2 text-[13px]">
|
||||
<div class="rounded-lg bg-slate-50 px-3 py-1.5 font-medium text-slate-600 border border-slate-100 flex items-center gap-2">
|
||||
<span>当前分数:</span>
|
||||
<span class="text-slate-800 font-bold">{{ score }} 分</span>
|
||||
<span>{{ $t('chat.training.currentScoreLabel') }}</span>
|
||||
<span class="text-slate-800 font-bold">{{ $t('chat.training.scoreShort', { score }) }}</span>
|
||||
</div>
|
||||
<div class="rounded-lg bg-slate-50 px-3 py-1.5 font-medium text-slate-600 border border-slate-100 flex items-center gap-2">
|
||||
<span>及格线:</span>
|
||||
<span class="text-slate-800 font-bold">{{ passScore }} 分</span>
|
||||
<span>{{ $t('chat.training.passLineLabel') }}</span>
|
||||
<span class="text-slate-800 font-bold">{{ $t('chat.training.passScoreShort', { passScore }) }}</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -158,16 +158,16 @@ const emit = defineEmits<{
|
||||
<div class="flex items-center gap-2 text-sm font-bold" :class="feedbackCorrect ? 'text-emerald-700' : 'text-red-700'">
|
||||
<CheckCircle2 v-if="feedbackCorrect" class="h-4 w-4" />
|
||||
<XCircle v-else class="h-4 w-4" />
|
||||
{{ feedbackCorrect ? '回答正确,继续下一题' : '回答错误' }}
|
||||
{{ feedbackCorrect ? $t('chat.training.exam.correctFeedback') : $t('chat.training.wrongFeedbackShort') }}
|
||||
</div>
|
||||
|
||||
<div class="mt-3 space-y-2 text-[13px] leading-6 text-slate-600">
|
||||
<div class="flex gap-2">
|
||||
<span class="font-medium text-slate-500 shrink-0">你的答案:</span>
|
||||
<span class="font-medium text-slate-500 shrink-0">{{ $t('chat.training.yourAnswerLabel') }}</span>
|
||||
<span class="font-medium" :class="feedbackCorrect ? 'text-emerald-600' : 'text-red-600'">{{ answerLabel || '--' }}</span>
|
||||
</div>
|
||||
<div v-if="!feedbackCorrect" class="flex gap-2">
|
||||
<span class="font-medium text-slate-500 shrink-0">正确答案:</span>
|
||||
<span class="font-medium text-slate-500 shrink-0">{{ $t('chat.training.correctAnswerLabel') }}</span>
|
||||
<span class="text-emerald-600 font-medium">{{ question.options?.find(o => o.id === question.answer)?.label || '--' }}</span>
|
||||
</div>
|
||||
<div class="mt-2 pl-2 border-l-2 border-slate-200/60 text-slate-500/90">
|
||||
@@ -183,7 +183,7 @@ const emit = defineEmits<{
|
||||
@click="emit('next')"
|
||||
>
|
||||
<ClipboardCheck class="h-4 w-4" />
|
||||
{{ answeredCount >= totalCount - 1 ? '完成考试并查看结果' : '下一题' }}
|
||||
{{ answeredCount >= totalCount - 1 ? $t('chat.training.finishAndViewResult') : $t('chat.training.exam.nextQuestion') }}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -33,10 +33,10 @@ const emit = defineEmits<{
|
||||
</div>
|
||||
<div>
|
||||
<div class="text-[11px] font-bold uppercase tracking-[0.15em] text-slate-500">
|
||||
第四步:结算结果
|
||||
{{ $t('chat.training.stepResultTitle') }}
|
||||
</div>
|
||||
<h3 class="text-lg font-bold text-slate-800">
|
||||
{{ isPassed ? '恭喜,你已通过考核!' : '很遗憾,考试未通过' }}
|
||||
{{ isPassed ? $t('chat.training.passTitleShort') : $t('chat.training.failTitleShort') }}
|
||||
</h3>
|
||||
</div>
|
||||
</div>
|
||||
@@ -59,7 +59,7 @@ const emit = defineEmits<{
|
||||
<div class="mt-1 text-2xl font-black text-emerald-600">{{ correctCount }}</div>
|
||||
</div>
|
||||
<div class="rounded-2xl bg-red-50/50 p-4 border border-red-100/50 text-center">
|
||||
<div class="text-[11px] font-bold text-red-400 uppercase">答错</div>
|
||||
<div class="text-[11px] font-bold text-red-400 uppercase">{{ $t('chat.training.wrongCountShort') }}</div>
|
||||
<div class="mt-1 text-2xl font-black text-red-500">{{ wrongCount }}</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -78,12 +78,12 @@ const emit = defineEmits<{
|
||||
@click="emit('restart')"
|
||||
>
|
||||
<RotateCcw class="h-4 w-4" />
|
||||
重新考试
|
||||
{{ $t('chat.training.result.retryExam') }}
|
||||
</button>
|
||||
</div>
|
||||
<div v-else class="flex items-center gap-2 text-emerald-600 font-medium text-sm">
|
||||
<CheckCircle2 class="h-4 w-4" />
|
||||
成绩已同步至 HR 管理系统
|
||||
{{ $t('chat.training.syncedToHr') }}
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
@@ -30,7 +30,7 @@ const emit = defineEmits<{
|
||||
<div class="h-12 w-12 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-6 w-6 text-white fill-white/20" />
|
||||
</div>
|
||||
<span class="text-white text-xs font-medium drop-shadow-md">点击播放视频</span>
|
||||
<span class="text-white text-xs font-medium drop-shadow-md">{{ $t('chat.training.clickPlayVideo') }}</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
Reference in new issue
Block a user