import { findMyTask } from "@/api/flowable/businessKey";

const flowtask = {
    state: {},
  
    mutations: {},
  
    actions: {
      // 设置代办任务
      initMyTaskNum({ commit }) {
        return new Promise((resolve, reject) => {
          //查询当前登录人的代办任务数量
          findMyTask({}).then(response => {
            let todos=document.querySelectorAll(".tips_Todo");
            let tasks=document.querySelectorAll(".tips_Task");
            if(todos.length>0){
              todos.forEach(el=>{
                el.innerHTML=response.data.todo;
                if(response.data.todo>0){
                  el.style.display="inline";
                }else{
                  el.style.display="none";
                }
              });
            }
            if(tasks.length>0){
              tasks.forEach(el=>{
                el.innerHTML=response.data.todo;
                if(response.data.todo>0){
                  el.style.display="inline";
                }else{
                  el.style.display="none";
                }
              });
            }
            resolve()
          }).catch(error => {
            reject(error)
          });
        })
      }
    }
  }
  
  export default flowtask