fix bugs
This commit is contained in:
1 parent
c0cb55dce6
commit
211763908a
4 files changed
+666
-271
No files matched your search
@@ -22,7 +22,6 @@ import { useGlobalMessageDialog } from '../composables/useGlobalMessageDialog';
|
||||
import { buildWecomAuditMeta, formatWecomAuditReason } from '../utils/wecom';
|
||||
import { getAuthHeaders } from '../utils/auth';
|
||||
import { listAdminSchedules, createAdminSchedule, updateAdminSchedule, deleteAdminSchedule, toggleAdminSchedule, runAdminSchedule, listAdminScheduleRuns, getAdminScheduleTaskConfig, testAdminScheduleSql, testAdminScheduleRun, type ScheduleTask, type ScheduleRun, type TestScheduleRunResult } from '../api/schedule';
|
||||
import { exportAdminScheduleUrl, importAdminSchedules } from '../api/schedule';
|
||||
import {
|
||||
ArrowLeft,
|
||||
// Save,
|
||||
@@ -39,7 +38,6 @@ import {
|
||||
MessageSquare,
|
||||
Globe,
|
||||
Download,
|
||||
ArrowUpFromLine,
|
||||
UserCog,
|
||||
Building,
|
||||
MessageCircleQuestion,
|
||||
@@ -710,8 +708,6 @@ const openScheduleCreateModal = async () => {
|
||||
const openScheduleEditModal = async (task: ScheduleTask) => {
|
||||
await Promise.all([loadAgents(), loadUsers()]);
|
||||
scheduleConfigCollapsed.value = true;
|
||||
scheduleNotifyFilterText.value = '';
|
||||
scheduleNotifyDropdownOpen.value = false;
|
||||
scheduleEditingId.value = task.id;
|
||||
scheduleCreateForm.value = {
|
||||
name: task.name || '',
|
||||
@@ -724,31 +720,6 @@ const openScheduleEditModal = async (task: ScheduleTask) => {
|
||||
enabled: !!task.enabled,
|
||||
data_source_type: (task.data_source_type || 'database') as 'database' | 'external_api',
|
||||
};
|
||||
scheduleSqlEditForm.value = {
|
||||
base_fetch_sql: '',
|
||||
fetch_where_conditions: '',
|
||||
fetch_order_by: '',
|
||||
detail_sql: '',
|
||||
writeback_sql: '',
|
||||
row_id_key: 'id',
|
||||
log_prefix: '',
|
||||
alias_order_str: '',
|
||||
detail_alias_order_str: '',
|
||||
header_labels_str: '{}',
|
||||
ds_db_type: 'sqlserver',
|
||||
ds_host: '',
|
||||
ds_port: '',
|
||||
ds_database: '',
|
||||
ds_username: '',
|
||||
ds_password: '',
|
||||
ds_driver: '',
|
||||
ds_encrypt: '',
|
||||
ds_trust_cert: '',
|
||||
api_url: '',
|
||||
api_method: 'POST',
|
||||
api_headers_str: '{}',
|
||||
api_body_template: '',
|
||||
};
|
||||
|
||||
try {
|
||||
const result = await getAdminScheduleTaskConfig(task.id);
|
||||
@@ -935,7 +906,6 @@ const selectedScheduleLatestRunAt = computed(
|
||||
const scheduleEnabledCount = computed(() => schedules.value.filter((item) => item.enabled).length);
|
||||
const scheduleDisabledCount = computed(() => schedules.value.filter((item) => !item.enabled).length);
|
||||
const scheduleRunningCount = computed(() => schedules.value.filter((item) => item.last_status === 'running').length);
|
||||
const scheduleImportInputRef = ref<HTMLInputElement | null>(null);
|
||||
|
||||
const loadSchedules = async () => {
|
||||
scheduleLoading.value = true;
|
||||
@@ -960,38 +930,6 @@ const loadSchedules = async () => {
|
||||
}
|
||||
};
|
||||
|
||||
const exportSchedule = async (taskId: number) => {
|
||||
const res = await fetch(exportAdminScheduleUrl(taskId), { headers: getAuthHeaders() });
|
||||
if (!res.ok) {
|
||||
showMessageDialog('error', '导出失败');
|
||||
return;
|
||||
}
|
||||
const blob = await res.blob();
|
||||
const url = URL.createObjectURL(blob);
|
||||
const a = document.createElement('a');
|
||||
a.href = url;
|
||||
a.download = `schedule_${taskId}_${new Date().toISOString().slice(0, 19).replace(/[:T]/g, '-')}.json`;
|
||||
a.click();
|
||||
URL.revokeObjectURL(url);
|
||||
};
|
||||
|
||||
const importSchedulesFromFile = async (event: Event) => {
|
||||
const input = event.target as HTMLInputElement;
|
||||
const file = input.files?.[0];
|
||||
if (!file) return;
|
||||
try {
|
||||
const text = await file.text();
|
||||
const payload = JSON.parse(text);
|
||||
const result = await importAdminSchedules(payload);
|
||||
showMessageDialog('success', `导入完成:${result.imported} 条,跳过 ${result.skipped} 条`);
|
||||
await loadSchedules();
|
||||
} catch (e: any) {
|
||||
showMessageDialog('error', e?.message || '导入失败');
|
||||
} finally {
|
||||
input.value = '';
|
||||
}
|
||||
};
|
||||
|
||||
const scheduleSqlEditForm = ref({
|
||||
base_fetch_sql: '',
|
||||
fetch_where_conditions: '',
|
||||
@@ -1042,24 +980,6 @@ const handleTestScheduleSql = async () => {
|
||||
};
|
||||
|
||||
const scheduleNotifyDropdownOpen = ref(false);
|
||||
const scheduleNotifyFilterText = ref('');
|
||||
|
||||
const filteredScheduleNotifyUsers = computed(() => {
|
||||
const keyword = scheduleNotifyFilterText.value.trim().toLowerCase();
|
||||
if (!keyword) return users.value;
|
||||
return users.value.filter((u) => {
|
||||
const fields = [
|
||||
u.real_name,
|
||||
u.username,
|
||||
u.employee_id,
|
||||
u.email,
|
||||
u.phone_number,
|
||||
]
|
||||
.filter(Boolean)
|
||||
.map(v => String(v).toLowerCase());
|
||||
return fields.some(v => v.includes(keyword));
|
||||
});
|
||||
});
|
||||
|
||||
const getUserName = (uid: number) => {
|
||||
const u = users.value.find(x => x.id === uid);
|
||||
@@ -4321,7 +4241,7 @@ const handlePermissionImport = async (event: Event) => {
|
||||
|
||||
<template v-if="scheduleViewMode === 'overview'">
|
||||
<div class="rounded-3xl border border-slate-200 bg-white p-6 shadow-sm">
|
||||
<div class="mb-5 grid grid-cols-1 gap-3 md:grid-cols-2 xl:grid-cols-4">
|
||||
<div class="mb-5 grid grid-cols-1 gap-3 md:grid-cols-2 xl:grid-cols-4">
|
||||
<div class="rounded-2xl bg-slate-50 px-4 py-3">
|
||||
<div class="text-xl font-bold text-slate-900">{{ schedules.length }}</div>
|
||||
<div class="text-sm text-slate-500">排程总数</div>
|
||||
@@ -4352,13 +4272,6 @@ const handlePermissionImport = async (event: Event) => {
|
||||
<Settings2 class="h-4 w-4" />
|
||||
</div>
|
||||
<div class="font-semibold text-slate-900">新增排程</div>
|
||||
<button
|
||||
class="inline-flex h-8 w-8 shrink-0 items-center justify-center rounded-xl border border-violet-200 text-violet-700 transition hover:bg-violet-50"
|
||||
title="汇入"
|
||||
@click="scheduleImportInputRef?.click()"
|
||||
>
|
||||
<ArrowUpFromLine class="h-4 w-4" />
|
||||
</button>
|
||||
</div>
|
||||
<div class="text-sm text-slate-500">
|
||||
点击按钮后弹窗录入排程字段。
|
||||
@@ -4371,13 +4284,6 @@ const handlePermissionImport = async (event: Event) => {
|
||||
<Plus class="h-4 w-4" />
|
||||
新增排程
|
||||
</button>
|
||||
<input
|
||||
ref="scheduleImportInputRef"
|
||||
type="file"
|
||||
accept=".json,application/json"
|
||||
class="hidden"
|
||||
@change="importSchedulesFromFile"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -4389,16 +4295,7 @@ const handlePermissionImport = async (event: Event) => {
|
||||
<button class="w-full text-left" @click="openScheduleRunSubmenu(s.id)">
|
||||
<div class="min-h-[96px]">
|
||||
<div class="flex items-center justify-between gap-3">
|
||||
<div class="flex min-w-0 items-center gap-2">
|
||||
<div class="truncate text-base font-semibold text-slate-900">{{ s.name }}</div>
|
||||
<button
|
||||
class="inline-flex h-8 w-8 shrink-0 items-center justify-center rounded-xl border border-emerald-200 text-emerald-700 transition hover:bg-emerald-50"
|
||||
title="汇出"
|
||||
@click.stop="exportSchedule(s.id)"
|
||||
>
|
||||
<Download class="h-4 w-4" />
|
||||
</button>
|
||||
</div>
|
||||
<div class="truncate text-base font-semibold text-slate-900">{{ s.name }}</div>
|
||||
<span class="inline-flex shrink-0 items-center whitespace-nowrap rounded-full px-2.5 py-1 text-xs font-semibold"
|
||||
:class="s.enabled ? 'bg-emerald-100 text-emerald-700' : 'bg-slate-200 text-slate-600'">
|
||||
{{ s.enabled ? '启用' : '停用' }}
|
||||
@@ -4406,6 +4303,12 @@ const handlePermissionImport = async (event: Event) => {
|
||||
</div>
|
||||
<div class="mt-2 text-sm text-slate-500">编号:{{ s.schedule_no }}</div>
|
||||
<div class="mt-1 text-sm text-slate-500">Cron:{{ s.cron_expr }}</div>
|
||||
<div
|
||||
v-if="s.schedule_type === 'platform_app' && s.platform_api_path"
|
||||
class="mt-1 text-sm text-slate-500"
|
||||
>
|
||||
配置:{{ s.platform_api_path }}
|
||||
</div>
|
||||
<div class="mt-1 text-sm text-slate-500">所有者:{{ s.owner_username || s.owner_user_id }}</div>
|
||||
</div>
|
||||
</button>
|
||||
@@ -6143,17 +6046,8 @@ const handlePermissionImport = async (event: Event) => {
|
||||
v-if="scheduleNotifyDropdownOpen"
|
||||
class="absolute z-50 mt-1 max-h-52 w-full overflow-auto rounded-xl border border-slate-200 bg-white shadow-lg"
|
||||
>
|
||||
<div class="sticky top-0 z-10 border-b border-slate-100 bg-white p-2">
|
||||
<input
|
||||
v-model.trim="scheduleNotifyFilterText"
|
||||
type="text"
|
||||
class="input-field !h-8 !rounded-lg !px-2.5 !py-1 !text-xs"
|
||||
placeholder="输入姓名 / 工号 / 用户名筛选"
|
||||
@click.stop
|
||||
/>
|
||||
</div>
|
||||
<div
|
||||
v-for="u in filteredScheduleNotifyUsers"
|
||||
v-for="u in users"
|
||||
:key="u.id"
|
||||
class="flex cursor-pointer items-center gap-2 px-3 py-2 text-sm transition hover:bg-slate-50"
|
||||
:class="scheduleCreateForm.notify_user_ids_json.includes(u.id) ? 'bg-blue-50/50' : ''"
|
||||
@@ -6169,9 +6063,6 @@ const handlePermissionImport = async (event: Event) => {
|
||||
/>
|
||||
<span class="text-slate-700">{{ u.real_name || u.username }}{{ u.employee_id ? '(' + u.employee_id + ')' : '' }}</span>
|
||||
</div>
|
||||
<div v-if="filteredScheduleNotifyUsers.length === 0" class="px-3 py-3 text-xs text-slate-400">
|
||||
未找到匹配人员
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
+149
-140
@@ -23,7 +23,7 @@ import { useGlobalMessageDialog } from '../composables/useGlobalMessageDialog';
|
||||
import { useIsMobile } from '../composables/useIsMobile';
|
||||
import { getAuthHeaders, getStoredAuthUser, clearAuthUser } from '../utils/auth';
|
||||
|
||||
const { t } = useI18n();
|
||||
const { t, locale } = useI18n();
|
||||
const { showMessageDialog } = useGlobalMessageDialog();
|
||||
const { isMobile } = useIsMobile();
|
||||
const showMobileAgentPopover = ref(false);
|
||||
@@ -91,8 +91,12 @@ const handleLogout = () => {
|
||||
router.push('/');
|
||||
};
|
||||
|
||||
watch(locale, (newLang) => {
|
||||
localStorage.setItem('hxops_lang', String(newLang));
|
||||
});
|
||||
|
||||
const handleVoiceFeatureClick = () => {
|
||||
showMessageDialog('info', '该功能正在开发中');
|
||||
showMessageDialog('info', t('chat.devComingSoon'));
|
||||
};
|
||||
|
||||
const stripReasoningPrelude = (text: string) => {
|
||||
@@ -563,7 +567,7 @@ const openPreview = async (file: SourceFileLink) => {
|
||||
previewFile.value = resolvedFile;
|
||||
filePreviewVisible.value = true;
|
||||
} catch (error: any) {
|
||||
showMessageDialog('warning', error?.message || '当前源文件暂时无法预览');
|
||||
showMessageDialog('warning', error?.message || t('chat.previewUnavailable'));
|
||||
}
|
||||
};
|
||||
|
||||
@@ -611,16 +615,16 @@ const openOAAutoLoginPage = (gopage: string, username: string, password: string,
|
||||
// 直接在弹出窗口内写入自动提交表单,避免跨窗口时序问题
|
||||
const popup = window.open('about:blank', target);
|
||||
if (!popup) {
|
||||
showMessageDialog('warning', '浏览器拦截了 OA 页面,请允许弹出窗口后重试。');
|
||||
showMessageDialog('warning', t('chat.oaPopupBlocked'));
|
||||
return;
|
||||
}
|
||||
|
||||
const formHtml = `
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head><meta charset="utf-8"><title>正在登录OA系统...</title></head>
|
||||
<head><meta charset="utf-8"><title>${t('chat.oaLoggingTitle')}</title></head>
|
||||
<body>
|
||||
<p style="text-align:center;margin-top:100px;font-family:sans-serif;color:#666;">正在登录OA系统,请稍候...</p>
|
||||
<p style="text-align:center;margin-top:100px;font-family:sans-serif;color:#666;">${t('chat.oaLoggingBody')}</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, '"')}" />
|
||||
@@ -640,7 +644,7 @@ const openOAAutoLoginPage = (gopage: string, username: string, password: string,
|
||||
const openOALeaveRequestDirectly = () => {
|
||||
const employeeId = currentUserEmployeeId.value;
|
||||
if (!employeeId || employeeId === '-') {
|
||||
showMessageDialog('warning', '没有工号信息无法登录OA系统!');
|
||||
showMessageDialog('warning', t('chat.noEmployeeId'));
|
||||
return;
|
||||
}
|
||||
oaLoginEmployeeId.value = employeeId;
|
||||
@@ -652,7 +656,7 @@ const openOALeaveRequestDirectly = () => {
|
||||
|
||||
const confirmOALogin = () => {
|
||||
if (!oaLoginPassword.value.trim()) {
|
||||
showMessageDialog('warning', '请输入OA登录密码!');
|
||||
showMessageDialog('warning', t('chat.oaPasswordRequired'));
|
||||
return;
|
||||
}
|
||||
// 记住密码到 localStorage
|
||||
@@ -668,12 +672,12 @@ const cancelOALogin = () => {
|
||||
const openOARequestDirectly = (requestId: string) => {
|
||||
const normalizedRequestId = String(requestId || '').trim();
|
||||
if (!normalizedRequestId || normalizedRequestId === '-') {
|
||||
showMessageDialog('warning', '当前未获取到 OA 单据编号,暂时无法打开单据详情。');
|
||||
showMessageDialog('warning', t('chat.oaRequestMissing'));
|
||||
return;
|
||||
}
|
||||
const employeeId = currentUserEmployeeId.value;
|
||||
if (!employeeId || employeeId === '-') {
|
||||
showMessageDialog('warning', '没有工号信息无法登录OA系统!');
|
||||
showMessageDialog('warning', t('chat.noEmployeeId'));
|
||||
return;
|
||||
}
|
||||
oaLoginEmployeeId.value = employeeId;
|
||||
@@ -887,12 +891,12 @@ const calculateDurationHours = (startTime: string, endTime: string) => {
|
||||
};
|
||||
|
||||
const formatDurationLabel = (hours: number) => {
|
||||
if (!hours) return '0 小时';
|
||||
if (!hours) return `0 ${t('chat.hourUnit')}`;
|
||||
if (hours >= 8 && Number.isInteger((hours / 8) * 10) && (hours / 8) >= 1) {
|
||||
const days = Number((hours / 8).toFixed(2));
|
||||
return `${days} 天 / ${hours} 小时`;
|
||||
return `${days} ${t('chat.dayUnit')} / ${hours} ${t('chat.hourUnit')}`;
|
||||
}
|
||||
return `${hours} 小时`;
|
||||
return `${hours} ${t('chat.hourUnit')}`;
|
||||
};
|
||||
|
||||
const extractLeaveTypeFromIntent = (content: string) => {
|
||||
@@ -999,7 +1003,7 @@ const saveLocalMessageToBackend = async (msg: any, userQuery: string = '') => {
|
||||
const NEED_BALANCE_CHECK_TYPES = new Set(['010', '408']);
|
||||
|
||||
const formatLeaveBalanceNumber = (value: any) => {
|
||||
if (value === null || value === undefined) return '暂无数据';
|
||||
if (value === null || value === undefined) return t('chat.noData');
|
||||
const num = Number(value);
|
||||
if (Number.isNaN(num)) return String(value);
|
||||
return Number.isInteger(num) ? String(num) : num.toFixed(2);
|
||||
@@ -1034,7 +1038,7 @@ const startLocalLeaveFlow = async (content: string) => {
|
||||
const thinkingMsg = {
|
||||
role: 'assistant' as const,
|
||||
type: 'text' as const,
|
||||
content: '正在查询您的假期余额,请稍候...',
|
||||
content: t('chat.queryLeaveBalance'),
|
||||
};
|
||||
messages.value.push(thinkingMsg);
|
||||
|
||||
@@ -1046,15 +1050,15 @@ const startLocalLeaveFlow = async (content: string) => {
|
||||
}
|
||||
|
||||
if (balance && !balance.has_balance) {
|
||||
const unit = initialLeaveType === '010' ? '天' : '小时';
|
||||
const unit = initialLeaveType === '010' ? t('chat.dayUnit') : t('chat.hourUnit');
|
||||
const detailLines = [
|
||||
`**${balance.leave_type_label}余额不足,暂无可用假期。**`,
|
||||
t('chat.leaveBalanceInsufficient', { label: balance.leave_type_label }),
|
||||
'',
|
||||
`| 假别 | 年度 | 可休 | 已休 | 当前剩余 |`,
|
||||
`| ${t('chat.leaveBalanceTableLeaveType')} | ${t('chat.leaveBalanceTableYear')} | ${t('chat.leaveBalanceTableAvailable')} | ${t('chat.leaveBalanceTableUsed')} | ${t('chat.leaveBalanceTableRemaining')} |`,
|
||||
`| :---: | :---: | :---: | :---: | :---: |`,
|
||||
`| ${balance.leave_type_label} | ${balance.year} | ${formatLeaveBalanceNumber(balance.total_hours)}${unit} | ${formatLeaveBalanceNumber(balance.used_hours)}${unit} | ${formatLeaveBalanceNumber(balance.remaining_hours)}${unit} |`,
|
||||
'',
|
||||
'如有疑问,请联系人事部门确认假期数据。',
|
||||
t('chat.leaveBalanceContactHr'),
|
||||
];
|
||||
const noBalanceMsg = {
|
||||
role: 'assistant' as const,
|
||||
@@ -1085,7 +1089,7 @@ const startLocalLeaveFlow = async (content: string) => {
|
||||
const formMsg = {
|
||||
role: 'assistant' as const,
|
||||
type: 'leave-form' as const,
|
||||
content: '已为你生成请假申请表,请直接在下方填写并提交。或登录OA系统直接申请',
|
||||
content: t('chat.leaveFormIntro'),
|
||||
payload,
|
||||
local_id: formId,
|
||||
local_only: true,
|
||||
@@ -1304,7 +1308,7 @@ const toggleBrowserPanel = () => {
|
||||
const loadBrowserPage = () => {
|
||||
const normalized = normalizeBrowserInput(browserDraftUrl.value);
|
||||
if (!normalized) {
|
||||
showMessageDialog('warning', '请输入有效的网址,例如 `https://example.com` 或 `localhost:8891`。');
|
||||
showMessageDialog('warning', t('chat.invalidBrowserUrl'));
|
||||
return;
|
||||
}
|
||||
browserCurrentUrl.value = normalized;
|
||||
@@ -1324,7 +1328,7 @@ const refreshBrowserPage = () => {
|
||||
const openBrowserInNewTab = () => {
|
||||
const normalized = browserCurrentUrl.value || normalizeBrowserInput(browserDraftUrl.value);
|
||||
if (!normalized) {
|
||||
showMessageDialog('warning', '请先输入可打开的网址。');
|
||||
showMessageDialog('warning', t('chat.enterBrowserUrl'));
|
||||
return;
|
||||
}
|
||||
window.open(normalized, '_blank', 'noopener,noreferrer');
|
||||
@@ -1435,13 +1439,13 @@ const handleSend = async (textOrEvent?: string | Event) => {
|
||||
};
|
||||
|
||||
const validateLeaveForm = (form: LeaveRequestFormData) => {
|
||||
if (!form.applicantName.trim()) return '请假人不能为空。';
|
||||
if (!form.employeeId.trim()) return '工号不能为空。';
|
||||
if (!form.leaveType.trim()) return '请选择假别。';
|
||||
if (!form.agentUid.trim()) return '请选择代理人。';
|
||||
if (!parseDateTime(form.startTime)) return '请选择正确的开始时间。';
|
||||
if (!parseDateTime(form.endTime)) return '请选择正确的结束时间。';
|
||||
if (calculateDurationHours(form.startTime, form.endTime) <= 0) return '时长必须大于0小时,请检查开始时间和结束时间。';
|
||||
if (!form.applicantName.trim()) return t('chat.leaveApplicantRequired');
|
||||
if (!form.employeeId.trim()) return t('chat.employeeIdRequired');
|
||||
if (!form.leaveType.trim()) return t('chat.leaveTypeRequired');
|
||||
if (!form.agentUid.trim()) return t('chat.leaveAgentRequired');
|
||||
if (!parseDateTime(form.startTime)) return t('chat.startTimeRequired');
|
||||
if (!parseDateTime(form.endTime)) return t('chat.endTimeRequired');
|
||||
if (calculateDurationHours(form.startTime, form.endTime) <= 0) return t('chat.durationInvalid');
|
||||
return '';
|
||||
};
|
||||
|
||||
@@ -1465,7 +1469,7 @@ const submitLeaveForm = (msg: any) => {
|
||||
const confirmMsg = {
|
||||
role: 'assistant' as const,
|
||||
type: 'leave-confirmation' as const,
|
||||
content: '请确认以下请假信息,确认无误后再提交到 OA。',
|
||||
content: t('chat.leaveConfirmPrompt'),
|
||||
payload: {
|
||||
formId: payload.formId,
|
||||
form: summary,
|
||||
@@ -1525,13 +1529,13 @@ const confirmLeaveSubmission = async (msg: any) => {
|
||||
});
|
||||
const data = await res.json().catch(() => ({}));
|
||||
if (!res.ok) {
|
||||
throw new Error(data?.error || 'OA 请假提交失败,请稍后重试。');
|
||||
throw new Error(data?.error || t('chat.oaLeaveSubmitFailed'));
|
||||
}
|
||||
|
||||
const resultMsg = {
|
||||
role: 'assistant' as const,
|
||||
type: 'leave-result' as const,
|
||||
content: '请假单已推送到 OA,具体单据请 【 登录OA系统查看提交】',
|
||||
content: t('chat.leaveResultSubmitted'),
|
||||
payload: {
|
||||
formId: payload.formId,
|
||||
success: true,
|
||||
@@ -1548,12 +1552,12 @@ const confirmLeaveSubmission = async (msg: any) => {
|
||||
saveLocalMessageToBackend(msg);
|
||||
saveLocalMessageToBackend(resultMsg);
|
||||
} catch (error: any) {
|
||||
const errorMessage = error?.message || 'OA 请假提交失败,请稍后重试。';
|
||||
const errorMessage = error?.message || t('chat.oaLeaveSubmitFailed');
|
||||
showMessageDialog('error', errorMessage);
|
||||
const resultMsg = {
|
||||
role: 'assistant' as const,
|
||||
type: 'leave-result' as const,
|
||||
content: `请假单提交失败:${errorMessage}`,
|
||||
content: t('chat.leaveSubmitFailedPrefix', { error: errorMessage }),
|
||||
payload: {
|
||||
formId: payload.formId,
|
||||
success: false,
|
||||
@@ -1609,7 +1613,7 @@ const loadHistory = async () => {
|
||||
};
|
||||
|
||||
const clearAllHistory = async () => {
|
||||
if (!confirm('确定要清除全部聊天历史记录吗?此操作不可恢复。')) return;
|
||||
if (!confirm(t('chat.confirmClearHistory'))) return;
|
||||
try {
|
||||
const res = await fetch(`/api/chat/sessions?agent_id=${agentId}`, {
|
||||
method: 'DELETE',
|
||||
@@ -1628,7 +1632,7 @@ const clearAllHistory = async () => {
|
||||
|
||||
const deleteHistoryItem = async (id: string, event: Event) => {
|
||||
event.stopPropagation();
|
||||
if (!confirm('确定要删除这条聊天记录吗?')) return;
|
||||
if (!confirm(t('chat.confirmDeleteHistoryItem'))) return;
|
||||
try {
|
||||
const res = await fetch(`/api/chat/sessions/${id}?agent_id=${agentId}`, {
|
||||
method: 'DELETE',
|
||||
@@ -1801,7 +1805,7 @@ const showChatRating = ref(false);
|
||||
<Sparkles class="h-5 w-5" />
|
||||
</div>
|
||||
|
||||
<button @click="startNewChat(); isSidebarOpen = false;" class="flex h-10 w-10 shrink-0 items-center justify-center rounded-xl bg-slate-50 text-slate-700 shadow-sm transition-colors hover:bg-slate-100 dark:bg-slate-800 dark:text-slate-200 dark:hover:bg-slate-700" title="创建新对话">
|
||||
<button @click="startNewChat(); isSidebarOpen = false;" class="flex h-10 w-10 shrink-0 items-center justify-center rounded-xl bg-slate-50 text-slate-700 shadow-sm transition-colors hover:bg-slate-100 dark:bg-slate-800 dark:text-slate-200 dark:hover:bg-slate-700" :title="$t('chat.createNewChat')">
|
||||
<Plus class="h-5 w-5" />
|
||||
</button>
|
||||
|
||||
@@ -1810,7 +1814,7 @@ const showChatRating = ref(false);
|
||||
<div class="flex h-8 w-8 items-center justify-center rounded-full bg-brand-600 text-sm font-bold text-white shadow-sm shadow-brand-500/20">
|
||||
{{ (currentUser?.username || 'I').charAt(0).toUpperCase() }}
|
||||
</div>
|
||||
<button @click="showGeneralFeedbackDialog = true" class="transition-colors hover:text-slate-600 dark:hover:text-slate-200" title="意见反馈"><Mail class="h-5 w-5" /></button>
|
||||
<button @click="showGeneralFeedbackDialog = true" class="transition-colors hover:text-slate-600 dark:hover:text-slate-200" :title="$t('chat.generalFeedback')"><Mail class="h-5 w-5" /></button>
|
||||
<button @click="router.push('/workspace?no_redirect=1')" class="transition-colors hover:text-slate-600 dark:hover:text-slate-200"><Settings class="h-5 w-5" /></button>
|
||||
</div>
|
||||
</div>
|
||||
@@ -1829,14 +1833,14 @@ const showChatRating = ref(false);
|
||||
|
||||
<div class="px-4 pb-4">
|
||||
<button @click="startNewChat(); isSidebarOpen = false;" class="flex w-full items-center justify-center gap-2 rounded-xl border border-slate-200 bg-slate-50 py-3 text-sm font-medium text-slate-700 shadow-sm transition-colors hover:bg-slate-100 dark:border-slate-700 dark:bg-slate-800 dark:text-slate-200 dark:hover:bg-slate-700">
|
||||
<Plus class="h-4 w-4" /> 创建新对话
|
||||
<Plus class="h-4 w-4" /> {{ $t('chat.createNewChat') }}
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<div class="flex items-center justify-between px-4 py-2">
|
||||
<span class="text-xs font-semibold text-slate-500 dark:text-slate-400">聊天记录</span>
|
||||
<span class="text-xs font-semibold text-slate-500 dark:text-slate-400">{{ $t('chat.history') }}</span>
|
||||
<button v-if="history.length > 0" @click="clearAllHistory" class="text-xs text-slate-400 transition-colors hover:text-slate-600 dark:hover:text-slate-200">
|
||||
清空全部
|
||||
{{ $t('chat.clearAll') }}
|
||||
</button>
|
||||
</div>
|
||||
|
||||
@@ -1861,7 +1865,7 @@ const showChatRating = ref(false);
|
||||
<button
|
||||
@click="deleteHistoryItem(item.conversation_id, $event)"
|
||||
class="absolute right-2 p-1.5 text-slate-400 opacity-0 transition-opacity hover:text-red-500 group-hover:opacity-100 dark:hover:text-red-400"
|
||||
title="清除该记录"
|
||||
:title="$t('chat.clearOneRecord')"
|
||||
>
|
||||
<X class="h-4 w-4" />
|
||||
</button>
|
||||
@@ -1872,7 +1876,7 @@ const showChatRating = ref(false);
|
||||
<div class="mt-auto flex flex-col p-4">
|
||||
<div v-if="userAgents.length > 0 && showAgentPanel" class="mb-4 rounded-2xl border border-slate-200 bg-slate-50/70 p-3 dark:border-slate-700 dark:bg-slate-800/60">
|
||||
<div class="mb-2 flex items-center gap-1.5 text-xs font-semibold text-slate-500 dark:text-slate-400">
|
||||
<LayoutGrid class="h-3.5 w-3.5" /> 智能体
|
||||
<LayoutGrid class="h-3.5 w-3.5" /> {{ $t('chat.agents') }}
|
||||
</div>
|
||||
<div class="grid grid-cols-2 gap-x-2 gap-y-1.5">
|
||||
<button
|
||||
@@ -1902,22 +1906,32 @@ const showChatRating = ref(false);
|
||||
</div>
|
||||
<div class="overflow-hidden">
|
||||
<div class="text-sm font-bold text-slate-900 dark:text-slate-100 truncate">{{ currentUser?.username || 'User' }}</div>
|
||||
<div v-if="(currentUser as any)?.employee_id" class="text-xs text-slate-500 dark:text-slate-400 truncate">工号: {{ (currentUser as any).employee_id }}</div>
|
||||
<div v-if="(currentUser as any)?.employee_id" class="text-xs text-slate-500 dark:text-slate-400 truncate">{{ $t('chat.employeeId') }}: {{ (currentUser as any).employee_id }}</div>
|
||||
<div v-else class="text-xs text-slate-500 dark:text-slate-400 truncate">{{ currentUser?.role }}</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="px-4 pt-3 pb-1 text-xs font-medium text-slate-500 dark:text-slate-400">{{ $t('chat.language') }}</div>
|
||||
<div class="px-4 pb-2">
|
||||
<select v-model="locale" class="w-full rounded-xl border border-slate-200 bg-white px-3 py-2 text-sm text-slate-700 outline-none transition focus:border-brand-400 dark:border-slate-700 dark:bg-slate-900 dark:text-slate-200">
|
||||
<option value="zh-CN">{{ $t('chat.langZhCn') }}</option>
|
||||
<option value="en">{{ $t('chat.langEn') }}</option>
|
||||
<option value="zh-TW">{{ $t('chat.langZhTw') }}</option>
|
||||
<option value="th">{{ $t('chat.langTh') }}</option>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<button @click="handleLogout" class="w-full text-left px-4 py-2 text-sm text-red-600 hover:bg-red-50 flex items-center gap-2 transition-colors mt-1">
|
||||
<LogOut class="w-4 h-4" />
|
||||
退出登录
|
||||
{{ $t('chat.logout') }}
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<div class="flex gap-3">
|
||||
<button @click="userAgents.length === 0 ? undefined : (showAgentPanel = !showAgentPanel)" :class="showAgentPanel && userAgents.length > 0 ? 'text-brand-600 dark:text-brand-400' : ''" class="transition-colors hover:text-slate-600 dark:hover:text-slate-200" :title="userAgents.length === 0 ? '暂无可用智能体' : (showAgentPanel ? '收起智能体' : '展开智能体')"><LayoutGrid class="h-4 w-4" /></button>
|
||||
<button @click="userAgents.length === 0 ? undefined : (showAgentPanel = !showAgentPanel)" :class="showAgentPanel && userAgents.length > 0 ? 'text-brand-600 dark:text-brand-400' : ''" class="transition-colors hover:text-slate-600 dark:hover:text-slate-200" :title="userAgents.length === 0 ? $t('chat.noAvailableAgents') : (showAgentPanel ? $t('chat.collapseAgents') : $t('chat.expandAgents'))"><LayoutGrid class="h-4 w-4" /></button>
|
||||
<button class="transition-colors hover:text-slate-600 dark:hover:text-slate-200"><Heart class="h-4 w-4" /></button>
|
||||
<button class="transition-colors hover:text-slate-600 dark:hover:text-slate-200"><Bell class="h-4 w-4" /></button>
|
||||
<button @click="showGeneralFeedbackDialog = true" class="transition-colors hover:text-slate-600 dark:hover:text-slate-200" title="意见反馈"><Mail class="h-4 w-4" /></button>
|
||||
<button @click="showGeneralFeedbackDialog = true" class="transition-colors hover:text-slate-600 dark:hover:text-slate-200" :title="$t('chat.generalFeedback')"><Mail class="h-4 w-4" /></button>
|
||||
<button @click="router.push('/workspace?no_redirect=1')" class="transition-colors hover:text-slate-600 dark:hover:text-slate-200"><Settings class="h-4 w-4" /></button>
|
||||
</div>
|
||||
</div>
|
||||
@@ -1933,15 +1947,15 @@ const showChatRating = ref(false);
|
||||
<span class="text-sm font-semibold text-slate-800 dark:text-slate-100">{{ currentAgent?.name || 'AI' }}</span>
|
||||
</div>
|
||||
<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="智能体">
|
||||
<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="$t('chat.agents')">
|
||||
<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="历史记录">
|
||||
<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="$t('chat.history')">
|
||||
<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="mb-2 text-xs font-medium text-slate-400">{{ $t('chat.agents') }}</div>
|
||||
<div class="grid grid-cols-2 gap-2">
|
||||
<button
|
||||
v-for="agent in userAgents"
|
||||
@@ -1955,7 +1969,7 @@ const showChatRating = ref(false);
|
||||
<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 v-if="userAgents.length === 0" class="py-3 text-center text-xs text-slate-400">{{ $t('chat.noOtherAgents') }}</div>
|
||||
</div>
|
||||
</header>
|
||||
|
||||
@@ -1987,7 +2001,7 @@ const showChatRating = ref(false);
|
||||
<div class="mb-6 flex h-16 w-16 items-center justify-center rounded-2xl bg-gradient-to-br from-brand-500 via-brand-600 to-sky-600 text-2xl font-bold text-white shadow-lg shadow-brand-500/20">
|
||||
AI
|
||||
</div>
|
||||
<h2 class="text-center text-xl font-medium text-slate-800 dark:text-slate-100 md:text-2xl">你好,我是和信AI数字人</h2>
|
||||
<h2 class="text-center text-xl font-medium text-slate-800 dark:text-slate-100 md:text-2xl">{{ $t('chat.welcomeTitle') }}</h2>
|
||||
</div>
|
||||
|
||||
<template v-for="(msg, index) in messages" :key="index">
|
||||
@@ -2014,16 +2028,11 @@ const showChatRating = ref(false);
|
||||
<div v-else>
|
||||
<div v-if="msg.type === 'leave-form'" class="space-y-4">
|
||||
<div class="text-sm font-medium text-slate-700 dark:text-slate-200">
|
||||
<template v-if="msg.content.includes('或登录OA系统直接申请')">
|
||||
已为你生成请假申请表,请直接在下方填写并提交。或 <a href="#" @click.prevent="openOALeaveRequestDirectly" class="text-brand-600 font-bold hover:underline">登录OA系统直接申请</a>
|
||||
</template>
|
||||
<template v-else>
|
||||
{{ msg.content }}
|
||||
</template>
|
||||
{{ $t('chat.leaveFormIntro') }} <a href="#" @click.prevent="openOALeaveRequestDirectly" class="text-brand-600 font-bold hover:underline">{{ $t('chat.oaLeaveDirectLink') }}</a>
|
||||
</div>
|
||||
<div v-if="getLeaveFormPayload(msg)" class="grid gap-4 md:grid-cols-2">
|
||||
<label class="space-y-1.5">
|
||||
<span class="text-xs font-semibold text-slate-500 dark:text-slate-400">填单人</span>
|
||||
<span class="text-xs font-semibold text-slate-500 dark:text-slate-400">{{ $t('chat.leaveFiller') }}</span>
|
||||
<input
|
||||
v-model="getLeaveFormPayload(msg)!.form.fillerName"
|
||||
type="text"
|
||||
@@ -2032,7 +2041,7 @@ const showChatRating = ref(false);
|
||||
/>
|
||||
</label>
|
||||
<label class="space-y-1.5">
|
||||
<span class="text-xs font-semibold text-slate-500 dark:text-slate-400">工号</span>
|
||||
<span class="text-xs font-semibold text-slate-500 dark:text-slate-400">{{ $t('chat.employeeId') }}</span>
|
||||
<input
|
||||
v-model="getLeaveFormPayload(msg)!.form.employeeId"
|
||||
type="text"
|
||||
@@ -2041,7 +2050,7 @@ const showChatRating = ref(false);
|
||||
/>
|
||||
</label>
|
||||
<label class="space-y-1.5">
|
||||
<span class="text-xs font-semibold text-slate-500 dark:text-slate-400">创建时间</span>
|
||||
<span class="text-xs font-semibold text-slate-500 dark:text-slate-400">{{ $t('chat.createdAt') }}</span>
|
||||
<input
|
||||
:value="getLeaveFormPayload(msg)!.form.applyTime.replace('T', ' ')"
|
||||
type="text"
|
||||
@@ -2050,23 +2059,23 @@ const showChatRating = ref(false);
|
||||
/>
|
||||
</label>
|
||||
<label class="space-y-1.5">
|
||||
<span class="text-xs font-semibold text-slate-500 dark:text-slate-400">假别</span>
|
||||
<span class="text-xs font-semibold text-slate-500 dark:text-slate-400">{{ $t('chat.leaveType') }}</span>
|
||||
<select
|
||||
v-model="getLeaveFormPayload(msg)!.form.leaveType"
|
||||
class="w-full rounded-xl border border-slate-200 px-3 py-2 text-sm text-slate-700 outline-none transition focus:border-blue-400 dark:border-slate-700 dark:bg-slate-950 dark:text-slate-100"
|
||||
:disabled="getLeaveFormPayload(msg)!.submitting || getLeaveFormPayload(msg)!.confirmationGenerated"
|
||||
>
|
||||
<option value="" disabled>请选择假别</option>
|
||||
<option value="" disabled>{{ $t('chat.selectLeaveType') }}</option>
|
||||
<option v-for="leaveType in LEAVE_TYPES" :key="leaveType.value" :value="leaveType.value">{{ leaveType.label }}</option>
|
||||
</select>
|
||||
</label>
|
||||
<label class="space-y-1.5">
|
||||
<span class="text-xs font-semibold text-slate-500 dark:text-slate-400">请假人</span>
|
||||
<span class="text-xs font-semibold text-slate-500 dark:text-slate-400">{{ $t('chat.leaveApplicant') }}</span>
|
||||
<div class="relative">
|
||||
<input
|
||||
:value="getLeaveFormPayload(msg)!.form.applicantName ? `${getLeaveFormPayload(msg)!.form.applicantName} / ${getLeaveFormPayload(msg)!.form.employeeId}` : ''"
|
||||
type="text"
|
||||
placeholder="请选择请假人"
|
||||
:placeholder="$t('chat.selectLeaveApplicant')"
|
||||
readonly
|
||||
class="w-full rounded-xl border border-slate-200 bg-white px-3 py-2 pr-11 text-sm text-slate-700 outline-none transition focus:border-blue-400 dark:border-slate-700 dark:bg-slate-950 dark:text-slate-100"
|
||||
:disabled="getLeaveFormPayload(msg)!.submitting || getLeaveFormPayload(msg)!.confirmationGenerated"
|
||||
@@ -2077,19 +2086,19 @@ const showChatRating = ref(false);
|
||||
class="absolute inset-y-0 right-0 flex w-11 items-center justify-center text-slate-400 transition hover:text-brand-600 disabled:cursor-not-allowed disabled:opacity-50"
|
||||
:disabled="getLeaveFormPayload(msg)!.submitting || getLeaveFormPayload(msg)!.confirmationGenerated"
|
||||
@click="openLeaveAgentDialog(msg, 'applicant')"
|
||||
title="选择请假人"
|
||||
:title="$t('chat.pickLeaveApplicant')"
|
||||
>
|
||||
<Search class="h-4 w-4" />
|
||||
</button>
|
||||
</div>
|
||||
</label>
|
||||
<label class="space-y-1.5">
|
||||
<span class="text-xs font-semibold text-slate-500 dark:text-slate-400">代理人</span>
|
||||
<span class="text-xs font-semibold text-slate-500 dark:text-slate-400">{{ $t('chat.leaveAgent') }}</span>
|
||||
<div class="relative">
|
||||
<input
|
||||
:value="getLeaveAgentDisplayValue(getLeaveFormPayload(msg)!.form)"
|
||||
type="text"
|
||||
placeholder="请选择代理人"
|
||||
:placeholder="$t('chat.selectLeaveAgent')"
|
||||
readonly
|
||||
class="w-full rounded-xl border border-slate-200 bg-white px-3 py-2 pr-11 text-sm text-slate-700 outline-none transition focus:border-blue-400 dark:border-slate-700 dark:bg-slate-950 dark:text-slate-100"
|
||||
:disabled="getLeaveFormPayload(msg)!.submitting || getLeaveFormPayload(msg)!.confirmationGenerated"
|
||||
@@ -2100,14 +2109,14 @@ const showChatRating = ref(false);
|
||||
class="absolute inset-y-0 right-0 flex w-11 items-center justify-center text-slate-400 transition hover:text-brand-600 disabled:cursor-not-allowed disabled:opacity-50"
|
||||
:disabled="getLeaveFormPayload(msg)!.submitting || getLeaveFormPayload(msg)!.confirmationGenerated"
|
||||
@click="openLeaveAgentDialog(msg)"
|
||||
title="选择代理人"
|
||||
:title="$t('chat.pickLeaveAgent')"
|
||||
>
|
||||
<Search class="h-4 w-4" />
|
||||
</button>
|
||||
</div>
|
||||
</label>
|
||||
<label class="space-y-1.5">
|
||||
<span class="text-xs font-semibold text-slate-500 dark:text-slate-400">开始时间</span>
|
||||
<span class="text-xs font-semibold text-slate-500 dark:text-slate-400">{{ $t('chat.startTime') }}</span>
|
||||
<input
|
||||
v-model="getLeaveFormPayload(msg)!.form.startTime"
|
||||
type="datetime-local"
|
||||
@@ -2117,7 +2126,7 @@ const showChatRating = ref(false);
|
||||
/>
|
||||
</label>
|
||||
<label class="space-y-1.5">
|
||||
<span class="text-xs font-semibold text-slate-500 dark:text-slate-400">结束时间</span>
|
||||
<span class="text-xs font-semibold text-slate-500 dark:text-slate-400">{{ $t('chat.endTime') }}</span>
|
||||
<input
|
||||
v-model="getLeaveFormPayload(msg)!.form.endTime"
|
||||
type="datetime-local"
|
||||
@@ -2127,7 +2136,7 @@ const showChatRating = ref(false);
|
||||
/>
|
||||
</label>
|
||||
<label class="space-y-1.5">
|
||||
<span class="text-xs font-semibold text-slate-500 dark:text-slate-400">时长</span>
|
||||
<span class="text-xs font-semibold text-slate-500 dark:text-slate-400">{{ $t('chat.duration') }}</span>
|
||||
<input
|
||||
:value="formatDurationLabel(getLeaveFormPayload(msg)!.form.durationHours)"
|
||||
type="text"
|
||||
@@ -2136,30 +2145,30 @@ const showChatRating = ref(false);
|
||||
/>
|
||||
</label>
|
||||
<label class="space-y-1.5">
|
||||
<span class="text-xs font-semibold text-slate-500 dark:text-slate-400">是否外出</span>
|
||||
<span class="text-xs font-semibold text-slate-500 dark:text-slate-400">{{ $t('chat.isOutOfOffice') }}</span>
|
||||
<select
|
||||
v-model="getLeaveFormPayload(msg)!.form.isOutOfOffice"
|
||||
class="w-full rounded-xl border border-slate-200 px-3 py-2 text-sm text-slate-700 outline-none transition focus:border-blue-400 dark:border-slate-700 dark:bg-slate-950 dark:text-slate-100"
|
||||
:disabled="getLeaveFormPayload(msg)!.submitting || getLeaveFormPayload(msg)!.confirmationGenerated"
|
||||
>
|
||||
<option :value="1">否</option>
|
||||
<option :value="0">是</option>
|
||||
<option :value="1">{{ $t('chat.no') }}</option>
|
||||
<option :value="0">{{ $t('chat.yes') }}</option>
|
||||
</select>
|
||||
</label>
|
||||
<label class="space-y-1.5 md:col-span-2">
|
||||
<span class="text-xs font-semibold text-slate-500 dark:text-slate-400">是否为工伤</span>
|
||||
<span class="text-xs font-semibold text-slate-500 dark:text-slate-400">{{ $t('chat.isWorkInjury') }}</span>
|
||||
<select
|
||||
v-model="getLeaveFormPayload(msg)!.form.isWorkInjury"
|
||||
class="w-full rounded-xl border border-slate-200 px-3 py-2 text-sm text-slate-700 outline-none transition focus:border-blue-400 dark:border-slate-700 dark:bg-slate-950 dark:text-slate-100"
|
||||
:disabled="getLeaveFormPayload(msg)!.submitting || getLeaveFormPayload(msg)!.confirmationGenerated"
|
||||
>
|
||||
<option :value="1">否</option>
|
||||
<option :value="0">是</option>
|
||||
<option :value="1">{{ $t('chat.no') }}</option>
|
||||
<option :value="0">{{ $t('chat.yes') }}</option>
|
||||
</select>
|
||||
</label>
|
||||
</div>
|
||||
<div v-if="getLeaveFormPayload(msg)?.confirmationGenerated" class="rounded-xl border border-amber-200 bg-amber-50 px-4 py-3 text-xs text-amber-700 dark:border-amber-500/30 dark:bg-amber-500/10 dark:text-amber-200">
|
||||
已生成确认单,如需调整可直接修改表单后再次点击提交。
|
||||
{{ $t('chat.leaveConfirmGenerated') }}
|
||||
</div>
|
||||
<div class="flex justify-end">
|
||||
<button
|
||||
@@ -2167,42 +2176,42 @@ const showChatRating = ref(false);
|
||||
:disabled="getLeaveFormPayload(msg)?.submitting || getLeaveFormPayload(msg)?.confirmationGenerated"
|
||||
class="rounded-xl bg-brand-600 px-4 py-2 text-sm font-medium text-white transition hover:bg-brand-700 disabled:cursor-not-allowed disabled:opacity-60"
|
||||
>
|
||||
{{ getLeaveFormPayload(msg)?.submitting ? '提交中...' : '提交' }}
|
||||
{{ getLeaveFormPayload(msg)?.submitting ? $t('chat.submitting') : $t('chat.submit') }}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
<div v-else-if="msg.type === 'leave-confirmation' && getLeaveConfirmationPayload(msg)" class="space-y-4">
|
||||
<div class="text-sm font-medium text-slate-700 dark:text-slate-200">{{ msg.content }}</div>
|
||||
<div class="rounded-2xl border border-slate-200 bg-slate-50/90 p-4 dark:border-slate-700 dark:bg-slate-800/60">
|
||||
<div class="mb-3 text-xs font-bold uppercase tracking-wider text-slate-400 dark:text-slate-500">填单人信息</div>
|
||||
<div class="mb-3 text-xs font-bold uppercase tracking-wider text-slate-400 dark:text-slate-500">{{ $t('chat.leaveFillerInfo') }}</div>
|
||||
<div class="grid gap-3 text-sm md:grid-cols-2">
|
||||
<div><span class="text-slate-500 dark:text-slate-400">填单人:</span>{{ getLeaveConfirmationPayload(msg)!.form.fillerName || '暂无数据' }}</div>
|
||||
<div><span class="text-slate-500 dark:text-slate-400">创建时间:</span>{{ getLeaveConfirmationPayload(msg)!.form.applyTime.replace('T', ' ') }}</div>
|
||||
<div v-if="getLeaveConfirmationPayload(msg)!.form.fillerJobTitleName || getLeaveConfirmationPayload(msg)!.form.fillerJobTitle"><span class="text-slate-500 dark:text-slate-400">填单人职务:</span>{{ getLeaveConfirmationPayload(msg)!.form.fillerJobTitleName || getLeaveConfirmationPayload(msg)!.form.fillerJobTitle }}</div>
|
||||
<div v-if="getLeaveConfirmationPayload(msg)!.form.fillerDepartmentName || getLeaveConfirmationPayload(msg)!.form.fillerDepartmentId"><span class="text-slate-500 dark:text-slate-400">填单人部门:</span>{{ getLeaveConfirmationPayload(msg)!.form.fillerDepartmentName || getLeaveConfirmationPayload(msg)!.form.fillerDepartmentId }}</div>
|
||||
<div v-if="getLeaveConfirmationPayload(msg)!.form.fillerSubCompanyName || getLeaveConfirmationPayload(msg)!.form.fillerSubCompanyId1"><span class="text-slate-500 dark:text-slate-400">填单人公司:</span>{{ getLeaveConfirmationPayload(msg)!.form.fillerSubCompanyName || getLeaveConfirmationPayload(msg)!.form.fillerSubCompanyId1 }}</div>
|
||||
<div><span class="text-slate-500 dark:text-slate-400">{{ $t('chat.leaveFiller') }}:</span>{{ getLeaveConfirmationPayload(msg)!.form.fillerName || $t('chat.noData') }}</div>
|
||||
<div><span class="text-slate-500 dark:text-slate-400">{{ $t('chat.createdAt') }}:</span>{{ getLeaveConfirmationPayload(msg)!.form.applyTime.replace('T', ' ') }}</div>
|
||||
<div v-if="getLeaveConfirmationPayload(msg)!.form.fillerJobTitleName || getLeaveConfirmationPayload(msg)!.form.fillerJobTitle"><span class="text-slate-500 dark:text-slate-400">{{ $t('chat.leaveFillerTitle') }}:</span>{{ getLeaveConfirmationPayload(msg)!.form.fillerJobTitleName || getLeaveConfirmationPayload(msg)!.form.fillerJobTitle }}</div>
|
||||
<div v-if="getLeaveConfirmationPayload(msg)!.form.fillerDepartmentName || getLeaveConfirmationPayload(msg)!.form.fillerDepartmentId"><span class="text-slate-500 dark:text-slate-400">{{ $t('chat.leaveFillerDept') }}:</span>{{ getLeaveConfirmationPayload(msg)!.form.fillerDepartmentName || getLeaveConfirmationPayload(msg)!.form.fillerDepartmentId }}</div>
|
||||
<div v-if="getLeaveConfirmationPayload(msg)!.form.fillerSubCompanyName || getLeaveConfirmationPayload(msg)!.form.fillerSubCompanyId1"><span class="text-slate-500 dark:text-slate-400">{{ $t('chat.leaveFillerCompany') }}:</span>{{ getLeaveConfirmationPayload(msg)!.form.fillerSubCompanyName || getLeaveConfirmationPayload(msg)!.form.fillerSubCompanyId1 }}</div>
|
||||
</div>
|
||||
<div class="my-3 border-t border-slate-200 dark:border-slate-700"></div>
|
||||
<div class="mb-3 text-xs font-bold uppercase tracking-wider text-slate-400 dark:text-slate-500">申请人信息</div>
|
||||
<div class="mb-3 text-xs font-bold uppercase tracking-wider text-slate-400 dark:text-slate-500">{{ $t('chat.leaveApplicantInfo') }}</div>
|
||||
<div class="grid gap-3 text-sm md:grid-cols-2">
|
||||
<div><span class="text-slate-500 dark:text-slate-400">请假人:</span>{{ getLeaveConfirmationPayload(msg)!.form.applicantName }}({{ getLeaveConfirmationPayload(msg)!.form.employeeId }})</div>
|
||||
<div v-if="getLeaveConfirmationPayload(msg)!.form.applicantJobTitleName || getLeaveConfirmationPayload(msg)!.form.applicantJobTitle"><span class="text-slate-500 dark:text-slate-400">申请人职务:</span>{{ getLeaveConfirmationPayload(msg)!.form.applicantJobTitleName || getLeaveConfirmationPayload(msg)!.form.applicantJobTitle }}</div>
|
||||
<div v-if="getLeaveConfirmationPayload(msg)!.form.applicantDepartmentName || getLeaveConfirmationPayload(msg)!.form.applicantDepartmentId"><span class="text-slate-500 dark:text-slate-400">申请人部门:</span>{{ getLeaveConfirmationPayload(msg)!.form.applicantDepartmentName || getLeaveConfirmationPayload(msg)!.form.applicantDepartmentId }}</div>
|
||||
<div v-if="getLeaveConfirmationPayload(msg)!.form.applicantSubCompanyName || getLeaveConfirmationPayload(msg)!.form.applicantSubCompanyId1"><span class="text-slate-500 dark:text-slate-400">申请人公司:</span>{{ getLeaveConfirmationPayload(msg)!.form.applicantSubCompanyName || getLeaveConfirmationPayload(msg)!.form.applicantSubCompanyId1 }}</div>
|
||||
<div><span class="text-slate-500 dark:text-slate-400">{{ $t('chat.leaveApplicant') }}:</span>{{ getLeaveConfirmationPayload(msg)!.form.applicantName }}({{ getLeaveConfirmationPayload(msg)!.form.employeeId }})</div>
|
||||
<div v-if="getLeaveConfirmationPayload(msg)!.form.applicantJobTitleName || getLeaveConfirmationPayload(msg)!.form.applicantJobTitle"><span class="text-slate-500 dark:text-slate-400">{{ $t('chat.leaveApplicantTitle') }}:</span>{{ getLeaveConfirmationPayload(msg)!.form.applicantJobTitleName || getLeaveConfirmationPayload(msg)!.form.applicantJobTitle }}</div>
|
||||
<div v-if="getLeaveConfirmationPayload(msg)!.form.applicantDepartmentName || getLeaveConfirmationPayload(msg)!.form.applicantDepartmentId"><span class="text-slate-500 dark:text-slate-400">{{ $t('chat.leaveApplicantDept') }}:</span>{{ getLeaveConfirmationPayload(msg)!.form.applicantDepartmentName || getLeaveConfirmationPayload(msg)!.form.applicantDepartmentId }}</div>
|
||||
<div v-if="getLeaveConfirmationPayload(msg)!.form.applicantSubCompanyName || getLeaveConfirmationPayload(msg)!.form.applicantSubCompanyId1"><span class="text-slate-500 dark:text-slate-400">{{ $t('chat.leaveApplicantCompany') }}:</span>{{ getLeaveConfirmationPayload(msg)!.form.applicantSubCompanyName || getLeaveConfirmationPayload(msg)!.form.applicantSubCompanyId1 }}</div>
|
||||
</div>
|
||||
<div class="my-3 border-t border-slate-200 dark:border-slate-700"></div>
|
||||
<div class="mb-3 text-xs font-bold uppercase tracking-wider text-slate-400 dark:text-slate-500">请假信息</div>
|
||||
<div class="mb-3 text-xs font-bold uppercase tracking-wider text-slate-400 dark:text-slate-500">{{ $t('chat.leaveInfo') }}</div>
|
||||
<div class="grid gap-3 text-sm md:grid-cols-2">
|
||||
<div><span class="text-slate-500 dark:text-slate-400">代理人:</span>{{ getLeaveAgentDisplayValue(getLeaveConfirmationPayload(msg)!.form) || '未选择' }}</div>
|
||||
<div v-if="getLeaveConfirmationPayload(msg)!.form.agentJobTitleName || getLeaveConfirmationPayload(msg)!.form.agentJobTitle"><span class="text-slate-500 dark:text-slate-400">代理人职务:</span>{{ getLeaveConfirmationPayload(msg)!.form.agentJobTitleName || getLeaveConfirmationPayload(msg)!.form.agentJobTitle }}</div>
|
||||
<div v-if="getLeaveConfirmationPayload(msg)!.form.agentDepartmentName || getLeaveConfirmationPayload(msg)!.form.agentDepartmentId"><span class="text-slate-500 dark:text-slate-400">代理人部门:</span>{{ getLeaveConfirmationPayload(msg)!.form.agentDepartmentName || getLeaveConfirmationPayload(msg)!.form.agentDepartmentId }}</div>
|
||||
<div v-if="getLeaveConfirmationPayload(msg)!.form.agentSubCompanyName || getLeaveConfirmationPayload(msg)!.form.agentSubCompanyId1"><span class="text-slate-500 dark:text-slate-400">代理人公司:</span>{{ getLeaveConfirmationPayload(msg)!.form.agentSubCompanyName || getLeaveConfirmationPayload(msg)!.form.agentSubCompanyId1 }}</div>
|
||||
<div><span class="text-slate-500 dark:text-slate-400">假别:</span>{{ getLeaveTypeLabel(getLeaveConfirmationPayload(msg)!.form.leaveType) }}</div>
|
||||
<div><span class="text-slate-500 dark:text-slate-400">时长:</span>{{ formatDurationLabel(getLeaveConfirmationPayload(msg)!.form.durationHours) }}</div>
|
||||
<div><span class="text-slate-500 dark:text-slate-400">开始时间:</span>{{ getLeaveConfirmationPayload(msg)!.form.startTime.replace('T', ' ') }}</div>
|
||||
<div><span class="text-slate-500 dark:text-slate-400">结束时间:</span>{{ getLeaveConfirmationPayload(msg)!.form.endTime.replace('T', ' ') }}</div>
|
||||
<div><span class="text-slate-500 dark:text-slate-400">是否外出:</span>{{ formatYesNoLabel(getLeaveConfirmationPayload(msg)!.form.isOutOfOffice) }}</div>
|
||||
<div><span class="text-slate-500 dark:text-slate-400">是否为工伤:</span>{{ formatYesNoLabel(getLeaveConfirmationPayload(msg)!.form.isWorkInjury) }}</div>
|
||||
<div><span class="text-slate-500 dark:text-slate-400">{{ $t('chat.leaveAgent') }}:</span>{{ getLeaveAgentDisplayValue(getLeaveConfirmationPayload(msg)!.form) || $t('chat.notSelected') }}</div>
|
||||
<div v-if="getLeaveConfirmationPayload(msg)!.form.agentJobTitleName || getLeaveConfirmationPayload(msg)!.form.agentJobTitle"><span class="text-slate-500 dark:text-slate-400">{{ $t('chat.leaveAgentTitle') }}:</span>{{ getLeaveConfirmationPayload(msg)!.form.agentJobTitleName || getLeaveConfirmationPayload(msg)!.form.agentJobTitle }}</div>
|
||||
<div v-if="getLeaveConfirmationPayload(msg)!.form.agentDepartmentName || getLeaveConfirmationPayload(msg)!.form.agentDepartmentId"><span class="text-slate-500 dark:text-slate-400">{{ $t('chat.leaveAgentDept') }}:</span>{{ getLeaveConfirmationPayload(msg)!.form.agentDepartmentName || getLeaveConfirmationPayload(msg)!.form.agentDepartmentId }}</div>
|
||||
<div v-if="getLeaveConfirmationPayload(msg)!.form.agentSubCompanyName || getLeaveConfirmationPayload(msg)!.form.agentSubCompanyId1"><span class="text-slate-500 dark:text-slate-400">{{ $t('chat.leaveAgentCompany') }}:</span>{{ getLeaveConfirmationPayload(msg)!.form.agentSubCompanyName || getLeaveConfirmationPayload(msg)!.form.agentSubCompanyId1 }}</div>
|
||||
<div><span class="text-slate-500 dark:text-slate-400">{{ $t('chat.leaveType') }}:</span>{{ getLeaveTypeLabel(getLeaveConfirmationPayload(msg)!.form.leaveType) }}</div>
|
||||
<div><span class="text-slate-500 dark:text-slate-400">{{ $t('chat.duration') }}:</span>{{ formatDurationLabel(getLeaveConfirmationPayload(msg)!.form.durationHours) }}</div>
|
||||
<div><span class="text-slate-500 dark:text-slate-400">{{ $t('chat.startTime') }}:</span>{{ getLeaveConfirmationPayload(msg)!.form.startTime.replace('T', ' ') }}</div>
|
||||
<div><span class="text-slate-500 dark:text-slate-400">{{ $t('chat.endTime') }}:</span>{{ getLeaveConfirmationPayload(msg)!.form.endTime.replace('T', ' ') }}</div>
|
||||
<div><span class="text-slate-500 dark:text-slate-400">{{ $t('chat.isOutOfOffice') }}:</span>{{ formatYesNoLabel(getLeaveConfirmationPayload(msg)!.form.isOutOfOffice) }}</div>
|
||||
<div><span class="text-slate-500 dark:text-slate-400">{{ $t('chat.isWorkInjury') }}:</span>{{ formatYesNoLabel(getLeaveConfirmationPayload(msg)!.form.isWorkInjury) }}</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="flex justify-end gap-3">
|
||||
@@ -2211,14 +2220,14 @@ const showChatRating = ref(false);
|
||||
@click="editLeaveConfirmation(msg, index)"
|
||||
class="rounded-xl border border-slate-200 px-4 py-2 text-sm font-medium text-slate-600 transition hover:bg-slate-50 disabled:cursor-not-allowed disabled:opacity-60 dark:border-slate-700 dark:text-slate-200 dark:hover:bg-slate-800"
|
||||
>
|
||||
返回修改
|
||||
{{ $t('chat.backToEdit') }}
|
||||
</button>
|
||||
<button
|
||||
@click="confirmLeaveSubmission(msg)"
|
||||
:disabled="getLeaveConfirmationPayload(msg)?.submitting || getLeaveConfirmationPayload(msg)?.confirmed"
|
||||
class="rounded-xl bg-emerald-600 px-4 py-2 text-sm font-medium text-white transition hover:bg-emerald-700 disabled:cursor-not-allowed disabled:opacity-60"
|
||||
>
|
||||
{{ getLeaveConfirmationPayload(msg)?.submitting ? '确认中...' : (getLeaveConfirmationPayload(msg)?.confirmed ? '已确认' : '确认') }}
|
||||
{{ getLeaveConfirmationPayload(msg)?.submitting ? $t('chat.confirming') : (getLeaveConfirmationPayload(msg)?.confirmed ? $t('chat.confirmed') : $t('chat.confirm')) }}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
@@ -2229,20 +2238,20 @@ const showChatRating = ref(false);
|
||||
? 'border-emerald-200 bg-emerald-50 text-emerald-800 dark:border-emerald-500/30 dark:bg-emerald-500/10 dark:text-emerald-100'
|
||||
: 'border-rose-200 bg-rose-50 text-rose-800 dark:border-rose-500/30 dark:bg-rose-500/10 dark:text-rose-100'"
|
||||
>
|
||||
<div class="text-sm font-semibold">{{ getLeaveResultPayload(msg)!.success ? 'OA 提交结果' : 'OA 提交失败' }}</div>
|
||||
<div class="text-sm font-semibold">{{ getLeaveResultPayload(msg)!.success ? $t('chat.oaSubmitResult') : $t('chat.oaSubmitFailed') }}</div>
|
||||
<div v-if="getLeaveResultPayload(msg)!.success" class="mt-2 whitespace-pre-wrap text-sm leading-7">
|
||||
请假单已推送到 OA,具体单据请
|
||||
{{ $t('chat.leaveResultPrefix') }}
|
||||
<a
|
||||
href="#"
|
||||
@click.prevent="openOARequestDirectly(getLeaveResultPayload(msg)!.referenceNo)"
|
||||
class="ml-1 inline-flex items-center rounded-full border border-brand-200 bg-brand-50 px-3 py-0.5 font-bold text-brand-700 transition hover:bg-brand-100 hover:underline dark:border-brand-500/30 dark:bg-brand-500/10 dark:text-brand-200 dark:hover:bg-brand-500/20"
|
||||
>
|
||||
【 登录OA系统查看提交】
|
||||
{{ $t('chat.leaveResultLinkText') }}
|
||||
</a>
|
||||
</div>
|
||||
<div v-else class="mt-2 whitespace-pre-wrap text-sm leading-7">{{ msg.content }}</div>
|
||||
<div class="mt-3 text-xs opacity-80">单据编号:{{ getLeaveResultPayload(msg)!.referenceNo }}</div>
|
||||
<div class="mt-1 text-xs opacity-80">提交时间:{{ getLeaveResultPayload(msg)!.submittedAt }}</div>
|
||||
<div class="mt-3 text-xs opacity-80">{{ $t('chat.requestNo') }}:{{ getLeaveResultPayload(msg)!.referenceNo }}</div>
|
||||
<div class="mt-1 text-xs opacity-80">{{ $t('chat.submitTime') }}:{{ getLeaveResultPayload(msg)!.submittedAt }}</div>
|
||||
</div>
|
||||
</div>
|
||||
<div
|
||||
@@ -2276,7 +2285,7 @@ const showChatRating = ref(false);
|
||||
:open="shouldExpandSourceDetails(msg)"
|
||||
>
|
||||
<summary class="cursor-pointer text-xs font-semibold uppercase tracking-wide text-slate-600 dark:text-slate-300">
|
||||
源文档 ({{ getDisplayRetrieverResources(msg).length }})
|
||||
{{ $t('chat.sourceDocs') }} ({{ getDisplayRetrieverResources(msg).length }})
|
||||
</summary>
|
||||
<div class="mt-3 space-y-2">
|
||||
<div
|
||||
@@ -2297,7 +2306,7 @@ const showChatRating = ref(false);
|
||||
open
|
||||
>
|
||||
<summary class="cursor-pointer text-xs font-semibold uppercase tracking-wide text-slate-600 dark:text-slate-300">
|
||||
生成内容归属部分
|
||||
{{ $t('chat.attributionParts') }}
|
||||
</summary>
|
||||
<ul class="mt-3 space-y-2">
|
||||
<li
|
||||
@@ -2355,7 +2364,7 @@ const showChatRating = ref(false);
|
||||
v-if="showChatRating && !isThinking && !(msg as any).rated"
|
||||
@click="handleOpenFeedback(index)"
|
||||
class="rounded-md p-1.5 text-xs transition-colors hover:bg-slate-100 dark:hover:bg-slate-800"
|
||||
title="评价回答"
|
||||
:title="$t('chat.rate')"
|
||||
>
|
||||
<MessageSquareText class="h-3.5 w-3.5" />
|
||||
</button>
|
||||
@@ -2387,7 +2396,7 @@ const showChatRating = ref(false);
|
||||
v-model="input"
|
||||
@keydown.enter.prevent="handleSend"
|
||||
rows="1"
|
||||
placeholder="问我任何事..."
|
||||
:placeholder="$t('chat.askAnything')"
|
||||
class="w-full resize-none border-none bg-transparent px-3 py-2 text-[15px] leading-relaxed text-slate-800 placeholder-slate-400 focus:outline-none focus:ring-0 focus:border-transparent dark:text-slate-100"
|
||||
style="min-height: 44px; max-height: 220px;"
|
||||
:disabled="isThinking"
|
||||
@@ -2401,7 +2410,7 @@ const showChatRating = ref(false);
|
||||
<button
|
||||
@click="handleVoiceFeatureClick"
|
||||
type="button"
|
||||
title="语音功能"
|
||||
:title="$t('chat.voiceFeature')"
|
||||
class="text-slate-400 transition-colors hover:text-brand-600 dark:hover:text-brand-300"
|
||||
>
|
||||
<Mic class="h-5 w-5" />
|
||||
@@ -2435,7 +2444,7 @@ const showChatRating = ref(false);
|
||||
class="flex items-center gap-1 rounded-lg border border-slate-200 px-3 py-1.5 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"
|
||||
>
|
||||
<Globe class="h-3.5 w-3.5 text-brand-500" />
|
||||
{{ browserPanelOpen ? '收起浏览器' : '打开浏览器' }}
|
||||
{{ browserPanelOpen ? $t('chat.collapseBrowser') : $t('chat.openBrowser') }}
|
||||
</button>
|
||||
</div>
|
||||
<button
|
||||
@@ -2451,7 +2460,7 @@ const showChatRating = ref(false);
|
||||
</div>
|
||||
</div>
|
||||
<div class="mt-3 text-center text-[11px] text-slate-400">
|
||||
AI 可能会犯错,请核实重要信息。
|
||||
{{ $t('chat.disclaimer') }}
|
||||
</div>
|
||||
</div>
|
||||
</footer>
|
||||
@@ -2482,12 +2491,12 @@ const showChatRating = ref(false);
|
||||
<div class="flex items-center justify-between border-b border-slate-200 px-4 py-3 dark:border-slate-800">
|
||||
<div class="flex items-center gap-2 text-sm font-semibold text-slate-700 dark:text-slate-100">
|
||||
<Globe class="h-4 w-4 text-brand-500" />
|
||||
浏览器
|
||||
{{ $t('chat.browser') }}
|
||||
</div>
|
||||
<button
|
||||
@click="browserPanelOpen = false"
|
||||
class="rounded-md p-1.5 text-slate-400 transition-colors hover:bg-slate-100 hover:text-slate-600 dark:hover:bg-slate-800 dark:hover:text-slate-200"
|
||||
title="关闭浏览器"
|
||||
:title="$t('chat.closeBrowser')"
|
||||
>
|
||||
<X class="h-4 w-4" />
|
||||
</button>
|
||||
@@ -2497,7 +2506,7 @@ const showChatRating = ref(false);
|
||||
<input
|
||||
v-model="browserDraftUrl"
|
||||
type="text"
|
||||
placeholder="输入网址,例如 https://example.com"
|
||||
:placeholder="$t('chat.browserInputPlaceholder')"
|
||||
class="flex-1 rounded-xl border border-slate-200 bg-slate-50 px-3 py-2 text-sm text-slate-800 outline-none transition focus:border-brand-400 focus:bg-white dark:border-slate-700 dark:bg-slate-900 dark:text-slate-100 dark:focus:bg-slate-950"
|
||||
@keydown="handleBrowserUrlEnter"
|
||||
/>
|
||||
@@ -2505,19 +2514,19 @@ const showChatRating = ref(false);
|
||||
@click="loadBrowserPage"
|
||||
class="rounded-xl bg-brand-600 px-3 py-2 text-xs font-medium text-white transition-colors hover:bg-brand-500"
|
||||
>
|
||||
打开
|
||||
{{ $t('chat.open') }}
|
||||
</button>
|
||||
<button
|
||||
@click="refreshBrowserPage"
|
||||
class="rounded-xl border border-slate-200 p-2 text-slate-500 transition-colors hover:bg-slate-50 hover:text-slate-700 dark:border-slate-700 dark:hover:bg-slate-800 dark:hover:text-slate-200"
|
||||
title="刷新"
|
||||
:title="$t('chat.refresh')"
|
||||
>
|
||||
<RotateCw class="h-4 w-4" />
|
||||
</button>
|
||||
<button
|
||||
@click="openBrowserInNewTab"
|
||||
class="rounded-xl border border-slate-200 p-2 text-slate-500 transition-colors hover:bg-slate-50 hover:text-slate-700 dark:border-slate-700 dark:hover:bg-slate-800 dark:hover:text-slate-200"
|
||||
title="新标签打开"
|
||||
:title="$t('chat.openInNewTab')"
|
||||
>
|
||||
<ExternalLink class="h-4 w-4" />
|
||||
</button>
|
||||
@@ -2529,8 +2538,8 @@ const showChatRating = ref(false);
|
||||
class="flex h-full flex-col items-center justify-center gap-3 px-8 text-center text-sm text-slate-500 dark:text-slate-400"
|
||||
>
|
||||
<Globe class="h-8 w-8 text-brand-500" />
|
||||
<div>在这里直接打开网页,边聊天边查看内容。</div>
|
||||
<div class="text-xs">支持输入 `https://`、`localhost` 或内网 IP 地址。</div>
|
||||
<div>{{ $t('chat.browserHint1') }}</div>
|
||||
<div class="text-xs">{{ $t('chat.browserHint2') }}</div>
|
||||
</div>
|
||||
<iframe
|
||||
v-else
|
||||
@@ -2561,7 +2570,7 @@ const showChatRating = ref(false);
|
||||
if (activeFeedbackMessageIndex !== null && messages[activeFeedbackMessageIndex]) {
|
||||
(messages[activeFeedbackMessageIndex] as any).rated = true;
|
||||
}
|
||||
showMessageDialog('success', '\u53cd\u9988\u63d0\u4ea4\u6210\u529f');
|
||||
showMessageDialog('success', t('chat.feedbackSubmitSuccess'));
|
||||
showGeneralFeedbackDialog = false;
|
||||
}"
|
||||
/>
|
||||
@@ -2573,8 +2582,8 @@ const showChatRating = ref(false);
|
||||
<div class="flex w-full max-w-2xl max-h-[80vh] flex-col rounded-2xl bg-white p-6 shadow-2xl dark:bg-slate-900">
|
||||
<div class="mb-4 flex items-center justify-between">
|
||||
<div>
|
||||
<h3 class="text-lg font-bold text-slate-800 dark:text-slate-100">选择{{ leaveUserSelectRole === 'agent' ? '代理人' : '请假人' }}</h3>
|
||||
<p class="mt-1 text-sm text-slate-500 dark:text-slate-400">已接入 OA 数据库视图查询。</p>
|
||||
<h3 class="text-lg font-bold text-slate-800 dark:text-slate-100">{{ $t('chat.selectWho', { role: leaveUserSelectRole === 'agent' ? $t('chat.leaveAgent') : $t('chat.leaveApplicant') }) }}</h3>
|
||||
<p class="mt-1 text-sm text-slate-500 dark:text-slate-400">{{ $t('chat.oaDataConnected') }}</p>
|
||||
</div>
|
||||
<button @click="closeLeaveAgentDialog" class="text-slate-400 hover:text-slate-600 dark:hover:text-slate-200">
|
||||
<X class="h-5 w-5" />
|
||||
@@ -2586,7 +2595,7 @@ const showChatRating = ref(false);
|
||||
v-model="leaveAgentKeyword"
|
||||
@keydown.enter="handleAgentSearch"
|
||||
type="text"
|
||||
placeholder="输入姓名或工号搜索,按回车键查询"
|
||||
:placeholder="$t('chat.searchByNameOrEmployeeId')"
|
||||
class="w-full rounded-xl border border-slate-200 bg-slate-50 px-4 py-2.5 pr-10 text-sm outline-none transition focus:border-brand-400 dark:border-slate-700 dark:bg-slate-950 dark:text-slate-100"
|
||||
/>
|
||||
<button @click="handleAgentSearch" class="absolute inset-y-0 right-0 flex w-10 items-center justify-center text-slate-400 hover:text-brand-600">
|
||||
@@ -2599,7 +2608,7 @@ const showChatRating = ref(false);
|
||||
<Loader2 class="h-6 w-6 animate-spin text-brand-500" />
|
||||
</div>
|
||||
<div v-else-if="leaveAgentOptions.length === 0" class="py-8 text-center text-sm text-slate-400">
|
||||
暂无数据
|
||||
{{ $t('chat.noData') }}
|
||||
</div>
|
||||
<template v-else>
|
||||
<button
|
||||
@@ -2614,8 +2623,8 @@ const showChatRating = ref(false);
|
||||
<div class="text-xs text-slate-500 dark:text-slate-400">UID:{{ option.uid }}</div>
|
||||
</div>
|
||||
<div class="text-right text-xs text-slate-500 dark:text-slate-400">
|
||||
<div>工号:{{ option.employeeId }}</div>
|
||||
<div>姓名:{{ option.name }}</div>
|
||||
<div>{{ $t('chat.employeeId') }}:{{ option.employeeId }}</div>
|
||||
<div>{{ $t('chat.name') }}:{{ option.name }}</div>
|
||||
</div>
|
||||
</button>
|
||||
|
||||
@@ -2625,17 +2634,17 @@ const showChatRating = ref(false);
|
||||
:disabled="leaveAgentLoading"
|
||||
class="text-xs text-slate-500 hover:text-slate-700 disabled:opacity-50 dark:text-slate-400 dark:hover:text-slate-300"
|
||||
>
|
||||
加载全部
|
||||
{{ $t('chat.loadAll') }}
|
||||
</button>
|
||||
<button
|
||||
@click="loadMoreAgents"
|
||||
:disabled="leaveAgentLoading"
|
||||
class="text-xs text-brand-600 hover:text-brand-700 disabled:opacity-50"
|
||||
>
|
||||
{{ leaveAgentLoading ? '加载中...' : '加载更多' }}
|
||||
{{ leaveAgentLoading ? $t('chat.loading') : $t('chat.loadMore') }}
|
||||
</button>
|
||||
</div>
|
||||
<div v-else class="py-4 text-center text-xs text-slate-400">没有更多数据了</div>
|
||||
<div v-else class="py-4 text-center text-xs text-slate-400">{{ $t('chat.noMoreData') }}</div>
|
||||
</template>
|
||||
</div>
|
||||
</div>
|
||||
@@ -2646,10 +2655,10 @@ const showChatRating = ref(false);
|
||||
<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>
|
||||
<h3 class="mb-4 text-center text-lg font-bold text-slate-800 dark:text-slate-100">{{ $t('chat.loginOaSystem') }}</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>
|
||||
<span class="text-sm font-medium text-slate-600 dark:text-slate-300">{{ $t('chat.employeeId') }}</span>
|
||||
<input
|
||||
v-model="oaLoginEmployeeId"
|
||||
type="text"
|
||||
@@ -2658,11 +2667,11 @@ const showChatRating = ref(false);
|
||||
/>
|
||||
</label>
|
||||
<label class="block space-y-1.5">
|
||||
<span class="text-sm font-medium text-slate-600 dark:text-slate-300">密码</span>
|
||||
<span class="text-sm font-medium text-slate-600 dark:text-slate-300">{{ $t('login.password') }}</span>
|
||||
<input
|
||||
v-model="oaLoginPassword"
|
||||
type="password"
|
||||
placeholder="请输入OA登录密码"
|
||||
:placeholder="$t('chat.enterOaPassword')"
|
||||
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"
|
||||
/>
|
||||
@@ -2673,13 +2682,13 @@ const showChatRating = ref(false);
|
||||
@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"
|
||||
>
|
||||
取消
|
||||
{{ $t('profile.cancel') }}
|
||||
</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"
|
||||
>
|
||||
确认登录
|
||||
{{ $t('chat.confirmLogin') }}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -1578,6 +1578,14 @@ onMounted(async () => {
|
||||
<User class="h-4 w-4" />
|
||||
<span>个人中心</span>
|
||||
</button>
|
||||
<button
|
||||
v-if="currentUser?.role === 'admin'"
|
||||
@click="openAdminPanel"
|
||||
class="flex w-full items-center gap-3 rounded-2xl px-4 py-3 text-left text-[15px] font-medium text-slate-600 transition-all hover:bg-slate-50 hover:text-slate-900"
|
||||
>
|
||||
<Settings class="h-4 w-4" />
|
||||
<span>管理后台</span>
|
||||
</button>
|
||||
<button
|
||||
@click="navigateToApplications"
|
||||
class="flex w-full items-center gap-3 rounded-2xl px-4 py-3 text-left text-[15px] font-medium transition-all"
|
||||
@@ -1630,14 +1638,6 @@ onMounted(async () => {
|
||||
<Bot class="h-4 w-4" />
|
||||
<span>返回聊天</span>
|
||||
</button>
|
||||
<button
|
||||
v-if="currentUser?.role === 'admin'"
|
||||
@click="openAdminPanel"
|
||||
class="flex w-full items-center gap-3 rounded-2xl px-4 py-3 text-left text-[15px] font-medium text-slate-600 transition-all hover:bg-slate-50 hover:text-slate-900"
|
||||
>
|
||||
<Settings class="h-4 w-4" />
|
||||
<span>管理后台</span>
|
||||
</button>
|
||||
<button
|
||||
@click="handleLogout"
|
||||
class="flex w-full items-center gap-3 rounded-2xl px-4 py-3 text-left text-[15px] font-medium text-red-500 transition-all hover:bg-red-50 hover:text-red-600"
|
||||
|
||||
Reference in new issue
Block a user