请假流程优化
This commit is contained in:
1 parent
d895754d70
commit
9de63c916c
2 files changed
+162
-123
No files matched your search
+101
-92
@@ -431,61 +431,47 @@ const { messages, isThinking, conversationId, sendMessage } = useChat();
|
||||
const input = ref('');
|
||||
const currentAgent = ref<any>(null);
|
||||
const showGeneralFeedbackDialog = ref(false);
|
||||
const showOALoginModal = ref(false);
|
||||
const oaLoginForm = ref({ username: '', password: '' });
|
||||
|
||||
const openOALoginModal = () => {
|
||||
oaLoginForm.value = {
|
||||
username: currentUserEmployeeId.value || currentUser.value?.username || '',
|
||||
password: ''
|
||||
};
|
||||
showOALoginModal.value = true;
|
||||
};
|
||||
const OA_LOGIN_URL = 'http://192.168.100.221:8888/login/Login.jsp?logintype=1';
|
||||
const OA_VERIFY_LOGIN_URL = 'http://192.168.100.221:8888/login/VerifyLogin.jsp';
|
||||
const OA_LEAVE_APPLY_PATH = '/workflow/request/AddRequest.jsp?workflowid=652&isagent=0&beagenter=0&f_weaver_belongto_userid=';
|
||||
const OA_AUTO_LOGIN_USERNAME = '26040006';
|
||||
const OA_AUTO_LOGIN_PASSWORD = '26040006';
|
||||
const OA_AUTO_LOGIN_TARGET = 'hxops-oa-leave-request';
|
||||
|
||||
const submitOALogin = () => {
|
||||
if (!oaLoginForm.value.username || !oaLoginForm.value.password) {
|
||||
showMessageDialog('error', '请输入账号和密码');
|
||||
const openOALeaveRequestDirectly = () => {
|
||||
const popup = window.open(OA_LOGIN_URL, OA_AUTO_LOGIN_TARGET);
|
||||
if (!popup) {
|
||||
showMessageDialog('warning', '浏览器拦截了 OA 页面,请允许弹出窗口后重试。');
|
||||
return;
|
||||
}
|
||||
|
||||
// 要跳转的目标 OA 页面
|
||||
const targetUrl = '/workflow/request/AddRequest.jsp?workflowid=652&isagent=0&beagenter=0&f_weaver_belongto_userid=';
|
||||
|
||||
// 创建隐藏表单进行 POST 提交到 OA 登录接口
|
||||
|
||||
const form = document.createElement('form');
|
||||
form.action = 'http://192.168.100.221:8888/login/VerifyLogin.jsp';
|
||||
form.action = OA_VERIFY_LOGIN_URL;
|
||||
form.method = 'POST';
|
||||
form.target = '_blank';
|
||||
|
||||
const inputLoginId = document.createElement('input');
|
||||
inputLoginId.type = 'hidden';
|
||||
inputLoginId.name = 'loginid';
|
||||
inputLoginId.value = oaLoginForm.value.username;
|
||||
form.appendChild(inputLoginId);
|
||||
|
||||
const inputPassword = document.createElement('input');
|
||||
inputPassword.type = 'hidden';
|
||||
inputPassword.name = 'userpassword';
|
||||
inputPassword.value = oaLoginForm.value.password;
|
||||
form.appendChild(inputPassword);
|
||||
|
||||
const inputGoPage = document.createElement('input');
|
||||
inputGoPage.type = 'hidden';
|
||||
inputGoPage.name = 'gopage';
|
||||
inputGoPage.value = targetUrl;
|
||||
form.appendChild(inputGoPage);
|
||||
|
||||
const inputLogintype = document.createElement('input');
|
||||
inputLogintype.type = 'hidden';
|
||||
inputLogintype.name = 'logintype';
|
||||
inputLogintype.value = '1';
|
||||
form.appendChild(inputLogintype);
|
||||
|
||||
form.target = OA_AUTO_LOGIN_TARGET;
|
||||
form.style.display = 'none';
|
||||
|
||||
const fields = {
|
||||
loginid: OA_AUTO_LOGIN_USERNAME,
|
||||
userpassword: OA_AUTO_LOGIN_PASSWORD,
|
||||
gopage: OA_LEAVE_APPLY_PATH,
|
||||
logintype: '1',
|
||||
};
|
||||
|
||||
Object.entries(fields).forEach(([name, value]) => {
|
||||
const input = document.createElement('input');
|
||||
input.type = 'hidden';
|
||||
input.name = name;
|
||||
input.value = value;
|
||||
form.appendChild(input);
|
||||
});
|
||||
|
||||
document.body.appendChild(form);
|
||||
form.submit();
|
||||
document.body.removeChild(form);
|
||||
|
||||
showOALoginModal.value = false;
|
||||
window.setTimeout(() => {
|
||||
form.submit();
|
||||
document.body.removeChild(form);
|
||||
}, 0);
|
||||
};
|
||||
|
||||
const activeFeedbackMessageIndex = ref<number | null>(null);
|
||||
@@ -633,6 +619,7 @@ const isStrongLeaveIntent = (content: string) => {
|
||||
// 弱意图(咨询流程/步骤)应走正常问答,不触发表单分流。
|
||||
const weakConsultationIntent = /(请假流程|请假怎么走|请假步骤|请假如何申请|请假如何走流程|请假怎么办|请假需要什么|请假规定)/;
|
||||
if (weakConsultationIntent.test(normalized)) return false;
|
||||
if (/^(请假|休假)$/.test(normalized)) return true;
|
||||
return /(我要请假|申请请假|发起请假|请假申请|我要休假|申请休假|我要请个假|想请假|帮我请假|代我请假|提交请假)/.test(normalized);
|
||||
};
|
||||
|
||||
@@ -655,6 +642,16 @@ const startLocalLeaveFlow = (content: string) => {
|
||||
});
|
||||
};
|
||||
|
||||
const handleChatMarkdownClick = (event: MouseEvent) => {
|
||||
const target = event.target as HTMLElement | null;
|
||||
const actionElement = target?.closest?.('[data-leave-action]') as HTMLElement | null;
|
||||
if (!actionElement) return;
|
||||
const action = actionElement.getAttribute('data-leave-action');
|
||||
if (action !== 'start-leave-flow' || isThinking.value) return;
|
||||
event.preventDefault();
|
||||
startLocalLeaveFlow('我要请假');
|
||||
};
|
||||
|
||||
const getLeaveFormPayload = (msg: any): LeaveFormPayload | null => (
|
||||
msg?.type === 'leave-form' && msg?.payload ? msg.payload as LeaveFormPayload : null
|
||||
);
|
||||
@@ -1263,8 +1260,11 @@ const showChatRating = ref(false);
|
||||
<main
|
||||
ref="chatScrollContainer"
|
||||
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'"
|
||||
:class="messages.length === 0 ? 'overflow-hidden md:overflow-y-auto' : 'overflow-y-auto scrollbar-thin'"
|
||||
>
|
||||
<div
|
||||
:class="messages.length === 0 ? 'h-full' : 'flex min-h-full flex-col justify-end'"
|
||||
>
|
||||
<div v-if="messages.length === 0" class="flex h-full flex-col items-center justify-center py-2 md:pb-16">
|
||||
<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
|
||||
@@ -1275,7 +1275,7 @@ const showChatRating = ref(false);
|
||||
<template v-for="(msg, index) in messages" :key="index">
|
||||
<div
|
||||
v-if="shouldRenderMessage(msg)"
|
||||
class="group mx-auto flex max-w-4xl animate-slide-up mb-6"
|
||||
class="group mx-auto mb-6 flex w-full max-w-4xl animate-slide-up"
|
||||
:class="msg.role === 'user' ? 'justify-end' : 'justify-start'"
|
||||
>
|
||||
<div
|
||||
@@ -1296,7 +1296,7 @@ const showChatRating = ref(false);
|
||||
<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="openOALoginModal" class="text-brand-600 font-bold hover:underline">登录OA系统直接申请</a>
|
||||
已为你生成请假申请表,请直接在下方填写并提交。或 <a href="#" @click.prevent="openOALeaveRequestDirectly" class="text-brand-600 font-bold hover:underline">登录OA系统直接申请</a>
|
||||
</template>
|
||||
<template v-else>
|
||||
{{ msg.content }}
|
||||
@@ -1453,6 +1453,7 @@ const showChatRating = ref(false);
|
||||
<div
|
||||
v-else
|
||||
class="chat-markdown 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"
|
||||
@click="handleChatMarkdownClick"
|
||||
v-html="renderMarkdown(msg.content)"
|
||||
></div>
|
||||
</div>
|
||||
@@ -1570,7 +1571,7 @@ const showChatRating = ref(false);
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<div v-if="shouldShowThinkingBubble" class="mx-auto flex max-w-5xl">
|
||||
<div v-if="shouldShowThinkingBubble" class="mx-auto flex w-full max-w-4xl justify-start">
|
||||
<div class="flex items-center gap-3 rounded-2xl rounded-tl-md border border-slate-200 bg-white/95 px-5 py-3 shadow-md dark:border-slate-700 dark:bg-slate-900/85">
|
||||
<div class="flex gap-1">
|
||||
<span class="h-2 w-2 animate-bounce rounded-full bg-brand-400"></span>
|
||||
@@ -1580,7 +1581,8 @@ const showChatRating = ref(false);
|
||||
<span class="text-sm font-medium text-slate-500 dark:text-slate-300">{{ $t('chat.thinking') }}</span>
|
||||
</div>
|
||||
</div>
|
||||
<div v-if="messages.length > 0" class="h-6 md:h-8"></div>
|
||||
<div v-if="messages.length > 0" class="h-2 md:h-3"></div>
|
||||
</div>
|
||||
</main>
|
||||
|
||||
<footer class="safe-bottom sticky bottom-0 z-20 bg-transparent p-3 md:p-6">
|
||||
@@ -1769,45 +1771,6 @@ const showChatRating = ref(false);
|
||||
}"
|
||||
/>
|
||||
|
||||
<div
|
||||
v-if="showOALoginModal"
|
||||
class="fixed inset-0 z-[100] flex items-center justify-center bg-black/40 backdrop-blur-sm p-4"
|
||||
>
|
||||
<div class="w-full max-w-sm rounded-2xl bg-white p-6 shadow-2xl dark:bg-slate-900">
|
||||
<div class="mb-5 flex items-center justify-between">
|
||||
<h3 class="text-lg font-bold text-slate-800 dark:text-slate-100">登录OA系统</h3>
|
||||
<button @click="showOALoginModal = false" class="text-slate-400 hover:text-slate-600 dark:hover:text-slate-200">
|
||||
<X class="h-5 w-5" />
|
||||
</button>
|
||||
</div>
|
||||
<div class="space-y-4">
|
||||
<div class="space-y-1.5">
|
||||
<label class="text-sm font-semibold text-slate-600 dark:text-slate-300">账号</label>
|
||||
<input
|
||||
v-model="oaLoginForm.username"
|
||||
type="text"
|
||||
placeholder="请输入账号"
|
||||
class="w-full rounded-xl border border-slate-200 bg-slate-50 px-4 py-2.5 text-sm outline-none focus:border-brand-500 focus:ring-1 focus:ring-brand-500 dark:border-slate-700 dark:bg-slate-800 dark:text-slate-100"
|
||||
/>
|
||||
</div>
|
||||
<div class="space-y-1.5">
|
||||
<label class="text-sm font-semibold text-slate-600 dark:text-slate-300">密码</label>
|
||||
<input
|
||||
v-model="oaLoginForm.password"
|
||||
type="password"
|
||||
placeholder="请输入密码"
|
||||
class="w-full rounded-xl border border-slate-200 bg-slate-50 px-4 py-2.5 text-sm outline-none focus:border-brand-500 focus:ring-1 focus:ring-brand-500 dark:border-slate-700 dark:bg-slate-800 dark:text-slate-100"
|
||||
/>
|
||||
</div>
|
||||
<button
|
||||
@click="submitOALogin"
|
||||
class="mt-2 w-full rounded-xl bg-brand-600 py-2.5 text-sm font-semibold text-white transition-colors hover:bg-brand-500"
|
||||
>
|
||||
确认登录
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
@@ -1844,4 +1807,50 @@ const showChatRating = ref(false);
|
||||
:deep(.chat-markdown details pre) {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
|
||||
:deep(.chat-markdown .leave-action-trigger) {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
margin: 0 0.2rem;
|
||||
padding: 0.1rem 0.6rem;
|
||||
border-radius: 9999px;
|
||||
border: 1px solid rgb(59 130 246 / 0.28);
|
||||
background: rgb(239 246 255);
|
||||
color: rgb(29 78 216);
|
||||
font-weight: 600;
|
||||
text-decoration: none;
|
||||
cursor: pointer;
|
||||
transition: all 0.2s ease;
|
||||
}
|
||||
|
||||
:deep(.chat-markdown .leave-action-trigger:hover) {
|
||||
background: rgb(219 234 254);
|
||||
border-color: rgb(59 130 246 / 0.4);
|
||||
}
|
||||
|
||||
:deep(.chat-markdown .leave-intent-highlight) {
|
||||
display: inline-block;
|
||||
margin: 0 0.2rem;
|
||||
padding: 0.05rem 0.4rem;
|
||||
border-radius: 0.5rem;
|
||||
background: rgb(254 249 195);
|
||||
color: rgb(161 98 7);
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
:deep(.dark .chat-markdown .leave-action-trigger) {
|
||||
border-color: rgb(96 165 250 / 0.35);
|
||||
background: rgb(30 41 59);
|
||||
color: rgb(147 197 253);
|
||||
}
|
||||
|
||||
:deep(.dark .chat-markdown .leave-action-trigger:hover) {
|
||||
background: rgb(30 64 175 / 0.25);
|
||||
}
|
||||
|
||||
:deep(.dark .chat-markdown .leave-intent-highlight) {
|
||||
background: rgb(113 63 18 / 0.45);
|
||||
color: rgb(253 224 71);
|
||||
}
|
||||
</style>
|
||||
Reference in new issue
Block a user