统计当前人每种流程的任务数

场景描述

计算当前登录者

  • 待办任务中每种流程的数量
  • 已办任务中每种流程的数量
  • 待阅任务中每种流程的数量
  • 已阅任务中每种流程的数量

实现思路

调用流程组件提供的 countTaskByProcess 方法计算

实现步骤

1 引用 taskUtil.js

在js代码中引用流程组件的taskUtil.js,代码如下

import TaskUtils from "$UI/comp/wfmui/components/wfmui/js/taskUtil";

2 调用 countTaskByProcess 方法

countTaskByProcess 方法提供两个参数option和page。其中option是json对象,包括查询条件等参数,page传入this。option中包含的参数如下

{
    "personFIDs": [],//当前人的fid数组
    "kind": "task",//task代表查询任务 notice代表查询通知
    "status": "wait",//wait代表查询待办 finish代表查询已办
    "filter": "",//过滤条件
    "orderBy": "",//排序
    "limit": "",//分页数据大小
    "offset": ""//偏移量
}

查询当前人每种流程的待办任务数量的代码如下

    //使用上下文组件获取当前人的fid数组
    let personMembers = this.comp("wxContext0").getAllPersonMembers();
    let personFIDs = [];
    personMembers.forEach((person) => {
        personFIDs.push(person.fid);
    });

    TaskUtils.countTaskByProcess({
        "personFIDs": personFIDs,//当前人的fid数组
        "kind": "task",//task任务 notice通知
        "status": "wait"//wait待办 finish已办
    },this).then(function(res){
        console.log(res);
    })

控制台输出如下图所示

results matching ""

    No results matching ""

    results matching ""

      No results matching ""