diff --git a/frontend/src/i18n.ts b/frontend/src/i18n.ts index c728cd62..06726563 100644 --- a/frontend/src/i18n.ts +++ b/frontend/src/i18n.ts @@ -452,7 +452,8 @@ const messages = { wecom: 'WeCom', permissions: 'App Permissions', requests: 'Permission Requests', - reports: 'Data Reports' + reports: 'Data Reports', + schedules: 'Schedule Management' }, // Dashboard @@ -1010,6 +1011,135 @@ const messages = { // Common Messages schedule: { + overviewTitle: 'Schedule Management Overview', + workbenchTitle: 'Schedule Management Workbench', + overviewSubtitle: 'Click a schedule card to open the workbench.', + workbenchSubtitle: 'Schedule list on the left, run records on the right.', + refresh: 'Refresh schedules', + stats: { + total: 'Total schedules', + enabled: 'Enabled', + disabled: 'Disabled', + running: 'Running' + }, + sectionOverview: 'Schedule Management Overview', + switchByCard: 'Switch by card', + addTitle: 'Add schedule', + addHint: 'Click the button to fill in schedule fields in a dialog.', + addButton: 'Add schedule', + emptyList: 'No schedules yet. Create one first.', + loading: 'Loading...', + enabled: 'Enabled', + disabled: 'Disabled', + scheduleNo: 'No.', + config: 'Config', + owner: 'Owner', + lastRun: 'Last run', + nextRun: 'Next run', + noSelection: 'No schedule selected', + selectedHint: 'Selected schedule · Last run {time}', + runBatches: 'Run batches', + totalProcessed: 'Total processed', + totalSuccess: 'Total success', + totalFailed: 'Total failed', + listTitle: 'Schedule list', + recordsTitle: '{name} · Run records', + recordsSubtitle: 'Run record details are shown below.', + noSelectionHint: 'Select a schedule from the list on the left first.', + filterStart: 'Start', + filterEnd: 'End', + query: 'Search', + reset: 'Reset', + queryingRuns: 'Loading records...', + noRunRecords: 'No run records yet.', + runLogs: 'Run logs', + stepsCount: '{count} steps', + viewDetail: 'View details', + resizeColumn: 'Drag to resize {label} column', + notified: 'Notified', + notifyError: 'Error', + download: 'Download', + log: 'Log', + actions: { + edit: 'Edit', + start: 'Start', + pause: 'Pause', + run: 'Run', + test: 'Test', + delete: 'Delete' + }, + columns: { + runNo: 'Run ID', + startedAt: 'Started at', + finishedAt: 'Finished at', + status: 'Status', + totalCount: 'Processed', + successCount: 'Success', + failedCount: 'Failed', + wecomNotified: 'WeCom notify', + detail: 'Detail', + log: 'Log' + }, + form: { + editTitle: 'Edit schedule', + createTitle: 'Add schedule', + name: 'Schedule name', + namePlaceholder: 'e.g. RoHS auto review schedule', + owner: 'Schedule owner', + noUsers: 'No users available', + selectOwner: 'Select an owner', + dataSourceConfig: 'Data source & execution config', + databaseDirect: 'Database', + externalApi: 'External API', + querying: 'Querying...', + testQuery: 'Test query', + expandConfig: 'Expand config', + collapseConfig: 'Collapse config', + dataSourceSection: 'Data source config', + waitSeconds: 'Wait time (seconds)', + noAgents: 'No agents available', + agentDisabled: 'Disabled', + cronTitle: 'Cron visual editor', + cronHint: 'Cron expression is generated automatically from the frequency you choose.', + everyMinutes: 'Every N minutes', + hourly: 'Hourly', + daily: 'Daily', + weekly: 'Weekly', + minuteInterval: 'Minute interval', + minuteOfHour: 'Minute of hour', + hour: 'Hour', + minute: 'Minute', + weekday: 'Weekday', + cronPreview: 'Cron preview', + nextRun: 'Next run', + notifyEnabled: 'Enable notifications', + selectNotifyUsers: 'Select notification recipients...', + enableOnCreate: 'Enable after creation', + cancel: 'Cancel', + saving: 'Saving...', + saveChanges: 'Save changes', + createSchedule: 'Create schedule' + }, + testRun: { + title: 'Test run — {name}', + subtitle: 'Edit WHERE clause, limit rows, run quickly and inspect each step', + close: 'Close', + running: 'Running...', + start: 'Start test run', + waitingHint: 'Dify calls may take a while, please wait...', + total: 'Total', + success: 'Success', + failed: 'Failed', + skipped: 'Skipped', + limitSummary: 'Limit {limit} rows | Dify Agent ID: {agentId}', + noAgent: 'None', + stepLogs: 'Step logs', + viewSql: 'View execution SQL', + errors: 'Errors ({count})', + queryResult: 'Query result', + resultSummary: '{total} total, showing {showing}', + viewGeneratedSql: 'View generated SQL' + }, status: { all: 'All', success: 'Success', @@ -1038,6 +1168,7 @@ const messages = { deleteConfirmMessage: 'Confirm deleting schedule \"{name}\"?', msg: { testRunFailed: 'Test run failed', + testQueryFailed: 'Test query failed', configRequired: 'At least one of Dify Agent, SQL config, or external API is required.', headerLabelsJsonInvalid: 'header_labels JSON format is invalid.', apiHeadersJsonInvalid: 'API Headers JSON format is invalid.', @@ -1766,7 +1897,8 @@ const messages = { wecom: '企业微信', permissions: '应用权限', requests: '权限审批', - reports: '数据报表' + reports: '数据报表', + schedules: '排程管理' }, // Dashboard @@ -2303,6 +2435,135 @@ const messages = { // Common Messages schedule: { + overviewTitle: '排程管理概览', + workbenchTitle: '排程管理工作台', + overviewSubtitle: '点击排程卡片进入排程工作台。', + workbenchSubtitle: '左侧排程列表,右侧执行记录列表。', + refresh: '刷新排程', + stats: { + total: '排程总数', + enabled: '启用中', + disabled: '停用中', + running: '执行中' + }, + sectionOverview: '排程管理概览', + switchByCard: '按卡片切换', + addTitle: '新增排程', + addHint: '点击按钮后弹窗录入排程字段。', + addButton: '新增排程', + emptyList: '暂无排程,请先创建。', + loading: '正在加载...', + enabled: '启用', + disabled: '停用', + scheduleNo: '编号', + config: '配置', + owner: '所有者', + lastRun: '最近执行', + nextRun: '下次执行', + noSelection: '未选择排程', + selectedHint: '当前选中排程 · 最近执行 {time}', + runBatches: '执行批次', + totalProcessed: '处理总数', + totalSuccess: '成功总数', + totalFailed: '失败总数', + listTitle: '排程列表', + recordsTitle: '{name} · 执行记录', + recordsSubtitle: '下方仅展示执行记录明细。', + noSelectionHint: '未选择排程,请先在左侧列表选择一个排程。', + filterStart: '开始', + filterEnd: '结束', + query: '查询', + reset: '重置', + queryingRuns: '正在查询记录...', + noRunRecords: '暂无执行记录。', + runLogs: '执行日志', + stepsCount: '共 {count} 步', + viewDetail: '查看详情', + resizeColumn: '拖拽调整{label}列宽', + notified: '已通知', + notifyError: '异常', + download: '下载', + log: '日志', + actions: { + edit: '编辑', + start: '启动', + pause: '暂停', + run: '执行', + test: '测试', + delete: '删除' + }, + columns: { + runNo: '执行单号', + startedAt: '开始时间', + finishedAt: '结束时间', + status: '状态', + totalCount: '处理', + successCount: '成功', + failedCount: '失败', + wecomNotified: '企微通知', + detail: '明细', + log: '日志' + }, + form: { + editTitle: '编辑排程', + createTitle: '新增排程', + name: '排程名称', + namePlaceholder: '例如:RoHS 自动审核排程', + owner: '排程所有者', + noUsers: '暂无可用用户', + selectOwner: '请选择所有者', + dataSourceConfig: '数据源与执行配置', + databaseDirect: '数据库直联', + externalApi: '外部API', + querying: '查询中...', + testQuery: '测试查询', + expandConfig: '展开配置', + collapseConfig: '收起配置', + dataSourceSection: '数据源配置', + waitSeconds: '等待时间(秒)', + noAgents: '暂无可用 Agent', + agentDisabled: '不启用', + cronTitle: 'Cron 图形化设置', + cronHint: '选择执行频率后自动生成 Cron 表达式。', + everyMinutes: '每隔分钟', + hourly: '每小时', + daily: '每天', + weekly: '每周', + minuteInterval: '分钟间隔', + minuteOfHour: '每小时第几分钟', + hour: '小时', + minute: '分钟', + weekday: '星期', + cronPreview: 'Cron 预览', + nextRun: '下次执行', + notifyEnabled: '启用通知', + selectNotifyUsers: '选择通知人员...', + enableOnCreate: '创建后启用', + cancel: '取消', + saving: '保存中...', + saveChanges: '保存修改', + createSchedule: '创建排程' + }, + testRun: { + title: '测试执行 — {name}', + subtitle: '编辑 WHERE 条件,限制行数,快速执行并查看每步结果', + close: '关闭', + running: '执行中...', + start: '开始测试执行', + waitingHint: 'Dify 调用可能需要较长时间,请耐心等待...', + total: '总处理', + success: '成功', + failed: '失败', + skipped: '跳过', + limitSummary: '限制 {limit} 条 | Dify Agent ID: {agentId}', + noAgent: '无', + stepLogs: '步骤日志', + viewSql: '查看执行 SQL', + errors: '错误信息 ({count})', + queryResult: '查询结果', + resultSummary: '共 {total} 条,展示 {showing} 条', + viewGeneratedSql: '查看生成 SQL' + }, status: { all: '全部状态', success: '成功', @@ -2331,6 +2592,7 @@ const messages = { deleteConfirmMessage: '确认删除排程「{name}」?', msg: { testRunFailed: '测试执行失败', + testQueryFailed: '测试查询失败', configRequired: 'Dify Agent、SQL 配置或外部 API 至少填写一项,否则排程执行无任何效果', headerLabelsJsonInvalid: 'header_labels JSON 格式错误,请检查', apiHeadersJsonInvalid: 'API Headers JSON 格式错误,请检查', @@ -3043,7 +3305,8 @@ const messages = { wecom: '企業微信', permissions: '應用權限', requests: '權限審批', - reports: '數據報表' + reports: '數據報表', + schedules: '排程管理' }, // Dashboard @@ -4242,7 +4505,8 @@ const messages = { wecom: 'WeCom', permissions: 'สิทธิ์แอปพลิเคชัน', requests: 'คำขอสิทธิ์', - reports: 'รายงานข้อมูล' + reports: 'รายงานข้อมูล', + schedules: 'Schedule Management' }, // Dashboard diff --git a/frontend/src/views/AdminView.vue b/frontend/src/views/AdminView.vue index a27b5025..15dc93a8 100644 --- a/frontend/src/views/AdminView.vue +++ b/frontend/src/views/AdminView.vue @@ -70,7 +70,7 @@ const sidebarItems = computed(() => { { id: 'departments', icon: Building, label: t('admin.nav.departments') }, { id: 'agents', icon: Bot, label: t('admin.nav.agents') }, { id: 'knowledge_base', icon: FileText, label: t('admin.nav.knowledgeBase') }, - { id: 'schedules', icon: Settings2, label: '排程管理' }, + { id: 'schedules', icon: Settings2, label: t('admin.nav.schedules') }, { id: 'announcements', icon: Megaphone, label: t('admin.nav.announcements') }, { id: 'questions', icon: MessageCircleQuestion, label: t('admin.nav.questions') }, { id: 'wecom', icon: Link2, label: t('admin.nav.wecom') }, @@ -456,17 +456,37 @@ const scheduleRunStatusFilter = ref<'all' | string>('all'); const scheduleRunStartedAfter = ref(''); const scheduleRunStartedBefore = ref(''); const scheduleRunColumnDefs = ref([ - { key: 'run_no', label: '执行单号', width: 280, min: 60 }, - { key: 'started_at', label: '开始时间', width: 190, min: 60 }, - { key: 'finished_at', label: '结束时间', width: 190, min: 60 }, - { key: 'status', label: '状态', width: 130, min: 50 }, - { key: 'total_count', label: '处理', width: 70, min: 40 }, - { key: 'success_count', label: '成功', width: 70, min: 40 }, - { key: 'failed_count', label: '失败', width: 70, min: 40 }, - { key: 'wecom_notified', label: '企微通知', width: 90, min: 50 }, - { key: 'detail', label: '明细', width: 90, min: 50 }, - { key: 'log', label: '日志', width: 90, min: 50 }, + { key: 'run_no', label: '', width: 280, min: 60 }, + { key: 'started_at', label: '', width: 190, min: 60 }, + { key: 'finished_at', label: '', width: 190, min: 60 }, + { key: 'status', label: '', width: 130, min: 50 }, + { key: 'total_count', label: '', width: 70, min: 40 }, + { key: 'success_count', label: '', width: 70, min: 40 }, + { key: 'failed_count', label: '', width: 70, min: 40 }, + { key: 'wecom_notified', label: '', width: 90, min: 50 }, + { key: 'detail', label: '', width: 90, min: 50 }, + { key: 'log', label: '', width: 90, min: 50 }, ]); + +const syncScheduleRunColumnLabels = () => { + const keyToI18n: Record = { + run_no: 'runNo', + started_at: 'startedAt', + finished_at: 'finishedAt', + status: 'status', + total_count: 'totalCount', + success_count: 'successCount', + failed_count: 'failedCount', + wecom_notified: 'wecomNotified', + detail: 'detail', + log: 'log', + }; + scheduleRunColumnDefs.value.forEach((col) => { + const i18nKey = keyToI18n[col.key]; + if (i18nKey) col.label = t(`admin.schedule.columns.${i18nKey}`); + }); +}; +watch(locale, syncScheduleRunColumnLabels, { immediate: true }); const resizingScheduleCol = ref<{ index: number; startX: number; startWidth: number } | null>(null); const onScheduleColResizeMove = (event: MouseEvent) => { @@ -522,7 +542,7 @@ const scheduleCronDesigner = ref({ weekly_hour: 9, weekly_minute: 0, }); -const weeklyDayOptions = [ +const weeklyDayOptions = computed(() => [ { value: 1, label: t('admin.schedule.weekday.mon') }, { value: 2, label: t('admin.schedule.weekday.tue') }, { value: 3, label: t('admin.schedule.weekday.wed') }, @@ -530,7 +550,7 @@ const weeklyDayOptions = [ { 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 = () => { const cfg = scheduleCronDesigner.value; @@ -807,13 +827,13 @@ const selectedSchedule = computed(() => schedules.value.find((item) => item.id === selectedScheduleId.value) || null ); -const scheduleRunStatusOptions = [ +const scheduleRunStatusOptions = computed(() => [ { 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 = { @@ -991,7 +1011,7 @@ const handleTestScheduleSql = async () => { }); scheduleTestResult.value = result; } catch (e: any) { - msg.error(`测试查询失败: ${e?.message || e}`); + msg.error(`${t('admin.schedule.msg.testQueryFailed')}: ${e?.message || e}`); } finally { scheduleTestLoading.value = false; } @@ -4258,10 +4278,10 @@ const handlePermissionImport = async (event: Event) => {

