查假期交互调整
This commit is contained in:
1 parent
2736224ed7
commit
fec2fc096e
8 files changed
+1076
-28
No files matched your search
@@ -1,4 +1,4 @@
|
||||
from flask import Blueprint, request, jsonify, current_app
|
||||
from flask import Blueprint, request, jsonify, current_app
|
||||
from app import db
|
||||
from app.models import User, Agent, QuickQuestion, UserFavoriteAgent, UserDefaultAgent, UserHomepageConfig, Announcement, LoginAudit, WecomCallbackAudit, GeneralFeedback, ChatLog
|
||||
from app.services.wecom_notify import mark_wecom_message_opened, send_wecom_event_message
|
||||
|
||||
Vendored
+2
-2
@@ -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-Cl-3HaxQ.js"></script>
|
||||
<link rel="stylesheet" crossorigin href="/assets/index-Ci0e0qmM.css">
|
||||
<script type="module" crossorigin src="/assets/index-B0RZ7Ems.js"></script>
|
||||
<link rel="stylesheet" crossorigin href="/assets/index-Ck6nsfgg.css">
|
||||
</head>
|
||||
<body>
|
||||
<div id="app"></div>␍
|
||||
|
||||
@@ -22,9 +22,14 @@ interface ChatMessage {
|
||||
// 对话消息结构:用户/助手文本 + 可选的来源与归因信息
|
||||
role: 'user' | 'assistant';
|
||||
content: string;
|
||||
type?: 'text' | 'leave-form' | 'leave-confirmation' | 'leave-result';
|
||||
retriever_resources?: RetrieverResource[];
|
||||
attribution_parts?: string[];
|
||||
chat_log_id?: number;
|
||||
payload?: any;
|
||||
local_id?: string;
|
||||
local_only?: boolean;
|
||||
rated?: boolean;
|
||||
}
|
||||
|
||||
// 统一资源格式为数组,兼容 list 或 { data: list } 两种结构
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
export interface AuthUser {
|
||||
id?: number;
|
||||
username?: string;
|
||||
real_name?: string;
|
||||
employee_id?: string;
|
||||
role?: string;
|
||||
token?: string;
|
||||
access_token?: string;
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
import { ref, onMounted, onBeforeUnmount, computed } from 'vue';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import { useChat } from '../composables/useChat';
|
||||
import { Send, Bot, Loader2, Plus, Copy, Edit2, RotateCw, Check, X, PanelLeftClose, PanelLeftOpen, Heart, Bell, Mail, Settings, Crown, ChevronDown, Sparkles, User, Database, Mic, LogOut, MessageSquareText } from 'lucide-vue-next';
|
||||
import { Send, Bot, Loader2, Plus, Copy, Edit2, RotateCw, Check, X, PanelLeftClose, PanelLeftOpen, Heart, Bell, Mail, Settings, Crown, ChevronDown, Sparkles, User, Database, Mic, LogOut, MessageSquareText, Globe, ExternalLink } from 'lucide-vue-next';
|
||||
import { marked } from 'marked';
|
||||
import { useRoute, useRouter } from 'vue-router';
|
||||
import { config } from '../config';
|
||||
@@ -28,6 +28,21 @@ const currentUser = ref(getStoredAuthUser());
|
||||
const showUserDropdown = ref(false);
|
||||
const userMenuRef = ref<HTMLElement | null>(null);
|
||||
|
||||
const currentUserDisplayName = computed(() => {
|
||||
const realName = currentUser.value?.real_name?.trim();
|
||||
if (realName) return realName;
|
||||
const username = currentUser.value?.username?.trim();
|
||||
if (username) return username;
|
||||
return '当前用户';
|
||||
});
|
||||
|
||||
const currentUserEmployeeId = computed(() => {
|
||||
const employeeId = currentUser.value?.employee_id?.trim();
|
||||
if (employeeId) return employeeId;
|
||||
const username = currentUser.value?.username?.trim();
|
||||
return username || '-';
|
||||
});
|
||||
|
||||
const handleDocumentPointerDown = (event: MouseEvent | TouchEvent) => {
|
||||
if (!showUserDropdown.value) return;
|
||||
const target = event.target as Node | null;
|
||||
@@ -350,6 +365,7 @@ const shouldExpandSourceDetails = (msg: any): boolean => {
|
||||
|
||||
const shouldRenderMessage = (msg: any): boolean => {
|
||||
if (msg?.role === 'user') return true;
|
||||
if (msg?.type === 'leave-form' || msg?.type === 'leave-confirmation' || msg?.type === 'leave-result') return true;
|
||||
const content = (msg?.content || '').trim();
|
||||
if (content) return true;
|
||||
if (getMessageLinks(msg).length > 0) return true;
|
||||
@@ -397,6 +413,253 @@ const input = ref('');
|
||||
const currentAgent = ref<any>(null);
|
||||
const showGeneralFeedbackDialog = ref(false);
|
||||
const activeFeedbackMessageIndex = ref<number | null>(null);
|
||||
const browserPanelOpen = ref(false);
|
||||
const browserDraftUrl = ref('');
|
||||
const browserCurrentUrl = ref('');
|
||||
const browserFrameKey = ref(0);
|
||||
const browserPanelWidth = ref(420);
|
||||
const isBrowserResizing = ref(false);
|
||||
const viewportWidth = ref(typeof window === 'undefined' ? 1440 : window.innerWidth);
|
||||
|
||||
const MIN_BROWSER_PANEL_WIDTH = 320;
|
||||
const MAX_BROWSER_PANEL_WIDTH = 960;
|
||||
|
||||
const LEAVE_TYPES = [
|
||||
{ label: '事假(小时)', value: '005' },
|
||||
{ label: '病假(小时)', value: '006' },
|
||||
{ label: '丧假(天)', value: '007' },
|
||||
{ label: '年假(天)', value: '010' },
|
||||
{ label: '因公出差(小时)', value: '021' },
|
||||
{ label: '调休假(小时)', value: '025' },
|
||||
{ label: '产假(天)', value: '401' },
|
||||
{ label: '陪产假(天)', value: '402' },
|
||||
{ label: '婚假(天)', value: '403' },
|
||||
{ label: '住院病假(小时)', value: '405' },
|
||||
{ label: '工伤假(天)', value: '406' },
|
||||
{ label: '返乡假(小时)', value: 'ZZ01' },
|
||||
{ label: '事假(经理专用小时)', value: 'ZZ04' },
|
||||
{ label: '病假(经理专用小时)', value: 'ZZ05' },
|
||||
{ label: '丧假(经理专用天)', value: 'ZZ07' },
|
||||
{ label: '产假(经理专用天)', value: 'ZZ08' },
|
||||
{ label: '陪产假(经理专用天)', value: 'ZZ09' },
|
||||
{ label: '婚假(经理专用天)', value: 'ZZ10' },
|
||||
{ label: '其他假(小时)', value: '035' },
|
||||
{ label: '育儿假(小时)', value: '408' }
|
||||
];
|
||||
|
||||
const getLeaveTypeLabel = (val: string) => {
|
||||
const t = LEAVE_TYPES.find(x => x.value === val);
|
||||
return t ? t.label : val;
|
||||
};
|
||||
|
||||
const LEAVE_RESULT_QUERY_URL = 'http://192.168.100.221:8888/';
|
||||
|
||||
interface LeaveRequestFormData {
|
||||
applicantName: string;
|
||||
employeeId: string;
|
||||
applyTime: string;
|
||||
leaveType: string;
|
||||
startTime: string;
|
||||
endTime: string;
|
||||
durationHours: number;
|
||||
isOutOfOffice: boolean;
|
||||
isWorkInjury: boolean;
|
||||
}
|
||||
|
||||
interface LeaveFormPayload {
|
||||
formId: string;
|
||||
form: LeaveRequestFormData;
|
||||
submitting: boolean;
|
||||
confirmationGenerated: boolean;
|
||||
}
|
||||
|
||||
interface LeaveConfirmationPayload {
|
||||
formId: string;
|
||||
form: LeaveRequestFormData;
|
||||
submitting: boolean;
|
||||
confirmed?: boolean;
|
||||
}
|
||||
|
||||
interface LeaveResultPayload {
|
||||
formId: string;
|
||||
success: boolean;
|
||||
referenceNo: string;
|
||||
submittedAt: string;
|
||||
}
|
||||
|
||||
let leaveFlowCounter = 0;
|
||||
|
||||
const formatDateTime = (date: Date) => {
|
||||
const year = date.getFullYear();
|
||||
const month = String(date.getMonth() + 1).padStart(2, '0');
|
||||
const day = String(date.getDate()).padStart(2, '0');
|
||||
const hours = String(date.getHours()).padStart(2, '0');
|
||||
const minutes = String(date.getMinutes()).padStart(2, '0');
|
||||
return `${year}-${month}-${day}T${hours}:${minutes}`;
|
||||
};
|
||||
|
||||
const parseDateTime = (value: string) => {
|
||||
const normalized = (value || '').trim().replace('T', ' ');
|
||||
const match = normalized.match(/^(\d{4})-(\d{2})-(\d{2})\s+(\d{2}):(\d{2})$/);
|
||||
if (!match) return null;
|
||||
const [, year, month, day, hour, minute] = match;
|
||||
const date = new Date(Number(year), Number(month) - 1, Number(day), Number(hour), Number(minute));
|
||||
return Number.isNaN(date.getTime()) ? null : date;
|
||||
};
|
||||
|
||||
const calculateDurationHours = (startTime: string, endTime: string) => {
|
||||
const start = parseDateTime(startTime);
|
||||
const end = parseDateTime(endTime);
|
||||
if (!start || !end || end.getTime() <= start.getTime()) return 0;
|
||||
return Number((((end.getTime() - start.getTime()) / 1000 / 60 / 60)).toFixed(2));
|
||||
};
|
||||
|
||||
const formatDurationLabel = (hours: number) => {
|
||||
if (!hours) return '0 小时';
|
||||
if (hours >= 8 && Number.isInteger((hours / 8) * 10) && (hours / 8) >= 1) {
|
||||
const days = Number((hours / 8).toFixed(2));
|
||||
return `${days} 天 / ${hours} 小时`;
|
||||
}
|
||||
return `${hours} 小时`;
|
||||
};
|
||||
|
||||
const createLeaveFormData = (): LeaveRequestFormData => {
|
||||
const now = new Date();
|
||||
const oneHourLater = new Date(now.getTime() + 60 * 60 * 1000);
|
||||
const startTime = formatDateTime(now);
|
||||
const endTime = formatDateTime(oneHourLater);
|
||||
return {
|
||||
applicantName: currentUserDisplayName.value,
|
||||
employeeId: currentUserEmployeeId.value,
|
||||
applyTime: formatDateTime(now),
|
||||
leaveType: '',
|
||||
startTime,
|
||||
endTime,
|
||||
durationHours: calculateDurationHours(startTime, endTime),
|
||||
isOutOfOffice: false,
|
||||
isWorkInjury: false,
|
||||
};
|
||||
};
|
||||
|
||||
const newLocalMessageId = (prefix: string) => {
|
||||
leaveFlowCounter += 1;
|
||||
return `${prefix}-${Date.now()}-${leaveFlowCounter}`;
|
||||
};
|
||||
|
||||
const syncLeaveDuration = (form: LeaveRequestFormData) => {
|
||||
form.durationHours = calculateDurationHours(form.startTime, form.endTime);
|
||||
};
|
||||
|
||||
const getLeaveIntentNormalized = (content: string) => (content || '').replace(/\s+/g, '');
|
||||
|
||||
const isLeaveIntent = (content: string) => {
|
||||
const normalized = getLeaveIntentNormalized(content);
|
||||
return /(我要请假|申请请假|发起请假|请假申请|我要休假|申请休假|我要请个假|想请假|我要走请假流程|请假流程)/.test(normalized);
|
||||
};
|
||||
|
||||
const getLeaveFormPayload = (msg: any): LeaveFormPayload | null => (
|
||||
msg?.type === 'leave-form' && msg?.payload ? msg.payload as LeaveFormPayload : null
|
||||
);
|
||||
|
||||
const getLeaveConfirmationPayload = (msg: any): LeaveConfirmationPayload | null => (
|
||||
msg?.type === 'leave-confirmation' && msg?.payload ? msg.payload as LeaveConfirmationPayload : null
|
||||
);
|
||||
|
||||
const getLeaveResultPayload = (msg: any): LeaveResultPayload | null => (
|
||||
msg?.type === 'leave-result' && msg?.payload ? msg.payload as LeaveResultPayload : null
|
||||
);
|
||||
|
||||
const findMessageIndexByLocalId = (localId: string) => messages.value.findIndex((msg: any) => msg?.local_id === localId);
|
||||
|
||||
const browserPanelStyle = computed(() => {
|
||||
if (viewportWidth.value < 1024) return undefined;
|
||||
return { width: `${browserPanelWidth.value}px` };
|
||||
});
|
||||
|
||||
const normalizeBrowserInput = (value: string) => {
|
||||
const raw = (value || '').trim();
|
||||
if (!raw) return '';
|
||||
if (/^https?:\/\//i.test(raw)) return raw;
|
||||
if (/^localhost(?::\d+)?(\/.*)?$/i.test(raw)) return `http://${raw}`;
|
||||
if (/^(?:\d{1,3}\.){3}\d{1,3}(?::\d+)?(\/.*)?$/.test(raw)) return `http://${raw}`;
|
||||
if (/^[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}(\/.*)?$/.test(raw)) return `https://${raw}`;
|
||||
return '';
|
||||
};
|
||||
|
||||
const toggleBrowserPanel = () => {
|
||||
browserPanelOpen.value = !browserPanelOpen.value;
|
||||
};
|
||||
|
||||
const loadBrowserPage = () => {
|
||||
const normalized = normalizeBrowserInput(browserDraftUrl.value);
|
||||
if (!normalized) {
|
||||
showMessageDialog('warning', '请输入有效的网址,例如 `https://example.com` 或 `localhost:8891`。');
|
||||
return;
|
||||
}
|
||||
browserCurrentUrl.value = normalized;
|
||||
browserDraftUrl.value = normalized;
|
||||
browserFrameKey.value += 1;
|
||||
browserPanelOpen.value = true;
|
||||
};
|
||||
|
||||
const refreshBrowserPage = () => {
|
||||
if (!browserCurrentUrl.value) {
|
||||
loadBrowserPage();
|
||||
return;
|
||||
}
|
||||
browserFrameKey.value += 1;
|
||||
};
|
||||
|
||||
const openBrowserInNewTab = () => {
|
||||
const normalized = browserCurrentUrl.value || normalizeBrowserInput(browserDraftUrl.value);
|
||||
if (!normalized) {
|
||||
showMessageDialog('warning', '请先输入可打开的网址。');
|
||||
return;
|
||||
}
|
||||
window.open(normalized, '_blank', 'noopener,noreferrer');
|
||||
};
|
||||
|
||||
const handleBrowserUrlEnter = (event: KeyboardEvent) => {
|
||||
if (event.key !== 'Enter') return;
|
||||
event.preventDefault();
|
||||
loadBrowserPage();
|
||||
};
|
||||
|
||||
const clampBrowserPanelWidth = (width: number) => {
|
||||
const maxAllowed = Math.min(MAX_BROWSER_PANEL_WIDTH, Math.max(MIN_BROWSER_PANEL_WIDTH, Math.floor(window.innerWidth * 0.7)));
|
||||
return Math.min(Math.max(width, MIN_BROWSER_PANEL_WIDTH), maxAllowed);
|
||||
};
|
||||
|
||||
const handleBrowserResizeMove = (event: MouseEvent) => {
|
||||
if (!isBrowserResizing.value) return;
|
||||
browserPanelWidth.value = clampBrowserPanelWidth(window.innerWidth - event.clientX);
|
||||
};
|
||||
|
||||
const stopBrowserResize = () => {
|
||||
if (!isBrowserResizing.value) return;
|
||||
isBrowserResizing.value = false;
|
||||
document.body.style.cursor = '';
|
||||
document.body.style.userSelect = '';
|
||||
window.removeEventListener('mousemove', handleBrowserResizeMove);
|
||||
window.removeEventListener('mouseup', stopBrowserResize);
|
||||
};
|
||||
|
||||
const startBrowserResize = (event: MouseEvent) => {
|
||||
if (viewportWidth.value < 1024) return;
|
||||
event.preventDefault();
|
||||
isBrowserResizing.value = true;
|
||||
document.body.style.cursor = 'col-resize';
|
||||
document.body.style.userSelect = 'none';
|
||||
window.addEventListener('mousemove', handleBrowserResizeMove);
|
||||
window.addEventListener('mouseup', stopBrowserResize);
|
||||
};
|
||||
|
||||
const syncViewportWidth = () => {
|
||||
viewportWidth.value = window.innerWidth;
|
||||
if (viewportWidth.value >= 1024) {
|
||||
browserPanelWidth.value = clampBrowserPanelWidth(browserPanelWidth.value);
|
||||
}
|
||||
};
|
||||
|
||||
const handleOpenFeedback = (index: number) => {
|
||||
activeFeedbackMessageIndex.value = index;
|
||||
@@ -445,6 +708,26 @@ const handleSend = async (textOrEvent?: string | Event) => {
|
||||
|
||||
// Clear input if sending from input box (not resending/regenerating)
|
||||
if (typeof textOrEvent !== 'string') input.value = '';
|
||||
|
||||
if (isLeaveIntent(content)) {
|
||||
const formId = newLocalMessageId('leave-form');
|
||||
const payload: LeaveFormPayload = {
|
||||
formId,
|
||||
form: createLeaveFormData(),
|
||||
submitting: false,
|
||||
confirmationGenerated: false,
|
||||
};
|
||||
messages.value.push({ role: 'user', content, type: 'text' });
|
||||
messages.value.push({
|
||||
role: 'assistant',
|
||||
type: 'leave-form',
|
||||
content: '已为你生成请假申请表,请直接在下方填写并提交。',
|
||||
payload,
|
||||
local_id: formId,
|
||||
local_only: true,
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
await sendMessage(content, agentId);
|
||||
|
||||
@@ -458,6 +741,101 @@ 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 (!parseDateTime(form.startTime)) return '开始时间格式不正确。';
|
||||
if (!parseDateTime(form.endTime)) return '结束时间格式不正确。';
|
||||
if (calculateDurationHours(form.startTime, form.endTime) <= 0) return '结束时间必须晚于开始时间。';
|
||||
return '';
|
||||
};
|
||||
|
||||
const submitLeaveForm = (msg: any) => {
|
||||
const payload = getLeaveFormPayload(msg);
|
||||
if (!payload) return;
|
||||
syncLeaveDuration(payload.form);
|
||||
const error = validateLeaveForm(payload.form);
|
||||
if (error) {
|
||||
showMessageDialog('warning', error);
|
||||
return;
|
||||
}
|
||||
|
||||
const existingConfirmIndex = messages.value.findIndex((item: any) => item?.type === 'leave-confirmation' && item?.payload?.formId === payload.formId);
|
||||
if (existingConfirmIndex >= 0) {
|
||||
messages.value.splice(existingConfirmIndex, 1);
|
||||
}
|
||||
|
||||
payload.confirmationGenerated = true;
|
||||
const summary = JSON.parse(JSON.stringify(payload.form)) as LeaveRequestFormData;
|
||||
messages.value.push({
|
||||
role: 'assistant',
|
||||
type: 'leave-confirmation',
|
||||
content: '请确认以下请假信息,确认无误后再提交到 OA。',
|
||||
payload: {
|
||||
formId: payload.formId,
|
||||
form: summary,
|
||||
submitting: false,
|
||||
},
|
||||
local_id: newLocalMessageId('leave-confirm'),
|
||||
local_only: true,
|
||||
});
|
||||
};
|
||||
|
||||
const editLeaveConfirmation = (msg: any, index: number) => {
|
||||
const payload = getLeaveConfirmationPayload(msg);
|
||||
if (!payload) return;
|
||||
const sourceIndex = findMessageIndexByLocalId(payload.formId);
|
||||
if (sourceIndex >= 0) {
|
||||
const sourcePayload = getLeaveFormPayload(messages.value[sourceIndex]);
|
||||
if (sourcePayload) {
|
||||
sourcePayload.confirmationGenerated = false;
|
||||
}
|
||||
}
|
||||
messages.value.splice(index, 1);
|
||||
};
|
||||
|
||||
const confirmLeaveSubmission = async (msg: any) => {
|
||||
const payload = getLeaveConfirmationPayload(msg);
|
||||
if (!payload || payload.submitting) return;
|
||||
payload.submitting = true;
|
||||
|
||||
const sourceIndex = findMessageIndexByLocalId(payload.formId);
|
||||
if (sourceIndex >= 0) {
|
||||
const sourcePayload = getLeaveFormPayload(messages.value[sourceIndex]);
|
||||
if (sourcePayload) {
|
||||
sourcePayload.submitting = true;
|
||||
sourcePayload.confirmationGenerated = true;
|
||||
}
|
||||
}
|
||||
|
||||
await new Promise((resolve) => window.setTimeout(resolve, 900));
|
||||
|
||||
const referenceNo = `OA-${Date.now().toString().slice(-8)}`;
|
||||
messages.value.push({
|
||||
role: 'assistant',
|
||||
type: 'leave-result',
|
||||
content: `请假单已生成,具体单据请到 ${LEAVE_RESULT_QUERY_URL} 查询。\n\n当前为前端演示提交流程,真实 OA 对接开发中。`,
|
||||
payload: {
|
||||
formId: payload.formId,
|
||||
success: true,
|
||||
referenceNo,
|
||||
submittedAt: formatDateTime(new Date()),
|
||||
},
|
||||
local_id: newLocalMessageId('leave-result'),
|
||||
local_only: true,
|
||||
});
|
||||
|
||||
payload.submitting = false;
|
||||
payload.confirmed = true;
|
||||
if (sourceIndex >= 0) {
|
||||
const sourcePayload = getLeaveFormPayload(messages.value[sourceIndex]);
|
||||
if (sourcePayload) {
|
||||
sourcePayload.submitting = false;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
const copyToClipboard = async (text: string, index: number) => {
|
||||
try {
|
||||
await navigator.clipboard.writeText(text);
|
||||
@@ -569,6 +947,7 @@ const loadAgent = async () => {
|
||||
onMounted(async () => {
|
||||
document.addEventListener('mousedown', handleDocumentPointerDown);
|
||||
document.addEventListener('touchstart', handleDocumentPointerDown, { passive: true });
|
||||
window.addEventListener('resize', syncViewportWidth);
|
||||
await loadAgent();
|
||||
|
||||
await loadHistory();
|
||||
@@ -584,6 +963,8 @@ onMounted(async () => {
|
||||
onBeforeUnmount(() => {
|
||||
document.removeEventListener('mousedown', handleDocumentPointerDown);
|
||||
document.removeEventListener('touchstart', handleDocumentPointerDown);
|
||||
window.removeEventListener('resize', syncViewportWidth);
|
||||
stopBrowserResize();
|
||||
});
|
||||
|
||||
/**
|
||||
@@ -754,6 +1135,8 @@ const showChatRating = ref(false);
|
||||
</div>
|
||||
|
||||
<template v-else>
|
||||
<div class="flex min-h-0 flex-1">
|
||||
<div class="flex min-h-0 flex-1 flex-col">
|
||||
<main
|
||||
class="flex-1 p-3 md:p-8"
|
||||
:class="messages.length === 0 ? 'overflow-hidden md:overflow-y-auto' : 'space-y-2 overflow-y-auto scrollbar-thin md:space-y-6'"
|
||||
@@ -791,7 +1174,158 @@ const showChatRating = ref(false);
|
||||
class="whitespace-pre-wrap"
|
||||
>{{ msg.content }}</div>
|
||||
<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">{{ msg.content }}</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>
|
||||
<input
|
||||
v-model="getLeaveFormPayload(msg)!.form.applicantName"
|
||||
type="text"
|
||||
class="w-full rounded-xl border border-slate-200 bg-slate-50 px-3 py-2 text-sm text-slate-500 outline-none dark:border-slate-700 dark:bg-slate-950/60 dark:text-slate-400"
|
||||
disabled
|
||||
/>
|
||||
</label>
|
||||
<label class="space-y-1.5">
|
||||
<span class="text-xs font-semibold text-slate-500 dark:text-slate-400">工号</span>
|
||||
<input
|
||||
v-model="getLeaveFormPayload(msg)!.form.employeeId"
|
||||
type="text"
|
||||
class="w-full rounded-xl border border-slate-200 bg-slate-50 px-3 py-2 text-sm text-slate-500 outline-none dark:border-slate-700 dark:bg-slate-950/60 dark:text-slate-400"
|
||||
disabled
|
||||
/>
|
||||
</label>
|
||||
<label class="space-y-1.5">
|
||||
<span class="text-xs font-semibold text-slate-500 dark:text-slate-400">申请时间</span>
|
||||
<input
|
||||
:value="getLeaveFormPayload(msg)!.form.applyTime.replace('T', ' ')"
|
||||
type="text"
|
||||
class="w-full rounded-xl border border-slate-200 bg-slate-50 px-3 py-2 text-sm text-slate-500 outline-none dark:border-slate-700 dark:bg-slate-950/60 dark:text-slate-400"
|
||||
disabled
|
||||
/>
|
||||
</label>
|
||||
<label class="space-y-1.5">
|
||||
<span class="text-xs font-semibold text-slate-500 dark:text-slate-400">假别</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 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>
|
||||
<input
|
||||
v-model="getLeaveFormPayload(msg)!.form.startTime"
|
||||
type="datetime-local"
|
||||
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"
|
||||
@input="syncLeaveDuration(getLeaveFormPayload(msg)!.form)"
|
||||
/>
|
||||
</label>
|
||||
<label class="space-y-1.5">
|
||||
<span class="text-xs font-semibold text-slate-500 dark:text-slate-400">结束时间</span>
|
||||
<input
|
||||
v-model="getLeaveFormPayload(msg)!.form.endTime"
|
||||
type="datetime-local"
|
||||
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"
|
||||
@input="syncLeaveDuration(getLeaveFormPayload(msg)!.form)"
|
||||
/>
|
||||
</label>
|
||||
<label class="space-y-1.5">
|
||||
<span class="text-xs font-semibold text-slate-500 dark:text-slate-400">时长</span>
|
||||
<input
|
||||
:value="formatDurationLabel(getLeaveFormPayload(msg)!.form.durationHours)"
|
||||
type="text"
|
||||
class="w-full rounded-xl border border-slate-200 bg-slate-50 px-3 py-2 text-sm text-slate-500 outline-none dark:border-slate-700 dark:bg-slate-950/60 dark:text-slate-400"
|
||||
disabled
|
||||
/>
|
||||
</label>
|
||||
<label class="space-y-1.5">
|
||||
<span class="text-xs font-semibold text-slate-500 dark:text-slate-400">是否外出</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="false">否</option>
|
||||
<option :value="true">是</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>
|
||||
<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="false">否</option>
|
||||
<option :value="true">是</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">
|
||||
已生成确认单,如需调整可直接修改表单后再次点击提交。
|
||||
</div>
|
||||
<div class="flex justify-end">
|
||||
<button
|
||||
@click="submitLeaveForm(msg)"
|
||||
:disabled="getLeaveFormPayload(msg)?.submitting || getLeaveFormPayload(msg)?.confirmationGenerated"
|
||||
class="rounded-xl bg-[#165DFF] px-4 py-2 text-sm font-medium text-white transition hover:bg-[#0E4FD2] disabled:cursor-not-allowed disabled:opacity-60"
|
||||
>
|
||||
{{ getLeaveFormPayload(msg)?.submitting ? '提交中...' : '提交' }}
|
||||
</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="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><span class="text-slate-500 dark:text-slate-400">申请时间:</span>{{ getLeaveConfirmationPayload(msg)!.form.applyTime.replace('T', ' ') }}</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>{{ getLeaveConfirmationPayload(msg)!.form.isOutOfOffice ? '是' : '否' }}</div>
|
||||
<div><span class="text-slate-500 dark:text-slate-400">是否为工伤:</span>{{ getLeaveConfirmationPayload(msg)!.form.isWorkInjury ? '是' : '否' }}</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="flex justify-end gap-3">
|
||||
<button
|
||||
v-if="!getLeaveConfirmationPayload(msg)?.submitting && !getLeaveConfirmationPayload(msg)?.confirmed"
|
||||
@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"
|
||||
>
|
||||
返回修改
|
||||
</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 ? '已确认' : '确认') }}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
<div v-else-if="msg.type === 'leave-result' && getLeaveResultPayload(msg)" class="space-y-3">
|
||||
<div
|
||||
class="rounded-2xl border px-4 py-4"
|
||||
:class="getLeaveResultPayload(msg)!.success
|
||||
? '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="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>
|
||||
</div>
|
||||
<div
|
||||
v-else
|
||||
class="prose prose-sm max-w-none leading-7 text-slate-800 dark:text-slate-100 prose-a:text-blue-600 dark:prose-a:text-blue-400 prose-p:my-1 prose-li:my-0.5 prose-ol:my-2 prose-ul:my-2 prose-headings:my-2 prose-hr:my-3 prose-code:rounded prose-code:bg-slate-100 prose-code:px-1 prose-code:text-blue-700 dark:prose-code:bg-slate-800 dark:prose-code:text-blue-300 prose-pre:my-3 prose-pre:border prose-pre:border-slate-700 prose-pre:bg-slate-900 prose-pre:text-slate-100"
|
||||
v-html="renderMarkdown(msg.content)"
|
||||
></div>
|
||||
@@ -799,7 +1333,7 @@ const showChatRating = ref(false);
|
||||
</div>
|
||||
|
||||
<div
|
||||
v-if=" msg.role === 'assistant' && ((getDisplayRetrieverResources(msg).length > 0) || (msg.attribution_parts && msg.attribution_parts.length > 0) || getMessageLinks(msg).length > 0)"
|
||||
v-if=" msg.role === 'assistant' && msg.type !== 'leave-form' && msg.type !== 'leave-confirmation' && msg.type !== 'leave-result' && ((getDisplayRetrieverResources(msg).length > 0) || (msg.attribution_parts && msg.attribution_parts.length > 0) || getMessageLinks(msg).length > 0)"
|
||||
class="mt-2 space-y-2"
|
||||
>
|
||||
<!-- 带有URL链接的源文件名称,支持预览 -->
|
||||
@@ -856,6 +1390,7 @@ const showChatRating = ref(false);
|
||||
</div>
|
||||
|
||||
<div
|
||||
v-if="msg.type !== 'leave-form'"
|
||||
class="mt-1 flex items-center gap-1 opacity-0 transition-opacity group-hover:opacity-100"
|
||||
:class="msg.role === 'user' ? 'justify-end text-slate-500' : 'justify-start text-slate-500'"
|
||||
>
|
||||
@@ -955,6 +1490,13 @@ const showChatRating = ref(false);
|
||||
<Database class="h-3.5 w-3.5 text-blue-500" />
|
||||
企业知识库 <ChevronDown class="h-3 w-3" />
|
||||
</button>
|
||||
<button
|
||||
@click="toggleBrowserPanel"
|
||||
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-emerald-500" />
|
||||
{{ browserPanelOpen ? '收起浏览器' : '打开浏览器' }}
|
||||
</button>
|
||||
</div>
|
||||
<button
|
||||
@click="handleSend"
|
||||
@@ -970,6 +1512,93 @@ const showChatRating = ref(false);
|
||||
</div>
|
||||
</div>
|
||||
</footer>
|
||||
</div>
|
||||
|
||||
<div
|
||||
v-if="browserPanelOpen"
|
||||
class="fixed inset-0 z-40 bg-slate-900/40 backdrop-blur-sm lg:hidden"
|
||||
@click="browserPanelOpen = false"
|
||||
></div>
|
||||
|
||||
<div
|
||||
v-if="browserPanelOpen"
|
||||
class="relative z-10 hidden w-2 shrink-0 cursor-col-resize bg-transparent lg:block"
|
||||
@mousedown="startBrowserResize"
|
||||
>
|
||||
<div
|
||||
class="absolute inset-y-0 left-1/2 w-px -translate-x-1/2 transition-colors"
|
||||
:class="isBrowserResizing ? 'bg-emerald-500' : 'bg-slate-200 dark:bg-slate-800'"
|
||||
></div>
|
||||
</div>
|
||||
|
||||
<aside
|
||||
v-if="browserPanelOpen"
|
||||
class="fixed inset-y-0 right-0 z-50 flex w-full max-w-[100vw] flex-col border-l border-slate-200 bg-white shadow-2xl dark:border-slate-800 dark:bg-slate-950 sm:w-[420px] lg:static lg:z-0 lg:w-[420px] lg:shadow-none"
|
||||
:style="browserPanelStyle"
|
||||
>
|
||||
<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-emerald-500" />
|
||||
浏览器
|
||||
</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="关闭浏览器"
|
||||
>
|
||||
<X class="h-4 w-4" />
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<div class="flex items-center gap-2 border-b border-slate-200 px-3 py-3 dark:border-slate-800">
|
||||
<input
|
||||
v-model="browserDraftUrl"
|
||||
type="text"
|
||||
placeholder="输入网址,例如 https://example.com"
|
||||
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-emerald-400 focus:bg-white dark:border-slate-700 dark:bg-slate-900 dark:text-slate-100 dark:focus:bg-slate-950"
|
||||
@keydown="handleBrowserUrlEnter"
|
||||
/>
|
||||
<button
|
||||
@click="loadBrowserPage"
|
||||
class="rounded-xl bg-emerald-600 px-3 py-2 text-xs font-medium text-white transition-colors hover:bg-emerald-500"
|
||||
>
|
||||
打开
|
||||
</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="刷新"
|
||||
>
|
||||
<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="新标签打开"
|
||||
>
|
||||
<ExternalLink class="h-4 w-4" />
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<div class="min-h-0 flex-1 bg-slate-100 dark:bg-slate-900">
|
||||
<div
|
||||
v-if="!browserCurrentUrl"
|
||||
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-emerald-500" />
|
||||
<div>在这里直接打开网页,边聊天边查看内容。</div>
|
||||
<div class="text-xs">支持输入 `https://`、`localhost` 或内网 IP 地址。</div>
|
||||
</div>
|
||||
<iframe
|
||||
v-else
|
||||
:key="browserFrameKey"
|
||||
:src="browserCurrentUrl"
|
||||
class="h-full w-full border-0 bg-white dark:bg-slate-950"
|
||||
allow="clipboard-read; clipboard-write"
|
||||
></iframe>
|
||||
</div>
|
||||
</aside>
|
||||
</div>
|
||||
</template>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -445,29 +445,6 @@ const handleLogin = async () => {
|
||||
}
|
||||
};
|
||||
|
||||
const handleCasdoorLogin = async () => {
|
||||
if (!config.auth?.casdoor?.enabled) return;
|
||||
try {
|
||||
// Ask backend to build a server-side-tracked authorize URL (includes state).
|
||||
const api = config.auth.casdoor.authorizeApi || '/api/user/casdoor/authorize-url';
|
||||
const callbackPath = config.auth.casdoor.callbackPath || '/casdoor-callback';
|
||||
const redirectUri = `${window.location.origin}${callbackPath}`;
|
||||
const res = await fetch(`${api}?redirect_uri=${encodeURIComponent(redirectUri)}`);
|
||||
const data = await res.json();
|
||||
if (!res.ok || !data.url) {
|
||||
showMessageDialog('error', data.error || t('login.requestFailed'));
|
||||
return;
|
||||
}
|
||||
if (data.state) {
|
||||
sessionStorage.setItem('hxops_casdoor_state', data.state);
|
||||
}
|
||||
window.location.href = data.url;
|
||||
} catch (e) {
|
||||
console.error(e);
|
||||
showMessageDialog('error', t('login.requestFailed'));
|
||||
}
|
||||
};
|
||||
|
||||
const tryCasdoorCallbackLogin = async () => {
|
||||
if (!config.auth?.casdoor?.enabled) return false;
|
||||
const casdoorPath = config.auth.casdoor.callbackPath || '/casdoor-callback';
|
||||
|
||||
@@ -0,0 +1,253 @@
|
||||
</td>␍
|
||||
</tr>␍
|
||||
<tr height="42px">␍
|
||||
<td align="right" valign="middle" style="padding-right: 12px">␍
|
||||
<span class="STYLE6" id="result0"></span>␍
|
||||
</td>␍
|
||||
</tr>␍
|
||||
</table>␍
|
||||
</td>␍
|
||||
</tr>␍
|
||||
</table>␍
|
||||
</div>␍
|
||||
␍
|
||||
␍
|
||||
<div id="zDialog_div_bottom" class="zDialog_div_bottom">␍
|
||||
<input type="button" style="display:none;" class=zd_btn_submit accessKey=S id=btnsearch value="S-搜索"></input>␍
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!-- 鎵�鏈夋病鏈夊唴瀹圭殑鏍囩璇峰鍔犱竴涓┖鏍� -->
|
||||
<!-- 瀹氫箟琛ㄨ揪寮忔墍浣跨敤鐨勫彉閲� -->
|
||||
|
||||
<table class="LayoutTable" id="" style="display:;width:100%;">
|
||||
<colgroup>
|
||||
<col width="20%"/>
|
||||
<col width="80%"/>
|
||||
</colgroup>
|
||||
<tbody>
|
||||
<!-- 鍒嗙粍寰幆 -->
|
||||
|
||||
|
||||
<tr class="intervalTR">
|
||||
<td class="interval" colspan="2" style="text-align:center;">␍
|
||||
<input type="button" class=zd_btn_submit accessKey=2 id=btnclear value="清除" onclick='onClear();'></input>␍
|
||||
<span class="e8_sep_line">|</span>
|
||||
<input type="button" class=zd_btn_cancle accessKey=T id=btncancel value="取消" onclick='onClose();'></input>␍
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
|
||||
␍
|
||||
<script type="text/javascript">␍
|
||||
jQuery(document).ready(function(){␍
|
||||
resizeDialog(document);␍
|
||||
});␍
|
||||
</script>␍
|
||||
</div>␍
|
||||
</div>␍
|
||||
</BODY></HTML>␍
|
||||
␍
|
||||
␍
|
||||
<script type="text/javascript">␍
|
||||
//<!--␍
|
||||
␍
|
||||
␍
|
||||
//-->␍
|
||||
</script>␍
|
||||
<!-- ␍
|
||||
<SCRIPT LANGUAGE=VBS>␍
|
||||
Sub btnclear_onclick()␍
|
||||
window.parent.returnvalue = Array(0,"")␍
|
||||
window.parent.close␍
|
||||
End Sub␍
|
||||
Sub BrowseTable_onclick()␍
|
||||
Set e = window.event.srcElement␍
|
||||
If e.TagName = "TD" Then ␍
|
||||
window.parent.returnvalue = Array(e.parentelement.cells(0).innerText,e.parentelement.cells(1).innerText,e.parentelement.cells(2).innerText)␍
|
||||
// window.parent.returnvalue = e.parentelement.cells(0).innerText␍
|
||||
window.parent.Close␍
|
||||
ElseIf e.TagName = "A" Then␍
|
||||
window.parent.returnvalue = Array(e.parentelement.parentelement.cells(0).innerText,e.parentelement.parentelement.cells(1).innerText,e.parentelement.parentelement.cells(2).innerText)␍
|
||||
// window.parent.returnvalue = e.parentelement.parentelement.cells(0).innerText␍
|
||||
window.parent.Close␍
|
||||
End If␍
|
||||
␍
|
||||
End Sub␍
|
||||
Sub BrowseTable_onmouseover()␍
|
||||
Set e = window.event.srcElement␍
|
||||
If e.TagName = "TD" Then␍
|
||||
e.parentelement.className = "Selected"␍
|
||||
ElseIf e.TagName = "A" Then␍
|
||||
e.parentelement.parentelement.className = "Selected"␍
|
||||
End If␍
|
||||
End Sub␍
|
||||
Sub BrowseTable_onmouseout()␍
|
||||
Set e = window.event.srcElement␍
|
||||
If e.TagName = "TD" Or e.TagName = "A" Then␍
|
||||
If e.TagName = "TD" Then␍
|
||||
Set p = e.parentelement␍
|
||||
Else␍
|
||||
Set p = e.parentelement.parentelement␍
|
||||
End If␍
|
||||
If p.RowIndex Mod 2 Then␍
|
||||
p.className = "DataLight"␍
|
||||
Else␍
|
||||
p.className = "DataDark"␍
|
||||
End If␍
|
||||
End If␍
|
||||
End Sub␍
|
||||
␍
|
||||
</SCRIPT>␍
|
||||
␍
|
||||
-->␍
|
||||
<SCRIPT LANGUAGE=VBS>␍
|
||||
Sub returnData(returnstr)␍
|
||||
window.parent.returnvalue = returnstr␍
|
||||
window.parent.Close␍
|
||||
End Sub␍
|
||||
</SCRIPT>␍
|
||||
<script language="javascript">␍
|
||||
$(function(){␍
|
||||
try{␍
|
||||
window.parent.setTabObjName("请假类型");␍
|
||||
}catch(e){␍
|
||||
//alert("ddddddddddddd");␍
|
||||
}␍
|
||||
});␍
|
||||
var parentWin = window.parent.parent.getParentWindow(parent);␍
|
||||
var dialog = window.parent.parent.getDialog(parent);␍
|
||||
function onClear()␍
|
||||
{␍
|
||||
var returnjson = {id:"",name:""};␍
|
||||
if(dialog){␍
|
||||
try{␍
|
||||
dialog.callback(returnjson);␍
|
||||
}catch(e){}␍
|
||||
␍
|
||||
try{␍
|
||||
dialog.close(returnjson);␍
|
||||
}catch(e){}␍
|
||||
␍
|
||||
}else{␍
|
||||
␍
|
||||
window.parent.returnValue=returnjson;␍
|
||||
window.parent.close();␍
|
||||
␍
|
||||
}␍
|
||||
}␍
|
||||
function onSubmit()␍
|
||||
{␍
|
||||
SearchForm.submit();␍
|
||||
}␍
|
||||
function onPage(index)␍
|
||||
{␍
|
||||
changeCurpage(index);//TD34490 lv 修改当前页␍
|
||||
SearchForm.submit();␍
|
||||
}␍
|
||||
function onClose()␍
|
||||
{␍
|
||||
if(dialog){␍
|
||||
dialog.close();␍
|
||||
}else{ ␍
|
||||
window.parent.close();␍
|
||||
}␍
|
||||
}␍
|
||||
//TD196207 回车即搜索␍
|
||||
function enterSearch(){␍
|
||||
var event = arguments.callee.caller.arguments[0] || window.event;␍
|
||||
if(event.keyCode == 13){␍
|
||||
SearchForm.submit();␍
|
||||
}␍
|
||||
}␍
|
||||
␍
|
||||
//TD34490 lv 修改当前页␍
|
||||
function changeCurpage(index){␍
|
||||
//document.SearchForm.curpage.value = index;␍
|
||||
}␍
|
||||
␍
|
||||
function BrowseTable_onclick(e){␍
|
||||
var e=e||event;␍
|
||||
var target=e.srcElement||e.target;␍
|
||||
␍
|
||||
if( target.nodeName =="TD"||target.nodeName =="A" ){␍
|
||||
var pNode = target.parentNode;␍
|
||||
if(pNode.nodeName!="TR"){␍
|
||||
pNode = pNode.parentNode;␍
|
||||
}␍
|
||||
var returnjson = {␍
|
||||
id:jQuery(jQuery(target).parents("tr")[0].cells[0]).text(),␍
|
||||
name:jQuery(jQuery(target).parents("tr")[0].cells[1]).text(),␍
|
||||
desc:jQuery(jQuery(target).parents("tr")[0].cells[2]).text()␍
|
||||
};␍
|
||||
if(dialog){␍
|
||||
try{␍
|
||||
dialog.callback(returnjson);␍
|
||||
}catch(e){}␍
|
||||
␍
|
||||
try{␍
|
||||
dialog.close(returnjson);␍
|
||||
}catch(e){}␍
|
||||
␍
|
||||
}else{ ␍
|
||||
window.parent.returnValue=returnjson;␍
|
||||
window.parent.close();␍
|
||||
}␍
|
||||
}␍
|
||||
}␍
|
||||
function afterDoWhenLoaded(){␍
|
||||
␍
|
||||
$("#_xTable").find("table.ListStyle tbody").children("tr[class!='Spacing']").each(function(){␍
|
||||
var tr = jQuery(this);␍
|
||||
tr.bind("click",function(){␍
|
||||
var id = tr.children("td:first").next().attr("spacevalue");␍
|
||||
var name = tr.children("td:first").next().next().text();␍
|
||||
␍
|
||||
var desc = "";␍
|
||||
try␍
|
||||
{␍
|
||||
desc = tr.children("td:first").next().next().next().text();␍
|
||||
}␍
|
||||
catch(e)␍
|
||||
{␍
|
||||
}␍
|
||||
␍
|
||||
␍
|
||||
var returnjson = {'id':id,'name':name,'desc':desc,'href':''};␍
|
||||
if(dialog){␍
|
||||
try{␍
|
||||
dialog.callback(returnjson);␍
|
||||
}catch(e){}␍
|
||||
␍
|
||||
try{␍
|
||||
dialog.close(returnjson);␍
|
||||
}catch(e){}␍
|
||||
}else{␍
|
||||
␍
|
||||
window.parent.returnValue = returnjson;␍
|
||||
window.parent.close();␍
|
||||
␍
|
||||
}␍
|
||||
});␍
|
||||
});␍
|
||||
}␍
|
||||
␍
|
||||
jQuery(function(){␍
|
||||
if(dialog){␍
|
||||
jQuery("#BrowseTable").bind("click",BrowseTable_onclick);␍
|
||||
}else{␍
|
||||
jQuery("#BrowseTable").find("tr[class^='Data'][class!='DataHeader']").bind("click",function(){␍
|
||||
window.parent.returnValue = {id:$(this).find("td:first").text(),name:$(this).find("td:first").next().text(),desc:$(this).find("td:first").next().next().text(),href:''};␍
|
||||
window.parent.close();␍
|
||||
});␍
|
||||
jQuery("#BrowseTable").find("tr[class^='Data'][class!='DataHeader']").bind("mouseover",function(){␍
|
||||
$(this).addClass("Selected");␍
|
||||
});␍
|
||||
jQuery("#BrowseTable").find("tr[class^='Data'][class!='DataHeader']").bind("mouseout",function(){␍
|
||||
$(this).removeClass("Selected");␍
|
||||
});␍
|
||||
}␍
|
||||
});␍
|
||||
␍
|
||||
</script>␍
|
||||
@@ -0,0 +1,182 @@
|
||||
urnvalue = Array(e.parentelement.parentelement.cells(0).innerText,e.parentelement.parentelement.cells(1).innerText,e.parentelement.parentelement.cells(2).innerText)␍
|
||||
// window.parent.returnvalue = e.parentelement.parentelement.cells(0).innerText␍
|
||||
window.parent.Close␍
|
||||
End If␍
|
||||
␍
|
||||
End Sub␍
|
||||
Sub BrowseTable_onmouseover()␍
|
||||
Set e = window.event.srcElement␍
|
||||
If e.TagName = "TD" Then␍
|
||||
e.parentelement.className = "Selected"␍
|
||||
ElseIf e.TagName = "A" Then␍
|
||||
e.parentelement.parentelement.className = "Selected"␍
|
||||
End If␍
|
||||
End Sub␍
|
||||
Sub BrowseTable_onmouseout()␍
|
||||
Set e = window.event.srcElement␍
|
||||
If e.TagName = "TD" Or e.TagName = "A" Then␍
|
||||
If e.TagName = "TD" Then␍
|
||||
Set p = e.parentelement␍
|
||||
Else␍
|
||||
Set p = e.parentelement.parentelement␍
|
||||
End If␍
|
||||
If p.RowIndex Mod 2 Then␍
|
||||
p.className = "DataLight"␍
|
||||
Else␍
|
||||
p.className = "DataDark"␍
|
||||
End If␍
|
||||
End If␍
|
||||
End Sub␍
|
||||
␍
|
||||
</SCRIPT>␍
|
||||
␍
|
||||
-->␍
|
||||
<SCRIPT LANGUAGE=VBS>␍
|
||||
Sub returnData(returnstr)␍
|
||||
window.parent.returnvalue = returnstr␍
|
||||
window.parent.Close␍
|
||||
End Sub␍
|
||||
</SCRIPT>␍
|
||||
<script language="javascript">␍
|
||||
$(function(){␍
|
||||
try{␍
|
||||
window.parent.setTabObjName("请假类型");␍
|
||||
}catch(e){␍
|
||||
//alert("ddddddddddddd");␍
|
||||
}␍
|
||||
});␍
|
||||
var parentWin = window.parent.parent.getParentWindow(parent);␍
|
||||
var dialog = window.parent.parent.getDialog(parent);␍
|
||||
function onClear()␍
|
||||
{␍
|
||||
var returnjson = {id:"",name:""};␍
|
||||
if(dialog){␍
|
||||
try{␍
|
||||
dialog.callback(returnjson);␍
|
||||
}catch(e){}␍
|
||||
␍
|
||||
try{␍
|
||||
dialog.close(returnjson);␍
|
||||
}catch(e){}␍
|
||||
␍
|
||||
}else{␍
|
||||
␍
|
||||
window.parent.returnValue=returnjson;␍
|
||||
window.parent.close();␍
|
||||
␍
|
||||
}␍
|
||||
}␍
|
||||
function onSubmit()␍
|
||||
{␍
|
||||
SearchForm.submit();␍
|
||||
}␍
|
||||
function onPage(index)␍
|
||||
{␍
|
||||
changeCurpage(index);//TD34490 lv 修改当前页␍
|
||||
SearchForm.submit();␍
|
||||
}␍
|
||||
function onClose()␍
|
||||
{␍
|
||||
if(dialog){␍
|
||||
dialog.close();␍
|
||||
}else{ ␍
|
||||
window.parent.close();␍
|
||||
}␍
|
||||
}␍
|
||||
//TD196207 回车即搜索␍
|
||||
function enterSearch(){␍
|
||||
var event = arguments.callee.caller.arguments[0] || window.event;␍
|
||||
if(event.keyCode == 13){␍
|
||||
SearchForm.submit();␍
|
||||
}␍
|
||||
}␍
|
||||
␍
|
||||
//TD34490 lv 修改当前页␍
|
||||
function changeCurpage(index){␍
|
||||
//document.SearchForm.curpage.value = index;␍
|
||||
}␍
|
||||
␍
|
||||
function BrowseTable_onclick(e){␍
|
||||
var e=e||event;␍
|
||||
var target=e.srcElement||e.target;␍
|
||||
␍
|
||||
if( target.nodeName =="TD"||target.nodeName =="A" ){␍
|
||||
var pNode = target.parentNode;␍
|
||||
if(pNode.nodeName!="TR"){␍
|
||||
pNode = pNode.parentNode;␍
|
||||
}␍
|
||||
var returnjson = {␍
|
||||
id:jQuery(jQuery(target).parents("tr")[0].cells[0]).text(),␍
|
||||
name:jQuery(jQuery(target).parents("tr")[0].cells[1]).text(),␍
|
||||
desc:jQuery(jQuery(target).parents("tr")[0].cells[2]).text()␍
|
||||
};␍
|
||||
if(dialog){␍
|
||||
try{␍
|
||||
dialog.callback(returnjson);␍
|
||||
}catch(e){}␍
|
||||
␍
|
||||
try{␍
|
||||
dialog.close(returnjson);␍
|
||||
}catch(e){}␍
|
||||
␍
|
||||
}else{ ␍
|
||||
window.parent.returnValue=returnjson;␍
|
||||
window.parent.close();␍
|
||||
}␍
|
||||
}␍
|
||||
}␍
|
||||
function afterDoWhenLoaded(){␍
|
||||
␍
|
||||
$("#_xTable").find("table.ListStyle tbody").children("tr[class!='Spacing']").each(function(){␍
|
||||
var tr = jQuery(this);␍
|
||||
tr.bind("click",function(){␍
|
||||
var id = tr.children("td:first").next().attr("spacevalue");␍
|
||||
var name = tr.children("td:first").next().next().text();␍
|
||||
␍
|
||||
var desc = "";␍
|
||||
try␍
|
||||
{␍
|
||||
desc = tr.children("td:first").next().next().next().text();␍
|
||||
}␍
|
||||
catch(e)␍
|
||||
{␍
|
||||
}␍
|
||||
␍
|
||||
␍
|
||||
var returnjson = {'id':id,'name':name,'desc':desc,'href':''};␍
|
||||
if(dialog){␍
|
||||
try{␍
|
||||
dialog.callback(returnjson);␍
|
||||
}catch(e){}␍
|
||||
␍
|
||||
try{␍
|
||||
dialog.close(returnjson);␍
|
||||
}catch(e){}␍
|
||||
}else{␍
|
||||
␍
|
||||
window.parent.returnValue = returnjson;␍
|
||||
window.parent.close();␍
|
||||
␍
|
||||
}␍
|
||||
});␍
|
||||
});␍
|
||||
}␍
|
||||
␍
|
||||
jQuery(function(){␍
|
||||
if(dialog){␍
|
||||
jQuery("#BrowseTable").bind("click",BrowseTable_onclick);␍
|
||||
}else{␍
|
||||
jQuery("#BrowseTable").find("tr[class^='Data'][class!='DataHeader']").bind("click",function(){␍
|
||||
window.parent.returnValue = {id:$(this).find("td:first").text(),name:$(this).find("td:first").next().text(),desc:$(this).find("td:first").next().next().text(),href:''};␍
|
||||
window.parent.close();␍
|
||||
});␍
|
||||
jQuery("#BrowseTable").find("tr[class^='Data'][class!='DataHeader']").bind("mouseover",function(){␍
|
||||
$(this).addClass("Selected");␍
|
||||
});␍
|
||||
jQuery("#BrowseTable").find("tr[class^='Data'][class!='DataHeader']").bind("mouseout",function(){␍
|
||||
$(this).removeClass("Selected");␍
|
||||
});␍
|
||||
}␍
|
||||
});␍
|
||||
␍
|
||||
</script>␍
|
||||
Reference in new issue
Block a user