代码整理
This commit is contained in:
1 parent
da3c9c4041
commit
3c3dcfb478
2 files changed
+147
-587
No files matched your search
+146
-586
@@ -68,10 +68,20 @@ class TaskService extends Service {
|
|||||||
await this.submitNode(updateItem, type, 0, 'updateTask')
|
await this.submitNode(updateItem, type, 0, 'updateTask')
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async amendTask() {
|
||||||
|
const { actionData } = this.ctx.request.body.appData;
|
||||||
|
var updateItem = {
|
||||||
|
...actionData,
|
||||||
|
taskInfo: JSON.parse(actionData.taskInfo),
|
||||||
|
taskWorkflow: JSON.parse(actionData.taskWorkflow)
|
||||||
|
}
|
||||||
|
|
||||||
|
await this.submitNode(updateItem, '同意', 1, 'createTask')
|
||||||
|
}
|
||||||
|
|
||||||
async submitNode(taskData, type, times, action) {
|
async submitNode(taskData, type, times, action) {
|
||||||
const { jianghuKnex } = this.app;
|
const { jianghuKnex } = this.app;
|
||||||
const { updateTaskData, historyInsertData, noticeInsertData } = await this.buildNext1({ taskData: taskData, type: type, times: times, action: action })
|
const { updateTaskData, historyInsertData, noticeInsertData } = await this.buildNext({ taskData: taskData, type: type, times: times, action: action })
|
||||||
const userList = jianghuKnex('enterprise_user').select()
|
|
||||||
|
|
||||||
console.log('updateTaskData------', updateTaskData);
|
console.log('updateTaskData------', updateTaskData);
|
||||||
console.log('historyInsertData------', historyInsertData);
|
console.log('historyInsertData------', historyInsertData);
|
||||||
@@ -84,10 +94,11 @@ class TaskService extends Service {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
async buildNext1({ taskData, type, times, action }) {
|
async buildNext({ taskData, type, times, action }) {
|
||||||
const { jianghuKnex } = this.app;
|
var that = this
|
||||||
|
const { jianghuKnex } = that.app;
|
||||||
const { userId, username } = this.ctx.userInfo;
|
const { userId, username } = this.ctx.userInfo;
|
||||||
const { taskId, taskInfo, taskWorkflow, taskConfigId, taskEditUserList, taskEditedUserList } = taskData;
|
const { taskId, taskInfo, taskWorkflow, taskConfigId, taskEditUserList, taskEditedUserList, taskViewUserList } = taskData;
|
||||||
|
|
||||||
const taskHistory = await jianghuKnex('task_history')
|
const taskHistory = await jianghuKnex('task_history')
|
||||||
.where({ taskId })
|
.where({ taskId })
|
||||||
@@ -96,24 +107,26 @@ class TaskService extends Service {
|
|||||||
.select();
|
.select();
|
||||||
const userList = await jianghuKnex('enterprise_user').select();
|
const userList = await jianghuKnex('enterprise_user').select();
|
||||||
|
|
||||||
console.log('taskHistory+++_', taskHistory);
|
|
||||||
|
|
||||||
var updateTaskData = {},
|
var updateTaskData = {},
|
||||||
historyInsertData = [],
|
historyInsertData = [],
|
||||||
noticeInsertData = [],
|
noticeInsertData = [],
|
||||||
curNode = taskWorkflow.nodeList.find(node => node.id == taskConfigId),
|
curNode = await taskWorkflow.nodeList.find(node => node.id == taskConfigId),
|
||||||
curNodeType = curNode?.properties.type,
|
curNodeType = curNode?.properties.type,
|
||||||
taskStatus = "running",
|
taskStatus = "running",
|
||||||
taskHistoryUser = [...taskHistory.map(h => h.createHistoryBy)];
|
taskHistoryUser = [...taskHistory.map(h => h.createHistoryBy)],
|
||||||
|
editUserList = taskEditUserList && taskEditUserList.split(',') || [],
|
||||||
|
editedUserList = taskEditedUserList && taskEditedUserList.split(',') || [],
|
||||||
|
bannedUser = [];
|
||||||
|
const { autoApprovel, abnormalType, abnormalUser } = taskInfo;
|
||||||
|
|
||||||
|
// 如果是审批进入,就加上本次审批人,用来判断可以自动审批的人
|
||||||
if (action == 'updateTask') taskHistoryUser.push(userId)
|
if (action == 'updateTask') taskHistoryUser.push(userId)
|
||||||
// 插入上一次节点历史
|
|
||||||
if (!taskData?.createHistoryBy) taskData.createHistoryBy = [userId]
|
|
||||||
taskStatus = curNodeType == 'end' ? 'end' : 'running'
|
|
||||||
console.log("taskData----", taskStatus, taskData);
|
|
||||||
|
|
||||||
// 判断是不是抄送节点,taskLineTypeList,taskExplain,taskHandleDesc,createHistoryBy
|
// 审批进入是没有createHistoryBy的,自动流转到下一个节点是有createHistoryBy的
|
||||||
if (curNodeType == 'noticeTask') {
|
if (!taskData?.createHistoryBy) taskData.createHistoryBy = [userId]
|
||||||
|
|
||||||
|
switch (curNodeType) {
|
||||||
|
case 'noticeTask':
|
||||||
taskData = {
|
taskData = {
|
||||||
...taskData,
|
...taskData,
|
||||||
taskLineTypeList: '抄送',
|
taskLineTypeList: '抄送',
|
||||||
@@ -122,7 +135,8 @@ class TaskService extends Service {
|
|||||||
createHistoryBy: taskEditUserList && taskEditUserList.split(',') || []
|
createHistoryBy: taskEditUserList && taskEditUserList.split(',') || []
|
||||||
}
|
}
|
||||||
historyInsertData.push(...await this.createTaskHistory({ taskData, taskStatus, type }))
|
historyInsertData.push(...await this.createTaskHistory({ taskData, taskStatus, type }))
|
||||||
} else if (curNodeType == 'end') {
|
break;
|
||||||
|
case 'end':
|
||||||
taskData = {
|
taskData = {
|
||||||
...taskData,
|
...taskData,
|
||||||
taskLineTypeList: '结束',
|
taskLineTypeList: '结束',
|
||||||
@@ -132,100 +146,29 @@ class TaskService extends Service {
|
|||||||
}
|
}
|
||||||
// 插入任务的结束记录
|
// 插入任务的结束记录
|
||||||
historyInsertData.push(...await this.createTaskHistory({ taskData, taskStatus, type }))
|
historyInsertData.push(...await this.createTaskHistory({ taskData, taskStatus, type }))
|
||||||
}
|
break;
|
||||||
|
|
||||||
|
|
||||||
// 判断是否同意
|
|
||||||
if (type == '同意') {
|
|
||||||
switch (curNodeType) {
|
|
||||||
case 'approvalTask':
|
case 'approvalTask':
|
||||||
var curApprovalType = curNode?.properties.approvalType,
|
// times为0表示首次进入该函数,无迭代
|
||||||
editUserList = taskEditUserList && taskEditUserList.split(',') || [],
|
|
||||||
editedUserList = taskEditedUserList && taskEditedUserList.split(',') || [];
|
|
||||||
|
|
||||||
const { autoApprovel, abnormalType, abnormalUser } = taskInfo
|
|
||||||
|
|
||||||
if (times == 0) {
|
if (times == 0) {
|
||||||
editUserList = editUserList.filter(u => u != userId)
|
editUserList = editUserList.filter(u => u != userId)
|
||||||
editedUserList.splice(-1, 0, userId)
|
editedUserList.splice(-1, 0, userId)
|
||||||
historyInsertData.push(...await this.createTaskHistory({ taskData, taskStatus, type }))
|
historyInsertData.push(...await this.createTaskHistory({ taskData, taskStatus, type }))
|
||||||
}
|
}
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 再判断是否需要结束审批流或流转到下一节点
|
||||||
|
if (type == '同意') {
|
||||||
|
switch (curNodeType) {
|
||||||
|
case 'approvalTask':
|
||||||
|
var curApprovalType = curNode?.properties.approvalType;
|
||||||
|
|
||||||
if (['会签'].includes(curApprovalType)) {
|
if (['会签'].includes(curApprovalType)) {
|
||||||
// 检查是否需要异常处理
|
await handleBanned()
|
||||||
// 先检查即将审批的人是否存在账号禁用情况
|
|
||||||
// 1、abnormalType == -1 自动通过
|
|
||||||
// 2、abnormalType == 1 替换成abnormalUser的人 再检查是否被禁用,否则就自动通过
|
|
||||||
|
|
||||||
// 检查是否需要替换人 abnormalType, abnormalUser
|
// 自动审批
|
||||||
var bannedUser = []
|
|
||||||
editUserList.forEach(editUser => {
|
|
||||||
var isBanned = userList.find(u => u.userId == editUser) == undefined ? true : false
|
|
||||||
if (isBanned) bannedUser.push(editUser)
|
|
||||||
|
|
||||||
return isBanned
|
|
||||||
})
|
|
||||||
if (bannedUser.length > 0) {
|
|
||||||
// 自动转交给指定人
|
|
||||||
if (abnormalType == 1 && userList.find(u => u.userId == abnormalUser) !== undefined) {
|
|
||||||
// 从后往前遍历,以避免索引变化的影响
|
|
||||||
for (let i = editUserList.length - 1; i >= 0; i--) {
|
|
||||||
if (bannedUser.includes(editUserList[i])) {
|
|
||||||
// 在当前索引之后插入 0
|
|
||||||
editUserList.splice(i + 1, 0, abnormalUser);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
var abnormalUserName = userList.find(u => u.userId == abnormalUser)?.username || abnormalUser
|
|
||||||
// 插入历史记录
|
|
||||||
taskData = {
|
|
||||||
...taskData,
|
|
||||||
taskComment: "账号禁用,系统自动转交" + abnormalUserName,
|
|
||||||
taskExplain: "系统自动转交",
|
|
||||||
taskHandleDesc: "同意",
|
|
||||||
taskLineTypeList: "同意",
|
|
||||||
createHistoryBy: bannedUser,
|
|
||||||
operationAt: dayjs().format("YYYY-MM-DD HH:mm:ss")
|
|
||||||
}
|
|
||||||
historyInsertData.push(...await this.createTaskHistory({ taskData, taskStatus, type }))
|
|
||||||
|
|
||||||
editUserList = editUserList.filter(editUser => !bannedUser.includes(editUser))
|
|
||||||
editedUserList = editedUserList ? editedUserList.concat(bannedUser) : bannedUser
|
|
||||||
|
|
||||||
// 修改审批流
|
|
||||||
var newUserIdList = curNode.properties.userIdList
|
|
||||||
|
|
||||||
// 从后往前遍历,以避免索引变化的影响
|
|
||||||
for (let i = newUserIdList.length - 1; i >= 0; i--) {
|
|
||||||
if (bannedUser.includes(newUserIdList[i])) {
|
|
||||||
// 在当前索引之后插入 0
|
|
||||||
newUserIdList.splice(i + 1, 0, abnormalUser);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
const foundNode = taskWorkflow.nodeList.find(node => node.id == curNode.id);
|
|
||||||
if (foundNode) {
|
|
||||||
foundNode.properties.userIdList = newUserIdList;
|
|
||||||
}
|
|
||||||
updateTaskData.taskWorkflow = JSON.stringify(_.cloneDeep(taskWorkflow))
|
|
||||||
} else {
|
|
||||||
// 自动同意
|
|
||||||
editUserList = editUserList.filter(editUser => !bannedUser.includes(editUser))
|
|
||||||
editedUserList = editedUserList ? editedUserList.concat(bannedUser) : bannedUser
|
|
||||||
|
|
||||||
taskData = {
|
|
||||||
...taskData,
|
|
||||||
taskComment: "账号禁用,自动同意",
|
|
||||||
taskExplain: "系统自动转交",
|
|
||||||
taskHandleDesc: "同意",
|
|
||||||
taskLineTypeList: "同意",
|
|
||||||
createHistoryBy: bannedUser,
|
|
||||||
operationAt: dayjs().format("YYYY-MM-DD HH:mm:ss")
|
|
||||||
}
|
|
||||||
|
|
||||||
historyInsertData.push(...await this.createTaskHistory({ taskData, taskStatus, type }))
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// 把可以自动审批的人给审批了
|
|
||||||
if (autoApprovel == 1 && times == 1) {
|
if (autoApprovel == 1 && times == 1) {
|
||||||
var autoApprovelUser = _.intersection(taskHistoryUser, editUserList)
|
var autoApprovelUser = _.intersection(taskHistoryUser, editUserList)
|
||||||
|
|
||||||
@@ -247,28 +190,7 @@ class TaskService extends Service {
|
|||||||
|
|
||||||
// 判断是否全部审批完成
|
// 判断是否全部审批完成
|
||||||
if (_.differenceWith(curNode.properties.userIdList, editedUserList, _.isEqual).length == 0) {
|
if (_.differenceWith(curNode.properties.userIdList, editedUserList, _.isEqual).length == 0) {
|
||||||
var nextNode = await this.getNextNode(taskWorkflow, curNode)
|
await goToNextNode()
|
||||||
|
|
||||||
editUserList = nextNode.properties.userIdList;
|
|
||||||
editedUserList = null;
|
|
||||||
|
|
||||||
taskData = {
|
|
||||||
...taskData,
|
|
||||||
taskConfigId: nextNode.id,
|
|
||||||
taskEditUserList: editUserList?.join(','),
|
|
||||||
taskEditedUserList: editedUserList?.join(','),
|
|
||||||
taskComment: null,
|
|
||||||
taskExplain: null,
|
|
||||||
taskHandleDesc: null,
|
|
||||||
taskLineTypeList: null,
|
|
||||||
createHistoryBy: null,
|
|
||||||
operationAt: dayjs().format("YYYY-MM-DD HH:mm:ss")
|
|
||||||
}
|
|
||||||
|
|
||||||
const result = await this.buildNext1({ taskData, type: '同意', times: 1, action })
|
|
||||||
_.assign(updateTaskData, result.updateTaskData)
|
|
||||||
historyInsertData.push(...result.historyInsertData)
|
|
||||||
noticeInsertData.push(...result.noticeInsertData)
|
|
||||||
} else {
|
} else {
|
||||||
_.assign(updateTaskData, {
|
_.assign(updateTaskData, {
|
||||||
taskConfigId: curNode.id,
|
taskConfigId: curNode.id,
|
||||||
@@ -279,124 +201,14 @@ class TaskService extends Service {
|
|||||||
} else if (['或签'].includes(curApprovalType)) {
|
} else if (['或签'].includes(curApprovalType)) {
|
||||||
if (times == 0) {
|
if (times == 0) {
|
||||||
// 手动审批直接进入下一节点
|
// 手动审批直接进入下一节点
|
||||||
var nextNode = await this.getNextNode(taskWorkflow, curNode)
|
await goToNextNode()
|
||||||
|
|
||||||
editUserList = nextNode.properties.userIdList;
|
|
||||||
editedUserList = null;
|
|
||||||
|
|
||||||
taskData = {
|
|
||||||
...taskData,
|
|
||||||
taskConfigId: nextNode.id,
|
|
||||||
taskEditUserList: editUserList?.join(','),
|
|
||||||
taskEditedUserList: editedUserList?.join(','),
|
|
||||||
taskComment: null,
|
|
||||||
taskExplain: null,
|
|
||||||
taskHandleDesc: null,
|
|
||||||
taskLineTypeList: null,
|
|
||||||
createHistoryBy: null,
|
|
||||||
operationAt: dayjs().format("YYYY-MM-DD HH:mm:ss")
|
|
||||||
}
|
|
||||||
|
|
||||||
const result = await this.buildNext1({ taskData, type: '同意', times: 1, action })
|
|
||||||
_.assign(updateTaskData, result.updateTaskData)
|
|
||||||
historyInsertData.push(...result.historyInsertData)
|
|
||||||
noticeInsertData.push(...result.noticeInsertData)
|
|
||||||
} else {
|
} else {
|
||||||
var bannedUser = []
|
await handleBanned()
|
||||||
editUserList.forEach(editUser => {
|
|
||||||
var isBanned = userList.find(u => u.userId == editUser) == undefined ? true : false
|
|
||||||
if (isBanned) bannedUser.push(editUser)
|
|
||||||
|
|
||||||
return isBanned
|
|
||||||
})
|
|
||||||
|
|
||||||
if (bannedUser.length > 0) {
|
|
||||||
// 自动转交给指定人
|
|
||||||
if (abnormalType == 1 && userList.find(u => u.userId == abnormalUser) !== undefined) {
|
|
||||||
// 从后往前遍历,以避免索引变化的影响
|
|
||||||
for (let i = editUserList.length - 1; i >= 0; i--) {
|
|
||||||
if (bannedUser.includes(editUserList[i])) {
|
|
||||||
// 在当前索引之后插入 0
|
|
||||||
editUserList.splice(i + 1, 0, abnormalUser);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// 插入历史记录
|
|
||||||
var abnormalUserName = userList.find(u => u.userId == abnormalUser)?.username || abnormalUser
|
|
||||||
taskData = {
|
|
||||||
...taskData,
|
|
||||||
taskComment: "账号禁用,系统自动转交" + abnormalUserName,
|
|
||||||
taskExplain: "系统自动转交",
|
|
||||||
taskHandleDesc: "同意",
|
|
||||||
taskLineTypeList: "同意",
|
|
||||||
createHistoryBy: bannedUser,
|
|
||||||
operationAt: dayjs().format("YYYY-MM-DD HH:mm:ss")
|
|
||||||
}
|
|
||||||
historyInsertData.push(...await this.createTaskHistory({ taskData, taskStatus, type }))
|
|
||||||
|
|
||||||
editUserList = editUserList.filter(editUser => !bannedUser.includes(editUser))
|
|
||||||
editedUserList = editedUserList ? editedUserList.concat(bannedUser) : bannedUser
|
|
||||||
|
|
||||||
// 修改审批流
|
|
||||||
var newUserIdList = curNode.properties.userIdList
|
|
||||||
|
|
||||||
// 从后往前遍历,以避免索引变化的影响
|
|
||||||
for (let i = newUserIdList.length - 1; i >= 0; i--) {
|
|
||||||
if (bannedUser.includes(newUserIdList[i])) {
|
|
||||||
// 在当前索引之后插入 0
|
|
||||||
newUserIdList.splice(i + 1, 0, abnormalUser);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
const foundNode = taskWorkflow.nodeList.find(node => node.id == curNode.id);
|
|
||||||
if (foundNode) {
|
|
||||||
foundNode.properties.userIdList = newUserIdList;
|
|
||||||
}
|
|
||||||
updateTaskData.taskWorkflow = JSON.stringify(_.cloneDeep(taskWorkflow))
|
|
||||||
} else {
|
|
||||||
// 自动同意
|
|
||||||
editUserList = editUserList.filter(editUser => !bannedUser.includes(editUser))
|
|
||||||
editedUserList = editedUserList ? editedUserList.concat(bannedUser) : bannedUser
|
|
||||||
|
|
||||||
taskData = {
|
|
||||||
...taskData,
|
|
||||||
taskComment: "账号禁用,自动同意",
|
|
||||||
taskExplain: "系统自动转交",
|
|
||||||
taskHandleDesc: "同意",
|
|
||||||
taskLineTypeList: "同意",
|
|
||||||
createHistoryBy: bannedUser,
|
|
||||||
operationAt: dayjs().format("YYYY-MM-DD HH:mm:ss")
|
|
||||||
}
|
|
||||||
|
|
||||||
historyInsertData.push(...await this.createTaskHistory({ taskData, taskStatus, type }))
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
if (abnormalType == -1 && editedUserList.length > 0
|
if (abnormalType == -1 && editedUserList.length > 0
|
||||||
|| abnormalType == 1 && editedUserList.filter(editUser => !bannedUser.includes(editUser)).length > 0
|
|| abnormalType == 1 && editedUserList.filter(editUser => !bannedUser.includes(editUser)).length > 0
|
||||||
|| editUserList.length == 0) {
|
|| editUserList.length == 0) {
|
||||||
var nextNode = await this.getNextNode(taskWorkflow, curNode)
|
await goToNextNode()
|
||||||
|
|
||||||
editUserList = nextNode.properties.userIdList;
|
|
||||||
editedUserList = null;
|
|
||||||
|
|
||||||
taskData = {
|
|
||||||
...taskData,
|
|
||||||
taskConfigId: nextNode.id,
|
|
||||||
taskEditUserList: editUserList?.join(','),
|
|
||||||
taskEditedUserList: editedUserList?.join(','),
|
|
||||||
taskComment: null,
|
|
||||||
taskExplain: null,
|
|
||||||
taskHandleDesc: null,
|
|
||||||
taskLineTypeList: null,
|
|
||||||
createHistoryBy: null,
|
|
||||||
operationAt: dayjs().format("YYYY-MM-DD HH:mm:ss")
|
|
||||||
}
|
|
||||||
|
|
||||||
const result = await this.buildNext1({ taskData, type: '同意', times: 1, action })
|
|
||||||
_.assign(updateTaskData, result.updateTaskData)
|
|
||||||
historyInsertData.push(...result.historyInsertData)
|
|
||||||
noticeInsertData.push(...result.noticeInsertData)
|
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
// 自动流转,识别是否需要自动审批
|
// 自动流转,识别是否需要自动审批
|
||||||
@@ -416,28 +228,7 @@ class TaskService extends Service {
|
|||||||
|
|
||||||
historyInsertData.push(...await this.createTaskHistory({ taskData, taskStatus, type }))
|
historyInsertData.push(...await this.createTaskHistory({ taskData, taskStatus, type }))
|
||||||
|
|
||||||
var nextNode = await this.getNextNode(taskWorkflow, curNode)
|
await goToNextNode()
|
||||||
|
|
||||||
editUserList = nextNode.properties.userIdList;
|
|
||||||
editedUserList = null;
|
|
||||||
|
|
||||||
taskData = {
|
|
||||||
...taskData,
|
|
||||||
taskConfigId: nextNode.id,
|
|
||||||
taskEditUserList: editUserList?.join(','),
|
|
||||||
taskEditedUserList: editedUserList?.join(','),
|
|
||||||
taskComment: null,
|
|
||||||
taskExplain: null,
|
|
||||||
taskHandleDesc: null,
|
|
||||||
taskLineTypeList: null,
|
|
||||||
createHistoryBy: null,
|
|
||||||
operationAt: dayjs().format("YYYY-MM-DD HH:mm:ss")
|
|
||||||
}
|
|
||||||
|
|
||||||
const result = await this.buildNext1({ taskData, type: '同意', times: 1, action })
|
|
||||||
_.assign(updateTaskData, result.updateTaskData)
|
|
||||||
historyInsertData.push(...result.historyInsertData)
|
|
||||||
noticeInsertData.push(...result.noticeInsertData)
|
|
||||||
} else {
|
} else {
|
||||||
_.assign(updateTaskData, {
|
_.assign(updateTaskData, {
|
||||||
taskConfigId: curNode.id,
|
taskConfigId: curNode.id,
|
||||||
@@ -453,105 +244,17 @@ class TaskService extends Service {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
} else if (['依次审批'].includes(curApprovalType)) {
|
} else if (['依次审批'].includes(curApprovalType)) {
|
||||||
|
|
||||||
// 判断是否全部审批完成
|
// 判断是否全部审批完成
|
||||||
if (_.differenceWith(curNode.properties.userIdList, editedUserList, _.isEqual).length == 0) {
|
if (_.differenceWith(curNode.properties.userIdList, editedUserList, _.isEqual).length == 0) {
|
||||||
var nextNode = await this.getNextNode(taskWorkflow, curNode)
|
await goToNextNode()
|
||||||
editUserList = nextNode.properties.userIdList;
|
|
||||||
editedUserList = null;
|
|
||||||
|
|
||||||
taskData = {
|
|
||||||
...taskData,
|
|
||||||
taskConfigId: nextNode.id,
|
|
||||||
taskEditUserList: editUserList?.join(','),
|
|
||||||
taskEditedUserList: editedUserList?.join(','),
|
|
||||||
taskComment: null,
|
|
||||||
taskExplain: null,
|
|
||||||
taskHandleDesc: null,
|
|
||||||
taskLineTypeList: null,
|
|
||||||
createHistoryBy: null,
|
|
||||||
operationAt: dayjs().format("YYYY-MM-DD HH:mm:ss")
|
|
||||||
}
|
|
||||||
|
|
||||||
const result = await this.buildNext1({ taskData, type: '同意', times: 1, action })
|
|
||||||
_.assign(updateTaskData, result.updateTaskData)
|
|
||||||
historyInsertData.push(...result.historyInsertData)
|
|
||||||
noticeInsertData.push(...result.noticeInsertData)
|
|
||||||
} else {
|
} else {
|
||||||
var bannedUser = []
|
await handleBanned()
|
||||||
editUserList.forEach(editUser => {
|
|
||||||
var isBanned = userList.find(u => u.userId == editUser) == undefined ? true : false
|
|
||||||
if (isBanned) bannedUser.push(editUser)
|
|
||||||
|
|
||||||
return isBanned
|
// 判断下一个是否可以自动审批
|
||||||
})
|
if (editUserList.length > 0) {
|
||||||
|
|
||||||
if (bannedUser.length > 0) {
|
|
||||||
// 自动转交给指定人
|
|
||||||
if (abnormalType == 1 && userList.find(u => u.userId == abnormalUser) !== undefined) {
|
|
||||||
// 从后往前遍历,以避免索引变化的影响
|
|
||||||
for (let i = editUserList.length - 1; i >= 0; i--) {
|
|
||||||
if (bannedUser.includes(editUserList[i])) {
|
|
||||||
// 在当前索引之后插入 0
|
|
||||||
editUserList.splice(i + 1, 0, abnormalUser);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// 插入历史记录
|
|
||||||
var abnormalUserName = userList.find(u => u.userId == abnormalUser)?.username || abnormalUser
|
|
||||||
taskData = {
|
|
||||||
...taskData,
|
|
||||||
taskComment: "账号禁用,系统自动转交" + abnormalUserName,
|
|
||||||
taskExplain: "系统自动转交",
|
|
||||||
taskHandleDesc: "同意",
|
|
||||||
taskLineTypeList: "同意",
|
|
||||||
createHistoryBy: bannedUser,
|
|
||||||
operationAt: dayjs().format("YYYY-MM-DD HH:mm:ss")
|
|
||||||
}
|
|
||||||
historyInsertData.push(...await this.createTaskHistory({ taskData, taskStatus, type }))
|
|
||||||
|
|
||||||
editUserList = editUserList.filter(editUser => !bannedUser.includes(editUser))
|
|
||||||
editedUserList = editedUserList ? editedUserList.concat(bannedUser) : bannedUser
|
|
||||||
|
|
||||||
// 修改审批流
|
|
||||||
var newUserIdList = curNode.properties.userIdList
|
|
||||||
|
|
||||||
// 从后往前遍历,以避免索引变化的影响
|
|
||||||
for (let i = newUserIdList.length - 1; i >= 0; i--) {
|
|
||||||
if (bannedUser.includes(newUserIdList[i])) {
|
|
||||||
// 在当前索引之后插入 0
|
|
||||||
newUserIdList.splice(i + 1, 0, abnormalUser);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
const foundNode = taskWorkflow.nodeList.find(node => node.id == curNode.id);
|
|
||||||
if (foundNode) {
|
|
||||||
foundNode.properties.userIdList = newUserIdList;
|
|
||||||
}
|
|
||||||
updateTaskData.taskWorkflow = JSON.stringify(_.cloneDeep(taskWorkflow))
|
|
||||||
} else {
|
|
||||||
// 自动同意
|
|
||||||
editUserList = editUserList.filter(editUser => !bannedUser.includes(editUser))
|
|
||||||
editedUserList = editedUserList ? editedUserList.concat(bannedUser) : bannedUser
|
|
||||||
|
|
||||||
taskData = {
|
|
||||||
...taskData,
|
|
||||||
taskComment: "账号禁用,自动同意",
|
|
||||||
taskExplain: "系统自动转交",
|
|
||||||
taskHandleDesc: "同意",
|
|
||||||
taskLineTypeList: "同意",
|
|
||||||
createHistoryBy: bannedUser,
|
|
||||||
operationAt: dayjs().format("YYYY-MM-DD HH:mm:ss")
|
|
||||||
}
|
|
||||||
|
|
||||||
historyInsertData.push(...await this.createTaskHistory({ taskData, taskStatus, type }))
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// 判断下一个是否可以自动审批 或是 禁用
|
|
||||||
if (autoApprovel == 1) {
|
if (autoApprovel == 1) {
|
||||||
while (editUserList.length > 0 && taskHistoryUser.includes(editUserList[0])) {
|
while (editUserList.length > 0 && taskHistoryUser.includes(editUserList[0])) {
|
||||||
// 插入历史
|
// 插入历史
|
||||||
@@ -573,27 +276,14 @@ class TaskService extends Service {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (editUserList.length == 0) {
|
if (editUserList.length == 0) {
|
||||||
var nextNode = await this.getNextNode(taskWorkflow, curNode)
|
await goToNextNode()
|
||||||
editUserList = nextNode.properties.userIdList;
|
} else {
|
||||||
editedUserList = null;
|
_.assign(updateTaskData, {
|
||||||
|
taskConfigId: curNode.id,
|
||||||
taskData = {
|
|
||||||
...taskData,
|
|
||||||
taskConfigId: nextNode.id,
|
|
||||||
taskEditUserList: editUserList?.join(','),
|
taskEditUserList: editUserList?.join(','),
|
||||||
taskEditedUserList: editedUserList?.join(','),
|
taskEditedUserList: editedUserList?.join(','),
|
||||||
taskComment: null,
|
})
|
||||||
taskExplain: null,
|
|
||||||
taskHandleDesc: null,
|
|
||||||
taskLineTypeList: null,
|
|
||||||
createHistoryBy: null,
|
|
||||||
operationAt: dayjs().format("YYYY-MM-DD HH:mm:ss")
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const result = await this.buildNext1({ taskData, type: '同意', times: 1, action })
|
|
||||||
_.assign(updateTaskData, result.updateTaskData)
|
|
||||||
historyInsertData.push(...result.historyInsertData)
|
|
||||||
noticeInsertData.push(...result.noticeInsertData)
|
|
||||||
} else {
|
} else {
|
||||||
_.assign(updateTaskData, {
|
_.assign(updateTaskData, {
|
||||||
taskConfigId: curNode.id,
|
taskConfigId: curNode.id,
|
||||||
@@ -602,13 +292,8 @@ class TaskService extends Service {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
_.assign(updateTaskData, {
|
await goToNextNode()
|
||||||
taskConfigId: curNode.id,
|
|
||||||
taskEditUserList: editUserList?.join(','),
|
|
||||||
taskEditedUserList: editedUserList?.join(','),
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -623,25 +308,7 @@ class TaskService extends Service {
|
|||||||
pushAt: dayjs().format("YYYY-MM-DD HH:mm:ss")
|
pushAt: dayjs().format("YYYY-MM-DD HH:mm:ss")
|
||||||
})
|
})
|
||||||
|
|
||||||
var nextNode = await this.getNextNode(taskWorkflow, curNode)
|
await goToNextNode()
|
||||||
|
|
||||||
taskData = {
|
|
||||||
...taskData,
|
|
||||||
taskConfigId: nextNode.id,
|
|
||||||
taskEditUserList: nextNode.properties.userIdList?.join(','),
|
|
||||||
taskEditedUserList: null,
|
|
||||||
taskComment: null,
|
|
||||||
taskExplain: null,
|
|
||||||
taskHandleDesc: null,
|
|
||||||
taskLineTypeList: null,
|
|
||||||
createHistoryBy: null,
|
|
||||||
operationAt: dayjs().format("YYYY-MM-DD HH:mm:ss")
|
|
||||||
}
|
|
||||||
|
|
||||||
const result = await this.buildNext1({ taskData, type: '同意', times: 1, action })
|
|
||||||
_.assign(updateTaskData, result.updateTaskData)
|
|
||||||
historyInsertData.push(...result.historyInsertData)
|
|
||||||
noticeInsertData.push(...result.noticeInsertData)
|
|
||||||
break;
|
break;
|
||||||
case 'end':
|
case 'end':
|
||||||
_.assign(updateTaskData, {
|
_.assign(updateTaskData, {
|
||||||
@@ -671,226 +338,119 @@ class TaskService extends Service {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
return {
|
return {
|
||||||
updateTaskData,
|
updateTaskData,
|
||||||
noticeInsertData,
|
noticeInsertData,
|
||||||
historyInsertData
|
historyInsertData
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async function handleBanned() {
|
||||||
|
// 判断该节点有无账号被禁用的人
|
||||||
|
editUserList.forEach(editUser => {
|
||||||
|
var isBanned = userList.find(u => u.userId == editUser) == undefined ? true : false
|
||||||
|
if (isBanned) bannedUser.push(editUser)
|
||||||
|
|
||||||
|
return isBanned
|
||||||
|
})
|
||||||
|
if (bannedUser.length > 0) {
|
||||||
|
// 自动转交给指定人
|
||||||
|
if (abnormalType == 1 && userList.find(u => u.userId == abnormalUser) !== undefined) {
|
||||||
|
// 在被禁用账号后面加上被转交人
|
||||||
|
for (let i = editUserList.length - 1; i >= 0; i--) {
|
||||||
|
if (bannedUser.includes(editUserList[i])) {
|
||||||
|
editUserList.splice(i + 1, 0, abnormalUser);
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO:逻辑待优化
|
|
||||||
async buildNext({ taskData, type }) {
|
|
||||||
const { userId, username } = this.ctx.userInfo;
|
|
||||||
const { taskId, taskInfo, taskWorkflow, taskConfigId, taskEditUserList, taskEditedUserList } = taskData;
|
|
||||||
|
|
||||||
var updateTaskData = null
|
|
||||||
var historyInsertData = []
|
|
||||||
var noticeInsertData = []
|
|
||||||
var curNode = taskWorkflow.nodeList.find(node => node.id == taskConfigId)
|
|
||||||
var taskStatus = "running"
|
|
||||||
|
|
||||||
taskData.createHistoryBy = userId
|
|
||||||
|
|
||||||
// 1、更新task状态
|
|
||||||
if (type == '同意') {
|
|
||||||
var approvalType = curNode.properties.approvalType
|
|
||||||
var editUserList = taskEditUserList && taskEditUserList.split(',') || []
|
|
||||||
var editedUserList = taskEditedUserList && taskEditedUserList.split(',') || []
|
|
||||||
|
|
||||||
// 判断该节点是否已完成
|
|
||||||
if (curNode.id.startsWith('approvalTask') && (approvalType == "会签" || approvalType == "依次审批") && editUserList.length > 1) {
|
|
||||||
// 未完成
|
|
||||||
editedUserList.push(userId)
|
|
||||||
updateTaskData = {
|
|
||||||
taskEditUserList: editUserList.filter(u => u != userId).join(','),
|
|
||||||
taskEditedUserList: editedUserList.join(','),
|
|
||||||
}
|
}
|
||||||
historyInsertData.push(await this.createTaskHistory({ taskData, taskStatus, type }))
|
var abnormalUserName = userList.find(u => u.userId == abnormalUser)?.username || abnormalUser
|
||||||
|
// 插入禁用账号的历史记录
|
||||||
} else {// 流转搭配下一节点
|
_.assign(taskData, {
|
||||||
|
taskComment: "账号禁用,系统自动转交" + abnormalUserName,
|
||||||
if (curNode.properties.type.startsWith('noticeTask-')) {
|
taskExplain: "系统自动转交",
|
||||||
var noticeUser = nextNode.properties.userIdList
|
taskHandleDesc: "同意",
|
||||||
for (let index = 0; index < noticeUser.length; index++) {
|
taskLineTypeList: "同意",
|
||||||
const element = noticeUser[index];
|
createHistoryBy: bannedUser,
|
||||||
taskData.createHistoryBy = element
|
|
||||||
historyInsertData.push(await this.createTaskHistory({ taskData, taskStatus, type }))
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
historyInsertData.push(await this.createTaskHistory({ taskData, taskStatus, type }))
|
|
||||||
}
|
|
||||||
|
|
||||||
// 找下一个节点
|
|
||||||
var nextNode = await this.getNextNode(taskWorkflow, curNode)
|
|
||||||
var nextLine = taskWorkflow.lineList.find(line => line.sourceNodeId == nextNode.id)
|
|
||||||
|
|
||||||
console.log('nextNode-=-', nextNode);
|
|
||||||
// 下一个节点是审批节点
|
|
||||||
if (nextNode.properties.type === "approvalTask") {
|
|
||||||
|
|
||||||
updateTaskData = {
|
|
||||||
taskConfigId: nextNode.id,
|
|
||||||
taskLineType: nextLine?.properties.type,
|
|
||||||
taskEditUserList: nextNode.properties.userIdList.join(','),
|
|
||||||
taskEditedUserList: null
|
|
||||||
}
|
|
||||||
|
|
||||||
// 如果autoApprovel == 1, 就自动再迭代
|
|
||||||
if (taskInfo.autoApprovel == 1) {
|
|
||||||
// 判断是不是只需要该人审批就能够继续流转: 一个人,多人或签
|
|
||||||
if (nextNode.properties.userIdList.length == 1 || nextNode.properties.approvalType == '或签' && nextNode.properties.userIdList.includes(userId)) {
|
|
||||||
taskData = {
|
|
||||||
...taskData,
|
|
||||||
taskConfigId: nextNode.id,
|
|
||||||
taskEditUserList: userId,
|
|
||||||
taskEditedUserList: null,
|
|
||||||
taskLineTypeList: type,
|
|
||||||
taskExplain: null,
|
|
||||||
taskHandleDesc: type,
|
|
||||||
taskComment: '系统自动流转',
|
|
||||||
operationAt: dayjs().format("YYYY-MM-DD HH:mm:ss")
|
operationAt: dayjs().format("YYYY-MM-DD HH:mm:ss")
|
||||||
}
|
})
|
||||||
const result = await this.buildNext({ taskData, type: '同意' })
|
historyInsertData.push(...await that.createTaskHistory({ taskData, taskStatus, type }))
|
||||||
updateTaskData = result.updateTaskData
|
|
||||||
historyInsertData.push(...result.historyInsertData)
|
|
||||||
noticeInsertData.push(...result.noticeInsertData)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// 下一个节点是抄送节点
|
editUserList = editUserList.filter(editUser => !bannedUser.includes(editUser))
|
||||||
if (nextNode.properties.type === "noticeTask") {
|
editedUserList = editedUserList ? editedUserList.concat(bannedUser) : bannedUser
|
||||||
|
|
||||||
noticeInsertData.push({
|
// 修改审批流
|
||||||
noticeId: await idGenerateUtil.uuid(),
|
var newUserIdList = curNode.properties.userIdList
|
||||||
noticeName: "通知-审批-" + taskId,
|
|
||||||
noticeContent: taskData.taskEditUserList,
|
for (let i = newUserIdList.length - 1; i >= 0; i--) {
|
||||||
pushContent: '{}',
|
if (bannedUser.includes(newUserIdList[i])) {
|
||||||
pushStatus: "success",
|
// 在被禁用账号后面加上被转交人
|
||||||
pushAt: dayjs().format("YYYY-MM-DD HH:mm:ss")
|
newUserIdList.splice(i + 1, 0, abnormalUser);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
const foundNode = taskWorkflow.nodeList.find(node => node.id == curNode.id);
|
||||||
|
if (foundNode) {
|
||||||
|
foundNode.properties.userIdList = newUserIdList;
|
||||||
|
}
|
||||||
|
updateTaskData.taskWorkflow = JSON.stringify(_.cloneDeep(taskWorkflow))
|
||||||
|
updateTaskData.taskViewUserList = taskViewUserList.push(abnormalUser)
|
||||||
|
} else {
|
||||||
|
// 自动同意
|
||||||
|
editUserList = editUserList.filter(editUser => !bannedUser.includes(editUser))
|
||||||
|
editedUserList = editedUserList ? editedUserList.concat(bannedUser) : bannedUser
|
||||||
|
|
||||||
|
_.assign(taskData, {
|
||||||
|
taskComment: "账号禁用,自动同意",
|
||||||
|
taskExplain: "系统自动转交",
|
||||||
|
taskHandleDesc: "同意",
|
||||||
|
taskLineTypeList: "同意",
|
||||||
|
createHistoryBy: bannedUser,
|
||||||
|
operationAt: dayjs().format("YYYY-MM-DD HH:mm:ss")
|
||||||
})
|
})
|
||||||
|
|
||||||
taskData = {
|
historyInsertData.push(...await that.createTaskHistory({ taskData, taskStatus, type }))
|
||||||
...taskData,
|
}
|
||||||
taskConfigId: nextNode.id,
|
}
|
||||||
taskEditUserList: nextNode.properties.userIdList.join(','),
|
|
||||||
taskEditedUserList: null,
|
}
|
||||||
|
|
||||||
|
async function goToNextNode() {
|
||||||
|
var nextNode = await getNextNode()
|
||||||
|
const { id, properties: { userIdList } } = nextNode
|
||||||
|
|
||||||
|
editUserList = _.cloneDeep(userIdList);
|
||||||
|
editedUserList = null;
|
||||||
|
|
||||||
|
_.assign(taskData, {
|
||||||
|
taskConfigId: id,
|
||||||
|
taskEditUserList: editUserList?.join(','),
|
||||||
|
taskEditedUserList: editedUserList?.join(','),
|
||||||
taskComment: null,
|
taskComment: null,
|
||||||
taskExplain: '抄送节点',
|
taskExplain: null,
|
||||||
taskHandleDesc: '抄送',
|
taskHandleDesc: null,
|
||||||
taskLineTypeList: '抄送',
|
taskLineTypeList: null,
|
||||||
|
createHistoryBy: null,
|
||||||
operationAt: dayjs().format("YYYY-MM-DD HH:mm:ss")
|
operationAt: dayjs().format("YYYY-MM-DD HH:mm:ss")
|
||||||
}
|
})
|
||||||
|
|
||||||
// var noticeUser = nextNode.properties.userIdList
|
const result = await that.buildNext({ taskData, type: '同意', times: 1, action })
|
||||||
// for (let index = 0; index < noticeUser.length; index++) {
|
const { updateTaskData: newUpdateTaskData, historyInsertData: newHistoryInsertData, noticeInsertData: newNoticeInsertData } = result
|
||||||
// const element = noticeUser[index];
|
_.assign(updateTaskData, newUpdateTaskData)
|
||||||
// taskData.createHistoryBy = element
|
historyInsertData.push(...newHistoryInsertData)
|
||||||
// historyInsertData.push(await this.createTaskHistory({ taskData, taskStatus, type }))
|
noticeInsertData.push(...newNoticeInsertData)
|
||||||
// }
|
|
||||||
|
|
||||||
// historyInsertData.push(await this.createTaskHistory({ taskData, taskStatus, type }))
|
async function getNextNode() {
|
||||||
|
const { lineList, nodeList } = taskWorkflow
|
||||||
// taskData = {
|
|
||||||
// ...taskData,
|
|
||||||
// taskConfigId: nextNode.id,
|
|
||||||
// taskEditUserList: nextNode.properties.userIdList.join(','),
|
|
||||||
// taskEditedUserList: null,
|
|
||||||
// taskComment: null,
|
|
||||||
// taskExplain: '抄送节点',
|
|
||||||
// taskHandleDesc: '抄送',
|
|
||||||
// taskLineTypeList: '抄送',
|
|
||||||
// operationAt: dayjs().format("YYYY-MM-DD HH:mm:ss")
|
|
||||||
// }
|
|
||||||
|
|
||||||
// var noticeUser = nextNode.properties.userIdList
|
|
||||||
// for (let index = 0; index < noticeUser.length; index++) {
|
|
||||||
// const element = noticeUser[index];
|
|
||||||
// taskData.createHistoryBy = element
|
|
||||||
// historyInsertData.push(await this.createTaskHistory({ taskData, taskStatus, type }))
|
|
||||||
// }
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// var noticeUser = nextNode.properties.userIdList
|
|
||||||
// for (let index = 0; index < noticeUser.length; index++) {
|
|
||||||
// const element = noticeUser[index];
|
|
||||||
// taskData.createHistoryBy = element
|
|
||||||
// historyInsertData.push(await this.createTaskHistory({ taskData, taskStatus, type }))
|
|
||||||
// }
|
|
||||||
|
|
||||||
nextNode = await this.getNextNode(taskWorkflow, nextNode)
|
|
||||||
|
|
||||||
// taskData = {
|
|
||||||
// ...taskData,
|
|
||||||
// taskConfigId: nextNode.id,
|
|
||||||
// taskEditUserList: nextNode.properties.userIdList?.join(','),
|
|
||||||
// taskEditUserList: null,
|
|
||||||
// taskExplain: null,
|
|
||||||
// taskHandleDesc: null,
|
|
||||||
// taskLineTypeList: null,
|
|
||||||
// operationAt: dayjs().format("YYYY-MM-DD HH:mm:ss")
|
|
||||||
// }
|
|
||||||
|
|
||||||
const result = await this.buildNext({ taskData, type: '同意' })
|
|
||||||
updateTaskData = result.updateTaskData
|
|
||||||
historyInsertData.push(...result.historyInsertData)
|
|
||||||
noticeInsertData.push(...result.noticeInsertData)
|
|
||||||
}
|
|
||||||
|
|
||||||
// 下一个节点是结束节点
|
|
||||||
if (nextNode.properties.type === "end") {
|
|
||||||
taskStatus = "end"
|
|
||||||
updateTaskData = {
|
|
||||||
taskStatus: taskStatus,
|
|
||||||
taskConfigId: null,
|
|
||||||
taskLineType: null,
|
|
||||||
taskEditUserList: null,
|
|
||||||
taskEditedUserList: null,
|
|
||||||
taskFinishAt: dayjs().format("YYYY-MM-DD HH:mm:ss")
|
|
||||||
}
|
|
||||||
|
|
||||||
historyInsertData.push(await this.createTaskHistory({ taskData, taskStatus, type }))
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
// 直接结束任务
|
|
||||||
taskStatus = "end"
|
|
||||||
updateTaskData = {
|
|
||||||
taskStatus: taskStatus,
|
|
||||||
taskConfigId: null,
|
|
||||||
taskLineType: null,
|
|
||||||
taskEditUserList: null,
|
|
||||||
taskEditedUserList: null,
|
|
||||||
taskFinishAt: dayjs().format("YYYY-MM-DD HH:mm:ss")
|
|
||||||
}
|
|
||||||
historyInsertData.push(await this.createTaskHistory({ taskData, taskStatus, type }))
|
|
||||||
}
|
|
||||||
|
|
||||||
return {
|
|
||||||
updateTaskData,
|
|
||||||
noticeInsertData,
|
|
||||||
historyInsertData
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
async getNextNode(workflow, curNode) {
|
|
||||||
const { lineList, nodeList } = workflow
|
|
||||||
var line = lineList.find(l => l.sourceNodeId == curNode.id),
|
var line = lineList.find(l => l.sourceNodeId == curNode.id),
|
||||||
nextNode = nodeList.find(n => n.id == line.targetNodeId);
|
nextNode = nodeList.find(n => n.id == line.targetNodeId);
|
||||||
|
|
||||||
if (nextNode.properties.type === "conditionTask") {
|
if (nextNode.properties.type === "conditionTask") {
|
||||||
nextNode = this.getNextNode(workflow, nextNode)
|
nextNode = await getNextNode()
|
||||||
}
|
}
|
||||||
|
|
||||||
return nextNode
|
return nextNode
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
async createTaskHistory({ taskData, taskStatus, type }) {
|
async createTaskHistory({ taskData, taskStatus, type }) {
|
||||||
const { userId, username } = this.ctx.userInfo;
|
|
||||||
|
|
||||||
// 解构 taskData 对象以简化访问
|
// 解构 taskData 对象以简化访问
|
||||||
const { taskId, taskFormInput, taskConfigId, taskNextConfigList,
|
const { taskId, taskFormInput, taskConfigId, taskNextConfigList,
|
||||||
taskLineType, taskEditUserList, taskViewUserList,
|
taskLineType, taskEditUserList, taskViewUserList,
|
||||||
|
|||||||
+1
-1
@@ -8,7 +8,7 @@
|
|||||||
"framework": "@jianghujs/jianghu"
|
"framework": "@jianghujs/jianghu"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@jianghujs/jianghu": "5.1.4",
|
"@jianghujs/jianghu": "5.1.11",
|
||||||
"dayjs": "^1.11.4",
|
"dayjs": "^1.11.4",
|
||||||
"dotenv": "^16.3.1",
|
"dotenv": "^16.3.1",
|
||||||
"egg": "^2.15.1",
|
"egg": "^2.15.1",
|
||||||
|
|||||||
Reference in new issue
Block a user