账号禁用异常处理
This commit is contained in:
1 parent
697918321c
commit
da3c9c4041
2 files changed
+295
-45
No files matched your search
+290
-42
@@ -71,10 +71,12 @@ class TaskService extends Service {
|
|||||||
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.buildNext1({ 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);
|
||||||
console.log('noticeInsertData------', noticeInsertData);
|
console.log('noticeInsertData------', noticeInsertData);
|
||||||
|
|
||||||
await jianghuKnex.transaction(async trx => {
|
await jianghuKnex.transaction(async trx => {
|
||||||
if (updateTaskData) await trx("task", this.ctx).where({ taskId: taskData.taskId }).jhUpdate(updateTaskData);
|
if (updateTaskData) await trx("task", this.ctx).where({ taskId: taskData.taskId }).jhUpdate(updateTaskData);
|
||||||
if (noticeInsertData.length > 0) await trx("notice_push", this.ctx).jhInsert(noticeInsertData);
|
if (noticeInsertData.length > 0) await trx("notice_push", this.ctx).jhInsert(noticeInsertData);
|
||||||
@@ -87,9 +89,16 @@ class TaskService extends Service {
|
|||||||
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 } = taskData;
|
||||||
|
|
||||||
const taskHistory = await jianghuKnex('task_history').where({ taskId }).where('taskConfigId', 'like', 'approvalTask-%').select();
|
const taskHistory = await jianghuKnex('task_history')
|
||||||
|
.where({ taskId })
|
||||||
|
.where('taskConfigId', 'like', 'approvalTask-%')
|
||||||
|
.whereNot('taskHandleDesc', '=', '系统自动转交')
|
||||||
|
.select();
|
||||||
|
const userList = await jianghuKnex('enterprise_user').select();
|
||||||
|
|
||||||
var updateTaskData = null,
|
console.log('taskHistory+++_', taskHistory);
|
||||||
|
|
||||||
|
var updateTaskData = {},
|
||||||
historyInsertData = [],
|
historyInsertData = [],
|
||||||
noticeInsertData = [],
|
noticeInsertData = [],
|
||||||
curNode = taskWorkflow.nodeList.find(node => node.id == taskConfigId),
|
curNode = taskWorkflow.nodeList.find(node => node.id == taskConfigId),
|
||||||
@@ -97,7 +106,7 @@ class TaskService extends Service {
|
|||||||
taskStatus = "running",
|
taskStatus = "running",
|
||||||
taskHistoryUser = [...taskHistory.map(h => h.createHistoryBy)];
|
taskHistoryUser = [...taskHistory.map(h => h.createHistoryBy)];
|
||||||
|
|
||||||
if (action == 'update') taskHistoryUser.push(userId)
|
if (action == 'updateTask') taskHistoryUser.push(userId)
|
||||||
// 插入上一次节点历史
|
// 插入上一次节点历史
|
||||||
if (!taskData?.createHistoryBy) taskData.createHistoryBy = [userId]
|
if (!taskData?.createHistoryBy) taskData.createHistoryBy = [userId]
|
||||||
taskStatus = curNodeType == 'end' ? 'end' : 'running'
|
taskStatus = curNodeType == 'end' ? 'end' : 'running'
|
||||||
@@ -131,10 +140,11 @@ class TaskService extends Service {
|
|||||||
switch (curNodeType) {
|
switch (curNodeType) {
|
||||||
case 'approvalTask':
|
case 'approvalTask':
|
||||||
var curApprovalType = curNode?.properties.approvalType,
|
var curApprovalType = curNode?.properties.approvalType,
|
||||||
autoApprovel = taskInfo.autoApprovel,
|
|
||||||
editUserList = taskEditUserList && taskEditUserList.split(',') || [],
|
editUserList = taskEditUserList && taskEditUserList.split(',') || [],
|
||||||
editedUserList = taskEditedUserList && taskEditedUserList.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)
|
||||||
@@ -142,6 +152,79 @@ class TaskService extends Service {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (['会签'].includes(curApprovalType)) {
|
if (['会签'].includes(curApprovalType)) {
|
||||||
|
// 检查是否需要异常处理
|
||||||
|
// 先检查即将审批的人是否存在账号禁用情况
|
||||||
|
// 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)
|
||||||
@@ -183,15 +266,15 @@ class TaskService extends Service {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const result = await this.buildNext1({ taskData, type: '同意', times: 1, action })
|
const result = await this.buildNext1({ taskData, type: '同意', times: 1, action })
|
||||||
updateTaskData = result.updateTaskData
|
_.assign(updateTaskData, result.updateTaskData)
|
||||||
historyInsertData.push(...result.historyInsertData)
|
historyInsertData.push(...result.historyInsertData)
|
||||||
noticeInsertData.push(...result.noticeInsertData)
|
noticeInsertData.push(...result.noticeInsertData)
|
||||||
} else {
|
} else {
|
||||||
updateTaskData = {
|
_.assign(updateTaskData, {
|
||||||
taskConfigId: curNode.id,
|
taskConfigId: curNode.id,
|
||||||
taskEditUserList: editUserList.join(','),
|
taskEditUserList: editUserList?.join(','),
|
||||||
taskEditedUserList: editedUserList.join(','),
|
taskEditedUserList: editedUserList?.join(','),
|
||||||
}
|
})
|
||||||
}
|
}
|
||||||
} else if (['或签'].includes(curApprovalType)) {
|
} else if (['或签'].includes(curApprovalType)) {
|
||||||
if (times == 0) {
|
if (times == 0) {
|
||||||
@@ -215,12 +298,109 @@ class TaskService extends Service {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const result = await this.buildNext1({ taskData, type: '同意', times: 1, action })
|
const result = await this.buildNext1({ taskData, type: '同意', times: 1, action })
|
||||||
updateTaskData = result.updateTaskData
|
_.assign(updateTaskData, result.updateTaskData)
|
||||||
historyInsertData.push(...result.historyInsertData)
|
historyInsertData.push(...result.historyInsertData)
|
||||||
noticeInsertData.push(...result.noticeInsertData)
|
noticeInsertData.push(...result.noticeInsertData)
|
||||||
|
} else {
|
||||||
|
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 (abnormalType == -1 && editedUserList.length > 0
|
||||||
|
|| abnormalType == 1 && editedUserList.filter(editUser => !bannedUser.includes(editUser)).length > 0
|
||||||
|
|| editUserList.length == 0) {
|
||||||
|
var nextNode = await this.getNextNode(taskWorkflow, curNode)
|
||||||
|
|
||||||
|
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 {
|
||||||
// 自动流转,识别是否需要自动审批
|
// 自动流转,识别是否需要自动审批
|
||||||
if (autoApprovel == 1) {
|
if (editUserList.length > 0 && autoApprovel == 1) {
|
||||||
var autoApprovelUser = _.intersection(taskHistoryUser, editUserList)
|
var autoApprovelUser = _.intersection(taskHistoryUser, editUserList)
|
||||||
|
|
||||||
if (autoApprovelUser.length > 0) {
|
if (autoApprovelUser.length > 0) {
|
||||||
@@ -255,23 +435,25 @@ class TaskService extends Service {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const result = await this.buildNext1({ taskData, type: '同意', times: 1, action })
|
const result = await this.buildNext1({ taskData, type: '同意', times: 1, action })
|
||||||
updateTaskData = result.updateTaskData
|
_.assign(updateTaskData, result.updateTaskData)
|
||||||
historyInsertData.push(...result.historyInsertData)
|
historyInsertData.push(...result.historyInsertData)
|
||||||
noticeInsertData.push(...result.noticeInsertData)
|
noticeInsertData.push(...result.noticeInsertData)
|
||||||
} else {
|
} else {
|
||||||
updateTaskData = {
|
_.assign(updateTaskData, {
|
||||||
taskConfigId: curNode.id,
|
taskConfigId: curNode.id,
|
||||||
taskEditUserList: editUserList.join(','),
|
taskEditUserList: editUserList?.join(','),
|
||||||
taskEditedUserList: editedUserList.join(','),
|
taskEditedUserList: editedUserList?.join(','),
|
||||||
}
|
})
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
updateTaskData = {
|
_.assign(updateTaskData, {
|
||||||
taskConfigId: curNode.id,
|
taskConfigId: curNode.id,
|
||||||
taskEditUserList: editUserList.join(','),
|
taskEditUserList: editUserList?.join(','),
|
||||||
taskEditedUserList: editedUserList.join(','),
|
taskEditedUserList: editedUserList?.join(','),
|
||||||
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
} else if (['依次审批'].includes(curApprovalType)) {
|
} else if (['依次审批'].includes(curApprovalType)) {
|
||||||
@@ -296,11 +478,80 @@ class TaskService extends Service {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const result = await this.buildNext1({ taskData, type: '同意', times: 1, action })
|
const result = await this.buildNext1({ taskData, type: '同意', times: 1, action })
|
||||||
updateTaskData = result.updateTaskData
|
_.assign(updateTaskData, result.updateTaskData)
|
||||||
historyInsertData.push(...result.historyInsertData)
|
historyInsertData.push(...result.historyInsertData)
|
||||||
noticeInsertData.push(...result.noticeInsertData)
|
noticeInsertData.push(...result.noticeInsertData)
|
||||||
} else {
|
} else {
|
||||||
// 判断下一个是否可以自动审批
|
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) {
|
if (autoApprovel == 1) {
|
||||||
while (editUserList.length > 0 && taskHistoryUser.includes(editUserList[0])) {
|
while (editUserList.length > 0 && taskHistoryUser.includes(editUserList[0])) {
|
||||||
// 插入历史
|
// 插入历史
|
||||||
@@ -340,28 +591,27 @@ class TaskService extends Service {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const result = await this.buildNext1({ taskData, type: '同意', times: 1, action })
|
const result = await this.buildNext1({ taskData, type: '同意', times: 1, action })
|
||||||
updateTaskData = result.updateTaskData
|
_.assign(updateTaskData, result.updateTaskData)
|
||||||
historyInsertData.push(...result.historyInsertData)
|
historyInsertData.push(...result.historyInsertData)
|
||||||
noticeInsertData.push(...result.noticeInsertData)
|
noticeInsertData.push(...result.noticeInsertData)
|
||||||
} else {
|
} else {
|
||||||
updateTaskData = {
|
_.assign(updateTaskData, {
|
||||||
taskConfigId: curNode.id,
|
taskConfigId: curNode.id,
|
||||||
taskEditUserList: editUserList.join(','),
|
taskEditUserList: editUserList?.join(','),
|
||||||
taskEditedUserList: editedUserList.join(','),
|
taskEditedUserList: editedUserList?.join(','),
|
||||||
}
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
updateTaskData = {
|
_.assign(updateTaskData, {
|
||||||
taskConfigId: curNode.id,
|
taskConfigId: curNode.id,
|
||||||
taskEditUserList: editUserList.join(','),
|
taskEditUserList: editUserList?.join(','),
|
||||||
taskEditedUserList: editedUserList.join(','),
|
taskEditedUserList: editedUserList?.join(','),
|
||||||
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case 'noticeTask':
|
case 'noticeTask':
|
||||||
noticeInsertData.push({
|
noticeInsertData.push({
|
||||||
@@ -389,20 +639,19 @@ class TaskService extends Service {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const result = await this.buildNext1({ taskData, type: '同意', times: 1, action })
|
const result = await this.buildNext1({ taskData, type: '同意', times: 1, action })
|
||||||
updateTaskData = result.updateTaskData
|
_.assign(updateTaskData, result.updateTaskData)
|
||||||
historyInsertData.push(...result.historyInsertData)
|
historyInsertData.push(...result.historyInsertData)
|
||||||
noticeInsertData.push(...result.noticeInsertData)
|
noticeInsertData.push(...result.noticeInsertData)
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case 'end':
|
case 'end':
|
||||||
updateTaskData = {
|
_.assign(updateTaskData, {
|
||||||
taskStatus: "success",
|
taskStatus: "success",
|
||||||
taskConfigId: null,
|
taskConfigId: null,
|
||||||
taskLineType: null,
|
taskLineType: null,
|
||||||
taskEditUserList: null,
|
taskEditUserList: null,
|
||||||
taskEditedUserList: null,
|
taskEditedUserList: null,
|
||||||
taskFinishAt: dayjs().format("YYYY-MM-DD HH:mm:ss")
|
taskFinishAt: dayjs().format("YYYY-MM-DD HH:mm:ss")
|
||||||
}
|
})
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
@@ -412,15 +661,14 @@ class TaskService extends Service {
|
|||||||
// 插入该条审批记录
|
// 插入该条审批记录
|
||||||
historyInsertData.push(...await this.createTaskHistory({ taskData, taskStatus: 'end', type }))
|
historyInsertData.push(...await this.createTaskHistory({ taskData, taskStatus: 'end', type }))
|
||||||
// 直接结束任务
|
// 直接结束任务
|
||||||
updateTaskData = {
|
_.assign(updateTaskData, {
|
||||||
taskStatus: 'reject',
|
taskStatus: 'reject',
|
||||||
taskConfigId: null,
|
taskConfigId: null,
|
||||||
taskLineType: null,
|
taskLineType: null,
|
||||||
taskEditUserList: null,
|
taskEditUserList: null,
|
||||||
taskEditedUserList: null,
|
taskEditedUserList: null,
|
||||||
taskFinishAt: dayjs().format("YYYY-MM-DD HH:mm:ss")
|
taskFinishAt: dayjs().format("YYYY-MM-DD HH:mm:ss")
|
||||||
}
|
})
|
||||||
// historyInsertData.push(...await this.createTaskHistory({ taskData, taskStatus, type: '拒绝' }))
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -705,8 +953,8 @@ class TaskService extends Service {
|
|||||||
const { taskComment, taskHandleDesc, createHistoryAt, taskStatus } = historyRecord
|
const { taskComment, taskHandleDesc, createHistoryAt, taskStatus } = historyRecord
|
||||||
|
|
||||||
return {
|
return {
|
||||||
userId: userId,
|
userId: appUserId,
|
||||||
username: username,
|
username: username || appUserId + '(账号被禁用)',
|
||||||
comment: taskComment,
|
comment: taskComment,
|
||||||
handleDesc: taskHandleDesc,
|
handleDesc: taskHandleDesc,
|
||||||
createHistoryAt: dayjs(createHistoryAt || '').format('YYYY-MM-DD HH:mm:ss'),
|
createHistoryAt: dayjs(createHistoryAt || '').format('YYYY-MM-DD HH:mm:ss'),
|
||||||
@@ -714,8 +962,8 @@ class TaskService extends Service {
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
return {
|
return {
|
||||||
userId: userId,
|
userId: appUserId,
|
||||||
username: username,
|
username: username || appUserId + '(账号被禁用)',
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -195,7 +195,8 @@
|
|||||||
taskStatusColor:{
|
taskStatusColor:{
|
||||||
'已通过': 'primary',
|
'已通过': 'primary',
|
||||||
'已拒绝': 'red',
|
'已拒绝': 'red',
|
||||||
'审核中': 'blue'
|
'审核中': 'blue',
|
||||||
|
"已撤回": 'grey'
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
// 计算
|
// 计算
|
||||||
@@ -248,7 +249,8 @@
|
|||||||
const statusMap = {
|
const statusMap = {
|
||||||
'success': '已通过',
|
'success': '已通过',
|
||||||
'reject': '已拒绝',
|
'reject': '已拒绝',
|
||||||
'running': '审核中'
|
'running': '审核中',
|
||||||
|
'revoke': '已撤回',
|
||||||
};
|
};
|
||||||
rows.forEach(row => {
|
rows.forEach(row => {
|
||||||
row.taskFormInput = JSON.parse(row.taskFormInput);
|
row.taskFormInput = JSON.parse(row.taskFormInput);
|
||||||
@@ -282,7 +284,7 @@
|
|||||||
pageId: 'taskManagement',
|
pageId: 'taskManagement',
|
||||||
actionId: 'updateItem',
|
actionId: 'updateItem',
|
||||||
actionData: {
|
actionData: {
|
||||||
taskStatus: 'end',
|
taskStatus: 'revoke',
|
||||||
taskLineType: null,
|
taskLineType: null,
|
||||||
taskEditUserList: null,
|
taskEditUserList: null,
|
||||||
taskEditedUserList: null,
|
taskEditedUserList: null,
|
||||||
|
|||||||
Reference in new issue
Block a user