- {{ scheduleViewMode === 'overview' ? '排程管理概览' : '排程管理工作台' }} + {{ scheduleViewMode === 'overview' ? $t('admin.schedule.overviewTitle') : $t('admin.schedule.workbenchTitle') }}

- {{ scheduleViewMode === 'overview' ? '点击排程卡片进入排程工作台。' : '左侧排程列表,右侧执行记录列表。' }} + {{ scheduleViewMode === 'overview' ? $t('admin.schedule.overviewSubtitle') : $t('admin.schedule.workbenchSubtitle') }}

@@ -4270,7 +4290,7 @@ const handlePermissionImport = async (event: Event) => { @click="loadSchedules" > - 刷新排程 + {{ $t('admin.schedule.refresh') }} @@ -4280,37 +4300,37 @@ const handlePermissionImport = async (event: Event) => {
{{ schedules.length }}
-
排程总数
+
{{ $t('admin.schedule.stats.total') }}
{{ scheduleEnabledCount }}
-
启用中
+
{{ $t('admin.schedule.stats.enabled') }}
{{ scheduleDisabledCount }}
-
停用中
+
{{ $t('admin.schedule.stats.disabled') }}
{{ scheduleRunningCount }}
-
执行中
+
{{ $t('admin.schedule.stats.running') }}
-

排程管理概览

- 按卡片切换 +

{{ $t('admin.schedule.sectionOverview') }}

+ {{ $t('admin.schedule.switchByCard') }}
-
正在加载...
+
{{ $t('admin.schedule.loading') }}
-
新增排程
+
{{ $t('admin.schedule.addTitle') }}
- 点击按钮后弹窗录入排程字段。 + {{ $t('admin.schedule.addHint') }}
@@ -4334,26 +4354,26 @@ const handlePermissionImport = async (event: Event) => {
{{ s.name }}
- {{ s.enabled ? '启用' : '停用' }} + {{ s.enabled ? $t('admin.schedule.enabled') : $t('admin.schedule.disabled') }}
-
编号:{{ s.schedule_no }}
+
{{ $t('admin.schedule.scheduleNo') }}:{{ s.schedule_no }}
Cron:{{ s.cron_expr }}
- 配置:{{ s.platform_api_path }} + {{ $t('admin.schedule.config') }}:{{ s.platform_api_path }}
-
所有者:{{ s.owner_username || s.owner_user_id }}
+
{{ $t('admin.schedule.owner') }}:{{ s.owner_username || s.owner_user_id }}
- 最近执行:{{ formatDateTime(s.last_run_at) }} + {{ $t('admin.schedule.lastRun') }}:{{ formatDateTime(s.last_run_at) }}
- 下次执行:{{ formatDateTime(s.next_run_at) }} + {{ $t('admin.schedule.nextRun') }}:{{ formatDateTime(s.next_run_at) }}
- 暂无排程,请先创建。 + {{ $t('admin.schedule.emptyList') }}
@@ -4416,24 +4436,24 @@ const handlePermissionImport = async (event: Event) => {
-
{{ selectedSchedule?.name || '未选择排程' }}
-
当前选中排程 · 最近执行 {{ selectedScheduleLatestRunAt }}
+
{{ selectedSchedule?.name || $t('admin.schedule.noSelection') }}
+
{{ $t('admin.schedule.selectedHint', { time: selectedScheduleLatestRunAt }) }}
{{ selectedScheduleRuns.length }}
-
执行批次
+
{{ $t('admin.schedule.runBatches') }}
{{ selectedScheduleRunMetrics.total }}
-
处理总数
+
{{ $t('admin.schedule.totalProcessed') }}
{{ selectedScheduleRunMetrics.success }}
-
成功总数
+
{{ $t('admin.schedule.totalSuccess') }}
{{ selectedScheduleRunMetrics.failed }}
-
失败总数
+
{{ $t('admin.schedule.totalFailed') }}
@@ -4441,8 +4461,8 @@ const handlePermissionImport = async (event: Event) => {
-

排程列表

- 按卡片切换 +

{{ $t('admin.schedule.listTitle') }}

+ {{ $t('admin.schedule.switchByCard') }}
- {{ s.enabled ? '启用' : '停用' }} + {{ s.enabled ? $t('admin.schedule.enabled') : $t('admin.schedule.disabled') }}
@@ -4517,16 +4537,16 @@ const handlePermissionImport = async (event: Event) => {
-

{{ selectedSchedule.name }} · 执行记录

-

下方仅展示执行记录明细。

+

{{ $t('admin.schedule.recordsTitle', { name: selectedSchedule.name }) }}

+

{{ $t('admin.schedule.recordsSubtitle') }}

- + - + + +
- +
@@ -5757,26 +5777,26 @@ const handlePermissionImport = async (event: Event) => {
-

数据源与执行配置

+

{{ $t('admin.schedule.form.dataSourceConfig') }}

+ >{{ $t('admin.schedule.form.databaseDirect') }} + >{{ $t('admin.schedule.form.externalApi') }}
@@ -5793,7 +5813,7 @@ const handlePermissionImport = async (event: Event) => { - 选择通知人员... + {{ $t('admin.schedule.form.selectNotifyUsers') }}
{
diff --git a/frontend/src/views/ChatView.vue b/frontend/src/views/ChatView.vue index c6336293..3b1c3b85 100644 --- a/frontend/src/views/ChatView.vue +++ b/frontend/src/views/ChatView.vue @@ -13,7 +13,7 @@ import { ref, onMounted, onBeforeUnmount, computed, watch, nextTick } from 'vue'; import { useI18n } from 'vue-i18n'; import { useChat } from '../composables/useChat'; -import { Send, Loader2, Plus, Copy, Edit2, RotateCw, Check, X, PanelLeftClose, PanelLeftOpen, Mail, Settings, ChevronDown, Sparkles, Database, Mic, LogOut, MessageSquareText, Globe, ExternalLink, Search, LayoutGrid, History, Sun, Moon } from 'lucide-vue-next'; +import { Send, Loader2, Plus, Copy, Edit2, RotateCw, Check, X, PanelLeftClose, PanelLeftOpen, ChevronDown, Sparkles, Database, Mic, LogOut, MessageSquareText, Globe, ExternalLink, Search, LayoutGrid, Briefcase, History, Sun, Moon } from 'lucide-vue-next'; import { marked } from 'marked'; import { useRoute, useRouter } from 'vue-router'; import { config } from '../config'; @@ -1848,8 +1848,8 @@ const showChatRating = ref(false);
{{ (currentUser?.username || 'I').charAt(0).toUpperCase() }}
- - + +
@@ -1945,9 +1945,9 @@ const showChatRating = ref(false);
-
{{ $t('chat.language') }}
-
- @@ -1955,7 +1955,7 @@ const showChatRating = ref(false);
- @@ -1969,8 +1969,8 @@ const showChatRating = ref(false); - - + +