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

+10 -8
View File
@@ -9,6 +9,7 @@
* - 对 Office 文档在可公网 HTTPS 访问时走 Office 在线预览,否则降级为打开/下载 * - 对 Office 文档在可公网 HTTPS 访问时走 Office 在线预览,否则降级为打开/下载
*/ */
import { computed, ref, watch } from 'vue'; import { computed, ref, watch } from 'vue';
import { useI18n } from 'vue-i18n';
import { marked } from 'marked'; import { marked } from 'marked';
import * as XLSX from 'xlsx'; import * as XLSX from 'xlsx';
import { useMessage } from '../composables/useMessage'; import { useMessage } from '../composables/useMessage';
@@ -44,6 +45,7 @@ const emit = defineEmits<{
(e: 'update:modelValue', value: boolean): void; (e: 'update:modelValue', value: boolean): void;
}>(); }>();
const msg = useMessage(); const msg = useMessage();
const { t } = useI18n();
const isLoading = ref(false); const isLoading = ref(false);
const error = ref(''); const error = ref('');
@@ -146,7 +148,7 @@ const downloadFile = async () => {
URL.revokeObjectURL(url); URL.revokeObjectURL(url);
} catch (err: any) { } catch (err: any) {
console.error('Download failed:', err); console.error('Download failed:', err);
msg.error('下载失败: ' + (err.message || '未知错误')); msg.error(t('filePreview.msg.downloadFailed', { reason: err.message || t('filePreview.msg.unknownError') }));
} finally { } finally {
isDownloading.value = false; isDownloading.value = false;
} }
@@ -419,7 +421,7 @@ watch(
<div class="bg-white dark:bg-slate-900 rounded-2xl shadow-xl w-full max-w-5xl h-[85vh] flex flex-col overflow-hidden border border-slate-200 dark:border-slate-700"> <div class="bg-white dark:bg-slate-900 rounded-2xl shadow-xl w-full max-w-5xl h-[85vh] flex flex-col overflow-hidden border border-slate-200 dark:border-slate-700">
<div class="px-6 py-4 border-b border-slate-200 dark:border-slate-700 flex items-start justify-between gap-4"> <div class="px-6 py-4 border-b border-slate-200 dark:border-slate-700 flex items-start justify-between gap-4">
<div class="min-w-0"> <div class="min-w-0">
<div class="text-sm font-medium text-slate-500 dark:text-slate-400 tracking-wide">文件预览</div> <div class="text-sm font-medium text-slate-500 dark:text-slate-400 tracking-wide">{{ t('filePreview.title') }}</div>
<div class="mt-1 font-semibold text-slate-900 dark:text-slate-100 break-words">{{ file.name }}</div> <div class="mt-1 font-semibold text-slate-900 dark:text-slate-100 break-words">{{ file.name }}</div>
<button type="button" @click="downloadFile" :disabled="isDownloading" class="mt-2 inline-flex items-center justify-center px-3 py-1.5 text-xs font-medium rounded-lg bg-brand-50 text-brand-700 hover:bg-brand-100 border border-brand-200 dark:bg-brand-900/30 dark:text-brand-300 dark:border-brand-800 transition-colors disabled:opacity-50 disabled:cursor-not-allowed"> <button type="button" @click="downloadFile" :disabled="isDownloading" class="mt-2 inline-flex items-center justify-center px-3 py-1.5 text-xs font-medium rounded-lg bg-brand-50 text-brand-700 hover:bg-brand-100 border border-brand-200 dark:bg-brand-900/30 dark:text-brand-300 dark:border-brand-800 transition-colors disabled:opacity-50 disabled:cursor-not-allowed">
<svg v-if="!isDownloading" xmlns="http://www.w3.org/2000/svg" class="h-4 w-4 mr-1.5" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2"> <svg v-if="!isDownloading" xmlns="http://www.w3.org/2000/svg" class="h-4 w-4 mr-1.5" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2">
@@ -429,20 +431,20 @@ watch(
<circle class="opacity-25" cx="12" cy="12" r="10" stroke="currentColor" stroke-width="4"></circle> <circle class="opacity-25" cx="12" cy="12" r="10" stroke="currentColor" stroke-width="4"></circle>
<path class="opacity-75" fill="currentColor" d="M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"></path> <path class="opacity-75" fill="currentColor" d="M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"></path>
</svg> </svg>
{{ isDownloading ? '下载中...' : '下载文件' }} {{ isDownloading ? t('filePreview.downloading') : t('filePreview.download') }}
</button> </button>
</div> </div>
<button type="button" @click="close" class="shrink-0 whitespace-nowrap inline-flex items-center justify-center px-4 py-2 rounded-xl border border-slate-200 dark:border-slate-700 text-slate-600 dark:text-slate-300 bg-white/80 dark:bg-slate-900/80 hover:bg-slate-100 dark:hover:bg-slate-800">关闭</button> <button type="button" @click="close" class="shrink-0 whitespace-nowrap inline-flex items-center justify-center px-4 py-2 rounded-xl border border-slate-200 dark:border-slate-700 text-slate-600 dark:text-slate-300 bg-white/80 dark:bg-slate-900/80 hover:bg-slate-100 dark:hover:bg-slate-800">{{ t('common.close') }}</button>
</div> </div>
<div class="flex-1 overflow-auto p-4 bg-slate-50 dark:bg-slate-950"> <div class="flex-1 overflow-auto p-4 bg-slate-50 dark:bg-slate-950">
<div v-if="isLoading" class="text-sm text-slate-500 dark:text-slate-400">加载中...</div> <div v-if="isLoading" class="text-sm text-slate-500 dark:text-slate-400">{{ t('common.loading') }}</div>
<div v-else-if="error" class="text-sm text-red-600 bg-red-50 border border-red-200 rounded-lg p-3"> <div v-else-if="error" class="text-sm text-red-600 bg-red-50 border border-red-200 rounded-lg p-3">
<template v-if="previewTooLarge"> <template v-if="previewTooLarge">
文件较大,暂不支持在线预览,请直接点击上方“下载文件”获取原文件。 {{ t('filePreview.tooLarge') }}
</template> </template>
<template v-else> <template v-else>
预览失败:{{ error }} {{ t('filePreview.previewFailed') }}{{ error }}
</template> </template>
</div> </div>
<div <div
@@ -532,7 +534,7 @@ watch(
<circle class="opacity-25" cx="12" cy="12" r="10" stroke="currentColor" stroke-width="4"></circle> <circle class="opacity-25" cx="12" cy="12" r="10" stroke="currentColor" stroke-width="4"></circle>
<path class="opacity-75" fill="currentColor" d="M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"></path> <path class="opacity-75" fill="currentColor" d="M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"></path>
</svg> </svg>
{{ isDownloading ? '下载中...' : '下载文件' }} {{ isDownloading ? t('filePreview.downloading') : t('filePreview.download') }}
</button> </button>
</div> </div>
</div> </div>
@@ -1,5 +1,6 @@
<script setup lang="ts"> <script setup lang="ts">
import { computed, ref, watch } from 'vue'; import { computed, ref, watch } from 'vue';
import { useI18n } from 'vue-i18n';
import { MessageSquareText, X } from 'lucide-vue-next'; import { MessageSquareText, X } from 'lucide-vue-next';
interface Props { interface Props {
@@ -20,11 +21,23 @@ const emit = defineEmits<{
(e: 'submitted'): void; (e: 'submitted'): void;
}>(); }>();
const typeOptions = ['功能建议', '问题反馈', '体验优化']; const { t } = useI18n();
const moduleOptions = ['知识库', '通用', '工作流', '账号权限'];
const selectedType = ref<string>('功能建议'); const typeOptions = computed(() => [
const selectedModule = ref<string>('知识库'); t('feedback.type.featureSuggestion'),
t('feedback.type.issueReport'),
t('feedback.type.experienceOptimization'),
]);
const moduleOptions = computed(() => [
t('feedback.module.knowledgeBase'),
t('feedback.module.general'),
t('feedback.module.workflow'),
t('feedback.module.accountPermission'),
]);
const selectedType = ref<string>(t('feedback.type.featureSuggestion'));
const selectedModule = ref<string>(t('feedback.module.knowledgeBase'));
const content = ref(''); const content = ref('');
const submitting = ref(false); const submitting = ref(false);
const error = ref(''); const error = ref('');
@@ -36,8 +49,8 @@ const closeDialog = () => {
}; };
const resetForm = () => { const resetForm = () => {
selectedType.value = '功能建议'; selectedType.value = t('feedback.type.featureSuggestion');
selectedModule.value = '知识库'; selectedModule.value = t('feedback.module.knowledgeBase');
content.value = ''; content.value = '';
error.value = ''; error.value = '';
submitting.value = false; submitting.value = false;
@@ -46,20 +59,19 @@ const resetForm = () => {
watch( watch(
() => props.modelValue, () => props.modelValue,
(visible) => { (visible) => {
if (visible) { if (visible) resetForm();
resetForm();
}
}, },
); );
const submitFeedback = async () => { const submitFeedback = async () => {
if (!canSubmit.value) { if (!canSubmit.value) {
error.value = '请填写反馈内容'; error.value = t('feedback.msg.fillContent');
return; return;
} }
submitting.value = true; submitting.value = true;
error.value = ''; error.value = '';
try { try {
const payload: Record<string, unknown> = { const payload: Record<string, unknown> = {
feedback_type: selectedType.value, feedback_type: selectedType.value,
@@ -67,6 +79,7 @@ const submitFeedback = async () => {
content: content.value.trim(), content: content.value.trim(),
source_page: props.sourcePage, source_page: props.sourcePage,
}; };
if (props.chatLogId !== null && props.chatLogId !== undefined) { if (props.chatLogId !== null && props.chatLogId !== undefined) {
payload.chat_log_id = props.chatLogId; payload.chat_log_id = props.chatLogId;
} }
@@ -82,14 +95,14 @@ const submitFeedback = async () => {
const data = await res.json().catch(() => ({})); const data = await res.json().catch(() => ({}));
if (!res.ok) { if (!res.ok) {
error.value = data?.error || '提交失败,请稍后重试'; error.value = data?.error || t('feedback.msg.submitFailed');
return; return;
} }
emit('submitted'); emit('submitted');
closeDialog(); closeDialog();
} catch { } catch {
error.value = '提交失败,请稍后重试'; error.value = t('feedback.msg.submitFailed');
} finally { } finally {
submitting.value = false; submitting.value = false;
} }
@@ -103,7 +116,7 @@ const submitFeedback = async () => {
> >
<div class="flex max-h-[92vh] w-full max-w-2xl flex-col rounded-2xl bg-white shadow-2xl"> <div class="flex max-h-[92vh] w-full max-w-2xl flex-col rounded-2xl bg-white shadow-2xl">
<div class="flex items-center justify-between border-b border-gray-100 px-5 pb-4 pt-5 sm:px-8 sm:pb-4 sm:pt-7"> <div class="flex items-center justify-between border-b border-gray-100 px-5 pb-4 pt-5 sm:px-8 sm:pb-4 sm:pt-7">
<h3 class="text-2xl font-bold text-gray-900">意见反馈</h3> <h3 class="text-2xl font-bold text-gray-900">{{ t('feedback.title') }}</h3>
<button <button
@click="closeDialog" @click="closeDialog"
class="rounded-lg p-1.5 text-gray-400 transition-colors hover:bg-gray-100 hover:text-gray-600" class="rounded-lg p-1.5 text-gray-400 transition-colors hover:bg-gray-100 hover:text-gray-600"
@@ -115,7 +128,7 @@ const submitFeedback = async () => {
<div class="space-y-5 overflow-y-auto px-5 py-5 sm:px-8"> <div class="space-y-5 overflow-y-auto px-5 py-5 sm:px-8">
<div class="space-y-1.5"> <div class="space-y-1.5">
<label class="block text-sm font-semibold text-gray-600">反馈类型</label> <label class="block text-sm font-semibold text-gray-600">{{ t('feedback.labels.type') }}</label>
<div class="flex flex-wrap gap-3"> <div class="flex flex-wrap gap-3">
<button <button
v-for="item in typeOptions" v-for="item in typeOptions"
@@ -134,7 +147,7 @@ const submitFeedback = async () => {
</div> </div>
<div class="space-y-1.5"> <div class="space-y-1.5">
<label class="block text-sm font-semibold text-gray-600">反馈模块</label> <label class="block text-sm font-semibold text-gray-600">{{ t('feedback.labels.module') }}</label>
<select <select
v-model="selectedModule" v-model="selectedModule"
class="w-full rounded-xl border-gray-200 bg-gray-50 px-4 py-3 text-base shadow-sm outline-none transition-all focus:border-blue-500 focus:bg-white focus:ring-2 focus:ring-blue-500/20" class="w-full rounded-xl border-gray-200 bg-gray-50 px-4 py-3 text-base shadow-sm outline-none transition-all focus:border-blue-500 focus:bg-white focus:ring-2 focus:ring-blue-500/20"
@@ -144,13 +157,13 @@ const submitFeedback = async () => {
</div> </div>
<div class="space-y-1.5"> <div class="space-y-1.5">
<label class="block text-sm font-semibold text-gray-600">反馈内容<span class="ml-0.5 text-red-500">*</span></label> <label class="block text-sm font-semibold text-gray-600">{{ t('feedback.labels.content') }}<span class="ml-0.5 text-red-500">*</span></label>
<textarea <textarea
v-model="content" v-model="content"
rows="5" rows="5"
maxlength="2000" maxlength="2000"
class="w-full resize-none rounded-xl border-gray-200 bg-gray-50 px-4 py-3 text-base shadow-sm outline-none transition-all focus:border-blue-500 focus:bg-white focus:ring-2 focus:ring-blue-500/20" class="w-full resize-none rounded-xl border-gray-200 bg-gray-50 px-4 py-3 text-base shadow-sm outline-none transition-all focus:border-blue-500 focus:bg-white focus:ring-2 focus:ring-blue-500/20"
placeholder="请描述你的问题或建议,帮助我们持续优化。" :placeholder="t('feedback.placeholder.content')"
/> />
<div class="mt-2 flex items-center justify-between"> <div class="mt-2 flex items-center justify-between">
<div v-if="error" class="text-base text-red-600">{{ error }}</div> <div v-if="error" class="text-base text-red-600">{{ error }}</div>
@@ -166,7 +179,7 @@ const submitFeedback = async () => {
class="rounded-xl px-5 py-2.5 text-base font-medium text-gray-600 transition-colors hover:bg-gray-100" class="rounded-xl px-5 py-2.5 text-base font-medium text-gray-600 transition-colors hover:bg-gray-100"
:disabled="submitting" :disabled="submitting"
> >
取消 {{ t('feedback.cancel') }}
</button> </button>
<button <button
@click="submitFeedback" @click="submitFeedback"
@@ -174,7 +187,7 @@ const submitFeedback = async () => {
:disabled="!canSubmit" :disabled="!canSubmit"
> >
<MessageSquareText class="h-5 w-5" /> <MessageSquareText class="h-5 w-5" />
{{ submitting ? '提交中' : '提交' }} {{ submitting ? t('feedback.submitting') : t('feedback.submit') }}
</button> </button>
</div> </div>
</div> </div>
+18 -16
View File
@@ -1,7 +1,9 @@
<script setup lang="ts"> <script setup lang="ts">
import { onMounted, ref } from 'vue'; import { onMounted, ref } from 'vue';
import { useI18n } from 'vue-i18n';
import { listWorkspaceScheduleRuns, workspaceRunExcelUrl, type ScheduleRun } from '../api/schedule'; import { listWorkspaceScheduleRuns, workspaceRunExcelUrl, type ScheduleRun } from '../api/schedule';
const { t } = useI18n();
const isLoading = ref(false); const isLoading = ref(false);
const error = ref(''); const error = ref('');
const runs = ref<ScheduleRun[]>([]); const runs = ref<ScheduleRun[]>([]);
@@ -12,7 +14,7 @@ const loadRuns = async () => {
try { try {
runs.value = await listWorkspaceScheduleRuns(); runs.value = await listWorkspaceScheduleRuns();
} catch (e: any) { } catch (e: any) {
error.value = e?.message || '加载排程记录失败'; error.value = e?.message || t('scheduleRuns.msg.loadFailed');
} finally { } finally {
isLoading.value = false; isLoading.value = false;
} }
@@ -26,27 +28,27 @@ onMounted(() => {
<template> <template>
<div class="mt-6 rounded-2xl border border-slate-200 bg-white p-5"> <div class="mt-6 rounded-2xl border border-slate-200 bg-white p-5">
<div class="mb-4 flex items-center justify-between"> <div class="mb-4 flex items-center justify-between">
<h3 class="text-lg font-semibold text-slate-900">排程记录</h3> <h3 class="text-lg font-semibold text-slate-900">{{ t('scheduleRuns.title') }}</h3>
<button class="rounded-lg border border-slate-300 px-3 py-1.5 text-sm text-slate-700 hover:bg-slate-50" @click="loadRuns"> <button class="rounded-lg border border-slate-300 px-3 py-1.5 text-sm text-slate-700 hover:bg-slate-50" @click="loadRuns">
刷新 {{ t('scheduleRuns.refresh') }}
</button> </button>
</div> </div>
<p class="mb-3 text-xs text-slate-500">仅展示你是 owner 或在通知名单中的记录</p> <p class="mb-3 text-xs text-slate-500">{{ t('scheduleRuns.tip') }}</p>
<div v-if="isLoading" class="py-6 text-sm text-slate-500">加载中...</div> <div v-if="isLoading" class="py-6 text-sm text-slate-500">{{ t('scheduleRuns.loading') }}</div>
<div v-else-if="error" class="py-6 text-sm text-rose-500">{{ error }}</div> <div v-else-if="error" class="py-6 text-sm text-rose-500">{{ error }}</div>
<div v-else-if="runs.length === 0" class="py-6 text-sm text-slate-400">暂无可见记录</div> <div v-else-if="runs.length === 0" class="py-6 text-sm text-slate-400">{{ t('scheduleRuns.empty') }}</div>
<div v-else class="overflow-x-auto"> <div v-else class="overflow-x-auto">
<table class="w-full min-w-[920px] text-sm"> <table class="w-full min-w-[920px] text-sm">
<thead> <thead>
<tr class="border-b border-slate-200 text-left text-slate-500"> <tr class="border-b border-slate-200 text-left text-slate-500">
<th class="px-2 py-2">执行单号</th> <th class="px-2 py-2">{{ t('scheduleRuns.columns.runNo') }}</th>
<th class="px-2 py-2">排程</th> <th class="px-2 py-2">{{ t('scheduleRuns.columns.schedule') }}</th>
<th class="px-2 py-2">开始</th> <th class="px-2 py-2">{{ t('scheduleRuns.columns.start') }}</th>
<th class="px-2 py-2">结束</th> <th class="px-2 py-2">{{ t('scheduleRuns.columns.end') }}</th>
<th class="px-2 py-2">状态</th> <th class="px-2 py-2">{{ t('scheduleRuns.columns.status') }}</th>
<th class="px-2 py-2">处理</th> <th class="px-2 py-2">{{ t('scheduleRuns.columns.total') }}</th>
<th class="px-2 py-2">成功</th> <th class="px-2 py-2">{{ t('scheduleRuns.columns.success') }}</th>
<th class="px-2 py-2">失败</th> <th class="px-2 py-2">{{ t('scheduleRuns.columns.failed') }}</th>
<th class="px-2 py-2">Excel</th> <th class="px-2 py-2">Excel</th>
</tr> </tr>
</thead> </thead>
@@ -61,7 +63,7 @@ onMounted(() => {
<td class="px-2 py-2">{{ run.success_count }}</td> <td class="px-2 py-2">{{ run.success_count }}</td>
<td class="px-2 py-2">{{ run.failed_count }}</td> <td class="px-2 py-2">{{ run.failed_count }}</td>
<td class="px-2 py-2"> <td class="px-2 py-2">
<a class="text-brand-600 hover:underline" :href="workspaceRunExcelUrl(run.id)" target="_blank">查看Excel</a> <a class="text-brand-600 hover:underline" :href="workspaceRunExcelUrl(run.id)" target="_blank">{{ t('scheduleRuns.viewExcel') }}</a>
</td> </td>
</tr> </tr>
</tbody> </tbody>
+30 -67
View File
@@ -1,15 +1,11 @@
<script setup lang="ts"> <script setup lang="ts">
import { ref, watch } from 'vue'; import { ref, watch } from 'vue';
import { useI18n } from 'vue-i18n';
import { getKbDifyHealth, type KbDifyHealth } from '../../api/kb'; import { getKbDifyHealth, type KbDifyHealth } from '../../api/kb';
const props = defineProps<{ const props = defineProps<{ open: boolean }>();
open: boolean; const emit = defineEmits<{ close: []; error: [message: string] }>();
}>(); const { t } = useI18n();
const emit = defineEmits<{
close: [];
error: [message: string];
}>();
const loading = ref(false); const loading = ref(false);
const payload = ref<KbDifyHealth | null>(null); const payload = ref<KbDifyHealth | null>(null);
@@ -20,94 +16,61 @@ const loadHealth = async () => {
loading.value = true; loading.value = true;
payload.value = await getKbDifyHealth(); payload.value = await getKbDifyHealth();
loading.value = false; loading.value = false;
if (!payload.value) { if (!payload.value) emit('error', t('kbDifyHealth.msg.loadFailed'));
emit('error', '加载 Dify 健康状态失败');
}
}; };
watch( watch(() => props.open, (open) => {
() => props.open, if (open) void loadHealth();
(open) => { });
if (open) {
void loadHealth();
}
}
);
</script> </script>
<template> <template>
<div <div v-if="open" class="fixed inset-0 z-50 flex items-center justify-center bg-slate-950/35 px-4 py-8 backdrop-blur-sm" @click="close">
v-if="open"
class="fixed inset-0 z-50 flex items-center justify-center bg-slate-950/35 px-4 py-8 backdrop-blur-sm"
@click="close"
>
<div class="w-full max-w-4xl rounded-3xl border border-slate-200 bg-white p-6 shadow-xl dark:border-slate-700 dark:bg-slate-900" @click.stop> <div class="w-full max-w-4xl rounded-3xl border border-slate-200 bg-white p-6 shadow-xl dark:border-slate-700 dark:bg-slate-900" @click.stop>
<div class="flex items-center justify-between gap-4"> <div class="flex items-center justify-between gap-4">
<div> <div>
<h3 class="text-xl font-bold text-slate-900 dark:text-slate-100">Dify 健康检查</h3> <h3 class="text-xl font-bold text-slate-900 dark:text-slate-100">{{ t('kbDifyHealth.title') }}</h3>
<p class="mt-1 text-sm text-slate-500 dark:text-slate-400"> <p class="mt-1 text-sm text-slate-500 dark:text-slate-400">{{ t('kbDifyHealth.subtitle') }}</p>
查看知识库模块当前的 Dify 连接情况和本地同步概况。
</p>
</div> </div>
<div class="flex items-center gap-3"> <div class="flex items-center gap-3">
<button class="rounded-2xl border border-slate-200 px-3 py-2 text-sm text-slate-600 hover:bg-slate-50 dark:border-slate-700 dark:text-slate-300 dark:hover:bg-slate-800" @click="loadHealth"> <button class="rounded-2xl border border-slate-200 px-3 py-2 text-sm text-slate-600 hover:bg-slate-50 dark:border-slate-700 dark:text-slate-300 dark:hover:bg-slate-800" @click="loadHealth">
刷新 {{ t('common.refresh') }}
</button> </button>
<button class="rounded-2xl border border-slate-200 px-3 py-2 text-sm text-slate-600 hover:bg-slate-50 dark:border-slate-700 dark:text-slate-300 dark:hover:bg-slate-800" @click="close"> <button class="rounded-2xl border border-slate-200 px-3 py-2 text-sm text-slate-600 hover:bg-slate-50 dark:border-slate-700 dark:text-slate-300 dark:hover:bg-slate-800" @click="close">
关闭 {{ t('common.close') }}
</button> </button>
</div> </div>
</div> </div>
<div v-if="loading" class="py-16 text-center text-sm text-slate-400">正在检测...</div> <div v-if="loading" class="py-16 text-center text-sm text-slate-400">{{ t('kbDifyHealth.loading') }}</div>
<div v-else-if="payload" class="mt-6 grid gap-4 md:grid-cols-2 xl:grid-cols-3"> <div v-else-if="payload" class="mt-6 grid gap-4 md:grid-cols-2 xl:grid-cols-3">
<div class="rounded-2xl border border-slate-200 px-4 py-4 dark:border-slate-700"> <div class="rounded-2xl border border-slate-200 px-4 py-4 dark:border-slate-700">
<div class="text-xs font-semibold uppercase tracking-[0.18em] text-slate-400">Dify API</div> <div class="text-xs font-semibold uppercase tracking-[0.18em] text-slate-400">Dify API</div>
<div class="mt-3 text-2xl font-semibold text-slate-900 dark:text-slate-100"> <div class="mt-3 text-2xl font-semibold text-slate-900 dark:text-slate-100">{{ payload.api.reachable ? t('kbDifyHealth.reachable') : t('kbDifyHealth.unreachable') }}</div>
{{ payload.api.reachable ? '可访问' : '不可访问' }} <div class="mt-2 break-all text-xs text-slate-500 dark:text-slate-400">{{ payload.dify_base_url || t('kbDifyHealth.notConfigured') }}</div>
</div>
<div class="mt-2 break-all text-xs text-slate-500 dark:text-slate-400">
{{ payload.dify_base_url || '未配置' }}
</div>
</div> </div>
<div class="rounded-2xl border border-slate-200 px-4 py-4 dark:border-slate-700"> <div class="rounded-2xl border border-slate-200 px-4 py-4 dark:border-slate-700">
<div class="text-xs font-semibold uppercase tracking-[0.18em] text-slate-400">Dataset 数量</div> <div class="text-xs font-semibold uppercase tracking-[0.18em] text-slate-400">{{ t('kbDifyHealth.datasetCount') }}</div>
<div class="mt-3 text-2xl font-semibold text-slate-900 dark:text-slate-100"> <div class="mt-3 text-2xl font-semibold text-slate-900 dark:text-slate-100">{{ payload.api.dataset_count ?? '--' }}</div>
{{ payload.api.dataset_count ?? '--' }} <div class="mt-2 text-xs text-slate-500 dark:text-slate-400">{{ t('kbDifyHealth.configured') }}{{ payload.dify_api_configured ? t('common.yes') : t('common.no') }}</div>
</div>
<div class="mt-2 text-xs text-slate-500 dark:text-slate-400">
配置完成:{{ payload.dify_api_configured ? '是' : '否' }}
</div>
</div> </div>
<div class="rounded-2xl border border-slate-200 px-4 py-4 dark:border-slate-700"> <div class="rounded-2xl border border-slate-200 px-4 py-4 dark:border-slate-700">
<div class="text-xs font-semibold uppercase tracking-[0.18em] text-slate-400">已绑定分组</div> <div class="text-xs font-semibold uppercase tracking-[0.18em] text-slate-400">{{ t('kbDifyHealth.boundGroups') }}</div>
<div class="mt-3 text-2xl font-semibold text-slate-900 dark:text-slate-100"> <div class="mt-3 text-2xl font-semibold text-slate-900 dark:text-slate-100">{{ payload.local_sync_health.dataset_bound_groups }}</div>
{{ payload.local_sync_health.dataset_bound_groups }} <div class="mt-2 text-xs text-slate-500 dark:text-slate-400">{{ t('kbDifyHealth.localSyncRecords') }}{{ payload.local_sync_health.sync_records }}</div>
</div>
<div class="mt-2 text-xs text-slate-500 dark:text-slate-400">
本地同步记录:{{ payload.local_sync_health.sync_records }}
</div>
</div> </div>
<div class="rounded-2xl border border-slate-200 px-4 py-4 dark:border-slate-700"> <div class="rounded-2xl border border-slate-200 px-4 py-4 dark:border-slate-700">
<div class="text-xs font-semibold uppercase tracking-[0.18em] text-slate-400">同步中版本</div> <div class="text-xs font-semibold uppercase tracking-[0.18em] text-slate-400">{{ t('kbDifyHealth.syncingVersions') }}</div>
<div class="mt-3 text-2xl font-semibold text-slate-900 dark:text-slate-100"> <div class="mt-3 text-2xl font-semibold text-slate-900 dark:text-slate-100">{{ payload.local_sync_health.syncing_versions }}</div>
{{ payload.local_sync_health.syncing_versions }}
</div>
</div> </div>
<div class="rounded-2xl border border-slate-200 px-4 py-4 dark:border-slate-700"> <div class="rounded-2xl border border-slate-200 px-4 py-4 dark:border-slate-700">
<div class="text-xs font-semibold uppercase tracking-[0.18em] text-slate-400">已同步版本</div> <div class="text-xs font-semibold uppercase tracking-[0.18em] text-slate-400">{{ t('kbDifyHealth.syncedVersions') }}</div>
<div class="mt-3 text-2xl font-semibold text-slate-900 dark:text-slate-100"> <div class="mt-3 text-2xl font-semibold text-slate-900 dark:text-slate-100">{{ payload.local_sync_health.synced_versions }}</div>
{{ payload.local_sync_health.synced_versions }}
</div>
</div> </div>
<div class="rounded-2xl border border-slate-200 px-4 py-4 dark:border-slate-700"> <div class="rounded-2xl border border-slate-200 px-4 py-4 dark:border-slate-700">
<div class="text-xs font-semibold uppercase tracking-[0.18em] text-slate-400">待同步任务</div> <div class="text-xs font-semibold uppercase tracking-[0.18em] text-slate-400">{{ t('kbDifyHealth.pendingSyncJobs') }}</div>
<div class="mt-3 text-2xl font-semibold text-slate-900 dark:text-slate-100"> <div class="mt-3 text-2xl font-semibold text-slate-900 dark:text-slate-100">{{ payload.local_sync_health.pending_sync_jobs }}</div>
{{ payload.local_sync_health.pending_sync_jobs }} <div class="mt-2 text-xs text-rose-500" v-if="payload.api.error">{{ payload.api.error }}</div>
</div>
<div class="mt-2 text-xs text-rose-500" v-if="payload.api.error">
{{ payload.api.error }}
</div>
</div> </div>
</div> </div>
</div> </div>
@@ -1,16 +1,11 @@
<script setup lang="ts"> <script setup lang="ts">
import { reactive, ref, watch } from 'vue'; import { reactive, ref, watch } from 'vue';
import { useI18n } from 'vue-i18n';
import { getKbDifySettings, updateKbDifySettings } from '../../api/kb'; import { getKbDifySettings, updateKbDifySettings } from '../../api/kb';
const props = defineProps<{ const props = defineProps<{ open: boolean }>();
open: boolean; const emit = defineEmits<{ close: []; saved: [message: string]; error: [message: string] }>();
}>(); const { t } = useI18n();
const emit = defineEmits<{
close: [];
saved: [message: string];
error: [message: string];
}>();
const loading = ref(false); const loading = ref(false);
const saving = ref(false); const saving = ref(false);
@@ -30,7 +25,7 @@ const loadSettings = async () => {
const settings = await getKbDifySettings(); const settings = await getKbDifySettings();
loading.value = false; loading.value = false;
if (!settings) { if (!settings) {
emit('error', '加载 Dify 设置失败'); emit('error', t('kbDifySettings.msg.loadFailed'));
return; return;
} }
Object.assign(form, settings); Object.assign(form, settings);
@@ -41,43 +36,32 @@ const save = async () => {
const result = await updateKbDifySettings(form); const result = await updateKbDifySettings(form);
saving.value = false; saving.value = false;
if (!result.ok) { if (!result.ok) {
emit('error', result.error || '保存 Dify 设置失败'); emit('error', result.error || t('kbDifySettings.msg.saveFailed'));
return; return;
} }
emit('saved', 'Dify 设置已保存'); emit('saved', t('kbDifySettings.msg.saved'));
emit('close'); emit('close');
}; };
watch( watch(() => props.open, (open) => {
() => props.open, if (open) void loadSettings();
(open) => { });
if (open) {
void loadSettings();
}
}
);
</script> </script>
<template> <template>
<div <div v-if="open" class="fixed inset-0 z-50 flex items-center justify-center bg-slate-950/35 px-4 py-8 backdrop-blur-sm" @click="close">
v-if="open"
class="fixed inset-0 z-50 flex items-center justify-center bg-slate-950/35 px-4 py-8 backdrop-blur-sm"
@click="close"
>
<div class="w-full max-w-3xl rounded-3xl border border-slate-200 bg-white p-6 shadow-xl dark:border-slate-700 dark:bg-slate-900" @click.stop> <div class="w-full max-w-3xl rounded-3xl border border-slate-200 bg-white p-6 shadow-xl dark:border-slate-700 dark:bg-slate-900" @click.stop>
<div class="flex items-center justify-between gap-4"> <div class="flex items-center justify-between gap-4">
<div> <div>
<h3 class="text-xl font-bold text-slate-900 dark:text-slate-100">Dify 设置</h3> <h3 class="text-xl font-bold text-slate-900 dark:text-slate-100">{{ t('kbDifySettings.title') }}</h3>
<p class="mt-1 text-sm text-slate-500 dark:text-slate-400"> <p class="mt-1 text-sm text-slate-500 dark:text-slate-400">{{ t('kbDifySettings.subtitle') }}</p>
管理知识库模块使用的 Dify 连接和默认同步参数。
</p>
</div> </div>
<button class="rounded-2xl border border-slate-200 px-3 py-2 text-sm text-slate-600 hover:bg-slate-50 dark:border-slate-700 dark:text-slate-300 dark:hover:bg-slate-800" @click="close"> <button class="rounded-2xl border border-slate-200 px-3 py-2 text-sm text-slate-600 hover:bg-slate-50 dark:border-slate-700 dark:text-slate-300 dark:hover:bg-slate-800" @click="close">
关闭 {{ t('common.close') }}
</button> </button>
</div> </div>
<div v-if="loading" class="py-16 text-center text-sm text-slate-400">正在加载设置...</div> <div v-if="loading" class="py-16 text-center text-sm text-slate-400">{{ t('kbDifySettings.loading') }}</div>
<div v-else class="mt-6 grid gap-4 md:grid-cols-2"> <div v-else class="mt-6 grid gap-4 md:grid-cols-2">
<label class="space-y-2 md:col-span-2"> <label class="space-y-2 md:col-span-2">
<span class="text-sm font-medium text-slate-600 dark:text-slate-300">Dify Base URL</span> <span class="text-sm font-medium text-slate-600 dark:text-slate-300">Dify Base URL</span>
@@ -119,14 +103,10 @@ watch(
<div class="mt-6 flex justify-end gap-3"> <div class="mt-6 flex justify-end gap-3">
<button class="rounded-2xl border border-slate-200 px-4 py-2.5 text-sm font-medium text-slate-700 hover:bg-slate-50 dark:border-slate-700 dark:text-slate-200 dark:hover:bg-slate-800" @click="close"> <button class="rounded-2xl border border-slate-200 px-4 py-2.5 text-sm font-medium text-slate-700 hover:bg-slate-50 dark:border-slate-700 dark:text-slate-200 dark:hover:bg-slate-800" @click="close">
取消 {{ t('common.cancel') }}
</button> </button>
<button <button class="rounded-2xl bg-brand-600 px-4 py-2.5 text-sm font-medium text-white hover:bg-brand-700 disabled:cursor-not-allowed disabled:opacity-60" :disabled="saving" @click="save">
class="rounded-2xl bg-brand-600 px-4 py-2.5 text-sm font-medium text-white hover:bg-brand-700 disabled:cursor-not-allowed disabled:opacity-60" {{ saving ? t('kbDifySettings.saving') : t('kbDifySettings.save') }}
:disabled="saving"
@click="save"
>
{{ saving ? '保存中...' : '保存设置' }}
</button> </button>
</div> </div>
</div> </div>
+62 -45
View File
@@ -1,9 +1,11 @@
<script setup lang="ts"> <script setup lang="ts">
import { computed, onMounted, ref } from 'vue'; import { computed, onMounted, ref } from 'vue';
import { useRouter } from 'vue-router'; import { useRouter } from 'vue-router';
import { useI18n } from 'vue-i18n';
import { Activity, FolderPlus, Pencil, Play, Settings, Trash2, Wrench, X } from 'lucide-vue-next'; import { Activity, FolderPlus, Pencil, Play, Settings, Trash2, Wrench, X } from 'lucide-vue-next';
import DifyHealthDialog from './DifyHealthDialog.vue'; import DifyHealthDialog from './DifyHealthDialog.vue';
import DifySettingsDialog from './DifySettingsDialog.vue'; import DifySettingsDialog from './DifySettingsDialog.vue';
import DeleteConfirmDialog from '../DeleteConfirmDialog.vue';
import { import {
createKbGroup, createKbGroup,
deleteKbGroup, deleteKbGroup,
@@ -16,6 +18,7 @@ import {
} from '../../api/kb'; } from '../../api/kb';
const router = useRouter(); const router = useRouter();
const { t } = useI18n();
const groups = ref<KbGroup[]>([]); const groups = ref<KbGroup[]>([]);
const jobs = ref<KbJob[]>([]); const jobs = ref<KbJob[]>([]);
@@ -31,14 +34,16 @@ const feedbackType = ref<'success' | 'error' | ''>('');
const runningJobId = ref<number | string | null>(null); const runningJobId = ref<number | string | null>(null);
const settingsDialogOpen = ref(false); const settingsDialogOpen = ref(false);
const healthDialogOpen = ref(false); const healthDialogOpen = ref(false);
const deleteDialogOpen = ref(false);
const deletingGroup = ref<KbGroup | null>(null);
const formTitle = computed(() => editingGroupId.value ? '编辑知识库分组' : '新建知识库分组'); const formTitle = computed(() => editingGroupId.value ? t('kbAdmin.form.editTitle') : t('kbAdmin.form.createTitle'));
const formDescription = computed(() => editingGroupId.value const formDescription = computed(() => editingGroupId.value
? '修改知识库分组名称和描述,保存后会立即刷新列表。' ? t('kbAdmin.form.editDesc')
: '用于验证主平台里的知识库管理入口和基础接口壳。'); : t('kbAdmin.form.createDesc'));
const submitText = computed(() => { const submitText = computed(() => {
if (isSubmitting.value) return editingGroupId.value ? '保存中...' : '提交中...'; if (isSubmitting.value) return editingGroupId.value ? t('kbAdmin.form.saving') : t('kbAdmin.form.submitting');
return editingGroupId.value ? '保存修改' : '创建分组'; return editingGroupId.value ? t('kbAdmin.form.saveChanges') : t('kbAdmin.form.create');
}); });
const loadData = async () => { const loadData = async () => {
@@ -47,13 +52,13 @@ const loadData = async () => {
if (groupsResult.ok) { if (groupsResult.ok) {
groups.value = groupsResult.data; groups.value = groupsResult.data;
} else { } else {
feedback.value = groupsResult.error || '加载知识库分组失败'; feedback.value = groupsResult.error || t('kbAdmin.msg.loadGroupsFailed');
feedbackType.value = 'error'; feedbackType.value = 'error';
} }
if (jobsResult.ok) { if (jobsResult.ok) {
jobs.value = jobsResult.data; jobs.value = jobsResult.data;
} else { } else {
feedback.value = jobsResult.error || '加载任务列表失败'; feedback.value = jobsResult.error || t('kbAdmin.msg.loadJobsFailed');
feedbackType.value = 'error'; feedbackType.value = 'error';
} }
isRefreshing.value = false; isRefreshing.value = false;
@@ -66,7 +71,7 @@ const resetForm = () => {
const handleCreateGroup = async () => { const handleCreateGroup = async () => {
if (!form.value.name.trim()) { if (!form.value.name.trim()) {
feedback.value = '请输入知识库分组名称'; feedback.value = t('kbAdmin.msg.nameRequired');
feedbackType.value = 'error'; feedbackType.value = 'error';
return; return;
} }
@@ -81,12 +86,12 @@ const handleCreateGroup = async () => {
isSubmitting.value = false; isSubmitting.value = false;
if (!result.ok) { if (!result.ok) {
feedback.value = result.error || '创建失败'; feedback.value = result.error || t('kbAdmin.msg.createFailed');
feedbackType.value = 'error'; feedbackType.value = 'error';
return; return;
} }
feedback.value = editingGroupId.value ? '知识库分组已更新' : '知识库分组创建成功'; feedback.value = editingGroupId.value ? t('kbAdmin.msg.updated') : t('kbAdmin.msg.created');
feedbackType.value = 'success'; feedbackType.value = 'success';
resetForm(); resetForm();
await loadData(); await loadData();
@@ -103,21 +108,26 @@ const handleEditGroup = (group: KbGroup) => {
}; };
const handleDeleteGroup = async (group: KbGroup) => { const handleDeleteGroup = async (group: KbGroup) => {
const confirmed = window.confirm(`确认删除知识库分组「${group.name}」吗?`); deletingGroup.value = group;
if (!confirmed) return; deleteDialogOpen.value = true;
};
const result = await deleteKbGroup(group.id); const handleDeleteGroupConfirm = async () => {
if (!deletingGroup.value) return;
const result = await deleteKbGroup(deletingGroup.value.id);
if (!result.ok) { if (!result.ok) {
feedback.value = result.error || '删除失败'; feedback.value = result.error || t('kbAdmin.msg.deleteFailed');
feedbackType.value = 'error'; feedbackType.value = 'error';
return; return;
} }
if (editingGroupId.value === group.id) { if (editingGroupId.value === deletingGroup.value.id) {
resetForm(); resetForm();
} }
feedback.value = '知识库分组已删除'; feedback.value = t('kbAdmin.msg.deleted');
feedbackType.value = 'success'; feedbackType.value = 'success';
deleteDialogOpen.value = false;
deletingGroup.value = null;
await loadData(); await loadData();
}; };
@@ -127,12 +137,12 @@ const handleRunJob = async (job: KbJob) => {
runningJobId.value = null; runningJobId.value = null;
if (!result.ok) { if (!result.ok) {
feedback.value = result.error || '任务执行失败'; feedback.value = result.error || t('kbAdmin.msg.runFailed');
feedbackType.value = 'error'; feedbackType.value = 'error';
return; return;
} }
feedback.value = result.run_result || '任务已执行'; feedback.value = result.run_result || t('kbAdmin.msg.runDone');
feedbackType.value = 'success'; feedbackType.value = 'success';
await loadData(); await loadData();
}; };
@@ -148,34 +158,34 @@ defineExpose({ loadData });
<div class="animate-fade-in-up"> <div class="animate-fade-in-up">
<div class="flex flex-col gap-4 border-b border-gray-100 bg-white px-8 py-6 dark:border-slate-700 dark:bg-slate-900 lg:flex-row lg:items-start lg:justify-between"> <div class="flex flex-col gap-4 border-b border-gray-100 bg-white px-8 py-6 dark:border-slate-700 dark:bg-slate-900 lg:flex-row lg:items-start lg:justify-between">
<div class="min-w-0 flex-1"> <div class="min-w-0 flex-1">
<h2 class="text-xl font-bold text-gray-900 dark:text-slate-100">知识库管理</h2> <h2 class="text-xl font-bold text-gray-900 dark:text-slate-100">{{ t('kbAdmin.title') }}</h2>
<p class="mt-1 text-sm text-gray-500 dark:text-slate-400"> <p class="mt-1 text-sm text-gray-500 dark:text-slate-400">
第一阶段先承接分组、任务和 Dify 管理入口,后续再接入清洗链路。 {{ t('kbAdmin.subtitle') }}
</p> </p>
</div> </div>
<div class="flex w-full shrink-0 flex-col gap-2 sm:w-auto sm:flex-row sm:items-center sm:justify-end"> <div class="flex w-full shrink-0 flex-col gap-2 sm:w-auto sm:flex-row sm:items-center sm:justify-end">
<div <div
class="inline-flex w-full items-stretch divide-x divide-slate-200 overflow-hidden rounded-xl border border-slate-200 bg-slate-50 dark:divide-slate-600 dark:border-slate-600 dark:bg-slate-800/80 sm:w-auto" class="inline-flex w-full items-stretch divide-x divide-slate-200 overflow-hidden rounded-xl border border-slate-200 bg-slate-50 dark:divide-slate-600 dark:border-slate-600 dark:bg-slate-800/80 sm:w-auto"
role="toolbar" role="toolbar"
aria-label="知识库工具操作" :aria-label="t('kbAdmin.toolbar')"
> >
<button <button
type="button" type="button"
@click="settingsDialogOpen = true" @click="settingsDialogOpen = true"
class="inline-flex flex-1 items-center justify-center gap-1.5 px-3 py-2.5 text-sm font-medium text-slate-700 transition-colors hover:bg-white dark:text-slate-200 dark:hover:bg-slate-700 sm:flex-none sm:px-4" class="inline-flex flex-1 items-center justify-center gap-1.5 px-3 py-2.5 text-sm font-medium text-slate-700 transition-colors hover:bg-white dark:text-slate-200 dark:hover:bg-slate-700 sm:flex-none sm:px-4"
title="Dify 设置" :title="t('kbAdmin.difySettings')"
> >
<Settings class="h-4 w-4 shrink-0" /> <Settings class="h-4 w-4 shrink-0" />
<span class="whitespace-nowrap">Dify 设置</span> <span class="whitespace-nowrap">{{ t('kbAdmin.difySettings') }}</span>
</button> </button>
<button <button
type="button" type="button"
@click="healthDialogOpen = true" @click="healthDialogOpen = true"
class="inline-flex flex-1 items-center justify-center gap-1.5 px-3 py-2.5 text-sm font-medium text-slate-700 transition-colors hover:bg-white dark:text-slate-200 dark:hover:bg-slate-700 sm:flex-none sm:px-4" class="inline-flex flex-1 items-center justify-center gap-1.5 px-3 py-2.5 text-sm font-medium text-slate-700 transition-colors hover:bg-white dark:text-slate-200 dark:hover:bg-slate-700 sm:flex-none sm:px-4"
title="健康检查" :title="t('kbAdmin.healthCheck')"
> >
<Activity class="h-4 w-4 shrink-0" /> <Activity class="h-4 w-4 shrink-0" />
<span class="whitespace-nowrap">健康检查</span> <span class="whitespace-nowrap">{{ t('kbAdmin.healthCheck') }}</span>
</button> </button>
</div> </div>
<button <button
@@ -184,7 +194,7 @@ defineExpose({ loadData });
class="inline-flex w-full items-center justify-center gap-2 rounded-xl bg-blue-600 px-5 py-2.5 text-sm font-medium text-white shadow-lg shadow-blue-200 transition-colors hover:bg-blue-700 sm:w-auto" class="inline-flex w-full items-center justify-center gap-2 rounded-xl bg-blue-600 px-5 py-2.5 text-sm font-medium text-white shadow-lg shadow-blue-200 transition-colors hover:bg-blue-700 sm:w-auto"
> >
<Wrench class="h-4 w-4 shrink-0" /> <Wrench class="h-4 w-4 shrink-0" />
<span class="whitespace-nowrap">前往工作台</span> <span class="whitespace-nowrap">{{ t('kbAdmin.goWorkspace') }}</span>
</button> </button>
</div> </div>
</div> </div>
@@ -203,16 +213,16 @@ defineExpose({ loadData });
<div class="space-y-4"> <div class="space-y-4">
<div> <div>
<label class="mb-2 block text-sm font-medium text-slate-600 dark:text-slate-300">分组名称</label> <label class="mb-2 block text-sm font-medium text-slate-600 dark:text-slate-300">{{ t('kbAdmin.form.groupName') }}</label>
<input v-model="form.name" class="input-field" placeholder="例如:财务制度库" /> <input v-model="form.name" class="input-field" :placeholder="t('kbAdmin.form.groupNamePlaceholder')" />
</div> </div>
<div> <div>
<label class="mb-2 block text-sm font-medium text-slate-600 dark:text-slate-300">分组描述</label> <label class="mb-2 block text-sm font-medium text-slate-600 dark:text-slate-300">{{ t('kbAdmin.form.groupDesc') }}</label>
<textarea <textarea
v-model="form.description" v-model="form.description"
rows="4" rows="4"
class="input-field" class="input-field"
placeholder="描述该知识库分组的业务范围或清洗目标" :placeholder="t('kbAdmin.form.groupDescPlaceholder')"
/> />
</div> </div>
<div class="flex flex-wrap items-center justify-end gap-2 border-t border-slate-100 pt-4 dark:border-slate-700"> <div class="flex flex-wrap items-center justify-end gap-2 border-t border-slate-100 pt-4 dark:border-slate-700">
@@ -232,7 +242,7 @@ defineExpose({ loadData });
class="inline-flex items-center gap-1.5 rounded-xl border border-slate-200 px-4 py-2 text-sm font-medium text-slate-700 transition-colors hover:bg-slate-50 dark:border-slate-700 dark:text-slate-200 dark:hover:bg-slate-800" class="inline-flex items-center gap-1.5 rounded-xl border border-slate-200 px-4 py-2 text-sm font-medium text-slate-700 transition-colors hover:bg-slate-50 dark:border-slate-700 dark:text-slate-200 dark:hover:bg-slate-800"
> >
<X class="h-4 w-4 shrink-0" /> <X class="h-4 w-4 shrink-0" />
取消编辑 {{ t('kbAdmin.form.cancelEdit') }}
</button> </button>
</div> </div>
<p <p
@@ -248,11 +258,11 @@ defineExpose({ loadData });
<div class="space-y-6"> <div class="space-y-6">
<section class="rounded-2xl border border-slate-200 p-6 dark:border-slate-700"> <section class="rounded-2xl border border-slate-200 p-6 dark:border-slate-700">
<div class="mb-4 flex items-center justify-between"> <div class="mb-4 flex items-center justify-between">
<h3 class="text-lg font-semibold text-slate-900 dark:text-slate-100">知识库分组概览</h3> <h3 class="text-lg font-semibold text-slate-900 dark:text-slate-100">{{ t('kbAdmin.groupsTitle') }}</h3>
<span class="text-xs text-slate-400">{{ isRefreshing ? '加载中...' : '/api/kb/groups' }}</span> <span class="text-xs text-slate-400">{{ isRefreshing ? t('common.loading') : '/api/kb/groups' }}</span>
</div> </div>
<div v-if="groups.length === 0" class="rounded-2xl border border-dashed border-slate-200 px-4 py-10 text-center text-sm text-slate-400 dark:border-slate-700"> <div v-if="groups.length === 0" class="rounded-2xl border border-dashed border-slate-200 px-4 py-10 text-center text-sm text-slate-400 dark:border-slate-700">
当前暂无分组,或知识库接口尚未联调完成。 {{ t('kbAdmin.groupsEmpty') }}
</div> </div>
<div v-else class="grid grid-cols-1 gap-3 md:grid-cols-2"> <div v-else class="grid grid-cols-1 gap-3 md:grid-cols-2">
<div <div
@@ -263,15 +273,15 @@ defineExpose({ loadData });
<div class="flex items-start justify-between gap-3"> <div class="flex items-start justify-between gap-3">
<div class="min-w-0"> <div class="min-w-0">
<div class="font-semibold text-slate-900 dark:text-slate-100">{{ group.name }}</div> <div class="font-semibold text-slate-900 dark:text-slate-100">{{ group.name }}</div>
<div class="mt-1 text-sm text-slate-500 dark:text-slate-400">{{ group.description || '暂无描述' }}</div> <div class="mt-1 text-sm text-slate-500 dark:text-slate-400">{{ group.description || t('kbAdmin.noDescription') }}</div>
</div> </div>
<div class="rounded-full bg-slate-100 px-2.5 py-1 text-xs font-medium text-slate-600 dark:bg-slate-800 dark:text-slate-300"> <div class="rounded-full bg-slate-100 px-2.5 py-1 text-xs font-medium text-slate-600 dark:bg-slate-800 dark:text-slate-300">
{{ group.document_count ?? 0 }} 文档 {{ t('kbAdmin.documentCount', { count: group.document_count ?? 0 }) }}
</div> </div>
</div> </div>
<div class="mt-4 flex flex-wrap items-center justify-between gap-3"> <div class="mt-4 flex flex-wrap items-center justify-between gap-3">
<div class="text-xs text-slate-400"> <div class="text-xs text-slate-400">
更新时间:{{ group.updated_at || '--' }} {{ t('kbAdmin.updatedAt') }}{{ group.updated_at || '--' }}
</div> </div>
<div class="flex items-center gap-2"> <div class="flex items-center gap-2">
<button <button
@@ -279,14 +289,14 @@ defineExpose({ loadData });
class="inline-flex items-center gap-1 rounded-xl border border-slate-200 px-3 py-2 text-xs font-medium text-slate-600 transition-colors hover:bg-slate-50 dark:border-slate-700 dark:text-slate-300 dark:hover:bg-slate-800" class="inline-flex items-center gap-1 rounded-xl border border-slate-200 px-3 py-2 text-xs font-medium text-slate-600 transition-colors hover:bg-slate-50 dark:border-slate-700 dark:text-slate-300 dark:hover:bg-slate-800"
> >
<Pencil class="h-3.5 w-3.5" /> <Pencil class="h-3.5 w-3.5" />
编辑 {{ t('common.edit') }}
</button> </button>
<button <button
@click="handleDeleteGroup(group)" @click="handleDeleteGroup(group)"
class="inline-flex items-center gap-1 rounded-xl border border-rose-200 px-3 py-2 text-xs font-medium text-rose-600 transition-colors hover:bg-rose-50 dark:border-rose-500/30 dark:text-rose-400 dark:hover:bg-rose-500/10" class="inline-flex items-center gap-1 rounded-xl border border-rose-200 px-3 py-2 text-xs font-medium text-rose-600 transition-colors hover:bg-rose-50 dark:border-rose-500/30 dark:text-rose-400 dark:hover:bg-rose-500/10"
> >
<Trash2 class="h-3.5 w-3.5" /> <Trash2 class="h-3.5 w-3.5" />
删除 {{ t('common.delete') }}
</button> </button>
</div> </div>
</div> </div>
@@ -296,11 +306,11 @@ defineExpose({ loadData });
<section class="rounded-2xl border border-slate-200 p-6 dark:border-slate-700"> <section class="rounded-2xl border border-slate-200 p-6 dark:border-slate-700">
<div class="mb-4 flex items-center justify-between"> <div class="mb-4 flex items-center justify-between">
<h3 class="text-lg font-semibold text-slate-900 dark:text-slate-100">任务队列占位</h3> <h3 class="text-lg font-semibold text-slate-900 dark:text-slate-100">{{ t('kbAdmin.jobsTitle') }}</h3>
<span class="text-xs text-slate-400">/api/kb/jobs</span> <span class="text-xs text-slate-400">/api/kb/jobs</span>
</div> </div>
<div v-if="jobs.length === 0" class="rounded-2xl border border-dashed border-slate-200 px-4 py-10 text-center text-sm text-slate-400 dark:border-slate-700"> <div v-if="jobs.length === 0" class="rounded-2xl border border-dashed border-slate-200 px-4 py-10 text-center text-sm text-slate-400 dark:border-slate-700">
暂无任务。第二阶段会在这里接入清洗、同步和重试任务。 {{ t('kbAdmin.jobsEmpty') }}
</div> </div>
<div v-else class="space-y-3"> <div v-else class="space-y-3">
<div <div
@@ -313,10 +323,10 @@ defineExpose({ loadData });
<div class="font-semibold text-slate-900 dark:text-slate-100">{{ job.job_type }}</div> <div class="font-semibold text-slate-900 dark:text-slate-100">{{ job.job_type }}</div>
<div class="mt-1 text-sm text-slate-500 dark:text-slate-400">{{ job.created_at || '--' }}</div> <div class="mt-1 text-sm text-slate-500 dark:text-slate-400">{{ job.created_at || '--' }}</div>
<div class="mt-2 text-sm text-slate-500 dark:text-slate-400"> <div class="mt-2 text-sm text-slate-500 dark:text-slate-400">
{{ job.message || '暂无任务说明' }} {{ job.message || t('kbAdmin.noJobMessage') }}
</div> </div>
<div class="mt-2 text-xs text-slate-400"> <div class="mt-2 text-xs text-slate-400">
文档:{{ job.document_id ?? '--' }} · 版本:{{ job.document_version_id ?? '--' }} · 进度:{{ job.progress ?? 0 }}% {{ t('kbAdmin.jobMeta', { docId: job.document_id ?? '--', versionId: job.document_version_id ?? '--', progress: job.progress ?? 0 }) }}
</div> </div>
</div> </div>
<span class="rounded-full bg-slate-100 px-2.5 py-1 text-xs font-medium text-slate-600 dark:bg-slate-800 dark:text-slate-300"> <span class="rounded-full bg-slate-100 px-2.5 py-1 text-xs font-medium text-slate-600 dark:bg-slate-800 dark:text-slate-300">
@@ -330,7 +340,7 @@ defineExpose({ loadData });
class="inline-flex items-center gap-1 rounded-xl border border-brand-200 px-3 py-2 text-xs font-medium text-brand-700 transition-colors hover:bg-brand-50 disabled:cursor-not-allowed disabled:opacity-60 dark:border-brand-500/30 dark:text-brand-300 dark:hover:bg-brand-500/10" class="inline-flex items-center gap-1 rounded-xl border border-brand-200 px-3 py-2 text-xs font-medium text-brand-700 transition-colors hover:bg-brand-50 disabled:cursor-not-allowed disabled:opacity-60 dark:border-brand-500/30 dark:text-brand-300 dark:hover:bg-brand-500/10"
> >
<Play class="h-3.5 w-3.5" /> <Play class="h-3.5 w-3.5" />
{{ runningJobId === job.id ? '执行中...' : '执行任务' }} {{ runningJobId === job.id ? t('kbAdmin.running') : t('kbAdmin.runJob') }}
</button> </button>
</div> </div>
</div> </div>
@@ -351,4 +361,11 @@ defineExpose({ loadData });
@close="healthDialogOpen = false" @close="healthDialogOpen = false"
@error="(message) => { feedback = message; feedbackType = 'error'; }" @error="(message) => { feedback = message; feedbackType = 'error'; }"
/> />
<DeleteConfirmDialog
v-model="deleteDialogOpen"
:title="t('kbAdmin.deleteDialog.title')"
:message="t('kbAdmin.deleteDialog.message', { name: deletingGroup?.name || '' })"
@confirm="handleDeleteGroupConfirm"
@cancel="() => { deleteDialogOpen = false; deletingGroup = null; }"
/>
</template> </template>
+873 -4
View File
@@ -1,4 +1,4 @@
import { createI18n } from 'vue-i18n'; import { createI18n } from 'vue-i18n';
const messages = { const messages = {
@@ -140,6 +140,12 @@ const messages = {
}, },
common: { common: {
errorOccurred: 'An error occurred', errorOccurred: 'An error occurred',
close: 'Close',
cancel: 'Cancel',
loading: 'Loading...',
refresh: 'Refresh',
yes: 'Yes',
no: 'No',
deleteDialog: { deleteDialog: {
defaultTitle: 'Are you sure you want to delete?', defaultTitle: 'Are you sure you want to delete?',
defaultMessage: 'When clicked the OK button, this dialog will be closed after 1 second', defaultMessage: 'When clicked the OK button, this dialog will be closed after 1 second',
@@ -147,6 +153,118 @@ const messages = {
confirm: 'OK' confirm: 'OK'
} }
}, },
scheduleRuns: {
title: 'Schedule Runs',
refresh: 'Refresh',
tip: 'Only runs where you are the owner or in notification list are shown.',
loading: 'Loading...',
empty: 'No visible records',
viewExcel: 'View Excel',
columns: {
runNo: 'Run No.',
schedule: 'Schedule',
start: 'Start',
end: 'End',
status: 'Status',
total: 'Total',
success: 'Success',
failed: 'Failed'
},
msg: {
loadFailed: 'Failed to load schedule runs'
}
},
filePreview: {
title: 'File Preview',
download: 'Download File',
downloading: 'Downloading...',
tooLarge: 'The file is too large for online preview. Please click Download File above to get the original file.',
previewFailed: 'Preview failed: ',
msg: {
downloadFailed: 'Download failed: {reason}',
unknownError: 'Unknown error'
}
},
kbDifySettings: {
title: 'Dify Settings',
subtitle: 'Manage Dify connection and default sync parameters for the knowledge base module.',
loading: 'Loading settings...',
save: 'Save Settings',
saving: 'Saving...',
msg: {
loadFailed: 'Failed to load Dify settings',
saveFailed: 'Failed to save Dify settings',
saved: 'Dify settings saved'
}
},
kbDifyHealth: {
title: 'Dify Health Check',
subtitle: 'View Dify connectivity and local sync overview for knowledge base module.',
loading: 'Checking...',
reachable: 'Reachable',
unreachable: 'Unreachable',
notConfigured: 'Not configured',
datasetCount: 'Dataset Count',
configured: 'Configured: ',
boundGroups: 'Bound Groups',
localSyncRecords: 'Local Sync Records: ',
syncingVersions: 'Syncing Versions',
syncedVersions: 'Synced Versions',
pendingSyncJobs: 'Pending Sync Jobs',
msg: {
loadFailed: 'Failed to load Dify health status'
}
},
kbAdmin: {
title: 'Knowledge Base Management',
subtitle: 'Phase 1 includes group, job and Dify entry management. Cleaning pipeline will be added later.',
toolbar: 'Knowledge base tools',
difySettings: 'Dify Settings',
healthCheck: 'Health Check',
goWorkspace: 'Go to Workspace',
groupsTitle: 'Group Overview',
groupsEmpty: 'No group yet, or knowledge base APIs are not ready.',
noDescription: 'No description',
documentCount: '{count} docs',
updatedAt: 'Updated at: ',
jobsTitle: 'Job Queue Placeholder',
jobsEmpty: 'No jobs. Cleaning, syncing and retry jobs will be integrated in phase 2.',
noJobMessage: 'No job message',
jobMeta: 'Doc: {docId} · Version: {versionId} · Progress: {progress}%',
running: 'Running...',
runJob: 'Run Job',
form: {
editTitle: 'Edit Knowledge Base Group',
createTitle: 'Create Knowledge Base Group',
editDesc: 'Edit name and description of the group. List refreshes after save.',
createDesc: 'Used to validate the knowledge base management entry and API shell in main platform.',
saving: 'Saving...',
submitting: 'Submitting...',
saveChanges: 'Save Changes',
create: 'Create Group',
groupName: 'Group Name',
groupNamePlaceholder: 'e.g. Finance Policy Library',
groupDesc: 'Group Description',
groupDescPlaceholder: 'Describe business scope or cleaning goals of this group',
cancelEdit: 'Cancel Edit'
},
deleteDialog: {
title: 'Are you sure you want to delete?',
message: 'This will delete knowledge base group \"{name}\". This action cannot be undone.'
},
msg: {
loadGroupsFailed: 'Failed to load knowledge base groups',
loadJobsFailed: 'Failed to load jobs',
nameRequired: 'Please enter group name',
createFailed: 'Creation failed',
created: 'Group created',
updated: 'Group updated',
deleteFailed: 'Delete failed',
deleted: 'Group deleted',
runFailed: 'Job run failed',
runDone: 'Job executed'
}
},
workspace: { workspace: {
title: 'AI Workspace', title: 'AI Workspace',
brandTitle: 'Hexin AI Workspace', brandTitle: 'Hexin AI Workspace',
@@ -220,7 +338,90 @@ const messages = {
reason: 'Reason for request', reason: 'Reason for request',
submit: 'Submit Request' submit: 'Submit Request'
}, },
wecomEntryNotice: 'Opened from WeCom message. Related context is ready.' wecomEntryNotice: 'Opened from WeCom message. Related context is ready.',
lang: {
zhCN: 'Simplified Chinese',
zhTW: 'Traditional Chinese'
},
mobileTabs: {
me: 'Me',
history: 'History',
applications: 'Applications'
},
nav: {
profile: 'Profile',
admin: 'Admin Console',
applications: 'Applications',
knowledgeBase: 'Knowledge Base',
scheduleRuns: 'Schedule Runs',
feedback: 'Feedback',
updates: 'Recent Updates',
backToChat: 'Back to Chat',
logout: 'Logout'
},
history: {
empty: 'No chat history yet',
untitled: 'Untitled Conversation'
},
schedule: {
title: 'Schedule Runs',
refresh: 'Refresh',
search: 'Search',
reset: 'Reset',
loading: 'Loading...',
empty: 'No schedule runs',
download: 'Download',
noPendingData: 'No pending data',
filters: {
name: 'Schedule Name',
namePlaceholder: 'Enter schedule name',
start: 'Start Time',
end: 'End Time',
status: 'Status'
},
columns: {
name: 'Schedule Name',
runNo: 'Run No.',
triggerType: 'Trigger',
start: 'Start Time',
end: 'End Time',
duration: 'Duration',
status: 'Status',
total: 'Total',
success: 'Success',
failed: 'Failed',
detail: 'Detail'
},
trigger: {
manual: 'Manual',
test: 'Test',
timed: 'Scheduled'
},
status: {
all: 'All',
success: 'Success',
partialFailed: 'Partial Success',
failed: 'Failed',
running: 'Running',
queued: 'Queued'
},
msg: {
downloadExcelFailed: 'Failed to download Excel'
}
},
profile: {
msg: {
loadFailed: 'Failed to load profile',
saveFailed: 'Failed to save profile',
saved: 'Profile saved',
changePasswordFailed: 'Failed to change password'
}
},
msg: {
casdoorNotMatchedContactAdmin: 'Casdoor login succeeded, but no local account matched. Please contact the administrator.',
casdoorNotMatchedNeedLocalUser: 'Casdoor login succeeded, but no local account matched. Ask the administrator to create a local user with the same username or email.',
localAccountDisabled: 'This local account is disabled. Please contact the administrator.'
}
}, },
admin: { admin: {
title: 'Admin Console', title: 'Admin Console',
@@ -808,6 +1009,43 @@ const messages = {
}, },
// Common Messages // Common Messages
schedule: {
status: {
all: 'All',
success: 'Success',
partialFailed: 'Partial Success',
failed: 'Failed',
running: 'Running',
queued: 'Queued'
},
weekday: {
mon: 'Mon',
tue: 'Tue',
wed: 'Wed',
thu: 'Thu',
fri: 'Fri',
sat: 'Sat',
sun: 'Sun'
},
step: {
fetchSrm: 'Fetch external system data',
callDify: 'Call Dify service',
writebackSrm: 'Write back to external system data',
callInternalApi: 'Call internal API',
preDify: 'Dify pre-processing'
},
deleteDialogTitle: 'Delete Schedule',
deleteConfirmMessage: 'Confirm deleting schedule \"{name}\"?',
msg: {
testRunFailed: 'Test run 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.',
runNowFailed: 'Manual run failed',
downloadExcelFailed: 'Failed to download Excel',
deleteFailed: 'Delete schedule failed'
}
},
role: { role: {
user: 'User', user: 'User',
admin: 'Admin', admin: 'Admin',
@@ -1152,6 +1390,12 @@ const messages = {
}, },
common: { common: {
errorOccurred: '发生错误', errorOccurred: '发生错误',
close: '关闭',
cancel: '取消',
loading: '加载中...',
refresh: '刷新',
yes: '是',
no: '否',
deleteDialog: { deleteDialog: {
defaultTitle: '您确定要删除吗?', defaultTitle: '您确定要删除吗?',
defaultMessage: '点击“确定”按钮后,该对话框将在 1 秒后关闭', defaultMessage: '点击“确定”按钮后,该对话框将在 1 秒后关闭',
@@ -1159,6 +1403,118 @@ const messages = {
confirm: '确定' confirm: '确定'
} }
}, },
scheduleRuns: {
title: '排程记录',
refresh: '刷新',
tip: '仅展示你是 owner 或在通知名单中的记录',
loading: '加载中...',
empty: '暂无可见记录',
viewExcel: '查看Excel',
columns: {
runNo: '执行单号',
schedule: '排程',
start: '开始',
end: '结束',
status: '状态',
total: '处理',
success: '成功',
failed: '失败'
},
msg: {
loadFailed: '加载排程记录失败'
}
},
filePreview: {
title: '文件预览',
download: '下载文件',
downloading: '下载中...',
tooLarge: '文件较大,暂不支持在线预览,请直接点击上方“下载文件”获取原文件。',
previewFailed: '预览失败:',
msg: {
downloadFailed: '下载失败: {reason}',
unknownError: '未知错误'
}
},
kbDifySettings: {
title: 'Dify 设置',
subtitle: '管理知识库模块使用的 Dify 连接和默认同步参数。',
loading: '正在加载设置...',
save: '保存设置',
saving: '保存中...',
msg: {
loadFailed: '加载 Dify 设置失败',
saveFailed: '保存 Dify 设置失败',
saved: 'Dify 设置已保存'
}
},
kbDifyHealth: {
title: 'Dify 健康检查',
subtitle: '查看知识库模块当前的 Dify 连接情况和本地同步概况。',
loading: '正在检测...',
reachable: '可访问',
unreachable: '不可访问',
notConfigured: '未配置',
datasetCount: 'Dataset 数量',
configured: '配置完成:',
boundGroups: '已绑定分组',
localSyncRecords: '本地同步记录:',
syncingVersions: '同步中版本',
syncedVersions: '已同步版本',
pendingSyncJobs: '待同步任务',
msg: {
loadFailed: '加载 Dify 健康状态失败'
}
},
kbAdmin: {
title: '知识库管理',
subtitle: '第一阶段先承接分组、任务和 Dify 管理入口,后续再接入清洗链路。',
toolbar: '知识库工具操作',
difySettings: 'Dify 设置',
healthCheck: '健康检查',
goWorkspace: '前往工作台',
groupsTitle: '知识库分组概览',
groupsEmpty: '当前暂无分组,或知识库接口尚未联调完成。',
noDescription: '暂无描述',
documentCount: '{count} 文档',
updatedAt: '更新时间:',
jobsTitle: '任务队列占位',
jobsEmpty: '暂无任务。第二阶段会在这里接入清洗、同步和重试任务。',
noJobMessage: '暂无任务说明',
jobMeta: '文档:{docId} · 版本:{versionId} · 进度:{progress}%',
running: '执行中...',
runJob: '执行任务',
form: {
editTitle: '编辑知识库分组',
createTitle: '新建知识库分组',
editDesc: '修改知识库分组名称和描述,保存后会立即刷新列表。',
createDesc: '用于验证主平台里的知识库管理入口和基础接口壳。',
saving: '保存中...',
submitting: '提交中...',
saveChanges: '保存修改',
create: '创建分组',
groupName: '分组名称',
groupNamePlaceholder: '例如:财务制度库',
groupDesc: '分组描述',
groupDescPlaceholder: '描述该知识库分组的业务范围或清洗目标',
cancelEdit: '取消编辑'
},
deleteDialog: {
title: '您确定要删除吗?',
message: '确认删除知识库分组“{name}”吗?'
},
msg: {
loadGroupsFailed: '加载知识库分组失败',
loadJobsFailed: '加载任务列表失败',
nameRequired: '请输入知识库分组名称',
createFailed: '创建失败',
created: '知识库分组创建成功',
updated: '知识库分组已更新',
deleteFailed: '删除失败',
deleted: '知识库分组已删除',
runFailed: '任务执行失败',
runDone: '任务已执行'
}
},
workspace: { workspace: {
title: 'AI 工作台', title: 'AI 工作台',
brandTitle: 'AI工作台', brandTitle: 'AI工作台',
@@ -1233,7 +1589,90 @@ const messages = {
reason: '申请理由', reason: '申请理由',
submit: '提交申请' submit: '提交申请'
}, },
wecomEntryNotice: '已从企业微信消息进入,已为你准备好相关上下文。' wecomEntryNotice: '已从企业微信消息进入,已为你准备好相关上下文。',
lang: {
zhCN: '简体中文',
zhTW: '繁體中文'
},
mobileTabs: {
me: '我的',
history: '历史会话',
applications: '应用管理'
},
nav: {
profile: '个人中心',
admin: '管理后台',
applications: '应用管理',
knowledgeBase: '知识库管理',
scheduleRuns: '排程记录',
feedback: '意见反馈',
updates: '最近更新',
backToChat: '返回聊天',
logout: '退出登录'
},
history: {
empty: '暂无历史会话',
untitled: '未命名对话'
},
schedule: {
title: '排程记录',
refresh: '刷新',
search: '查询',
reset: '重置',
loading: '正在加载...',
empty: '暂无排程记录',
download: '下载',
noPendingData: '无待处理数据',
filters: {
name: '排程名称',
namePlaceholder: '输入排程名称',
start: '开始时间',
end: '结束时间',
status: '状态'
},
columns: {
name: '排程名称',
runNo: '运行编号',
triggerType: '触发方式',
start: '开始时间',
end: '结束时间',
duration: '耗时',
status: '状态',
total: '处理笔数',
success: '成功笔数',
failed: '失败笔数',
detail: '明细'
},
trigger: {
manual: '手动',
test: '测试',
timed: '定时'
},
status: {
all: '全部状态',
success: '成功',
partialFailed: '部分成功',
failed: '失败',
running: '执行中',
queued: '排队中'
},
msg: {
downloadExcelFailed: '下载 Excel 失败'
}
},
profile: {
msg: {
loadFailed: '加载个人中心失败',
saveFailed: '保存个人资料失败',
saved: '个人资料已保存',
changePasswordFailed: '修改密码失败'
}
},
msg: {
casdoorNotMatchedContactAdmin: 'Casdoor 登录成功,但未匹配到本地账号,请联系管理员。',
casdoorNotMatchedNeedLocalUser: 'Casdoor 登录成功,但未匹配到本地账号。请让管理员在本地用户表创建同名 username 或相同 email 的账号。',
localAccountDisabled: '该本地账号已被禁用,请联系管理员启用后再登录。'
}
}, },
admin: { admin: {
title: '管理控制台', title: '管理控制台',
@@ -1800,6 +2239,43 @@ const messages = {
}, },
// Common Messages // Common Messages
schedule: {
status: {
all: '全部状态',
success: '成功',
partialFailed: '部分成功',
failed: '失败',
running: '执行中',
queued: '排队中'
},
weekday: {
mon: '周一',
tue: '周二',
wed: '周三',
thu: '周四',
fri: '周五',
sat: '周六',
sun: '周日'
},
step: {
fetchSrm: '抓取外部系统数据',
callDify: '调用Dify服务',
writebackSrm: '回写外部系统数据',
callInternalApi: '调用内部API',
preDify: 'Dify前处理'
},
deleteDialogTitle: '删除排程',
deleteConfirmMessage: '确认删除排程「{name}」?',
msg: {
testRunFailed: '测试执行失败',
configRequired: 'Dify Agent、SQL 配置或外部 API 至少填写一项,否则排程执行无任何效果',
headerLabelsJsonInvalid: 'header_labels JSON 格式错误,请检查',
apiHeadersJsonInvalid: 'API Headers JSON 格式错误,请检查',
runNowFailed: '手动执行失败',
downloadExcelFailed: '下载 Excel 失败',
deleteFailed: '删除排程失败'
}
},
role: { role: {
user: '普通用户', user: '普通用户',
admin: '管理员', admin: '管理员',
@@ -2128,6 +2604,12 @@ const messages = {
}, },
common: { common: {
errorOccurred: '發生錯誤', errorOccurred: '發生錯誤',
close: '關閉',
cancel: '取消',
loading: '載入中...',
refresh: '刷新',
yes: '是',
no: '否',
deleteDialog: { deleteDialog: {
defaultTitle: '您確定要刪除嗎?', defaultTitle: '您確定要刪除嗎?',
defaultMessage: '點擊「確定」按鈕後,此對話框將在 1 秒後關閉', defaultMessage: '點擊「確定」按鈕後,此對話框將在 1 秒後關閉',
@@ -2135,6 +2617,118 @@ const messages = {
confirm: '確定' confirm: '確定'
} }
}, },
scheduleRuns: {
title: '排程記錄',
refresh: '刷新',
tip: '僅展示你是 owner 或在通知名單中的記錄',
loading: '載入中...',
empty: '暫無可見記錄',
viewExcel: '查看Excel',
columns: {
runNo: '執行單號',
schedule: '排程',
start: '開始',
end: '結束',
status: '狀態',
total: '處理',
success: '成功',
failed: '失敗'
},
msg: {
loadFailed: '載入排程記錄失敗'
}
},
filePreview: {
title: '檔案預覽',
download: '下載檔案',
downloading: '下載中...',
tooLarge: '檔案較大,暫不支援線上預覽,請直接點擊上方「下載檔案」取得原始檔案。',
previewFailed: '預覽失敗:',
msg: {
downloadFailed: '下載失敗: {reason}',
unknownError: '未知錯誤'
}
},
kbDifySettings: {
title: 'Dify 設定',
subtitle: '管理知識庫模組使用的 Dify 連線和預設同步參數。',
loading: '正在載入設定...',
save: '儲存設定',
saving: '儲存中...',
msg: {
loadFailed: '載入 Dify 設定失敗',
saveFailed: '儲存 Dify 設定失敗',
saved: 'Dify 設定已儲存'
}
},
kbDifyHealth: {
title: 'Dify 健康檢查',
subtitle: '查看知識庫模組目前的 Dify 連線情況和本地同步概況。',
loading: '正在檢測...',
reachable: '可訪問',
unreachable: '不可訪問',
notConfigured: '未配置',
datasetCount: 'Dataset 數量',
configured: '配置完成:',
boundGroups: '已綁定分組',
localSyncRecords: '本地同步記錄:',
syncingVersions: '同步中版本',
syncedVersions: '已同步版本',
pendingSyncJobs: '待同步任務',
msg: {
loadFailed: '載入 Dify 健康狀態失敗'
}
},
kbAdmin: {
title: '知識庫管理',
subtitle: '第一階段先承接分組、任務和 Dify 管理入口,後續再接入清洗鏈路。',
toolbar: '知識庫工具操作',
difySettings: 'Dify 設定',
healthCheck: '健康檢查',
goWorkspace: '前往工作台',
groupsTitle: '知識庫分組概覽',
groupsEmpty: '當前暫無分組,或知識庫介面尚未聯調完成。',
noDescription: '暫無描述',
documentCount: '{count} 文件',
updatedAt: '更新時間:',
jobsTitle: '任務隊列占位',
jobsEmpty: '暫無任務。第二階段會在這裡接入清洗、同步和重試任務。',
noJobMessage: '暫無任務說明',
jobMeta: '文檔:{docId} · 版本:{versionId} · 進度:{progress}%',
running: '執行中...',
runJob: '執行任務',
form: {
editTitle: '編輯知識庫分組',
createTitle: '新建知識庫分組',
editDesc: '修改知識庫分組名稱和描述,儲存後會立即刷新列表。',
createDesc: '用於驗證主平台裡的知識庫管理入口和基礎介面殼。',
saving: '儲存中...',
submitting: '提交中...',
saveChanges: '儲存修改',
create: '建立分組',
groupName: '分組名稱',
groupNamePlaceholder: '例如:財務制度庫',
groupDesc: '分組描述',
groupDescPlaceholder: '描述該知識庫分組的業務範圍或清洗目標',
cancelEdit: '取消編輯'
},
deleteDialog: {
title: '您確定要刪除嗎?',
message: '確認刪除知識庫分組「{name}」嗎?'
},
msg: {
loadGroupsFailed: '載入知識庫分組失敗',
loadJobsFailed: '載入任務列表失敗',
nameRequired: '請輸入知識庫分組名稱',
createFailed: '建立失敗',
created: '知識庫分組建立成功',
updated: '知識庫分組已更新',
deleteFailed: '刪除失敗',
deleted: '知識庫分組已刪除',
runFailed: '任務執行失敗',
runDone: '任務已執行'
}
},
workspace: { workspace: {
title: 'AI 工作台', title: 'AI 工作台',
brandTitle: 'AI工作台', brandTitle: 'AI工作台',
@@ -2209,7 +2803,90 @@ const messages = {
reason: '申請理由', reason: '申請理由',
submit: '提交申請' submit: '提交申請'
}, },
wecomEntryNotice: '已從企業微信消息進入,已為你準備好相關上下文。' wecomEntryNotice: '已從企業微信消息進入,已為你準備好相關上下文。',
lang: {
zhCN: '簡體中文',
zhTW: '繁體中文'
},
mobileTabs: {
me: '我的',
history: '歷史會話',
applications: '應用管理'
},
nav: {
profile: '個人中心',
admin: '管理後台',
applications: '應用管理',
knowledgeBase: '知識庫管理',
scheduleRuns: '排程記錄',
feedback: '意見反饋',
updates: '最近更新',
backToChat: '返回聊天',
logout: '退出登錄'
},
history: {
empty: '暫無歷史會話',
untitled: '未命名對話'
},
schedule: {
title: '排程記錄',
refresh: '刷新',
search: '查詢',
reset: '重置',
loading: '正在載入...',
empty: '暫無排程記錄',
download: '下載',
noPendingData: '無待處理數據',
filters: {
name: '排程名稱',
namePlaceholder: '輸入排程名稱',
start: '開始時間',
end: '結束時間',
status: '狀態'
},
columns: {
name: '排程名稱',
runNo: '運行編號',
triggerType: '觸發方式',
start: '開始時間',
end: '結束時間',
duration: '耗時',
status: '狀態',
total: '處理筆數',
success: '成功筆數',
failed: '失敗筆數',
detail: '明細'
},
trigger: {
manual: '手動',
test: '測試',
timed: '定時'
},
status: {
all: '全部狀態',
success: '成功',
partialFailed: '部分成功',
failed: '失敗',
running: '執行中',
queued: '排隊中'
},
msg: {
downloadExcelFailed: '下載 Excel 失敗'
}
},
profile: {
msg: {
loadFailed: '載入個人中心失敗',
saveFailed: '保存個人資料失敗',
saved: '個人資料已保存',
changePasswordFailed: '修改密碼失敗'
}
},
msg: {
casdoorNotMatchedContactAdmin: 'Casdoor 登錄成功,但未匹配到本地賬號,請聯繫管理員。',
casdoorNotMatchedNeedLocalUser: 'Casdoor 登錄成功,但未匹配到本地賬號。請讓管理員在本地用戶表建立同名 username 或相同 email 的賬號。',
localAccountDisabled: '該本地賬號已被禁用,請聯繫管理員啟用後再登錄。'
}
}, },
admin: { admin: {
title: '管理控制台', title: '管理控制台',
@@ -2781,6 +3458,43 @@ const messages = {
}, },
// Common Messages // Common Messages
schedule: {
status: {
all: '全部狀態',
success: '成功',
partialFailed: '部分成功',
failed: '失敗',
running: '執行中',
queued: '排隊中'
},
weekday: {
mon: '週一',
tue: '週二',
wed: '週三',
thu: '週四',
fri: '週五',
sat: '週六',
sun: '週日'
},
step: {
fetchSrm: '抓取外部系統資料',
callDify: '調用Dify服務',
writebackSrm: '回寫外部系統資料',
callInternalApi: '調用內部API',
preDify: 'Dify前處理'
},
deleteDialogTitle: '刪除排程',
deleteConfirmMessage: '確認刪除排程「{name}」?',
msg: {
testRunFailed: '測試執行失敗',
configRequired: 'Dify Agent、SQL 配置或外部 API 至少填寫一項,否則排程執行無任何效果',
headerLabelsJsonInvalid: 'header_labels JSON 格式錯誤,請檢查',
apiHeadersJsonInvalid: 'API Headers JSON 格式錯誤,請檢查',
runNowFailed: '手動執行失敗',
downloadExcelFailed: '下載 Excel 失敗',
deleteFailed: '刪除排程失敗'
}
},
role: { role: {
user: '普通用戶', user: '普通用戶',
admin: '管理員', admin: '管理員',
@@ -3109,6 +3823,12 @@ const messages = {
}, },
common: { common: {
errorOccurred: 'เกิดข้อผิดพลาด', errorOccurred: 'เกิดข้อผิดพลาด',
close: 'ปิด',
cancel: 'ยกเลิก',
loading: 'กำลังโหลด...',
refresh: 'รีเฟรช',
yes: 'ใช่',
no: 'ไม่',
deleteDialog: { deleteDialog: {
defaultTitle: 'คุณแน่ใจหรือไม่ว่าต้องการลบ?', defaultTitle: 'คุณแน่ใจหรือไม่ว่าต้องการลบ?',
defaultMessage: 'เมื่อกดปุ่มตกลง กล่องโต้ตอบนี้จะปิดหลังจาก 1 วินาที', defaultMessage: 'เมื่อกดปุ่มตกลง กล่องโต้ตอบนี้จะปิดหลังจาก 1 วินาที',
@@ -3116,6 +3836,118 @@ const messages = {
confirm: 'ตกลง' confirm: 'ตกลง'
} }
}, },
scheduleRuns: {
title: 'บันทึกการตั้งเวลา',
refresh: 'รีเฟรช',
tip: 'แสดงเฉพาะรายการที่คุณเป็น owner หรืออยู่ในรายชื่อแจ้งเตือน',
loading: 'กำลังโหลด...',
empty: 'ยังไม่มีรายการที่มองเห็นได้',
viewExcel: 'ดู Excel',
columns: {
runNo: 'เลขรัน',
schedule: 'ตารางเวลา',
start: 'เริ่ม',
end: 'สิ้นสุด',
status: 'สถานะ',
total: 'ประมวลผล',
success: 'สำเร็จ',
failed: 'ล้มเหลว'
},
msg: {
loadFailed: 'โหลดบันทึกการตั้งเวลาล้มเหลว'
}
},
filePreview: {
title: 'พรีวิวไฟล์',
download: 'ดาวน์โหลดไฟล์',
downloading: 'กำลังดาวน์โหลด...',
tooLarge: 'ไฟล์มีขนาดใหญ่เกินไป ไม่รองรับการพรีวิวออนไลน์ กรุณาคลิก \"ดาวน์โหลดไฟล์\" ด้านบนเพื่อรับไฟล์ต้นฉบับ',
previewFailed: 'พรีวิวล้มเหลว: ',
msg: {
downloadFailed: 'ดาวน์โหลดล้มเหลว: {reason}',
unknownError: 'ข้อผิดพลาดที่ไม่ทราบสาเหตุ'
}
},
kbDifySettings: {
title: 'ตั้งค่า Dify',
subtitle: 'จัดการการเชื่อมต่อ Dify และค่าซิงค์เริ่มต้นของโมดูลคลังความรู้',
loading: 'กำลังโหลดการตั้งค่า...',
save: 'บันทึกการตั้งค่า',
saving: 'กำลังบันทึก...',
msg: {
loadFailed: 'โหลดการตั้งค่า Dify ล้มเหลว',
saveFailed: 'บันทึกการตั้งค่า Dify ล้มเหลว',
saved: 'บันทึกการตั้งค่า Dify แล้ว'
}
},
kbDifyHealth: {
title: 'ตรวจสุขภาพ Dify',
subtitle: 'ดูสถานะการเชื่อมต่อ Dify และภาพรวมการซิงค์ภายในของโมดูลคลังความรู้',
loading: 'กำลังตรวจสอบ...',
reachable: 'เข้าถึงได้',
unreachable: 'เข้าถึงไม่ได้',
notConfigured: 'ยังไม่ตั้งค่า',
datasetCount: 'จำนวน Dataset',
configured: 'ตั้งค่าแล้ว: ',
boundGroups: 'กลุ่มที่ผูกแล้ว',
localSyncRecords: 'บันทึกซิงค์ภายใน: ',
syncingVersions: 'เวอร์ชันที่กำลังซิงค์',
syncedVersions: 'เวอร์ชันที่ซิงค์แล้ว',
pendingSyncJobs: 'งานซิงค์ที่รออยู่',
msg: {
loadFailed: 'โหลดสถานะสุขภาพ Dify ล้มเหลว'
}
},
kbAdmin: {
title: 'จัดการคลังความรู้',
subtitle: 'ระยะแรกครอบคลุมการจัดการกลุ่ม งาน และทางเข้า Dify ก่อน จากนั้นค่อยต่อสายงานทำความสะอาด',
toolbar: 'เครื่องมือคลังความรู้',
difySettings: 'ตั้งค่า Dify',
healthCheck: 'ตรวจสุขภาพ',
goWorkspace: 'ไปยังเวิร์กสเปซ',
groupsTitle: 'ภาพรวมกลุ่มคลังความรู้',
groupsEmpty: 'ยังไม่มีกลุ่ม หรือ API คลังความรู้ยังไม่พร้อม',
noDescription: 'ไม่มีคำอธิบาย',
documentCount: '{count} เอกสาร',
updatedAt: 'อัปเดตเมื่อ: ',
jobsTitle: 'พื้นที่งานคิว',
jobsEmpty: 'ยังไม่มีงาน ระยะถัดไปจะเชื่อมงานทำความสะอาด ซิงค์ และลองใหม่',
noJobMessage: 'ไม่มีคำอธิบายงาน',
jobMeta: 'เอกสาร: {docId} · เวอร์ชัน: {versionId} · ความคืบหน้า: {progress}%',
running: 'กำลังรัน...',
runJob: 'รันงาน',
form: {
editTitle: 'แก้ไขกลุ่มคลังความรู้',
createTitle: 'สร้างกลุ่มคลังความรู้',
editDesc: 'แก้ไขชื่อและคำอธิบายกลุ่ม รายการจะรีเฟรชทันทีหลังบันทึก',
createDesc: 'ใช้ตรวจสอบทางเข้าจัดการคลังความรู้และโครง API พื้นฐานในแพลตฟอร์มหลัก',
saving: 'กำลังบันทึก...',
submitting: 'กำลังส่ง...',
saveChanges: 'บันทึกการแก้ไข',
create: 'สร้างกลุ่ม',
groupName: 'ชื่อกลุ่ม',
groupNamePlaceholder: 'เช่น: คลังนโยบายการเงิน',
groupDesc: 'คำอธิบายกลุ่ม',
groupDescPlaceholder: 'อธิบายขอบเขตงานหรือเป้าหมายการทำความสะอาดของกลุ่มนี้',
cancelEdit: 'ยกเลิกการแก้ไข'
},
deleteDialog: {
title: 'คุณแน่ใจหรือไม่ว่าต้องการลบ?',
message: 'ยืนยันลบกลุ่มคลังความรู้ \"{name}\" หรือไม่?'
},
msg: {
loadGroupsFailed: 'โหลดกลุ่มคลังความรู้ล้มเหลว',
loadJobsFailed: 'โหลดรายการงานล้มเหลว',
nameRequired: 'กรุณากรอกชื่อกลุ่มคลังความรู้',
createFailed: 'สร้างไม่สำเร็จ',
created: 'สร้างกลุ่มคลังความรู้สำเร็จ',
updated: 'อัปเดตกลุ่มคลังความรู้แล้ว',
deleteFailed: 'ลบไม่สำเร็จ',
deleted: 'ลบกลุ่มคลังความรู้แล้ว',
runFailed: 'รันงานล้มเหลว',
runDone: 'รันงานแล้ว'
}
},
workspace: { workspace: {
title: 'พื้นที่ทำงาน AI', title: 'พื้นที่ทำงาน AI',
brandTitle: 'Hexin AI Workspace', brandTitle: 'Hexin AI Workspace',
@@ -3762,6 +4594,43 @@ const messages = {
}, },
// Common Messages // Common Messages
schedule: {
status: {
all: 'ทุกสถานะ',
success: 'สำเร็จ',
partialFailed: 'สำเร็จบางส่วน',
failed: 'ล้มเหลว',
running: 'กำลังทำงาน',
queued: 'อยู่ในคิว'
},
weekday: {
mon: 'จันทร์',
tue: 'อังคาร',
wed: 'พุธ',
thu: 'พฤหัสบดี',
fri: 'ศุกร์',
sat: 'เสาร์',
sun: 'อาทิตย์'
},
step: {
fetchSrm: 'ดึงข้อมูลจากระบบภายนอก',
callDify: 'เรียกใช้บริการ Dify',
writebackSrm: 'เขียนข้อมูลกลับระบบภายนอก',
callInternalApi: 'เรียกใช้ API ภายใน',
preDify: 'ประมวลผลก่อน Dify'
},
deleteDialogTitle: 'ลบตารางเวลา',
deleteConfirmMessage: 'ยืนยันการลบตารางเวลา \"{name}\"?',
msg: {
testRunFailed: 'ทดสอบการทำงานล้มเหลว',
configRequired: 'ต้องกรอกอย่างน้อยหนึ่งรายการใน Dify Agent, SQL config หรือ external API',
headerLabelsJsonInvalid: 'รูปแบบ JSON ของ header_labels ไม่ถูกต้อง',
apiHeadersJsonInvalid: 'รูปแบบ JSON ของ API Headers ไม่ถูกต้อง',
runNowFailed: 'การรันด้วยตนเองล้มเหลว',
downloadExcelFailed: 'ดาวน์โหลด Excel ล้มเหลว',
deleteFailed: 'ลบตารางเวลาล้มเหลว'
}
},
role: { role: {
user: 'ผู้ใช้ทั่วไป', user: 'ผู้ใช้ทั่วไป',
admin: 'ผู้ดูแลระบบ', admin: 'ผู้ดูแลระบบ',
+33 -33
View File
@@ -523,13 +523,13 @@ const scheduleCronDesigner = ref({
weekly_minute: 0, weekly_minute: 0,
}); });
const weeklyDayOptions = [ const weeklyDayOptions = [
{ value: 1, label: '周一' }, { value: 1, label: t('admin.schedule.weekday.mon') },
{ value: 2, label: '周二' }, { value: 2, label: t('admin.schedule.weekday.tue') },
{ value: 3, label: '周三' }, { value: 3, label: t('admin.schedule.weekday.wed') },
{ value: 4, label: '周四' }, { value: 4, label: t('admin.schedule.weekday.thu') },
{ value: 5, label: '周五' }, { value: 5, label: t('admin.schedule.weekday.fri') },
{ value: 6, label: '周六' }, { value: 6, label: t('admin.schedule.weekday.sat') },
{ value: 0, label: '周日' }, { value: 0, label: t('admin.schedule.weekday.sun') },
]; ];
const buildCronExprFromDesigner = () => { const buildCronExprFromDesigner = () => {
@@ -808,20 +808,20 @@ const selectedSchedule = computed(() =>
); );
const scheduleRunStatusOptions = [ const scheduleRunStatusOptions = [
{ value: 'all', label: '全部状态' }, { value: 'all', label: t('admin.schedule.status.all') },
{ value: 'success', label: '成功' }, { value: 'success', label: t('admin.schedule.status.success') },
{ value: 'partial_failed', label: '部分成功' }, { value: 'partial_failed', label: t('admin.schedule.status.partialFailed') },
{ value: 'failed', label: '失败' }, { value: 'failed', label: t('admin.schedule.status.failed') },
{ value: 'running', label: '执行中' }, { value: 'running', label: t('admin.schedule.status.running') },
]; ];
const getScheduleRunStatusBadge = (status: string) => { const getScheduleRunStatusBadge = (status: string) => {
const map: Record<string, { cls: string; label: string }> = { const map: Record<string, { cls: string; label: string }> = {
success: { cls: 'bg-emerald-100 text-emerald-700', 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: '部分成功' }, partial_failed: { cls: 'bg-blue-100 text-blue-700', label: t('admin.schedule.status.partialFailed') },
failed: { cls: 'bg-rose-100 text-rose-700', label: '失败' }, failed: { cls: 'bg-rose-100 text-rose-700', label: t('admin.schedule.status.failed') },
running: { cls: 'bg-amber-100 text-amber-700', label: '执行中' }, running: { cls: 'bg-amber-100 text-amber-700', label: t('admin.schedule.status.running') },
queued: { cls: 'bg-slate-100 text-slate-600', label: '排队中' }, 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 }; 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 expandedScheduleRunId = ref<number | null>(null);
const stepLabelMap: Record<string, string> = { const stepLabelMap: Record<string, string> = {
fetch_srm: '抓取外部系统数据', fetch_srm: t('admin.schedule.step.fetchSrm'),
call_dify: '调用Dify服务', call_dify: t('admin.schedule.step.callDify'),
writeback_srm: '回写外部系统数据', writeback_srm: t('admin.schedule.step.writebackSrm'),
call_internal_api: '调用内部API', call_internal_api: t('admin.schedule.step.callInternalApi'),
pre_dify: 'Dify前处理', pre_dify: t('admin.schedule.step.preDify'),
}; };
const stepStatusMap: Record<string, { cls: string; label: string }> = { const stepStatusMap: Record<string, { cls: string; label: string }> = {
success: { cls: 'bg-emerald-100 text-emerald-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: '失败' }, failed: { cls: 'bg-rose-100 text-rose-700', label: t('admin.schedule.status.failed') },
}; };
const showTestRunDialog = ref(false); const showTestRunDialog = ref(false);
@@ -893,7 +893,7 @@ const handleTestRun = async () => {
await viewScheduleRuns(s.id); await viewScheduleRuns(s.id);
} }
} catch (e: any) { } catch (e: any) {
msg.error(`测试执行失败: ${e?.message || e}`); msg.error(`${t('admin.schedule.msg.testRunFailed')}: ${e?.message || e}`);
} finally { } finally {
testRunLoading.value = false; testRunLoading.value = false;
} }
@@ -1025,7 +1025,7 @@ const createSchedule = async () => {
const hasSql = dst === 'database' && !!scheduleSqlEditForm.value.base_fetch_sql.trim(); const hasSql = dst === 'database' && !!scheduleSqlEditForm.value.base_fetch_sql.trim();
const hasApi = dst === 'external_api' && !!scheduleSqlEditForm.value.api_url.trim(); const hasApi = dst === 'external_api' && !!scheduleSqlEditForm.value.api_url.trim();
if (!hasAgent && !hasSql && !hasApi) { if (!hasAgent && !hasSql && !hasApi) {
msg.error('Dify Agent、SQL 配置或外部 API 至少填写一项,否则排程执行无任何效果'); msg.error(t('admin.schedule.msg.configRequired'));
return; return;
} }
@@ -1033,7 +1033,7 @@ const createSchedule = async () => {
try { try {
headerLabels = JSON.parse(scheduleSqlEditForm.value.header_labels_str || '{}'); headerLabels = JSON.parse(scheduleSqlEditForm.value.header_labels_str || '{}');
} catch { } catch {
msg.error('header_labels JSON 格式错误,请检查'); msg.error(t('admin.schedule.msg.headerLabelsJsonInvalid'));
return; return;
} }
let apiHeaders: Record<string, string> = {}; let apiHeaders: Record<string, string> = {};
@@ -1041,7 +1041,7 @@ const createSchedule = async () => {
try { try {
apiHeaders = JSON.parse(scheduleSqlEditForm.value.api_headers_str || '{}'); apiHeaders = JSON.parse(scheduleSqlEditForm.value.api_headers_str || '{}');
} catch { } catch {
msg.error('API Headers JSON 格式错误,请检查'); msg.error(t('admin.schedule.msg.apiHeadersJsonInvalid'));
return; return;
} }
} }
@@ -1165,7 +1165,7 @@ const runScheduleNow = async (taskId: number) => {
const res = await runAdminSchedule(taskId); const res = await runAdminSchedule(taskId);
if (!res.ok) { if (!res.ok) {
const data = await res.json().catch(() => ({})); const data = await res.json().catch(() => ({}));
msg.error(data?.error || '手动执行失败'); msg.error(data?.error || t('admin.schedule.msg.runNowFailed'));
return; return;
} }
await viewScheduleRuns(taskId); await viewScheduleRuns(taskId);
@@ -1189,7 +1189,7 @@ const setScheduleEnabled = async (taskId: number, enabled: boolean) => {
const downloadScheduleExcel = async (runId: number) => { const downloadScheduleExcel = async (runId: number) => {
const res = await fetch(`/api/admin/schedule-runs/${runId}/excel`, { headers: getAuthHeaders() }); const res = await fetch(`/api/admin/schedule-runs/${runId}/excel`, { headers: getAuthHeaders() });
if (!res.ok) { if (!res.ok) {
msg.error('下载 Excel 失败'); msg.error(t('admin.schedule.msg.downloadExcelFailed'));
return; return;
} }
const blob = await res.blob(); const blob = await res.blob();
@@ -1206,11 +1206,11 @@ const downloadScheduleExcel = async (runId: number) => {
const deleteSchedule = (task: ScheduleTask) => { const deleteSchedule = (task: ScheduleTask) => {
openDeleteConfirmDialog( openDeleteConfirmDialog(
`确认删除排程「${task.name}」?`, t('admin.schedule.deleteConfirmMessage', { name: task.name }),
async () => { async () => {
const res = await deleteAdminSchedule(task.id); const res = await deleteAdminSchedule(task.id);
if (!res.ok) { if (!res.ok) {
msg.error('删除排程失败'); msg.error(t('admin.schedule.msg.deleteFailed'));
return; return;
} }
if (selectedScheduleId.value === task.id) { if (selectedScheduleId.value === task.id) {
@@ -1219,7 +1219,7 @@ const deleteSchedule = (task: ScheduleTask) => {
} }
await loadSchedules(); 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'); let msg = err.error || t('login.failed');
if (isCasdoorMode) { if (isCasdoorMode) {
if (err.error_code === 'CASDOOR_USER_NOT_FOUND') { if (err.error_code === 'CASDOOR_USER_NOT_FOUND') {
msg = 'Casdoor 登录成功,但未匹配到本地账号,请联系管理员。'; msg = t('workspace.msg.casdoorNotMatchedContactAdmin');
} else if (err.error_code === 'ACCOUNT_DISABLED') { } else if (err.error_code === 'ACCOUNT_DISABLED') {
msg = t('login.accountDisabled'); msg = t('login.accountDisabled');
} else if (String(err.error || '').includes('invalid_grant')) { } else if (String(err.error || '').includes('invalid_grant')) {
@@ -522,9 +522,9 @@ const tryCasdoorCallbackLogin = async () => {
const code = String(data.error_code || ''); const code = String(data.error_code || '');
let msg = data.error || 'Casdoor login failed'; let msg = data.error || 'Casdoor login failed';
if (code === 'CASDOOR_USER_NOT_FOUND') { if (code === 'CASDOOR_USER_NOT_FOUND') {
msg = 'Casdoor 登录成功,但未匹配到本地账号。请让管理员在本地用户表创建同名 username 或相同 email 的账号。'; msg = t('workspace.msg.casdoorNotMatchedNeedLocalUser');
} else if (code === 'ACCOUNT_DISABLED') { } else if (code === 'ACCOUNT_DISABLED') {
msg = '该本地账号已被禁用,请联系管理员启用后再登录。'; msg = t('workspace.msg.localAccountDisabled');
} }
msg.error(msg); msg.error(msg);
clearWecomCallbackQuery(); clearWecomCallbackQuery();
@@ -835,9 +835,9 @@ const mobileTabActive = computed({
}); });
const mobileTabTitle = computed(() => { const mobileTabTitle = computed(() => {
if (mobileTabActive.value === 'profile') return '我的'; if (mobileTabActive.value === 'profile') return t('workspace.mobileTabs.me');
if (mobileTabActive.value === 'history') return '历史会话'; if (mobileTabActive.value === 'history') return t('workspace.mobileTabs.history');
return '应用管理'; return t('workspace.mobileTabs.applications');
}); });
const handleLogout = () => { const handleLogout = () => {
@@ -876,7 +876,7 @@ const fetchProfile = async () => {
try { try {
const res = await fetch('/api/user/profile', { headers: getAuthHeaders() }); const res = await fetch('/api/user/profile', { headers: getAuthHeaders() });
if (!res.ok) { if (!res.ok) {
msg.error('加载个人中心失败'); msg.error(t('workspace.profile.msg.loadFailed'));
return; return;
} }
const data = await res.json(); const data = await res.json();
@@ -891,7 +891,7 @@ const fetchProfile = async () => {
isProfileEditing.value = false; isProfileEditing.value = false;
} catch (e) { } catch (e) {
console.error(e); console.error(e);
msg.error('加载个人中心失败'); msg.error(t('workspace.profile.msg.loadFailed'));
} finally { } finally {
isProfileLoading.value = false; isProfileLoading.value = false;
} }
@@ -946,16 +946,16 @@ const saveProfile = async () => {
if (!res.ok) { if (!res.ok) {
const message = await parseErrorMessage(res); const message = await parseErrorMessage(res);
msg.error(message || '保存个人资料失败'); msg.error(message || t('workspace.profile.msg.saveFailed'));
return; return;
} }
msg.success('个人资料已保存'); msg.success(t('workspace.profile.msg.saved'));
captureOriginalProfile(); captureOriginalProfile();
isProfileEditing.value = false; isProfileEditing.value = false;
} catch (e) { } catch (e) {
console.error(e); console.error(e);
msg.error('保存个人资料失败'); msg.error(t('workspace.profile.msg.saveFailed'));
} finally { } finally {
isProfileSaving.value = false; isProfileSaving.value = false;
} }
@@ -979,7 +979,7 @@ const handleChangePassword = async () => {
const data = await res.json(); const data = await res.json();
if (!res.ok) { if (!res.ok) {
msg.error(data.error || '修改密码失败'); msg.error(data.error || t('workspace.profile.msg.changePasswordFailed'));
return; return;
} }
@@ -988,7 +988,7 @@ const handleChangePassword = async () => {
showPasswordModal.value = false; showPasswordModal.value = false;
} catch (e) { } catch (e) {
console.error(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 wsScheduleStartedBefore = ref(todayEndLocal());
const wsScheduleStatusOptions = [ const wsScheduleStatusOptions = [
{ value: 'all', label: '全部状态' }, { value: 'all', label: t('workspace.schedule.status.all') },
{ value: 'success', label: '成功' }, { value: 'success', label: t('workspace.schedule.status.success') },
{ value: 'partial_failed', label: '部分成功' }, { value: 'partial_failed', label: t('workspace.schedule.status.partialFailed') },
{ value: 'failed', label: '失败' }, { value: 'failed', label: t('workspace.schedule.status.failed') },
{ value: 'running', label: '执行中' }, { value: 'running', label: t('workspace.schedule.status.running') },
]; ];
const getWsScheduleStatusBadge = (status: string) => { const getWsScheduleStatusBadge = (status: string) => {
const map: Record<string, { cls: string; label: string }> = { const map: Record<string, { cls: string; label: string }> = {
success: { cls: 'bg-emerald-100 text-emerald-700', 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: '部分成功' }, partial_failed: { cls: 'bg-blue-100 text-blue-700', label: t('workspace.schedule.status.partialFailed') },
failed: { cls: 'bg-rose-100 text-rose-700', label: '失败' }, failed: { cls: 'bg-rose-100 text-rose-700', label: t('workspace.schedule.status.failed') },
running: { cls: 'bg-amber-100 text-amber-700', label: '执行中' }, running: { cls: 'bg-amber-100 text-amber-700', label: t('workspace.schedule.status.running') },
queued: { cls: 'bg-slate-100 text-slate-600', label: '排队中' }, 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 }; return map[status] || { cls: 'bg-slate-100 text-slate-600', label: status };
}; };
@@ -1104,7 +1104,7 @@ const resetWsScheduleFilters = () => {
const downloadWsScheduleExcel = async (runId: number) => { const downloadWsScheduleExcel = async (runId: number) => {
const res = await fetch(workspaceRunExcelUrl(runId), { headers: getAuthHeaders() }); const res = await fetch(workspaceRunExcelUrl(runId), { headers: getAuthHeaders() });
if (!res.ok) { if (!res.ok) {
msg.error('下载 Excel 失败'); msg.error(t('workspace.schedule.msg.downloadExcelFailed'));
return; return;
} }
const blob = await res.blob(); const blob = await res.blob();
@@ -1394,8 +1394,8 @@ onMounted(async () => {
<ThemeToggleButton /> <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"> <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="en">English</option>
<option value="zh-CN">简体中文</option> <option value="zh-CN">{{ $t('workspace.lang.zhCN') }}</option>
<option value="zh-TW">繁體中文</option> <option value="zh-TW">{{ $t('workspace.lang.zhTW') }}</option>
<option value="th">ไทย</option> <option value="th">ไทย</option>
</select> </select>
</div> </div>
@@ -1547,7 +1547,7 @@ onMounted(async () => {
<div v-else class="min-h-screen animate-fade-in"> <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"> <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"> <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> <span class="text-sm font-semibold text-slate-800 dark:text-slate-100">{{ mobileTabTitle }}</span>
</div> </div>
</header> </header>
@@ -1560,7 +1560,7 @@ onMounted(async () => {
<Bot class="h-6 w-6" /> <Bot class="h-6 w-6" />
</div> </div>
<div class="min-w-0"> <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"> <div class="truncate text-xs font-medium text-slate-400">
{{ currentUser?.username }} / {{ currentUser?.role }} {{ currentUser?.username }} / {{ currentUser?.role }}
</div> </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'" :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" /> <User class="h-4 w-4" />
<span>个人中心</span> <span>{{ $t('workspace.nav.profile') }}</span>
</button> </button>
<button <button
v-if="currentUser?.role === 'admin'" 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" 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" /> <Settings class="h-4 w-4" />
<span>管理后台</span> <span>{{ $t('workspace.nav.admin') }}</span>
</button> </button>
<button <button
@click="navigateToApplications" @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'" :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" /> <LayoutGrid class="h-4 w-4" />
<span>应用管理</span> <span>{{ $t('workspace.nav.applications') }}</span>
</button> </button>
<button <button
@click="navigateToKnowledgeBase" @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'" :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" /> <FileText class="h-4 w-4" />
<span>知识库管理</span> <span>{{ $t('workspace.nav.knowledgeBase') }}</span>
</button> </button>
<button <button
@click="navigateToScheduleRuns" @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'" :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" /> <Clock class="h-4 w-4" />
<span>排程记录</span> <span>{{ $t('workspace.nav.scheduleRuns') }}</span>
</button> </button>
<button <button
@click="openGeneralFeedback" @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'" :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" /> <Edit class="h-4 w-4" />
<span>意见反馈</span> <span>{{ $t('workspace.nav.feedback') }}</span>
</button> </button>
<button <button
@click="navigateToUpdates" @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'" :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" /> <Megaphone class="h-4 w-4" />
<span>最近更新</span> <span>{{ $t('workspace.nav.updates') }}</span>
</button> </button>
</div> </div>
</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" 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" /> <Bot class="h-4 w-4" />
<span>返回聊天</span> <span>{{ $t('workspace.nav.backToChat') }}</span>
</button> </button>
<button <button
@click="handleLogout" @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" 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" /> <LogOut class="h-4 w-4" />
<span>退出登录</span> <span>{{ $t('workspace.nav.logout') }}</span>
</button> </button>
</div> </div>
</div> </div>
@@ -1658,7 +1658,7 @@ onMounted(async () => {
</div> </div>
<div v-else-if="chatHistories.length === 0" class="flex flex-col items-center justify-center py-20 text-slate-400"> <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" /> <Bot class="h-10 w-10 mb-2" />
<p class="text-sm">暂无历史会话</p> <p class="text-sm">{{ $t('workspace.history.empty') }}</p>
</div> </div>
<div v-else> <div v-else>
<button <button
@@ -1674,7 +1674,7 @@ onMounted(async () => {
</div> </div>
<div class="min-w-0 flex-1"> <div class="min-w-0 flex-1">
<div class="flex items-center gap-2"> <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>
<div class="mt-0.5 flex items-center gap-2 text-xs text-slate-400"> <div class="mt-0.5 flex items-center gap-2 text-xs text-slate-400">
<span>{{ item.agent_name || '' }}</span> <span>{{ item.agent_name || '' }}</span>
@@ -1701,39 +1701,39 @@ onMounted(async () => {
</div> </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="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 ? '' : ''">
<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 v-if="isMobile" class="text-sm font-medium text-slate-900 truncate">{{ profileUser.real_name || profileUser.username || '-' }}</div>
</div> </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 v-if="isMobile" class="text-sm font-medium text-slate-900 truncate">{{ profileUser.employee_id || '-' }}</div>
</div> </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 v-if="isMobile" class="text-sm font-medium text-slate-900 truncate">{{ profileUser.department || '-' }}</div>
</div> </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 :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') || '管理员') : ($t('profile.roleUser') || '用户') }}</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>
<div :class="isMobile ? 'col-span-2' : 'sm:col-span-2'"> <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 v-if="isMobile" class="text-sm font-medium text-slate-900 truncate">{{ profileUser.email || '-' }}</div>
</div> </div>
</div> </div>
</div> </div>
<div v-if="!isMobile" class="flex shrink-0 items-center gap-2 self-start lg:ml-6"> <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"> <button @click="showPasswordModal = true" class="btn-primary px-6 py-3 text-base">
修改密码 {{ $t('profile.changePassword') }}
</button> </button>
</div> </div>
</div> </div>
<div v-if="isMobile" class="mt-4 flex items-center justify-center gap-4"> <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"> <button @click="showPasswordModal = true" class="btn-primary flex-1 py-2.5 text-sm text-center">
修改密码 {{ $t('profile.changePassword') }}
</button> </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"> <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> </button>
</div> </div>
</div> </div>
@@ -1744,18 +1744,18 @@ onMounted(async () => {
<div class="flex items-center" :class="isMobile ? 'w-full justify-center gap-2' : ''"> <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' : ''"> <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' : ''" /> <User class="h-6 w-6 text-brand-500" :class="isMobile ? 'h-4 w-4' : ''" />
基本信息 {{ $t('profile.basicInfo') }}
</h3> </h3>
<button v-if="isMobile && !isProfileEditing" @click="startProfileEditing" class="btn-secondary px-3 py-1 text-xs"> <button v-if="isMobile && !isProfileEditing" @click="startProfileEditing" class="btn-secondary px-3 py-1 text-xs">
编辑 {{ $t('profile.edit') }}
</button> </button>
</div> </div>
<p v-if="!isMobile" class="mt-2 text-sm text-slate-500"> <p v-if="!isMobile" class="mt-2 text-sm text-slate-500">
{{ isProfileEditing ? '可直接修改并保存个人资料' : '切换到编辑模式以更新个人资料' }} {{ isProfileEditing ? $t('profile.directEditHint') : $t('profile.switchEditHint') }}
</p> </p>
<div v-if="!isMobile" class="flex items-center gap-2"> <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"> <button v-if="!isProfileEditing" @click="startProfileEditing" class="btn-secondary px-5 py-2.5 text-sm">
编辑 {{ $t('profile.edit') }}
</button> </button>
<template v-else> <template v-else>
<button @click="cancelProfileEditing" class="btn-secondary px-5 py-2.5 text-sm"> <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" class="btn-primary px-5 py-2.5 text-sm disabled:opacity-50 disabled:cursor-not-allowed"
> >
<Save class="w-4 h-4" /> <Save class="w-4 h-4" />
<span>{{ isProfileSaving ? '保存中...' : '保存' }}</span> <span>{{ isProfileSaving ? $t('profile.saving') : $t('workspace.save') }}</span>
</button> </button>
</template> </template>
</div> </div>
@@ -1775,7 +1775,7 @@ onMounted(async () => {
<div class="grid grid-cols-1 gap-5 md:grid-cols-2" :class="isMobile ? 'gap-3' : ''"> <div class="grid grid-cols-1 gap-5 md:grid-cols-2" :class="isMobile ? 'gap-3' : ''">
<div> <div>
<label class="mb-2 flex items-center gap-2 text-sm font-medium text-slate-500" :class="isMobile ? 'text-xs mb-1' : ''"> <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> </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' : ''"> <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 || '-' }} {{ profileUser.username || '-' }}
@@ -1783,7 +1783,7 @@ onMounted(async () => {
</div> </div>
<div> <div>
<label class="mb-2 flex items-center gap-2 text-sm font-medium text-slate-500" :class="isMobile ? 'text-xs mb-1' : ''"> <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> </label>
<input v-if="isProfileEditing" v-model="profileUser.employee_id" type="text" class="input-field" :class="isMobile ? 'h-10 text-sm' : 'h-[58px]'" /> <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' : ''"> <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>
<div> <div>
<label class="mb-2 flex items-center gap-2 text-sm font-medium text-slate-500" :class="isMobile ? 'text-xs mb-1' : ''"> <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> </label>
<input v-if="isProfileEditing" v-model="profileUser.real_name" type="text" class="input-field" :class="isMobile ? 'h-10 text-sm' : 'h-[58px]'" /> <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' : ''"> <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>
<div> <div>
<label class="mb-2 flex items-center gap-2 text-sm font-medium text-slate-500" :class="isMobile ? 'text-xs mb-1' : ''"> <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> </label>
<input v-if="isProfileEditing" v-model="profileUser.department" type="text" class="input-field" :class="isMobile ? 'h-10 text-sm' : 'h-[58px]'" /> <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' : ''"> <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>
<div> <div>
<label class="mb-2 flex items-center gap-2 text-sm font-medium text-slate-500" :class="isMobile ? 'text-xs mb-1' : ''"> <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> </label>
<input v-if="isProfileEditing" v-model="profileUser.email" type="email" class="input-field" :class="isMobile ? 'h-10 text-sm' : 'h-[58px]'" /> <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' : ''"> <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>
<div> <div>
<label class="mb-2 flex items-center gap-2 text-sm font-medium text-slate-500" :class="isMobile ? 'text-xs mb-1' : ''"> <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> </label>
<input v-if="isProfileEditing" v-model="profileUser.phone_number" type="text" class="input-field" :class="isMobile ? 'h-10 text-sm' : 'h-[58px]'" /> <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' : ''"> <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"> <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"> <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" /> <Palette class="h-5 w-5 text-brand-500" />
偏好设置 {{ $t('profile.preferences') }}
</h3> </h3>
<div class="grid grid-cols-1 gap-6 md:grid-cols-2"> <div class="grid grid-cols-1 gap-6 md:grid-cols-2">
<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('workspace.languageLabel') }}</label>
<select v-model="profileUser.language" :disabled="!isProfileEditing" class="input-field h-[58px]"> <select v-model="profileUser.language" :disabled="!isProfileEditing" class="input-field h-[58px]">
<option value="en">English</option> <option value="en">English</option>
<option value="zh-CN">简体中文</option> <option value="zh-CN">{{ $t('workspace.lang.zhCN') }}</option>
<option value="zh-TW">繁體中文</option> <option value="zh-TW">{{ $t('workspace.lang.zhTW') }}</option>
<option value="th">ไทย</option> <option value="th">ไทย</option>
</select> </select>
</div> </div>
<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"> <div class="grid grid-cols-3 gap-2">
<button <button
v-for="item in themeOptions" v-for="item in themeOptions"
@@ -1876,30 +1876,30 @@ onMounted(async () => {
<template v-else-if="activeSidebarItem === 'schedule_runs'"> <template v-else-if="activeSidebarItem === 'schedule_runs'">
<div class="space-y-5 animate-fade-in-up"> <div class="space-y-5 animate-fade-in-up">
<div class="flex items-center justify-between"> <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 <button
@click="loadWorkspaceScheduleRuns" @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" 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" /> <RefreshCw class="h-3.5 w-3.5" />
刷新 {{ $t('workspace.schedule.refresh') }}
</button> </button>
</div> </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 class="flex flex-wrap items-end gap-3 rounded-2xl border border-slate-200 bg-slate-50/40 px-4 py-3">
<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.name') }}</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" /> <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>
<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" /> <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>
<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" /> <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>
<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"> <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> <option v-for="o in wsScheduleStatusOptions" :key="o.value" :value="o.value">{{ o.label }}</option>
</select> </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" 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" /> <Search class="h-3.5 w-3.5" />
查询 {{ $t('workspace.schedule.search') }}
</button> </button>
<button <button
@click="resetWsScheduleFilters" @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" 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> </button>
</div> </div>
<div v-if="workspaceScheduleLoading" 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">暂无排程记录</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 v-else class="overflow-hidden rounded-2xl border border-slate-200 bg-white">
<div class="overflow-x-auto"> <div class="overflow-x-auto">
<table class="w-full text-sm"> <table class="w-full text-sm">
<thead> <thead>
<tr class="border-b border-slate-100 bg-slate-50/60"> <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">{{ $t('workspace.schedule.columns.name') }}</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.runNo') }}</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.triggerType') }}</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.start') }}</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.end') }}</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.duration') }}</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.status') }}</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.total') }}</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.success') }}</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.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> </tr>
</thead> </thead>
<tbody> <tbody>
<tr v-for="r in workspaceScheduleRuns" :key="r.id" class="border-b border-slate-50 transition-colors hover:bg-slate-50/50"> <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 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 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.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">{{ 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> <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 }} {{ getWsScheduleStatusBadge(r.status).label }}
</span> </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-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>
<td class="px-4 py-3 text-slate-500">{{ r.total_count || 0 }}</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> <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" 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" /> <Download class="h-3 w-3" />
下载 {{ $t('workspace.schedule.download') }}
</a> </a>
<span v-else class="text-xs text-slate-300">-</span> <span v-else class="text-xs text-slate-300">-</span>
</td> </td>
@@ -2162,9 +2162,9 @@ onMounted(async () => {
<div class="flex h-14 items-center justify-around"> <div class="flex h-14 items-center justify-around">
<button <button
v-for="tab in ([ v-for="tab in ([
{ key: 'applications', icon: LayoutGrid, label: '应用管理' }, { key: 'applications', icon: LayoutGrid, label: $t('workspace.mobileTabs.applications') },
{ key: 'history', icon: Bot, label: '历史会话' }, { key: 'history', icon: Bot, label: $t('workspace.mobileTabs.history') },
{ key: 'profile', icon: User, label: '我的' }, { key: 'profile', icon: User, label: $t('workspace.mobileTabs.me') },
] as const)" ] as const)"
:key="tab.key" :key="tab.key"
@click="mobileTabActive = tab.key" @click="mobileTabActive = tab.key"