Merge branch 'test' into prod
# Conflicts: # backend/Dockerfile
This commit is contained in:
commit
fd049f98db
18 files changed
+461
-140
No files matched your search
@@ -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;
|
||||
@@ -666,11 +679,38 @@ const formatDurationLabel = (hours: number) => {
|
||||
return `${hours} 小时`;
|
||||
};
|
||||
|
||||
const createLeaveFormData = (): LeaveRequestFormData => {
|
||||
const extractLeaveTypeFromIntent = (content: string) => {
|
||||
if (!content) return '';
|
||||
const map: Record<string, string> = {
|
||||
'事假': '005',
|
||||
'病假': '006',
|
||||
'丧假': '007',
|
||||
'年假': '010',
|
||||
'因公出差': '021',
|
||||
'出差': '021',
|
||||
'调休': '025',
|
||||
'产假': '401',
|
||||
'陪产假': '402',
|
||||
'婚假': '403',
|
||||
'住院': '405',
|
||||
'工伤': '406',
|
||||
'育儿假': '408',
|
||||
'返乡': 'ZZ01',
|
||||
};
|
||||
for (const [key, val] of Object.entries(map)) {
|
||||
if (content.includes(key)) {
|
||||
return val;
|
||||
}
|
||||
}
|
||||
return '';
|
||||
};
|
||||
|
||||
const createLeaveFormData = (content?: string): LeaveRequestFormData => {
|
||||
const now = new Date();
|
||||
const oneHourLater = new Date(now.getTime() + 60 * 60 * 1000);
|
||||
const startTime = formatDateTime(now);
|
||||
const endTime = formatDateTime(oneHourLater);
|
||||
const initialLeaveType = extractLeaveTypeFromIntent(content || '');
|
||||
return {
|
||||
applicantName: currentUserDisplayName.value,
|
||||
employeeId: currentUserEmployeeId.value,
|
||||
@@ -680,7 +720,7 @@ const createLeaveFormData = (): LeaveRequestFormData => {
|
||||
agentUid: '',
|
||||
agentEmployeeId: '',
|
||||
agentName: '',
|
||||
leaveType: '',
|
||||
leaveType: initialLeaveType,
|
||||
startTime,
|
||||
endTime,
|
||||
durationHours: calculateDurationHours(startTime, endTime),
|
||||
@@ -705,8 +745,8 @@ const isStrongLeaveIntent = (content: string) => {
|
||||
// 弱意图(咨询流程/步骤)应走正常问答,不触发表单分流。
|
||||
const weakConsultationIntent = /(请假流程|请假怎么走|请假步骤|请假如何申请|请假如何走流程|请假怎么办|请假需要什么|请假规定)/;
|
||||
if (weakConsultationIntent.test(normalized)) return false;
|
||||
if (/^(请假|休假)$/.test(normalized)) return true;
|
||||
return /(我要请假|申请请假|发起请假|请假申请|我要休假|申请休假|我要请个假|想请假|帮我请假|代我请假|提交请假)/.test(normalized);
|
||||
if (/^(请假|休假|年假|事假|病假|调休)$/.test(normalized)) return true;
|
||||
return /(我要请|申请请|发起请|请假申请|我要休|申请休|想请|帮我请|代我请|提交请)/.test(normalized);
|
||||
};
|
||||
|
||||
const saveLocalMessageToBackend = async (msg: any, userQuery: string = '') => {
|
||||
@@ -744,7 +784,7 @@ const startLocalLeaveFlow = async (content: string) => {
|
||||
const formId = newLocalMessageId('leave-form');
|
||||
const payload: LeaveFormPayload = {
|
||||
formId,
|
||||
form: createLeaveFormData(),
|
||||
form: createLeaveFormData(content),
|
||||
submitting: false,
|
||||
confirmationGenerated: false,
|
||||
};
|
||||
@@ -1132,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,
|
||||
@@ -1736,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>
|
||||
|
||||
Reference in new issue
Block a user