update translation

This commit is contained in:
sophie committed 2026-05-22 13:48:41 +08:00
1 parent 02d0c1dcd6
commit 1689347494
9 files changed
+1170 -324

No files matched your search

+33 -33
View File
@@ -523,13 +523,13 @@ const scheduleCronDesigner = ref({
weekly_minute: 0,
});
const weeklyDayOptions = [
{ value: 1, label: '周一' },
{ value: 2, label: '周二' },
{ value: 3, label: '周三' },
{ value: 4, label: '周四' },
{ value: 5, label: '周五' },
{ value: 6, label: '周六' },
{ value: 0, label: '周日' },
{ value: 1, label: t('admin.schedule.weekday.mon') },
{ value: 2, label: t('admin.schedule.weekday.tue') },
{ value: 3, label: t('admin.schedule.weekday.wed') },
{ value: 4, label: t('admin.schedule.weekday.thu') },
{ value: 5, label: t('admin.schedule.weekday.fri') },
{ value: 6, label: t('admin.schedule.weekday.sat') },
{ value: 0, label: t('admin.schedule.weekday.sun') },
];
const buildCronExprFromDesigner = () => {
@@ -808,20 +808,20 @@ const selectedSchedule = computed(() =>
);
const scheduleRunStatusOptions = [
{ value: 'all', label: '全部状态' },
{ value: 'success', label: '成功' },
{ value: 'partial_failed', label: '部分成功' },
{ value: 'failed', label: '失败' },
{ value: 'running', label: '执行中' },
{ value: 'all', label: t('admin.schedule.status.all') },
{ value: 'success', label: t('admin.schedule.status.success') },
{ value: 'partial_failed', label: t('admin.schedule.status.partialFailed') },
{ value: 'failed', label: t('admin.schedule.status.failed') },
{ value: 'running', label: t('admin.schedule.status.running') },
];
const getScheduleRunStatusBadge = (status: string) => {
const map: Record<string, { cls: string; label: string }> = {
success: { cls: 'bg-emerald-100 text-emerald-700', label: '成功' },
partial_failed: { cls: 'bg-blue-100 text-blue-700', label: '部分成功' },
failed: { cls: 'bg-rose-100 text-rose-700', label: '失败' },
running: { cls: 'bg-amber-100 text-amber-700', label: '执行中' },
queued: { cls: 'bg-slate-100 text-slate-600', label: '排队中' },
success: { cls: 'bg-emerald-100 text-emerald-700', label: t('admin.schedule.status.success') },
partial_failed: { cls: 'bg-blue-100 text-blue-700', label: t('admin.schedule.status.partialFailed') },
failed: { cls: 'bg-rose-100 text-rose-700', label: t('admin.schedule.status.failed') },
running: { cls: 'bg-amber-100 text-amber-700', label: t('admin.schedule.status.running') },
queued: { cls: 'bg-slate-100 text-slate-600', label: t('admin.schedule.status.queued') },
};
return map[status] || { cls: 'bg-slate-100 text-slate-600', label: status };
};
@@ -837,15 +837,15 @@ const formatDateTime = (iso?: string | null) => {
const expandedScheduleRunId = ref<number | null>(null);
const stepLabelMap: Record<string, string> = {
fetch_srm: '抓取外部系统数据',
call_dify: '调用Dify服务',
writeback_srm: '回写外部系统数据',
call_internal_api: '调用内部API',
pre_dify: 'Dify前处理',
fetch_srm: t('admin.schedule.step.fetchSrm'),
call_dify: t('admin.schedule.step.callDify'),
writeback_srm: t('admin.schedule.step.writebackSrm'),
call_internal_api: t('admin.schedule.step.callInternalApi'),
pre_dify: t('admin.schedule.step.preDify'),
};
const stepStatusMap: Record<string, { cls: string; label: string }> = {
success: { cls: 'bg-emerald-100 text-emerald-700', label: '成功' },
failed: { cls: 'bg-rose-100 text-rose-700', label: '失败' },
success: { cls: 'bg-emerald-100 text-emerald-700', label: t('admin.schedule.status.success') },
failed: { cls: 'bg-rose-100 text-rose-700', label: t('admin.schedule.status.failed') },
};
const showTestRunDialog = ref(false);
@@ -893,7 +893,7 @@ const handleTestRun = async () => {
await viewScheduleRuns(s.id);
}
} catch (e: any) {
msg.error(`测试执行失败: ${e?.message || e}`);
msg.error(`${t('admin.schedule.msg.testRunFailed')}: ${e?.message || e}`);
} finally {
testRunLoading.value = false;
}
@@ -1025,7 +1025,7 @@ const createSchedule = async () => {
const hasSql = dst === 'database' && !!scheduleSqlEditForm.value.base_fetch_sql.trim();
const hasApi = dst === 'external_api' && !!scheduleSqlEditForm.value.api_url.trim();
if (!hasAgent && !hasSql && !hasApi) {
msg.error('Dify Agent、SQL 配置或外部 API 至少填写一项,否则排程执行无任何效果');
msg.error(t('admin.schedule.msg.configRequired'));
return;
}
@@ -1033,7 +1033,7 @@ const createSchedule = async () => {
try {
headerLabels = JSON.parse(scheduleSqlEditForm.value.header_labels_str || '{}');
} catch {
msg.error('header_labels JSON 格式错误,请检查');
msg.error(t('admin.schedule.msg.headerLabelsJsonInvalid'));
return;
}
let apiHeaders: Record<string, string> = {};
@@ -1041,7 +1041,7 @@ const createSchedule = async () => {
try {
apiHeaders = JSON.parse(scheduleSqlEditForm.value.api_headers_str || '{}');
} catch {
msg.error('API Headers JSON 格式错误,请检查');
msg.error(t('admin.schedule.msg.apiHeadersJsonInvalid'));
return;
}
}
@@ -1165,7 +1165,7 @@ const runScheduleNow = async (taskId: number) => {
const res = await runAdminSchedule(taskId);
if (!res.ok) {
const data = await res.json().catch(() => ({}));
msg.error(data?.error || '手动执行失败');
msg.error(data?.error || t('admin.schedule.msg.runNowFailed'));
return;
}
await viewScheduleRuns(taskId);
@@ -1189,7 +1189,7 @@ const setScheduleEnabled = async (taskId: number, enabled: boolean) => {
const downloadScheduleExcel = async (runId: number) => {
const res = await fetch(`/api/admin/schedule-runs/${runId}/excel`, { headers: getAuthHeaders() });
if (!res.ok) {
msg.error('下载 Excel 失败');
msg.error(t('admin.schedule.msg.downloadExcelFailed'));
return;
}
const blob = await res.blob();
@@ -1206,11 +1206,11 @@ const downloadScheduleExcel = async (runId: number) => {
const deleteSchedule = (task: ScheduleTask) => {
openDeleteConfirmDialog(
`确认删除排程「${task.name}」?`,
t('admin.schedule.deleteConfirmMessage', { name: task.name }),
async () => {
const res = await deleteAdminSchedule(task.id);
if (!res.ok) {
msg.error('删除排程失败');
msg.error(t('admin.schedule.msg.deleteFailed'));
return;
}
if (selectedScheduleId.value === task.id) {
@@ -1219,7 +1219,7 @@ const deleteSchedule = (task: ScheduleTask) => {
}
await loadSchedules();
},
'删除排程'
t('admin.schedule.deleteDialogTitle')
);
};
+92 -92
View File
@@ -456,7 +456,7 @@ const handleLogin = async (event?: Event) => {
let msg = err.error || t('login.failed');
if (isCasdoorMode) {
if (err.error_code === 'CASDOOR_USER_NOT_FOUND') {
msg = 'Casdoor 登录成功,但未匹配到本地账号,请联系管理员。';
msg = t('workspace.msg.casdoorNotMatchedContactAdmin');
} else if (err.error_code === 'ACCOUNT_DISABLED') {
msg = t('login.accountDisabled');
} else if (String(err.error || '').includes('invalid_grant')) {
@@ -522,9 +522,9 @@ const tryCasdoorCallbackLogin = async () => {
const code = String(data.error_code || '');
let msg = data.error || 'Casdoor login failed';
if (code === 'CASDOOR_USER_NOT_FOUND') {
msg = 'Casdoor 登录成功,但未匹配到本地账号。请让管理员在本地用户表创建同名 username 或相同 email 的账号。';
msg = t('workspace.msg.casdoorNotMatchedNeedLocalUser');
} else if (code === 'ACCOUNT_DISABLED') {
msg = '该本地账号已被禁用,请联系管理员启用后再登录。';
msg = t('workspace.msg.localAccountDisabled');
}
msg.error(msg);
clearWecomCallbackQuery();
@@ -835,9 +835,9 @@ const mobileTabActive = computed({
});
const mobileTabTitle = computed(() => {
if (mobileTabActive.value === 'profile') return '我的';
if (mobileTabActive.value === 'history') return '历史会话';
return '应用管理';
if (mobileTabActive.value === 'profile') return t('workspace.mobileTabs.me');
if (mobileTabActive.value === 'history') return t('workspace.mobileTabs.history');
return t('workspace.mobileTabs.applications');
});
const handleLogout = () => {
@@ -876,7 +876,7 @@ const fetchProfile = async () => {
try {
const res = await fetch('/api/user/profile', { headers: getAuthHeaders() });
if (!res.ok) {
msg.error('加载个人中心失败');
msg.error(t('workspace.profile.msg.loadFailed'));
return;
}
const data = await res.json();
@@ -891,7 +891,7 @@ const fetchProfile = async () => {
isProfileEditing.value = false;
} catch (e) {
console.error(e);
msg.error('加载个人中心失败');
msg.error(t('workspace.profile.msg.loadFailed'));
} finally {
isProfileLoading.value = false;
}
@@ -946,16 +946,16 @@ const saveProfile = async () => {
if (!res.ok) {
const message = await parseErrorMessage(res);
msg.error(message || '保存个人资料失败');
msg.error(message || t('workspace.profile.msg.saveFailed'));
return;
}
msg.success('个人资料已保存');
msg.success(t('workspace.profile.msg.saved'));
captureOriginalProfile();
isProfileEditing.value = false;
} catch (e) {
console.error(e);
msg.error('保存个人资料失败');
msg.error(t('workspace.profile.msg.saveFailed'));
} finally {
isProfileSaving.value = false;
}
@@ -979,7 +979,7 @@ const handleChangePassword = async () => {
const data = await res.json();
if (!res.ok) {
msg.error(data.error || '修改密码失败');
msg.error(data.error || t('workspace.profile.msg.changePasswordFailed'));
return;
}
@@ -988,7 +988,7 @@ const handleChangePassword = async () => {
showPasswordModal.value = false;
} catch (e) {
console.error(e);
msg.error('修改密码失败');
msg.error(t('workspace.profile.msg.changePasswordFailed'));
}
};
@@ -1051,20 +1051,20 @@ const wsScheduleStartedAfter = ref(todayStartLocal());
const wsScheduleStartedBefore = ref(todayEndLocal());
const wsScheduleStatusOptions = [
{ value: 'all', label: '全部状态' },
{ value: 'success', label: '成功' },
{ value: 'partial_failed', label: '部分成功' },
{ value: 'failed', label: '失败' },
{ value: 'running', label: '执行中' },
{ value: 'all', label: t('workspace.schedule.status.all') },
{ value: 'success', label: t('workspace.schedule.status.success') },
{ value: 'partial_failed', label: t('workspace.schedule.status.partialFailed') },
{ value: 'failed', label: t('workspace.schedule.status.failed') },
{ value: 'running', label: t('workspace.schedule.status.running') },
];
const getWsScheduleStatusBadge = (status: string) => {
const map: Record<string, { cls: string; label: string }> = {
success: { cls: 'bg-emerald-100 text-emerald-700', label: '成功' },
partial_failed: { cls: 'bg-blue-100 text-blue-700', label: '部分成功' },
failed: { cls: 'bg-rose-100 text-rose-700', label: '失败' },
running: { cls: 'bg-amber-100 text-amber-700', label: '执行中' },
queued: { cls: 'bg-slate-100 text-slate-600', label: '排队中' },
success: { cls: 'bg-emerald-100 text-emerald-700', label: t('workspace.schedule.status.success') },
partial_failed: { cls: 'bg-blue-100 text-blue-700', label: t('workspace.schedule.status.partialFailed') },
failed: { cls: 'bg-rose-100 text-rose-700', label: t('workspace.schedule.status.failed') },
running: { cls: 'bg-amber-100 text-amber-700', label: t('workspace.schedule.status.running') },
queued: { cls: 'bg-slate-100 text-slate-600', label: t('workspace.schedule.status.queued') },
};
return map[status] || { cls: 'bg-slate-100 text-slate-600', label: status };
};
@@ -1104,7 +1104,7 @@ const resetWsScheduleFilters = () => {
const downloadWsScheduleExcel = async (runId: number) => {
const res = await fetch(workspaceRunExcelUrl(runId), { headers: getAuthHeaders() });
if (!res.ok) {
msg.error('下载 Excel 失败');
msg.error(t('workspace.schedule.msg.downloadExcelFailed'));
return;
}
const blob = await res.blob();
@@ -1394,8 +1394,8 @@ onMounted(async () => {
<ThemeToggleButton />
<select v-model="locale" class="bg-white/80 dark:bg-slate-900/80 backdrop-blur-md shadow-sm border border-slate-200 dark:border-slate-700 text-xs font-medium text-slate-600 dark:text-slate-300 hover:text-slate-800 dark:hover:text-slate-100 cursor-pointer outline-none rounded-full px-3 py-1.5 transition-all hover:shadow-md">
<option value="en">English</option>
<option value="zh-CN">简体中文</option>
<option value="zh-TW">繁體中文</option>
<option value="zh-CN">{{ $t('workspace.lang.zhCN') }}</option>
<option value="zh-TW">{{ $t('workspace.lang.zhTW') }}</option>
<option value="th">ไทย</option>
</select>
</div>
@@ -1547,7 +1547,7 @@ onMounted(async () => {
<div v-else class="min-h-screen animate-fade-in">
<header v-if="isMobile" class="sticky top-0 z-30 flex items-center justify-between border-b border-slate-200 bg-white px-4 py-2.5 dark:border-slate-800 dark:bg-slate-950">
<div class="flex items-center gap-2">
<button @click="router.push('/chat/16')" class="flex h-7 w-7 items-center justify-center rounded-lg bg-gradient-to-br from-brand-500 via-brand-600 to-purple-600 text-xs font-bold text-white shadow-sm shadow-brand-500/20" title="返回聊天">AI</button>
<button @click="router.push('/chat/16')" class="flex h-7 w-7 items-center justify-center rounded-lg bg-gradient-to-br from-brand-500 via-brand-600 to-purple-600 text-xs font-bold text-white shadow-sm shadow-brand-500/20" :title="$t('workspace.nav.backToChat')">AI</button>
<span class="text-sm font-semibold text-slate-800 dark:text-slate-100">{{ mobileTabTitle }}</span>
</div>
</header>
@@ -1560,7 +1560,7 @@ onMounted(async () => {
<Bot class="h-6 w-6" />
</div>
<div class="min-w-0">
<div class="text-2xl font-extrabold tracking-tight text-[#14213d]">和信AI</div>
<div class="text-2xl font-extrabold tracking-tight text-[#14213d]">{{ $t('workspace.brandTitle') }}</div>
<div class="truncate text-xs font-medium text-slate-400">
{{ currentUser?.username }} / {{ currentUser?.role }}
</div>
@@ -1576,7 +1576,7 @@ onMounted(async () => {
:class="activeSidebarItem === 'profile' ? 'bg-brand-50 text-brand-700 shadow-sm' : 'text-slate-600 hover:bg-slate-50 hover:text-slate-900'"
>
<User class="h-4 w-4" />
<span>个人中心</span>
<span>{{ $t('workspace.nav.profile') }}</span>
</button>
<button
v-if="currentUser?.role === 'admin'"
@@ -1584,7 +1584,7 @@ onMounted(async () => {
class="flex w-full items-center gap-3 rounded-2xl px-4 py-3 text-left text-[15px] font-medium text-slate-600 transition-all hover:bg-slate-50 hover:text-slate-900"
>
<Settings class="h-4 w-4" />
<span>管理后台</span>
<span>{{ $t('workspace.nav.admin') }}</span>
</button>
<button
@click="navigateToApplications"
@@ -1592,7 +1592,7 @@ onMounted(async () => {
:class="activeSidebarItem === 'applications' ? 'bg-brand-50 text-brand-700 shadow-sm' : 'text-slate-600 hover:bg-slate-50 hover:text-slate-900'"
>
<LayoutGrid class="h-4 w-4" />
<span>应用管理</span>
<span>{{ $t('workspace.nav.applications') }}</span>
</button>
<button
@click="navigateToKnowledgeBase"
@@ -1600,7 +1600,7 @@ onMounted(async () => {
:class="activeSidebarItem === 'knowledge_base' ? 'bg-brand-50 text-brand-700 shadow-sm' : 'text-slate-600 hover:bg-slate-50 hover:text-slate-900'"
>
<FileText class="h-4 w-4" />
<span>知识库管理</span>
<span>{{ $t('workspace.nav.knowledgeBase') }}</span>
</button>
<button
@click="navigateToScheduleRuns"
@@ -1608,7 +1608,7 @@ onMounted(async () => {
:class="activeSidebarItem === 'schedule_runs' ? 'bg-brand-50 text-brand-700 shadow-sm' : 'text-slate-600 hover:bg-slate-50 hover:text-slate-900'"
>
<Clock class="h-4 w-4" />
<span>排程记录</span>
<span>{{ $t('workspace.nav.scheduleRuns') }}</span>
</button>
<button
@click="openGeneralFeedback"
@@ -1616,7 +1616,7 @@ onMounted(async () => {
:class="activeSidebarItem === 'feedback' ? 'bg-brand-50 text-brand-700 shadow-sm' : 'text-slate-600 hover:bg-slate-50 hover:text-slate-900'"
>
<Edit class="h-4 w-4" />
<span>意见反馈</span>
<span>{{ $t('workspace.nav.feedback') }}</span>
</button>
<button
@click="navigateToUpdates"
@@ -1624,7 +1624,7 @@ onMounted(async () => {
:class="activeSidebarItem === 'updates' ? 'bg-brand-50 text-brand-700 shadow-sm' : 'text-slate-600 hover:bg-slate-50 hover:text-slate-900'"
>
<Megaphone class="h-4 w-4" />
<span>最近更新</span>
<span>{{ $t('workspace.nav.updates') }}</span>
</button>
</div>
</div>
@@ -1636,14 +1636,14 @@ onMounted(async () => {
class="flex w-full items-center gap-3 rounded-2xl px-4 py-3 text-left text-[15px] font-medium text-slate-600 transition-all hover:bg-slate-50 hover:text-slate-900"
>
<Bot class="h-4 w-4" />
<span>返回聊天</span>
<span>{{ $t('workspace.nav.backToChat') }}</span>
</button>
<button
@click="handleLogout"
class="flex w-full items-center gap-3 rounded-2xl px-4 py-3 text-left text-[15px] font-medium text-red-500 transition-all hover:bg-red-50 hover:text-red-600"
>
<LogOut class="h-4 w-4" />
<span>退出登录</span>
<span>{{ $t('workspace.nav.logout') }}</span>
</button>
</div>
</div>
@@ -1658,7 +1658,7 @@ onMounted(async () => {
</div>
<div v-else-if="chatHistories.length === 0" class="flex flex-col items-center justify-center py-20 text-slate-400">
<Bot class="h-10 w-10 mb-2" />
<p class="text-sm">暂无历史会话</p>
<p class="text-sm">{{ $t('workspace.history.empty') }}</p>
</div>
<div v-else>
<button
@@ -1674,7 +1674,7 @@ onMounted(async () => {
</div>
<div class="min-w-0 flex-1">
<div class="flex items-center gap-2">
<span class="truncate text-sm font-medium text-slate-800 dark:text-slate-100">{{ item.title || '未命名对话' }}</span>
<span class="truncate text-sm font-medium text-slate-800 dark:text-slate-100">{{ item.title || $t('workspace.history.untitled') }}</span>
</div>
<div class="mt-0.5 flex items-center gap-2 text-xs text-slate-400">
<span>{{ item.agent_name || '' }}</span>
@@ -1701,39 +1701,39 @@ onMounted(async () => {
</div>
<div class="grid flex-1 text-left" :class="isMobile ? 'grid-cols-2 gap-x-4 gap-y-1' : 'grid-cols-1 gap-x-12 gap-y-3 sm:grid-cols-2'">
<div :class="isMobile ? '' : ''">
<div :class="isMobile ? 'text-xs text-slate-400' : 'text-lg font-semibold text-slate-900'">{{ isMobile ? '姓名' : (profileUser.username || '-') }}</div>
<div :class="isMobile ? 'text-xs text-slate-400' : 'text-lg font-semibold text-slate-900'">{{ isMobile ? $t('profile.realName') : (profileUser.username || '-') }}</div>
<div v-if="isMobile" class="text-sm font-medium text-slate-900 truncate">{{ profileUser.real_name || profileUser.username || '-' }}</div>
</div>
<div>
<div :class="isMobile ? 'text-xs text-slate-400' : 'text-lg font-semibold text-slate-900'">{{ isMobile ? '工号' : (profileUser.employee_id || '-') }}</div>
<div :class="isMobile ? 'text-xs text-slate-400' : 'text-lg font-semibold text-slate-900'">{{ isMobile ? $t('profile.employeeId') : (profileUser.employee_id || '-') }}</div>
<div v-if="isMobile" class="text-sm font-medium text-slate-900 truncate">{{ profileUser.employee_id || '-' }}</div>
</div>
<div>
<div :class="isMobile ? 'text-xs text-slate-400' : 'text-lg font-semibold text-slate-900'">{{ isMobile ? '部门' : (profileUser.department || '-') }}</div>
<div :class="isMobile ? 'text-xs text-slate-400' : 'text-lg font-semibold text-slate-900'">{{ isMobile ? $t('profile.department') : (profileUser.department || '-') }}</div>
<div v-if="isMobile" class="text-sm font-medium text-slate-900 truncate">{{ profileUser.department || '-' }}</div>
</div>
<div>
<div :class="isMobile ? 'text-xs text-slate-400' : 'text-lg font-semibold text-slate-900'">{{ isMobile ? '角色' : (profileUser.role === 'admin' ? ($t('profile.roleAdmin') || 'Administrator') : ($t('profile.roleUser') || 'User')) }}</div>
<div v-if="isMobile" class="text-sm font-medium text-slate-900 truncate">{{ profileUser.role === 'admin' ? ($t('profile.roleAdmin') || '管理员') : ($t('profile.roleUser') || '用户') }}</div>
<div :class="isMobile ? 'text-xs text-slate-400' : 'text-lg font-semibold text-slate-900'">{{ isMobile ? $t('profile.role') : (profileUser.role === 'admin' ? ($t('profile.roleAdmin') || 'Administrator') : ($t('profile.roleUser') || 'User')) }}</div>
<div v-if="isMobile" class="text-sm font-medium text-slate-900 truncate">{{ profileUser.role === 'admin' ? ($t('profile.roleAdmin') || 'Administrator') : ($t('profile.roleUser') || 'User') }}</div>
</div>
<div :class="isMobile ? 'col-span-2' : 'sm:col-span-2'">
<div :class="isMobile ? 'text-xs text-slate-400' : 'break-all text-lg font-semibold text-slate-900'">{{ isMobile ? '邮箱' : (profileUser.email || '-') }}</div>
<div :class="isMobile ? 'text-xs text-slate-400' : 'break-all text-lg font-semibold text-slate-900'">{{ isMobile ? $t('profile.email') : (profileUser.email || '-') }}</div>
<div v-if="isMobile" class="text-sm font-medium text-slate-900 truncate">{{ profileUser.email || '-' }}</div>
</div>
</div>
</div>
<div v-if="!isMobile" class="flex shrink-0 items-center gap-2 self-start lg:ml-6">
<button @click="showPasswordModal = true" class="btn-primary px-6 py-3 text-base">
修改密码
{{ $t('profile.changePassword') }}
</button>
</div>
</div>
<div v-if="isMobile" class="mt-4 flex items-center justify-center gap-4">
<button @click="showPasswordModal = true" class="btn-primary flex-1 py-2.5 text-sm text-center">
修改密码
{{ $t('profile.changePassword') }}
</button>
<button @click="handleLogout" class="btn-secondary flex-1 py-2.5 text-sm text-center text-red-600 hover:bg-red-50 dark:text-red-400 dark:hover:bg-red-950">
退出登录
{{ $t('workspace.nav.logout') }}
</button>
</div>
</div>
@@ -1744,18 +1744,18 @@ onMounted(async () => {
<div class="flex items-center" :class="isMobile ? 'w-full justify-center gap-2' : ''">
<h3 class="flex items-center gap-3 text-3xl font-bold text-slate-900" :class="isMobile ? 'text-lg gap-2' : ''">
<User class="h-6 w-6 text-brand-500" :class="isMobile ? 'h-4 w-4' : ''" />
基本信息
{{ $t('profile.basicInfo') }}
</h3>
<button v-if="isMobile && !isProfileEditing" @click="startProfileEditing" class="btn-secondary px-3 py-1 text-xs">
编辑
{{ $t('profile.edit') }}
</button>
</div>
<p v-if="!isMobile" class="mt-2 text-sm text-slate-500">
{{ isProfileEditing ? '可直接修改并保存个人资料' : '切换到编辑模式以更新个人资料' }}
{{ isProfileEditing ? $t('profile.directEditHint') : $t('profile.switchEditHint') }}
</p>
<div v-if="!isMobile" class="flex items-center gap-2">
<button v-if="!isProfileEditing" @click="startProfileEditing" class="btn-secondary px-5 py-2.5 text-sm">
编辑
{{ $t('profile.edit') }}
</button>
<template v-else>
<button @click="cancelProfileEditing" class="btn-secondary px-5 py-2.5 text-sm">
@@ -1767,7 +1767,7 @@ onMounted(async () => {
class="btn-primary px-5 py-2.5 text-sm disabled:opacity-50 disabled:cursor-not-allowed"
>
<Save class="w-4 h-4" />
<span>{{ isProfileSaving ? '保存中...' : '保存' }}</span>
<span>{{ isProfileSaving ? $t('profile.saving') : $t('workspace.save') }}</span>
</button>
</template>
</div>
@@ -1775,7 +1775,7 @@ onMounted(async () => {
<div class="grid grid-cols-1 gap-5 md:grid-cols-2" :class="isMobile ? 'gap-3' : ''">
<div>
<label class="mb-2 flex items-center gap-2 text-sm font-medium text-slate-500" :class="isMobile ? 'text-xs mb-1' : ''">
<User class="h-4 w-4" /> 用户名
<User class="h-4 w-4" /> {{ $t('profile.username') }}
</label>
<div class="rounded-2xl border border-slate-200 bg-slate-50 px-4 py-4 text-lg font-medium text-slate-700" :class="isMobile ? 'px-3 py-2 text-sm rounded-xl' : ''">
{{ profileUser.username || '-' }}
@@ -1783,7 +1783,7 @@ onMounted(async () => {
</div>
<div>
<label class="mb-2 flex items-center gap-2 text-sm font-medium text-slate-500" :class="isMobile ? 'text-xs mb-1' : ''">
<CreditCard class="h-4 w-4" /> 工号
<CreditCard class="h-4 w-4" /> {{ $t('profile.employeeId') }}
</label>
<input v-if="isProfileEditing" v-model="profileUser.employee_id" type="text" class="input-field" :class="isMobile ? 'h-10 text-sm' : 'h-[58px]'" />
<div v-else class="rounded-2xl border border-slate-200 bg-slate-50 px-4 py-4 text-lg font-medium text-slate-700" :class="isMobile ? 'px-3 py-2 text-sm rounded-xl' : ''">
@@ -1792,7 +1792,7 @@ onMounted(async () => {
</div>
<div>
<label class="mb-2 flex items-center gap-2 text-sm font-medium text-slate-500" :class="isMobile ? 'text-xs mb-1' : ''">
<User class="h-4 w-4" /> 真实姓名
<User class="h-4 w-4" /> {{ $t('profile.realName') }}
</label>
<input v-if="isProfileEditing" v-model="profileUser.real_name" type="text" class="input-field" :class="isMobile ? 'h-10 text-sm' : 'h-[58px]'" />
<div v-else class="rounded-2xl border border-slate-200 bg-slate-50 px-4 py-4 text-lg font-medium text-slate-700" :class="isMobile ? 'px-3 py-2 text-sm rounded-xl' : ''">
@@ -1801,7 +1801,7 @@ onMounted(async () => {
</div>
<div>
<label class="mb-2 flex items-center gap-2 text-sm font-medium text-slate-500" :class="isMobile ? 'text-xs mb-1' : ''">
<Building class="h-4 w-4" /> 部门
<Building class="h-4 w-4" /> {{ $t('profile.department') }}
</label>
<input v-if="isProfileEditing" v-model="profileUser.department" type="text" class="input-field" :class="isMobile ? 'h-10 text-sm' : 'h-[58px]'" />
<div v-else class="rounded-2xl border border-slate-200 bg-slate-50 px-4 py-4 text-lg font-medium text-slate-700" :class="isMobile ? 'px-3 py-2 text-sm rounded-xl' : ''">
@@ -1810,7 +1810,7 @@ onMounted(async () => {
</div>
<div>
<label class="mb-2 flex items-center gap-2 text-sm font-medium text-slate-500" :class="isMobile ? 'text-xs mb-1' : ''">
<Mail class="h-4 w-4" /> 邮箱
<Mail class="h-4 w-4" /> {{ $t('profile.email') }}
</label>
<input v-if="isProfileEditing" v-model="profileUser.email" type="email" class="input-field" :class="isMobile ? 'h-10 text-sm' : 'h-[58px]'" />
<div v-else class="rounded-2xl border border-slate-200 bg-slate-50 px-4 py-4 text-lg font-medium text-slate-700" :class="isMobile ? 'px-3 py-2 text-sm rounded-xl' : ''">
@@ -1819,7 +1819,7 @@ onMounted(async () => {
</div>
<div>
<label class="mb-2 flex items-center gap-2 text-sm font-medium text-slate-500" :class="isMobile ? 'text-xs mb-1' : ''">
<Globe class="h-4 w-4" /> 手机号
<Globe class="h-4 w-4" /> {{ $t('profile.phoneNumber') }}
</label>
<input v-if="isProfileEditing" v-model="profileUser.phone_number" type="text" class="input-field" :class="isMobile ? 'h-10 text-sm' : 'h-[58px]'" />
<div v-else class="rounded-2xl border border-slate-200 bg-slate-50 px-4 py-4 text-lg font-medium text-slate-700" :class="isMobile ? 'px-3 py-2 text-sm rounded-xl' : ''">
@@ -1832,20 +1832,20 @@ onMounted(async () => {
<div class="rounded-3xl border border-slate-200 bg-white p-8 shadow-sm">
<h3 class="mb-6 flex items-center gap-3 text-2xl font-bold text-slate-900">
<Palette class="h-5 w-5 text-brand-500" />
偏好设置
{{ $t('profile.preferences') }}
</h3>
<div class="grid grid-cols-1 gap-6 md:grid-cols-2">
<div>
<label class="mb-2 block text-sm font-medium text-slate-500">语言</label>
<label class="mb-2 block text-sm font-medium text-slate-500">{{ $t('workspace.languageLabel') }}</label>
<select v-model="profileUser.language" :disabled="!isProfileEditing" class="input-field h-[58px]">
<option value="en">English</option>
<option value="zh-CN">简体中文</option>
<option value="zh-TW">繁體中文</option>
<option value="zh-CN">{{ $t('workspace.lang.zhCN') }}</option>
<option value="zh-TW">{{ $t('workspace.lang.zhTW') }}</option>
<option value="th">ไทย</option>
</select>
</div>
<div>
<label class="mb-2 block text-sm font-medium text-slate-500">主题</label>
<label class="mb-2 block text-sm font-medium text-slate-500">{{ $t('profile.theme') }}</label>
<div class="grid grid-cols-3 gap-2">
<button
v-for="item in themeOptions"
@@ -1876,30 +1876,30 @@ onMounted(async () => {
<template v-else-if="activeSidebarItem === 'schedule_runs'">
<div class="space-y-5 animate-fade-in-up">
<div class="flex items-center justify-between">
<h2 class="text-2xl font-bold text-slate-900">排程记录</h2>
<h2 class="text-2xl font-bold text-slate-900">{{ $t('workspace.schedule.title') }}</h2>
<button
@click="loadWorkspaceScheduleRuns"
class="inline-flex items-center gap-1.5 rounded-xl border border-slate-200 px-3 py-1.5 text-sm font-medium text-slate-600 transition-colors hover:bg-slate-50"
>
<RefreshCw class="h-3.5 w-3.5" />
刷新
{{ $t('workspace.schedule.refresh') }}
</button>
</div>
<div class="flex flex-wrap items-end gap-3 rounded-2xl border border-slate-200 bg-slate-50/40 px-4 py-3">
<div>
<label class="mb-1 block text-xs font-medium text-slate-500">排程名称</label>
<input type="text" v-model="wsScheduleNameFilter" placeholder="输入排程名称" class="!w-[150px] !py-1 !px-2 !text-xs rounded-lg border border-slate-200 bg-white" />
<label class="mb-1 block text-xs font-medium text-slate-500">{{ $t('workspace.schedule.filters.name') }}</label>
<input type="text" v-model="wsScheduleNameFilter" :placeholder="$t('workspace.schedule.filters.namePlaceholder')" class="!w-[150px] !py-1 !px-2 !text-xs rounded-lg border border-slate-200 bg-white" />
</div>
<div>
<label class="mb-1 block text-xs font-medium text-slate-500">开始时间</label>
<label class="mb-1 block text-xs font-medium text-slate-500">{{ $t('workspace.schedule.filters.start') }}</label>
<input type="datetime-local" step="1" v-model="wsScheduleStartedAfter" class="!w-[170px] !py-1 !px-2 !text-xs rounded-lg border border-slate-200 bg-white" />
</div>
<div>
<label class="mb-1 block text-xs font-medium text-slate-500">结束时间</label>
<label class="mb-1 block text-xs font-medium text-slate-500">{{ $t('workspace.schedule.filters.end') }}</label>
<input type="datetime-local" step="1" v-model="wsScheduleStartedBefore" class="!w-[170px] !py-1 !px-2 !text-xs rounded-lg border border-slate-200 bg-white" />
</div>
<div>
<label class="mb-1 block text-xs font-medium text-slate-500">状态</label>
<label class="mb-1 block text-xs font-medium text-slate-500">{{ $t('workspace.schedule.filters.status') }}</label>
<select v-model="wsScheduleStatusFilter" class="!w-[120px] !py-1 !px-2 !text-xs rounded-lg border border-slate-200 bg-white">
<option v-for="o in wsScheduleStatusOptions" :key="o.value" :value="o.value">{{ o.label }}</option>
</select>
@@ -1909,41 +1909,41 @@ onMounted(async () => {
class="inline-flex items-center gap-1 rounded-xl bg-brand-600 px-3 py-1.5 text-sm font-medium text-white transition-colors hover:bg-brand-700"
>
<Search class="h-3.5 w-3.5" />
查询
{{ $t('workspace.schedule.search') }}
</button>
<button
@click="resetWsScheduleFilters"
class="rounded-xl border border-slate-200 px-3 py-1.5 text-sm font-medium text-slate-600 transition-colors hover:bg-slate-50"
>
重置
{{ $t('workspace.schedule.reset') }}
</button>
</div>
<div v-if="workspaceScheduleLoading" class="py-10 text-center text-sm text-slate-400">正在加载...</div>
<div v-else-if="workspaceScheduleRuns.length === 0" class="py-10 text-center text-sm text-slate-400">暂无排程记录</div>
<div v-if="workspaceScheduleLoading" class="py-10 text-center text-sm text-slate-400">{{ $t('workspace.schedule.loading') }}</div>
<div v-else-if="workspaceScheduleRuns.length === 0" class="py-10 text-center text-sm text-slate-400">{{ $t('workspace.schedule.empty') }}</div>
<div v-else class="overflow-hidden rounded-2xl border border-slate-200 bg-white">
<div class="overflow-x-auto">
<table class="w-full text-sm">
<thead>
<tr class="border-b border-slate-100 bg-slate-50/60">
<th class="px-4 py-3 text-left font-semibold text-slate-600">排程名称</th>
<th class="px-4 py-3 text-left font-semibold text-slate-600">运行编号</th>
<th class="px-4 py-3 text-left font-semibold text-slate-600">触发方式</th>
<th class="px-4 py-3 text-left font-semibold text-slate-600">开始时间</th>
<th class="px-4 py-3 text-left font-semibold text-slate-600">结束时间</th>
<th class="px-4 py-3 text-left font-semibold text-slate-600">耗时</th>
<th class="px-4 py-3 text-left font-semibold text-slate-600">状态</th>
<th class="px-4 py-3 text-left font-semibold text-slate-600">处理笔数</th>
<th class="px-4 py-3 text-left font-semibold text-slate-600">成功笔数</th>
<th class="px-4 py-3 text-left font-semibold text-slate-600">失败笔数</th>
<th class="px-4 py-3 text-left font-semibold text-slate-600">{{ $t('workspace.schedule.columns.name') }}</th>
<th class="px-4 py-3 text-left font-semibold text-slate-600">{{ $t('workspace.schedule.columns.runNo') }}</th>
<th class="px-4 py-3 text-left font-semibold text-slate-600">{{ $t('workspace.schedule.columns.triggerType') }}</th>
<th class="px-4 py-3 text-left font-semibold text-slate-600">{{ $t('workspace.schedule.columns.start') }}</th>
<th class="px-4 py-3 text-left font-semibold text-slate-600">{{ $t('workspace.schedule.columns.end') }}</th>
<th class="px-4 py-3 text-left font-semibold text-slate-600">{{ $t('workspace.schedule.columns.duration') }}</th>
<th class="px-4 py-3 text-left font-semibold text-slate-600">{{ $t('workspace.schedule.columns.status') }}</th>
<th class="px-4 py-3 text-left font-semibold text-slate-600">{{ $t('workspace.schedule.columns.total') }}</th>
<th class="px-4 py-3 text-left font-semibold text-slate-600">{{ $t('workspace.schedule.columns.success') }}</th>
<th class="px-4 py-3 text-left font-semibold text-slate-600">{{ $t('workspace.schedule.columns.failed') }}</th>
<th class="px-4 py-3 text-left font-semibold text-slate-600">明细</th>
<th class="px-4 py-3 text-left font-semibold text-slate-600">{{ $t('workspace.schedule.columns.detail') }}</th>
</tr>
</thead>
<tbody>
<tr v-for="r in workspaceScheduleRuns" :key="r.id" class="border-b border-slate-50 transition-colors hover:bg-slate-50/50">
<td class="px-4 py-3 font-medium text-slate-900">{{ r.schedule_name || '-' }}</td>
<td class="px-4 py-3 text-slate-500 font-mono text-xs">{{ r.run_no }}</td>
<td class="px-4 py-3 text-slate-500">{{ r.trigger_type === 'manual' ? '手动' : r.trigger_type === 'test' ? '测试' : '定时' }}</td>
<td class="px-4 py-3 text-slate-500">{{ r.trigger_type === 'manual' ? $t('workspace.schedule.trigger.manual') : r.trigger_type === 'test' ? $t('workspace.schedule.trigger.test') : $t('workspace.schedule.trigger.timed') }}</td>
<td class="px-4 py-3 text-slate-500 whitespace-nowrap">{{ formatDateTime(r.started_at) }}</td>
<td class="px-4 py-3 text-slate-500 whitespace-nowrap">{{ formatDateTime(r.finished_at) }}</td>
<td class="px-4 py-3 text-slate-500 whitespace-nowrap">{{ r.duration_ms != null ? (r.duration_ms >= 1000 ? (r.duration_ms / 1000).toFixed(1) + 's' : r.duration_ms + 'ms') : '-' }}</td>
@@ -1952,7 +1952,7 @@ onMounted(async () => {
{{ getWsScheduleStatusBadge(r.status).label }}
</span>
<span v-if="r.error_message && r.error_message !== '无待处理数据'" class="ml-1 text-xs text-slate-400" :title="r.error_message">...</span>
<span v-else-if="r.error_message === '无待处理数据'" class="ml-1 text-xs text-slate-400">(无待处理数据)</span>
<span v-else-if="r.error_message === '无待处理数据'" class="ml-1 text-xs text-slate-400">({{ $t('workspace.schedule.noPendingData') }})</span>
</td>
<td class="px-4 py-3 text-slate-500">{{ r.total_count || 0 }}</td>
<td class="px-4 py-3 text-emerald-600 font-medium">{{ r.success_count ?? 0 }}</td>
@@ -1966,7 +1966,7 @@ onMounted(async () => {
class="inline-flex items-center gap-1 rounded-lg border border-slate-200 px-2 py-1 text-xs font-medium text-slate-600 transition-colors hover:bg-slate-50"
>
<Download class="h-3 w-3" />
下载
{{ $t('workspace.schedule.download') }}
</a>
<span v-else class="text-xs text-slate-300">-</span>
</td>
@@ -2162,9 +2162,9 @@ onMounted(async () => {
<div class="flex h-14 items-center justify-around">
<button
v-for="tab in ([
{ key: 'applications', icon: LayoutGrid, label: '应用管理' },
{ key: 'history', icon: Bot, label: '历史会话' },
{ key: 'profile', icon: User, label: '我的' },
{ key: 'applications', icon: LayoutGrid, label: $t('workspace.mobileTabs.applications') },
{ key: 'history', icon: Bot, label: $t('workspace.mobileTabs.history') },
{ key: 'profile', icon: User, label: $t('workspace.mobileTabs.me') },
] as const)"
:key="tab.key"
@click="mobileTabActive = tab.key"