Merge branch 'dev' into test

This commit is contained in:
sophie committed 2026-05-21 09:20:20 +08:00
commit be0b40bfae
3 files changed
+308 -91

No files matched your search

+2 -2
View File
@@ -10,8 +10,8 @@
<meta name="apple-mobile-web-app-title" content="AI工作台" />
<link rel="manifest" href="/manifest.webmanifest" />
<title>AI工作台</title>
<script type="module" crossorigin src="/assets/index-C27ubssp.js"></script>
<link rel="stylesheet" crossorigin href="/assets/index-Cf26xMBx.css">
<script type="module" crossorigin src="/assets/index-DXNJeOLf.js"></script>
<link rel="stylesheet" crossorigin href="/assets/index-CcWOFgeX.css">
</head>
<body>
<div id="app"></div>␍
+161 -36
View File
@@ -13,7 +13,7 @@
import { ref, onMounted, onBeforeUnmount, computed, watch, nextTick } from 'vue';
import { useI18n } from 'vue-i18n';
import { useChat } from '../composables/useChat';
import { Send, Loader2, Plus, Copy, Edit2, RotateCw, Check, X, PanelLeftClose, PanelLeftOpen, Heart, Bell, Mail, Settings, ChevronDown, Sparkles, Database, Mic, LogOut, MessageSquareText, Globe, ExternalLink, Search, LayoutGrid, UserCircle } from 'lucide-vue-next';
import { Send, Loader2, Plus, Copy, Edit2, RotateCw, Check, X, PanelLeftClose, PanelLeftOpen, Heart, Bell, Mail, Settings, ChevronDown, Sparkles, Database, Mic, LogOut, MessageSquareText, Globe, ExternalLink, Search, LayoutGrid, History } from 'lucide-vue-next';
import { marked } from 'marked';
import { useRoute, useRouter } from 'vue-router';
import { config } from '../config';
@@ -26,6 +26,21 @@ import { getAuthHeaders, getStoredAuthUser, clearAuthUser } from '../utils/auth'
const { t } = useI18n();
const { showMessageDialog } = useGlobalMessageDialog();
const { isMobile } = useIsMobile();
const showMobileAgentPopover = ref(false);
const mobileAgentPopoverRef = ref<HTMLElement | null>(null);
const handleMobileAgentPopoverClickOutside = (e: MouseEvent | TouchEvent) => {
if (mobileAgentPopoverRef.value && !mobileAgentPopoverRef.value.contains(e.target as Node)) {
showMobileAgentPopover.value = false;
}
};
const toggleMobileAgentPopover = () => {
showMobileAgentPopover.value = !showMobileAgentPopover.value;
if (showMobileAgentPopover.value) {
loadUserAgents();
}
};
const currentUser = ref(getStoredAuthUser());
const showUserDropdown = ref(false);
const userMenuRef = ref<HTMLElement | null>(null);
@@ -578,52 +593,77 @@ const userAgents = ref<Array<{ id: number; name: string; description: string; ic
const showGeneralFeedbackDialog = ref(false);
const showAgentPanel = ref(true);
const OA_BASE_URL = 'http://oa.well-trust.com:8888';
const OA_BASE_URL = 'http://192.168.100.221:8888';
const OA_LOGIN_URL = `${OA_BASE_URL}/login/Login.jsp?logintype=1`;
const OA_VERIFY_LOGIN_URL = `${OA_BASE_URL}/login/VerifyLogin.jsp`;
const OA_LEAVE_APPLY_PATH = '/workflow/request/AddRequest.jsp?workflowid=652&isagent=0&beagenter=0&f_weaver_belongto_userid=';
const OA_REQUEST_VIEW_PATH = '/workflow/request/ViewRequest.jsp?requestid=';
const OA_AUTO_LOGIN_USERNAME = '26040006';
const OA_AUTO_LOGIN_PASSWORD = '26040006';
const OA_AUTO_LOGIN_TARGET = 'hxops-oa-leave-request';
const openOAAutoLoginPage = (gopage: string, target = OA_AUTO_LOGIN_TARGET) => {
const popup = window.open(OA_LOGIN_URL, target);
// OA 登录对话框状态
const OA_PASSWORD_STORAGE_KEY = 'hxops_oa_login_password';
const showOALoginDialog = ref(false);
const oaLoginEmployeeId = ref('');
const oaLoginPassword = ref(localStorage.getItem(OA_PASSWORD_STORAGE_KEY) || '');
const oaLoginGopage = ref('');
const oaLoginTarget = ref(OA_AUTO_LOGIN_TARGET);
const openOAAutoLoginPage = (gopage: string, username: string, password: string, target = OA_AUTO_LOGIN_TARGET) => {
// 直接在弹出窗口内写入自动提交表单,避免跨窗口时序问题
const popup = window.open('about:blank', target);
if (!popup) {
showMessageDialog('warning', '浏览器拦截了 OA 页面,请允许弹出窗口后重试。');
return;
}
const form = document.createElement('form');
form.action = OA_VERIFY_LOGIN_URL;
form.method = 'POST';
form.target = target;
form.style.display = 'none';
const formHtml = `
<!DOCTYPE html>
<html>
<head><meta charset="utf-8"><title>正在登录OA系统...</title></head>
<body>
<p style="text-align:center;margin-top:100px;font-family:sans-serif;color:#666;">正在登录OA系统,请稍候...</p>
<form id="oaLoginForm" action="${OA_VERIFY_LOGIN_URL}" method="POST">
<input type="hidden" name="loginid" value="${username}" />
<input type="hidden" name="userpassword" value="${password.replace(/"/g, '&quot;')}" />
<input type="hidden" name="gopage" value="${gopage}" />
<input type="hidden" name="logintype" value="1" />
</form>
<script>document.getElementById('oaLoginForm').submit();<\/script>
</body>
</html>
`;
const fields = {
loginid: OA_AUTO_LOGIN_USERNAME,
userpassword: OA_AUTO_LOGIN_PASSWORD,
gopage,
logintype: '1',
};
Object.entries(fields).forEach(([name, value]) => {
const input = document.createElement('input');
input.type = 'hidden';
input.name = name;
input.value = value;
form.appendChild(input);
});
document.body.appendChild(form);
window.setTimeout(() => {
form.submit();
document.body.removeChild(form);
}, 0);
popup.document.open();
popup.document.write(formHtml);
popup.document.close();
};
const openOALeaveRequestDirectly = () => {
openOAAutoLoginPage(OA_LEAVE_APPLY_PATH);
const employeeId = currentUserEmployeeId.value;
if (!employeeId || employeeId === '-') {
showMessageDialog('warning', '没有工号信息无法登录OA系统!');
return;
}
oaLoginEmployeeId.value = employeeId;
oaLoginPassword.value = localStorage.getItem(OA_PASSWORD_STORAGE_KEY) || '';
oaLoginGopage.value = OA_LEAVE_APPLY_PATH;
oaLoginTarget.value = OA_AUTO_LOGIN_TARGET;
showOALoginDialog.value = true;
};
const confirmOALogin = () => {
if (!oaLoginPassword.value.trim()) {
showMessageDialog('warning', '请输入OA登录密码!');
return;
}
// 记住密码到 localStorage
localStorage.setItem(OA_PASSWORD_STORAGE_KEY, oaLoginPassword.value.trim());
showOALoginDialog.value = false;
openOAAutoLoginPage(oaLoginGopage.value, oaLoginEmployeeId.value, oaLoginPassword.value.trim(), oaLoginTarget.value);
};
const cancelOALogin = () => {
showOALoginDialog.value = false;
};
const openOARequestDirectly = (requestId: string) => {
@@ -632,7 +672,16 @@ const openOARequestDirectly = (requestId: string) => {
showMessageDialog('warning', '当前未获取到 OA 单据编号,暂时无法打开单据详情。');
return;
}
openOAAutoLoginPage(`${OA_REQUEST_VIEW_PATH}${encodeURIComponent(normalizedRequestId)}`, `hxops-oa-request-${normalizedRequestId}`);
const employeeId = currentUserEmployeeId.value;
if (!employeeId || employeeId === '-') {
showMessageDialog('warning', '没有工号信息无法登录OA系统!');
return;
}
oaLoginEmployeeId.value = employeeId;
oaLoginPassword.value = localStorage.getItem(OA_PASSWORD_STORAGE_KEY) || '';
oaLoginGopage.value = `${OA_REQUEST_VIEW_PATH}${encodeURIComponent(normalizedRequestId)}`;
oaLoginTarget.value = `hxops-oa-request-${normalizedRequestId}`;
showOALoginDialog.value = true;
};
const activeFeedbackMessageIndex = ref<number | null>(null);
@@ -1662,12 +1711,19 @@ const switchToAgent = (agent: { id: number; name: string }) => {
onMounted(async () => {
document.addEventListener('mousedown', handleDocumentPointerDown);
document.addEventListener('touchstart', handleDocumentPointerDown, { passive: true });
document.addEventListener('mousedown', handleMobileAgentPopoverClickOutside);
document.addEventListener('touchstart', handleMobileAgentPopoverClickOutside, { passive: true });
window.addEventListener('resize', syncViewportWidth);
await syncCurrentUserProfile();
await loadAgent();
await loadUserAgents();
await loadHistory();
const convId = route.query.conversation_id as string;
if (convId) {
await loadConversation(convId);
}
if (presetQuestion.value) {
input.value = presetQuestion.value;
@@ -1681,6 +1737,8 @@ onMounted(async () => {
onBeforeUnmount(() => {
document.removeEventListener('mousedown', handleDocumentPointerDown);
document.removeEventListener('touchstart', handleDocumentPointerDown);
document.removeEventListener('mousedown', handleMobileAgentPopoverClickOutside);
document.removeEventListener('touchstart', handleMobileAgentPopoverClickOutside);
window.removeEventListener('resize', syncViewportWidth);
stopBrowserResize();
if (scrollToBottomFrame !== null) {
@@ -1873,9 +1931,31 @@ const showChatRating = ref(false);
<div class="flex h-7 w-7 items-center justify-center rounded-lg bg-gradient-to-br from-brand-500 via-brand-600 to-sky-600 text-xs font-bold text-white shadow-sm shadow-brand-500/20">AI</div>
<span class="text-sm font-semibold text-slate-800 dark:text-slate-100">{{ currentAgent?.name || 'AI' }}</span>
</div>
<button @click="router.push('/workspace?view=profile')" class="flex h-9 w-9 items-center justify-center rounded-full text-slate-500 transition-colors hover:bg-slate-100 dark:text-slate-300 dark:hover:bg-slate-800" title="个人设置">
<UserCircle class="h-6 w-6" />
</button>
<div class="flex items-center gap-1">
<button @click="toggleMobileAgentPopover" class="flex h-9 w-9 items-center justify-center rounded-full text-slate-500 transition-colors hover:bg-slate-100 dark:text-slate-300 dark:hover:bg-slate-800" title="智能体">
<LayoutGrid class="h-5 w-5" />
</button>
<button @click="router.push('/workspace?view=history')" class="flex h-9 w-9 items-center justify-center rounded-full text-slate-500 transition-colors hover:bg-slate-100 dark:text-slate-300 dark:hover:bg-slate-800" title="历史记录">
<History class="h-5 w-5" />
</button>
</div>
<div v-if="showMobileAgentPopover" ref="mobileAgentPopoverRef" class="absolute right-4 top-12 z-50 w-72 rounded-2xl border border-slate-200 bg-white p-3 shadow-xl dark:border-slate-700 dark:bg-slate-800">
<div class="mb-2 text-xs font-medium text-slate-400">智能体</div>
<div class="grid grid-cols-2 gap-2">
<button
v-for="agent in userAgents"
:key="agent.id"
@click="switchToAgent(agent); showMobileAgentPopover = false"
class="flex flex-col items-center gap-1.5 rounded-xl px-2 py-3 text-center transition-colors hover:bg-slate-100 dark:hover:bg-slate-700"
>
<div class="flex h-9 w-9 items-center justify-center rounded-lg bg-brand-50 text-sm font-bold text-brand-600 dark:bg-brand-900/30">
{{ agent.name.charAt(0) }}
</div>
<span class="w-full truncate text-xs font-medium text-slate-700 dark:text-slate-200">{{ agent.name }}</span>
</button>
</div>
<div v-if="userAgents.length === 0" class="py-3 text-center text-xs text-slate-400">暂无其他智能体</div>
</div>
</header>
<div v-if="!currentAgent" class="flex flex-1 flex-col items-center justify-center space-y-4">
@@ -2560,6 +2640,51 @@ const showChatRating = ref(false);
</div>
</div>
<!-- OA 登录对话框 -->
<Teleport to="body">
<div v-if="showOALoginDialog" class="fixed inset-0 z-[9999] flex items-center justify-center">
<div class="absolute inset-0 bg-black/40" @click="cancelOALogin"></div>
<div class="relative w-full max-w-sm rounded-2xl bg-white p-6 shadow-2xl dark:bg-slate-800">
<h3 class="mb-4 text-center text-lg font-bold text-slate-800 dark:text-slate-100">登录OA系统</h3>
<div class="space-y-4">
<label class="block space-y-1.5">
<span class="text-sm font-medium text-slate-600 dark:text-slate-300">工号</span>
<input
v-model="oaLoginEmployeeId"
type="text"
disabled
class="w-full rounded-xl border border-slate-200 bg-slate-100 px-3 py-2.5 text-sm text-slate-600 outline-none dark:border-slate-600 dark:bg-slate-700 dark:text-slate-300"
/>
</label>
<label class="block space-y-1.5">
<span class="text-sm font-medium text-slate-600 dark:text-slate-300">密码</span>
<input
v-model="oaLoginPassword"
type="password"
placeholder="请输入OA登录密码"
class="w-full rounded-xl border border-slate-200 bg-white px-3 py-2.5 text-sm text-slate-800 outline-none focus:border-brand-400 focus:ring-2 focus:ring-brand-100 dark:border-slate-600 dark:bg-slate-900 dark:text-slate-100 dark:focus:border-brand-500 dark:focus:ring-brand-500/20"
@keyup.enter="confirmOALogin"
/>
</label>
</div>
<div class="mt-6 flex items-center justify-end gap-3">
<button
@click="cancelOALogin"
class="rounded-xl border border-slate-200 px-4 py-2 text-sm font-medium text-slate-600 transition hover:bg-slate-50 dark:border-slate-600 dark:text-slate-300 dark:hover:bg-slate-700"
>
取消
</button>
<button
@click="confirmOALogin"
class="rounded-xl bg-brand-600 px-4 py-2 text-sm font-medium text-white transition hover:bg-brand-700 dark:bg-brand-500 dark:hover:bg-brand-600"
>
确认登录
</button>
</div>
</div>
</div>
</Teleport>
</template>
<style scoped>
+145 -53
View File
@@ -48,8 +48,7 @@ import {
Megaphone,
X,
ChevronDown,
ChevronUp,
MessageCircle
ChevronUp
} from 'lucide-vue-next';
import KbWorkspaceView from './KbWorkspaceView.vue';
@@ -320,7 +319,7 @@ const fetchHome = async () => {
defaultSections.forEach(d => {
if (!backendIds.has(d.id)) {
if (config.workspace.modules[mapKey(d.id) as keyof typeof config.workspace.modules] === false) {
return;
return;
}
merged.push(d);
}
@@ -771,7 +770,7 @@ const handleRegister = async () => {
}
};
const activeSidebarItem = ref<'profile' | 'applications' | 'feedback' | 'updates' | 'knowledge_base' | 'schedule_runs'>('applications');
const activeSidebarItem = ref<'profile' | 'applications' | 'feedback' | 'updates' | 'knowledge_base' | 'schedule_runs' | 'history'>('applications');
const isProfileLoading = ref(false);
const isProfileSaving = ref(false);
const isProfileEditing = ref(false);
@@ -817,15 +816,16 @@ const hasProfileUnsavedChanges = computed(() => {
const mobileTabActive = computed({
get: () => {
if (activeSidebarItem.value === 'profile') return 'profile';
if (activeSidebarItem.value === 'feedback') return 'feedback';
if (activeSidebarItem.value === 'history') return 'history';
return 'applications';
},
set: (tab: 'applications' | 'feedback' | 'profile') => {
set: (tab: 'applications' | 'profile' | 'history') => {
if (tab === 'profile') {
activeSidebarItem.value = 'profile';
if (!profileUser.value.id) fetchProfile();
} else if (tab === 'feedback') {
activeSidebarItem.value = 'feedback';
} else if (tab === 'history') {
activeSidebarItem.value = 'history';
if (chatHistories.value.length === 0) loadChatHistories();
} else {
activeSidebarItem.value = 'applications';
}
@@ -834,7 +834,7 @@ const mobileTabActive = computed({
const mobileTabTitle = computed(() => {
if (mobileTabActive.value === 'profile') return '我的';
if (mobileTabActive.value === 'feedback') return '意见反馈';
if (mobileTabActive.value === 'history') return '历史会话';
return '应用管理';
});
@@ -1117,6 +1117,43 @@ const downloadWsScheduleExcel = async (runId: number) => {
URL.revokeObjectURL(url);
};
interface ChatHistoryItem {
id: number;
conversation_id: string;
title: string;
agent_id?: number;
agent_name?: string;
created_at: string;
}
const chatHistories = ref<ChatHistoryItem[]>([]);
const isLoadingHistories = ref(false);
const loadChatHistories = async () => {
isLoadingHistories.value = true;
try {
const res = await fetch('/api/agents', { headers: getAuthHeaders() });
if (!res.ok) { isLoadingHistories.value = false; return; }
const agentList = await res.json();
const allHistories: ChatHistoryItem[] = [];
await Promise.all(
(Array.isArray(agentList) ? agentList : []).map(async (agent: any) => {
try {
const hRes = await fetch(`/api/chat/sessions?agent_id=${agent.id}`, { headers: getAuthHeaders() });
if (hRes.ok) {
const sessions = await hRes.json();
for (const s of sessions) {
allHistories.push({ ...s, agent_id: agent.id, agent_name: agent.name });
}
}
} catch {}
})
);
allHistories.sort((a, b) => new Date(b.created_at).getTime() - new Date(a.created_at).getTime());
chatHistories.value = allHistories;
} catch {}
isLoadingHistories.value = false;
};
const navigateToGeneralChat = () => {
router.push(`/chat/${DEFAULT_POST_LOGIN_AGENT_ID}`);
};
@@ -1331,12 +1368,15 @@ onMounted(async () => {
await fetchHome();
await handleWecomDeeplinkContext();
const viewParam = route.query.view as string;
const validViews: string[] = ['profile', 'applications', 'feedback', 'updates', 'knowledge_base', 'schedule_runs'];
const validViews: string[] = ['profile', 'applications', 'feedback', 'updates', 'knowledge_base', 'schedule_runs', 'history'];
if (viewParam && validViews.includes(viewParam)) {
activeSidebarItem.value = viewParam as typeof activeSidebarItem.value;
if (viewParam === 'profile' && !profileUser.value.id) {
await fetchProfile();
}
if (viewParam === 'history') {
await loadChatHistories();
}
}
} else {
await fetchPublicAgents();
@@ -1384,7 +1424,7 @@ onMounted(async () => {
<!--
<div class="inline-flex items-center gap-2 px-3 py-1 rounded-full bg-brand-50 text-brand-600 text-sm font-medium border border-brand-100">
<span class="relative flex h-2 w-2">
<span class="animate-ping absolute inline-flex h-full w-full rounded-full bg-brand-400 opacity-75"></span>
<span class="animate-ping absolute inline-flex h-full w-full rounded-full bg-brand-400 opacity-75"></span>
<span class="relative inline-flex rounded-full h-2 w-2 bg-brand-500"></span>
</span>
{{ $t('title') }}
@@ -1609,7 +1649,43 @@ onMounted(async () => {
</aside>
<section class="min-w-0 space-y-6 bg-gray-50 px-4 py-6 md:px-6 md:py-8 lg:px-8" :class="isMobile ? 'pb-20' : ''">
<template v-if="activeSidebarItem === 'profile'">
<template v-if="activeSidebarItem === 'history'">
<div class="space-y-3">
<div v-if="isLoadingHistories" class="flex justify-center py-20">
<div class="animate-spin rounded-full h-8 w-8 border-b-2 border-brand-600"></div>
</div>
<div v-else-if="chatHistories.length === 0" class="flex flex-col items-center justify-center py-20 text-slate-400">
<Bot class="h-10 w-10 mb-2" />
<p class="text-sm">暂无历史会话</p>
</div>
<div v-else>
<button
v-for="item in chatHistories"
:key="item.id"
@click="router.push(`/chat/${item.agent_id || 16}?conversation_id=${item.conversation_id}`)"
class="w-full rounded-2xl border border-slate-200 bg-white p-3 text-left transition-colors hover:border-brand-300 hover:bg-brand-50/50 dark:border-slate-700 dark:bg-slate-800 dark:hover:border-brand-600 mb-2"
:class="isMobile ? 'p-2.5 rounded-xl' : ''"
>
<div class="flex items-start gap-3">
<div class="flex h-8 w-8 shrink-0 items-center justify-center rounded-lg bg-brand-50 text-xs font-bold text-brand-600 dark:bg-brand-900/30" :class="isMobile ? 'h-7 w-7 text-[10px]' : ''">
{{ (item.agent_name || 'AI').charAt(0) }}
</div>
<div class="min-w-0 flex-1">
<div class="flex items-center gap-2">
<span class="truncate text-sm font-medium text-slate-800 dark:text-slate-100">{{ item.title || '未命名对话' }}</span>
</div>
<div class="mt-0.5 flex items-center gap-2 text-xs text-slate-400">
<span>{{ item.agent_name || '' }}</span>
<span>{{ new Date(item.created_at).toLocaleDateString() }}</span>
</div>
</div>
</div>
</button>
</div>
</div>
</template>
<template v-else-if="activeSidebarItem === 'profile'">
<div v-if="isProfileLoading" class="flex justify-center py-20">
<div class="animate-spin rounded-full h-8 w-8 border-b-2 border-brand-600"></div>
</div>
@@ -1618,48 +1694,64 @@ onMounted(async () => {
<div class="rounded-3xl border border-slate-200 bg-white px-6 py-6 shadow-sm md:px-8">
<div class="flex flex-col gap-6 lg:flex-row lg:items-start lg:justify-between">
<div class="flex flex-1 flex-col gap-6 sm:flex-row sm:items-center sm:justify-start">
<div class="flex h-24 w-24 shrink-0 items-center justify-center rounded-full bg-brand-100 text-4xl font-bold text-brand-600">
<div class="flex h-24 w-24 shrink-0 items-center justify-center rounded-full bg-brand-100 text-4xl font-bold text-brand-600" :class="isMobile ? 'h-14 w-14 text-2xl' : ''">
{{ (profileUser.real_name || profileUser.username || 'U').charAt(0).toUpperCase() }}
</div>
<div class="grid flex-1 grid-cols-1 gap-x-12 gap-y-3 text-left sm:grid-cols-2">
<div>
<div class="text-lg font-semibold text-slate-900">{{ profileUser.username || '-' }}</div>
<div class="grid flex-1 text-left" :class="isMobile ? 'grid-cols-2 gap-x-4 gap-y-1' : 'grid-cols-1 gap-x-12 gap-y-3 sm:grid-cols-2'">
<div :class="isMobile ? '' : ''">
<div :class="isMobile ? 'text-xs text-slate-400' : 'text-lg font-semibold text-slate-900'">{{ isMobile ? '姓名' : (profileUser.username || '-') }}</div>
<div v-if="isMobile" class="text-sm font-medium text-slate-900 truncate">{{ profileUser.real_name || profileUser.username || '-' }}</div>
</div>
<div>
<div class="text-lg font-semibold text-slate-900">{{ profileUser.employee_id || '-' }}</div>
<div :class="isMobile ? 'text-xs text-slate-400' : 'text-lg font-semibold text-slate-900'">{{ isMobile ? '工号' : (profileUser.employee_id || '-') }}</div>
<div v-if="isMobile" class="text-sm font-medium text-slate-900 truncate">{{ profileUser.employee_id || '-' }}</div>
</div>
<div>
<div class="text-lg font-semibold text-slate-900">{{ profileUser.department || '-' }}</div>
<div :class="isMobile ? 'text-xs text-slate-400' : 'text-lg font-semibold text-slate-900'">{{ isMobile ? '部门' : (profileUser.department || '-') }}</div>
<div v-if="isMobile" class="text-sm font-medium text-slate-900 truncate">{{ profileUser.department || '-' }}</div>
</div>
<div>
<div class="text-lg font-semibold text-slate-900">
{{ 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 ? '角色' : (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>
<div class="sm:col-span-2">
<div class="break-all text-lg font-semibold text-slate-900">{{ profileUser.email || '-' }}</div>
<div :class="isMobile ? 'col-span-2' : 'sm:col-span-2'">
<div :class="isMobile ? 'text-xs text-slate-400' : 'break-all text-lg font-semibold text-slate-900'">{{ isMobile ? '邮箱' : (profileUser.email || '-') }}</div>
<div v-if="isMobile" class="text-sm font-medium text-slate-900 truncate">{{ profileUser.email || '-' }}</div>
</div>
</div>
</div>
<button @click="showPasswordModal = true" class="btn-primary shrink-0 self-start px-6 py-3 text-base 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>
</div>
</div>
<div v-if="isMobile" class="mt-4 flex items-center justify-center gap-4">
<button @click="showPasswordModal = true" class="btn-primary flex-1 py-2.5 text-sm text-center">
修改密码
</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>
</div>
</div>
<div class="space-y-6">
<div class="rounded-3xl border border-slate-200 bg-white p-8 shadow-sm">
<div class="mb-8 flex flex-col gap-4 sm:flex-row sm:items-center sm:justify-between">
<div>
<h3 class="flex items-center gap-3 text-3xl font-bold text-slate-900">
<User class="h-6 w-6 text-brand-500" />
<div class="rounded-3xl border border-slate-200 bg-white p-8 shadow-sm" :class="isMobile ? 'p-4' : ''">
<div class="mb-8 flex flex-col gap-4 sm:flex-row sm:items-center sm:justify-between" :class="isMobile ? 'mb-4 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' : ''">
<User class="h-6 w-6 text-brand-500" :class="isMobile ? 'h-4 w-4' : ''" />
基本信息
</h3>
<p class="mt-2 text-sm text-slate-500">
{{ isProfileEditing ? '可直接修改并保存个人资料' : '切换到编辑模式以更新个人资料' }}
</p>
<button v-if="isMobile && !isProfileEditing" @click="startProfileEditing" class="btn-secondary px-3 py-1 text-xs">
编辑
</button>
</div>
<div class="flex items-center gap-2">
<p v-if="!isMobile" class="mt-2 text-sm text-slate-500">
{{ isProfileEditing ? '可直接修改并保存个人资料' : '切换到编辑模式以更新个人资料' }}
</p>
<div v-if="!isMobile" class="flex items-center gap-2">
<button v-if="!isProfileEditing" @click="startProfileEditing" class="btn-secondary px-5 py-2.5 text-sm">
编辑
</button>
@@ -1678,57 +1770,57 @@ onMounted(async () => {
</template>
</div>
</div>
<div class="grid grid-cols-1 gap-5 md:grid-cols-2">
<div class="grid grid-cols-1 gap-5 md:grid-cols-2" :class="isMobile ? 'gap-3' : ''">
<div>
<label class="mb-2 flex items-center gap-2 text-sm font-medium text-slate-500">
<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" /> 用户名
</label>
<div class="rounded-2xl border border-slate-200 bg-slate-50 px-4 py-4 text-lg font-medium text-slate-700">
<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 || '-' }}
</div>
</div>
<div>
<label class="mb-2 flex items-center gap-2 text-sm font-medium text-slate-500">
<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" /> 工号
</label>
<input v-if="isProfileEditing" v-model="profileUser.employee_id" type="text" class="input-field 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">
<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' : ''">
{{ profileUser.employee_id || '-' }}
</div>
</div>
<div>
<label class="mb-2 flex items-center gap-2 text-sm font-medium text-slate-500">
<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" /> 真实姓名
</label>
<input v-if="isProfileEditing" v-model="profileUser.real_name" type="text" class="input-field 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">
<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' : ''">
{{ profileUser.real_name || '-' }}
</div>
</div>
<div>
<label class="mb-2 flex items-center gap-2 text-sm font-medium text-slate-500">
<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" /> 部门
</label>
<input v-if="isProfileEditing" v-model="profileUser.department" type="text" class="input-field 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">
<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' : ''">
{{ profileUser.department || '-' }}
</div>
</div>
<div>
<label class="mb-2 flex items-center gap-2 text-sm font-medium text-slate-500">
<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" /> 邮箱
</label>
<input v-if="isProfileEditing" v-model="profileUser.email" type="email" class="input-field 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">
<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' : ''">
{{ profileUser.email || '-' }}
</div>
</div>
<div>
<label class="mb-2 flex items-center gap-2 text-sm font-medium text-slate-500">
<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" /> 手机号
</label>
<input v-if="isProfileEditing" v-model="profileUser.phone_number" type="text" class="input-field 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">
<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' : ''">
{{ profileUser.phone_number || '-' }}
</div>
</div>
@@ -1849,7 +1941,7 @@ onMounted(async () => {
<tr v-for="r in workspaceScheduleRuns" :key="r.id" class="border-b border-slate-50 transition-colors hover:bg-slate-50/50">
<td class="px-4 py-3 font-medium text-slate-900">{{ r.schedule_name || '-' }}</td>
<td class="px-4 py-3 text-slate-500 font-mono text-xs">{{ r.run_no }}</td>
<td class="px-4 py-3 text-slate-500">{{ r.trigger_type === 'manual' ? '手动' : '定时' }}</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 whitespace-nowrap">{{ formatDateTime(r.started_at) }}</td>
<td class="px-4 py-3 text-slate-500 whitespace-nowrap">{{ formatDateTime(r.finished_at) }}</td>
<td class="px-4 py-3 text-slate-500 whitespace-nowrap">{{ r.duration_ms != null ? (r.duration_ms >= 1000 ? (r.duration_ms / 1000).toFixed(1) + 's' : r.duration_ms + 'ms') : '-' }}</td>
@@ -2069,7 +2161,7 @@ onMounted(async () => {
<button
v-for="tab in ([
{ key: 'applications', icon: LayoutGrid, label: '应用管理' },
{ key: 'feedback', icon: MessageCircle, label: '意见反馈' },
{ key: 'history', icon: Bot, label: '历史会话' },
{ key: 'profile', icon: User, label: '我的' },
] as const)"
:key="tab.key"