From 4b554204a7f8fdbe0e15b37991ef264fa04a0906 Mon Sep 17 00:00:00 2001 From: smallNorthLee <18210040298@163.com> Date: Thu, 20 Mar 2025 22:50:58 +0800 Subject: [PATCH 1/3] =?UTF-8?q?feat:=20oa=E4=B8=9A=E5=8A=A1=E8=A1=A8?= =?UTF-8?q?=E5=8D=95=E6=B7=BB=E5=8A=A0=E5=AE=A1=E6=89=B9=E4=BA=BA=E9=80=89?= =?UTF-8?q?=E6=8B=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/bpm/oa/leave/create.vue | 219 ++++++++++++++++++------------ 1 file changed, 132 insertions(+), 87 deletions(-) diff --git a/src/views/bpm/oa/leave/create.vue b/src/views/bpm/oa/leave/create.vue index 28a15af73..4160fb038 100644 --- a/src/views/bpm/oa/leave/create.vue +++ b/src/views/bpm/oa/leave/create.vue @@ -1,83 +1,69 @@ -- Gitee From a5c533bff034ffd4e7b87ea9b33dcdb0ef6e4828 Mon Sep 17 00:00:00 2001 From: lizhixian <18210040298@163.com> Date: Fri, 21 Mar 2025 10:24:16 +0800 Subject: [PATCH 2/3] =?UTF-8?q?feat=EF=BC=9A=20=E5=A2=9E=E5=8A=A0=E6=A1=88?= =?UTF-8?q?=E4=BE=8B=E6=B5=81=E7=A8=8B=EF=BC=8C=E4=B8=9A=E5=8A=A1=E8=A1=A8?= =?UTF-8?q?=E5=8D=95=E5=8F=91=E8=B5=B7=E6=97=B6=E9=80=89=E6=8B=A9=E5=AE=A1?= =?UTF-8?q?=E6=89=B9=E4=BA=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/bpm/oa/leave/create.vue | 175 +++++++++++++++++------------- 1 file changed, 97 insertions(+), 78 deletions(-) diff --git a/src/views/bpm/oa/leave/create.vue b/src/views/bpm/oa/leave/create.vue index 4160fb038..b0d66f4a2 100644 --- a/src/views/bpm/oa/leave/create.vue +++ b/src/views/bpm/oa/leave/create.vue @@ -1,70 +1,75 @@ -- Gitee From 913c995562ecbb826d0db2f0041b888d5795fa11 Mon Sep 17 00:00:00 2001 From: lizhixian <18210040298@163.com> Date: Fri, 21 Mar 2025 11:48:13 +0800 Subject: [PATCH 3/3] =?UTF-8?q?feat=EF=BC=9A=E5=A2=9E=E5=8A=A0=E6=A1=88?= =?UTF-8?q?=E4=BE=8B=E6=B5=81=E7=A8=8B=EF=BC=8C=E4=B8=9A=E5=8A=A1=E8=A1=A8?= =?UTF-8?q?=E5=8D=95=E5=8F=91=E8=B5=B7=E6=97=B6=E9=80=89=E6=8B=A9=E5=AE=A1?= =?UTF-8?q?=E6=89=B9=E4=BA=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/bpm/oa/leave/create.vue | 29 +++++++++++++++-------------- 1 file changed, 15 insertions(+), 14 deletions(-) diff --git a/src/views/bpm/oa/leave/create.vue b/src/views/bpm/oa/leave/create.vue index b0d66f4a2..2bd2aa741 100644 --- a/src/views/bpm/oa/leave/create.vue +++ b/src/views/bpm/oa/leave/create.vue @@ -138,12 +138,12 @@ const submitForm = async () => { // 新增 ====== begin ======== /** 获取审批详情 */ -const getApprovalDetail = async (row: any) => { +const getApprovalDetail = async () => { try { const data = await ProcessInstanceApi.getApprovalDetail({ - processDefinitionId: row.id, + processDefinitionId: processDefinitionId.value, activityId: NodeId.START_USER_NODE_ID, - processVariablesStr: row.processVariablesStr // 解决 GET 无法传递对象的问题,后端 String 再转 JSON + processVariablesStr: JSON.stringify({ day: daysDifference() }) // 解决 GET 无法传递对象的问题,后端 String 再转 JSON }) if (!data) { @@ -178,6 +178,13 @@ const getApprovalDetail = async (row: any) => { const selectUserConfirm = (id: string, userList: any[]) => { startUserSelectAssignees.value[id] = userList?.map((item: any) => item.id) } + +// 计算天数差 +const daysDifference = () => { + const oneDay = 24 * 60 * 60 * 1000 // 一天的毫秒数 + const diffTime = Math.abs(Number(formData.value.endTime) - Number(formData.value.startTime)) + return Math.floor(diffTime / oneDay) +} // 新增 ====== end ======== /** 初始化 */ @@ -194,15 +201,12 @@ onMounted(async () => { processDefinitionId.value = processDefinitionDetail.id startUserSelectTasks.value = processDefinitionDetail.startUserSelectTasks // 新增 ====== begin ======== - // 查询流程预测节点 - getApprovalDetail({ - id: processDefinitionId.value, - processVariablesStr: JSON.stringify(formData.value) - }) + // 加载最新的审批详情,主要用于节点预测 + getApprovalDetail() // 新增 ====== end ======== }) // 新增 ====== begin ======== -/** 预测流程节点会因为输入的参数值而产生新的预测结果值,所以需重新预测一次 */ +/** 预测流程节点会因为输入的参数值而产生新的预测结果值,所以需重新预测一次, formData.value可改成实际业务中的特定字段 */ watch( formData.value, (newValue, oldValue) => { @@ -213,11 +217,8 @@ watch( // 记录之前的节点审批人 tempStartUserSelectAssignees.value = startUserSelectAssignees.value startUserSelectAssignees.value = {} - // 加载最新的审批详情 - getApprovalDetail({ - id: processDefinitionId.value, - processVariablesStr: JSON.stringify(newValue) // 解决 GET 无法传递对象的问题,后端 String 再转 JSON - }) + // 加载最新的审批详情,主要用于节点预测 + getApprovalDetail() } }, { -- Gitee