我的审批展示逻辑
This commit is contained in:
1 parent
c44365e44f
commit
d2cfd28e41
5 files changed
+39
-20
No files matched your search
+26
-3
@@ -73,11 +73,12 @@ class TaskService extends Service {
|
||||
var editedUserList = taskEditedUserList && taskEditedUserList.split(',') || []
|
||||
|
||||
// 判断该节点是否已完成
|
||||
if ((approvalType == "会签" || approvalType == "依次审批") && editUserList.length + 1 < editedUserList.length) {
|
||||
if ((approvalType == "会签" || approvalType == "依次审批") && editUserList.length > 1) {
|
||||
// 未完成
|
||||
editedUserList.push(userId)
|
||||
updateTaskData = {
|
||||
taskEditUserList: editUserList.filter(u => u != userId),
|
||||
taskEditedUserList: editedUserList.push(userId).join(','),
|
||||
taskEditUserList: editUserList.filter(u => u != userId).join(','),
|
||||
taskEditedUserList: editedUserList.join(','),
|
||||
}
|
||||
|
||||
historyInsertData.push(await this.createTaskHistory({ taskData, taskStatus, type }))
|
||||
@@ -265,6 +266,28 @@ class TaskService extends Service {
|
||||
return workflowHistory
|
||||
|
||||
}
|
||||
|
||||
async getTaskList() {
|
||||
const { jianghuKnex } = this.app;
|
||||
const { userId } = this.ctx.userInfo;
|
||||
|
||||
const task = await jianghuKnex('task').where({ taskStatus: 'running' }).where('taskEditUserList', 'like', '%' + userId + '%').select();
|
||||
|
||||
// 判断是否到该人审批
|
||||
const result = task.filter(item => {
|
||||
const { taskWorkflow, taskConfigId, taskEditUserList } = item
|
||||
// 查看当前节点是否是"依次审批"
|
||||
var isApproval = true,
|
||||
type = JSON.parse(taskWorkflow).nodeList.find(node => node.id === taskConfigId)?.properties.approvalType
|
||||
|
||||
if (type === '依次审批' && !taskEditUserList.startsWith(userId)) {
|
||||
isApproval = false
|
||||
}
|
||||
|
||||
return isApproval
|
||||
})
|
||||
return result
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = TaskService;
|
||||
Reference in new issue
Block a user