feat:增加案例流程,业务表单发起时选择审批人

This commit is contained in:
lizhixian 2025-03-21 11:48:13 +08:00
parent a5c533bff0
commit 913c995562

View File

@ -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()
}
},
{