AI请假对接OA自动跳转待提交页面

This commit is contained in:
runny committed 2026-05-18 11:02:26 +08:00
1 parent 059346f1ac
commit c0dde055cd
3 files changed
+52 -10

No files matched your search

@@ -40,6 +40,10 @@ class HRLeaveSQLServerService:
"明细",
"查询",
)
_STRONG_BALANCE_PATTERNS = (
r"(?:假期|年假|育儿假|休假).{0,6}(?:还剩|还有|剩余|可休|已休|未休|多少)",
r"(?:还剩|还有|剩余|可休|已休|未休|多少).{0,6}(?:假期|年假|育儿假|休假)",
)
@staticmethod
def supports(query: str) -> bool:
@@ -50,6 +54,8 @@ class HRLeaveSQLServerService:
return False
if any(keyword in text for keyword in HRLeaveSQLServerService._PROCESS_KEYWORDS):
return False
if any(re.search(pattern, text) for pattern in HRLeaveSQLServerService._STRONG_BALANCE_PATTERNS):
return True
if not any(keyword in text for keyword in HRLeaveSQLServerService._SELF_KEYWORDS):
return False
if any(keyword in text for keyword in HRLeaveSQLServerService._BALANCE_KEYWORDS):
@@ -0,0 +1,13 @@
from app.services.hr_leave_sqlserver import HRLeaveSQLServerService
def test_supports_strong_leave_balance_intent_without_self_pronoun():
assert HRLeaveSQLServerService.supports("假期还有多少")
assert HRLeaveSQLServerService.supports("还有多少假期")
assert HRLeaveSQLServerService.supports("年假还有多少天")
assert HRLeaveSQLServerService.supports("还有多少年假")
def test_supports_rejects_leave_process_questions():
assert not HRLeaveSQLServerService.supports("假期怎么申请")
assert not HRLeaveSQLServerService.supports("年假制度是什么")
+33 -10
View File
@@ -434,15 +434,17 @@ const input = ref('');
const currentAgent = ref<any>(null);
const showGeneralFeedbackDialog = ref(false);
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_BASE_URL = 'http://oa.well-trust.com:8888';
const OA_LOGIN_URL = `${OA_BASE_URL}/login/Login.jsp?logintype=1`;
const OA_VERIFY_LOGIN_URL = `${OA_BASE_URL}/login/VerifyLogin.jsp`;
const OA_LEAVE_APPLY_PATH = '/workflow/request/AddRequest.jsp?workflowid=652&isagent=0&beagenter=0&f_weaver_belongto_userid=';
const OA_REQUEST_VIEW_PATH = '/workflow/request/ViewRequest.jsp?requestid=';
const OA_AUTO_LOGIN_USERNAME = '26040006';
const OA_AUTO_LOGIN_PASSWORD = '26040006';
const OA_AUTO_LOGIN_TARGET = 'hxops-oa-leave-request';
const openOALeaveRequestDirectly = () => {
const popup = window.open(OA_LOGIN_URL, OA_AUTO_LOGIN_TARGET);
const openOAAutoLoginPage = (gopage: string, target = OA_AUTO_LOGIN_TARGET) => {
const popup = window.open(OA_LOGIN_URL, target);
if (!popup) {
showMessageDialog('warning', '浏览器拦截了 OA 页面,请允许弹出窗口后重试。');
return;
@@ -451,13 +453,13 @@ const openOALeaveRequestDirectly = () => {
const form = document.createElement('form');
form.action = OA_VERIFY_LOGIN_URL;
form.method = 'POST';
form.target = OA_AUTO_LOGIN_TARGET;
form.target = target;
form.style.display = 'none';
const fields = {
loginid: OA_AUTO_LOGIN_USERNAME,
userpassword: OA_AUTO_LOGIN_PASSWORD,
gopage: OA_LEAVE_APPLY_PATH,
gopage,
logintype: '1',
};
@@ -476,6 +478,19 @@ const openOALeaveRequestDirectly = () => {
}, 0);
};
const openOALeaveRequestDirectly = () => {
openOAAutoLoginPage(OA_LEAVE_APPLY_PATH);
};
const openOARequestDirectly = (requestId: string) => {
const normalizedRequestId = String(requestId || '').trim();
if (!normalizedRequestId || normalizedRequestId === '-') {
showMessageDialog('warning', '当前未获取到 OA 单据编号,暂时无法打开单据详情。');
return;
}
openOAAutoLoginPage(`${OA_REQUEST_VIEW_PATH}${encodeURIComponent(normalizedRequestId)}`, `hxops-oa-request-${normalizedRequestId}`);
};
const activeFeedbackMessageIndex = ref<number | null>(null);
const browserPanelOpen = ref(false);
const browserDraftUrl = ref('');
@@ -516,8 +531,6 @@ const getLeaveTypeLabel = (val: string) => {
return t ? t.label : val;
};
const LEAVE_RESULT_QUERY_URL = 'http://192.168.100.221:8888/';
interface LeaveRequestFormData {
applicantName: string;
employeeId: string;
@@ -1159,7 +1172,7 @@ const confirmLeaveSubmission = async (msg: any) => {
const resultMsg = {
role: 'assistant' as const,
type: 'leave-result' as const,
content: `请假单已提交到 OA,具体单据请到 ${LEAVE_RESULT_QUERY_URL} 查询。`,
content: '请假单已推送到 OA,具体单据请 【 登录OA系统查看提交】',
payload: {
formId: payload.formId,
success: true,
@@ -1763,7 +1776,17 @@ const showChatRating = ref(false);
: '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 v-if="getLeaveResultPayload(msg)!.success" class="mt-2 whitespace-pre-wrap text-sm leading-7">
请假单已推送到 OA,具体单据请
<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系统查看提交】
</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>