import http from '../request/index.js'; import { Base64 } from 'js-base64'; /** * api/task/KanbanDef/GetMy * 得到我的任务看板设置 * @param {*} param * @returns */ export const kanbanGetMy = () => { const app = getApp() let header = {} let url = `${app.globalData.apiurl.gungho}/api/task/KanbanDef/GetMy` return http.requestGungho({ method: "GET", header: {}, url, }) } /** * 得到我的任务看板设置 * @param {*} param * @returns */ export const getKanbanLaneTask = (param = {}) => { const app = getApp() const { prjId = "", taskType = "", importance = "", delay = "N", duesoon = "N", cretor = "", kanbans = [] } = param; let url = `${app.globalData.apiurl.gungho}/api/task/GetKanbanLaneTask` return http.requestGungho({ method: "POST", header: {}, url, data: { prjId, taskType, importance, delay, duesoon, cretor, kanbans }, }) } /** * api/task/UpdTaskPlanType * 修改任务的计划类型 ,任务看板使用,收件箱等 * @param {*} param { id: xxx,type: 0,1,2,3,state: xxx} * @returns */ export const updPlanType = (tasks) => { const app = getApp() let header = {} let url = `${app.globalData.apiurl.gungho}/api/task/UpdTaskPlanType` return http.requestGungho({ method: "POST", header: {}, url, data: tasks, }) } /** * api/project/GetMyPrjList?login=xx&userName=xx&sessionId=SESSION_ID * 获取任务相关的项目 * @param {*} type 默认0,0:我的任务,1:我创建的。2:我负责的,3:我相关的 */ export const getPrjList = (type = 0) => { const app = getApp() let header = {} let url = `${app.globalData.apiurl.gungho}/api/task/GetPrjList?type=${type}` return http.requestGungho({ method: "GET", header: {}, url, }) } /** * api/task/GetInfo?login=xx&userName=xx&sessionId=SESSION_ID * 得到任务详情 * @param {*} * id:任务ID * includSubTask : 0 默认不获取任务中的子任务列表 1 –获取任务中的子任务列表 */ export const getInfo = (id, includSubTask = 0) => { const app = getApp() var header = {} let url = `${app.globalData.apiurl.gungho}/api/task/GetInfo?id=${encodeURI(id)}&includSubTask=${includSubTask}` return http.requestGungho({ method: "GET", header: {}, url, }) } /** * api/task/Create?login=xx&userName=xx&sessionId=SESSION_ID * 创建任务 * @param {*} */ export const create = (param = {}) => { const app = getApp() var header = {} let url = `${app.globalData.apiurl.gungho}/api/task/Create` const { planType = "0" /* 计划类型 */ , prjName = "" /* 项目名称 */ , prjId = "", name = "", desc = "", takeon = "", takeonName = "", group_exec = [], pic = "", picName = "", planStart = "", planDue = "", auditorSet = "" /* 审核人 */ , relList = [] /* 相关人 */ , checkItem = "" /* 检查项 */ , workUnit = 1 /* 工时单位:0 - 分钟,1 - 小时,2 - 天,3 - 周,4 - 月 */ , planWH = "" /* 计划工时 */ , taskClsName = "" /* 任务分类 */ , addCalendar = 0 /* 是否把任务加到日程 1 – 加入 */ , taskType = "0" /* 0 - 个人任务,1 - 部门任务,2 - Group任务,3—阶段 */ , quadrant = "0" /* 重要紧急度 */ , dueType = 0 /* dueType */ , putOffDay = 0 /* 顺延天数 */ , fromType = 0 /* 来源类型:0 - 常规创建,1 - 来源项目事件,2 - 项目计划 */ , fromObjID = "", showPTaskPath = "0" /* 显示父任务路径 */ , startRemindStyleID = "" /* 开始日期提醒样式ID */ , remindStyleID = "" /* 任务截止提醒样式ID */ , weight = "" /* 任务权重 */ , multiExecutor = 0 /* 0、1 是否多执行人 */ , key = 0 /* //关键任务0/1 */ , track = 0 /* 需要跟踪0/1 */ , notice = 0 /* 表示任务创建的时候不发通知0/1 */ , tag = "" /* 标签 */ , outputFileDef = "" /* 输出文件定义 */ , attachList = [] /* 附件列表 */ , timePointType = "" /* 提醒的时间点类型 0 – 开始日期 1—截至日期 */ , relResList = [] /* 执行资源 */ , phaseName = "" /* 阶段 */ , filePath = "" /* 文档柜信息 */ , keyNodeID = "" /* 关键节点ID */ } = param return http.requestGungho({ method: "POST", header: {}, url, data: { planType, prjName, prjId, name, desc, takeon, takeonName, group_exec, pic, picName, planStart, planDue, auditorSet, relList, checkItem, workUnit, planWH, taskClsName, addCalendar, taskType, quadrant, dueType, putOffDay, fromType, fromObjID, showPTaskPath, startRemindStyleID, remindStyleID, weight, multiExecutor, key, track, notice, tag, outputFileDef, attachList, timePointType, relResList, phaseName, filePath, keyNodeID } }) } /** * api/task/SetState?login=xx&userName=xx&sessionId=SESSION_ID * 设置任务状态 * * @param {*} id */ export const setState = (param = {}) => { const app = getApp() let header = {} const { id, state, note = "" } = param; let url = `${app.globalData.apiurl.gungho}/api/task/SetState` return http.requestGungho({ method: "POST", header: {}, url, data: { id, state, note }, }) } /** * api/task/Close?login=xx&userName=xx&sessionId=SESSION_ID * 设置任务完成 *isFinish:是否完成,1 – 完成,0 – 终止 * @param {*} id */ export const close = (param = {}) => { const app = getApp() let header = {} let url = `${app.globalData.apiurl.gungho}/api/task/Close` const { id, isFinish = 0, cause = "" } = param; return http.requestGungho({ method: "POST", header: {}, url, data: { id, isFinish, cause } }) } /** * api/task/Delete?login=xx&userName=xx&sessionId=SESSION_ID * 删除任务 * @param {*} id */ export const del = (param = {}) => { const app = getApp() let header = {} let url = `${app.globalData.apiurl.gungho}/api/task/Delete` const { id, cause = "" } = param; return http.requestGungho({ method: "POST", header: {}, url, data: { id, cause }, }) } /** * api/task/Submit?login=xx&userName=xx&sessionId=SESSION_ID * 任务提交 * @param {*} id */ export const submit = (param = {}) => { const app = getApp() let header = {} let url = `${app.globalData.apiurl.gungho}/api/task/Submit` const { id, auditorList = [], detailURL = "" } = param; return http.requestGungho({ method: "POST", header: {}, url, data: { id, auditorList, detailURL }, }) } /** * api/task/Forward?login=xx&userName=xx&sessionId=SESSION_ID * 任务转发 * @param {*} id */ export const forward = (param = {}) => { const app = getApp() let header = {} let url = `${app.globalData.apiurl.gungho}/api/task/Forward` const { id, takeon, takeonName, cause = "", } = param; return http.requestGungho({ method: "POST", header: {}, url, data: { id, takeon, takeonName, cause }, }) } /** * api/task/SetAttention?login=xx&userName=xx&sessionId=SESSION_ID * 设置任务关注 * id –任务ID * prjid –输出文件定义,为空表示删除原输出定义 * isatten 0,取消 ,1加入 * * @param {*} id */ export const setAttention = (param = {}) => { const app = getApp() let header = {} const { id, prjId = {}, isAtten = "0" } = param; let url = `${app.globalData.apiurl.gungho}/api/task/SetAttention?id=${encodeURI(id)}&prjid=${encodeURI(prjId)}&isatten=${encodeURI(isAtten)}` return http.requestGungho({ method: "POST", header: {}, url, data: {}, }) } /** * api/task/SetUrgentImportance?login=xx&userName=xx&sessionId=SESSION_ID * 设置重要度信息信息 * 0:"不重要不紧急",1:重要不紧急,2:紧急不重要,3:重要紧急 * @param {*} id */ export const setUrgentImportance = (param = {}) => { const app = getApp() let header = {} let url = `${app.globalData.apiurl.gungho}/api/task/SetUrgentImportance` const { id, quadrant = "0" } = param; return http.requestGungho({ method: "POST", header: {}, url, data: { id, quadrant }, }) } /** * api/task/SetTakeon?login=xx&userName=xx&sessionId=SESSION_ID * 设置任务执行人信息 * @param {*} */ export const setTakeon = (param = {}) => { const app = getApp() let header = {} let url = `${app.globalData.apiurl.gungho}/api/task/SetTakeon` const { taskId = [], takeon = "", takeonName = "", takeonRole = "", takeonRes = "", takeonResName = "" } = param; return http.requestGungho({ method: "POST", header: {}, url, data: { taskId, takeon, takeonName, takeonRole, takeonRes, takeonResName }, }) } /** * api/task/SetAuditorSet?login=xx&userName=xx&sessionId=SESSION_ID * 设置任务审核人信息 * @param {*} id */ export const setAuditorSet = (param = {}) => { const app = getApp() let header = {} let url = `${app.globalData.apiurl.gungho}/api/task/SetAuditorSet` const { id, auditorSet = "" } = param; return http.requestGungho({ method: "POST", header: {}, url, data: { id, auditorSet }, }) } /** * api/task/SetRelPerson?login=xx&userName=xx&sessionId=SESSION_ID * 设置任务相关人信息 * @param {*} id */ export const setRelPerson = (param = {}) => { const app = getApp() let header = {} let url = `${app.globalData.apiurl.gungho}/api/task/SetRelPerson` const { id, relList = [], relResList = [] } = param; return http.requestGungho({ method: "POST", header: {}, url, data: { id, relList, relResList }, }) } /** * api/task/SetPic?login=xx&userName=xx&sessionId=SESSION_ID * 设置任务负责人信息 * @param {*} id */ export const setPic = (param = {}) => { const app = getApp() let header = {} let url = `${app.globalData.apiurl.gungho}/api/task/SetPic` const { id, pic = "", picName = "" } = param; return http.requestGungho({ method: "POST", header: {}, url, data: { id, pic, picName }, }) } /** * api/task/SetPrj?login=xx&userName=xx&sessionId=SESSION_ID * 设置任务项目信息 * cabinet:{"Cabinet":"{ACFA0D43-58EE-4665-AE71-3528245672D6}","Path":""} * @param {*} id */ export const setPrj = (param = {}) => { const app = getApp() let header = {} let url = `${app.globalData.apiurl.gungho}/api/task/SetPrj` const { id, prjId = "", prjName = "", cabinet = "" } = param; return http.requestGungho({ method: "POST", header: {}, url, data: { id, prjId, prjName, cabinet }, }) } /** * api/task/SetPhase?login=xx&userName=xx&sessionId=SESSION_ID * 设置任务阶段信息 * @param {*} id */ export const setPhase = (param = {}) => { const app = getApp() let header = {} let url = `${app.globalData.apiurl.gungho}/api/task/SetPhase` const { id, phaseName = "" } = param; return http.requestGungho({ method: "POST", header: {}, url, data: { id, phaseName }, }) } /** * api/task/SetDate?login=xx&userName=xx&sessionId=SESSION_ID * 设置任务时间信息 * @param {*} id */ export const setDate = (param = {}) => { const app = getApp() let header = {} let url = `${app.globalData.apiurl.gungho}/api/task/SetDate` const { id, startDate = "", dueDate = "" } = param; return http.requestGungho({ method: "POST", header: {}, url, data: { id, startDate, dueDate } }) } /** * api/task/SetAttr?login=xx&userName=xx&sessionId=SESSION_ID * 设置单个任务属性{id:"",attrSet[{name:"",value:""},...]} * @param {*} */ export const setAttr = (task) => { const app = getApp() let header = {} let url = `${app.globalData.apiurl.gungho}/api/task/SetAttr` return http.requestGungho({ method: "POST", header: {}, url, data: task }) } /** * api/task/SetAttrs?login=xx&userName=xx&sessionId=SESSION_ID * 设置多个任务属性[{id:"",attrSet[{name:"",value:""},...]},...] * @param {*} */ export const taskSetAttrs = (tasks) => { const app = getApp() let header = {} let url = `${app.globalData.apiurl.gungho}/api/task/SetAttrs` return http.requestGungho({ method: "POST", header: {}, url, data: tasks }) } /** * api/task/QueryList?login=xx&userName=xx&sessionId=SESSION_ID * 查询任务列表 * @param {*} */ export const queryList = (param = {}) => { const app = getApp() let header = {} let url = `${app.globalData.apiurl.gungho}/api/task/QueryList` const { page, size, sql, attrs, order, type = "", prjId = "" } = param; return http.requestGungho({ method: "POST", header, url, data: { page, size, sql: Base64.encode(sql), attrs, order, type, prjId } }) } /** * api/task/QueryAuditList?login=xx&userName=xx&sessionId=SESSION_ID * 查询需要我审核的任务列表 * @param {*} */ export const queryAuditList = (param = {}) => { const app = getApp() let header = {} let url = `${app.globalData.apiurl.gungho}/api/task/QueryAuditList` const { page, size, sql, attrs, order, } = param; return http.requestGungho({ method: "POST", header, url, data: { page, size, sql: Base64.encode(sql), attrs, order, } }) } /** * api/api/task/Attach/GetList?login=xx&userName=xx&sessionId=SESSION_ID * 查询任务列表 * @param {*} * outType –输出文档的类型:-1 –不限止,0 –输入文档,1 –输出文档 */ export const attachList = (param = {}) => { const app = getApp() let header = {} let url = `${app.globalData.apiurl.gungho}/api/task/Attach/GetList` const { page = 1, sessionid = "", taskID, taskCode, attachName = "", includeSubTask = 0, outType = -1, orderby = "", numPerPage = 9999, } = param; return http.requestGungho({ method: "POST", header, url, data: { page, sessionid, taskID, taskCode, attachName, includeSubTask, outType, orderby, numPerPage, } }) } /** * api/task/Attach/Add?login=xx&userName=xx&sessionId=SESSION_ID * 增加任务附件(包括参照物与交付物) * @param {*} taskID 任务Id * @param {*} attach: fileServer String 是 文件服务器标识 fileID String 是 文件ID fileSize String 是 文件大小 clsID String 是 文件类ID objID String 是 文件对象ID dispName String 是 文件显示名称 IsOut Number 是 是否是交付物:0 – 参照物,1 – 交付物 LinkType Number 是 链接类型:0 – 实体数据,1 – 引用其它数据 */ export const attachAdd = (param = {}) => { const app = getApp() const { taskID = "", //任务ID attach = [], } = param let header = {} let url = `${app.globalData.apiurl.gungho}/api/task/Attach/Add` return http.requestGungho({ method: "POST", header, url, data: { taskID, attach } }) } /** * api/task/Attach/Remove?login=xx&userName=xx&sessionId=SESSION_ID * 删除任务附件(包括参照物与交付物) * @param {*} */ export const attachRemove = (param = {}) => { const app = getApp() const { taskID = "", //任务ID fileID = "", } = param let header = {} let url = `${app.globalData.apiurl.gungho}/api/task/Attach/Remove` return http.requestGungho({ method: "POST", header, url, data: { taskID, fileID } }) } /** * api/task/SetCalendar?login=xx&userName=xx&sessionId=SESSION_ID * 得到任务动态列表历 * @param {*} */ export const logGetDynamicList = (taskId, isAsc = 1) => { const app = getApp() let url = `${app.globalData.apiurl.gungho}/api/task/Log/GetDynamicList?taskID=${encodeURI(taskId)}&isAsc=${isAsc}` return http.requestGungho({ method: "GET", url }) } /** * api/task/SetCalendar?login=xx&userName=xx&sessionId=SESSION_ID * 得到任务讨论列表 * @param {*} */ export const logGetList = (param = {}) => { const app = getApp() const { sessionID = "", page = 1, id, isAsc = 0, numPerPage = 10 } = param; let header = {} let url = `${app.globalData.apiurl.gungho}/api/task/Log/GetDiscList` return http.requestGungho({ method: "POST", header, url, data: { sessionID, page, taskID: id, isAsc, numPerPage } }) } /** * api/task/SetCalendar?login=xx&userName=xx&sessionId=SESSION_ID * 增加交流 或动态 * opType;//操作类型:创建/确认/已读/担当变化/退回/提交/搁置/版本/回复 * 交流:回复 * @param {*} */ export const logAdd = (param) => { const app = getApp() const { id, opType, content = "" } = param let header = {} let url = `${app.globalData.apiurl.gungho}/api/task/Log/Add` return http.requestGungho({ method: "POST", header, url, data: { taskID: `{${id.replace(/^\{|\}$/g, "")}}`, opType, content } }) } /** * api/task/QueryAuditList?login=xx&userName=xx&sessionId=SESSION_ID processId :任务流程ID * @param {*} id */ export const getProcessTaskId = (processId) => { const app = getApp() let url = `${app.globalData.apiurl.gungho}/api/process/task/GetProcessTaskId?processId=${encodeURI(processId)}` return http.requestGungho({ method: "GET", url, }) } /** * api/task/Submit * 处理任务提交 * @param {*} Query参数 名称 类型 必须有值 示例 描述 sessionID String 是 操作用户的SessionID Body参数 名称 类型 必须有值 示例 描述 taskId String 是 {...} 任务ID action String 是 同意 完成的动作 note String 否 完成的动作 detailUrl String 否 http://xxxx 详情URL 暂定:http:xxxxx/externaltaskpage?id=xxx 需要base64 stepUser Array 否 下一结点的执行用户,可选 nodeId String 是 流程定义结点ID login String 是 用户登录名 name String 是 用户名称 */ export const agree = (param = {}) => { const { id, processId, action = "同意", note = "", stepUser = [] } = param; const app = getApp() let header = {} return new Promise(async (resolve, reject) => { try { let res = await getProcessTaskId(processId) let processTaskId = "" if (res) processTaskId = res.id || "" if (!processTaskId) { return reject("任务流程ID获取为空") } let taskurl = `${app.globalData.apiurl.httpurl}/externaltaskpage?id=${id}` let url = `${app.globalData.apiurl.gungho}/api/process/task/Submit` res = await http.requestGungho({ method: "POST", header: {}, url, data: { taskId: processTaskId, action, note, detail_url: Base64.encode(taskurl), step_user: stepUser }, }) resolve(res) } catch (ex) { reject(ex) } }) } /** * api/task/Submit * 处理任务提交 * @param {*} Query参数 名称 类型 必须有值 示例 描述 sessionID String 是 操作用户的SessionID Body参数 名称 类型 必须有值 示例 描述 taskId String 是 {...} 任务ID note String 否 意见备注 detailUrl String 否 http://xxxx 详情URL 暂定:http:xxxxx/externaltaskpage?id=xxx 需要base64 */ export const disagree = (param = {}) => { const { id, processId, note = "", } = param; const app = getApp() let header = {} return new Promise(async (resolve, reject) => { try { let res = await getProcessTaskId(processId) let processTaskId = "" if (res) processTaskId = res.id || "" if (!processTaskId) { return reject("任务流程ID获取为空") } let taskurl = `${app.globalData.apiurl.httpurl}/externaltaskpage?id=${id}` let url = `${app.globalData.apiurl.gungho}/api/process/task/Reject` res = await http.requestGungho({ method: "POST", header: {}, url, data: { taskId: processTaskId, note, detail_url: Base64.encode(taskurl), }, }) resolve(res) } catch (ex) { reject(ex) } }) } /** * api/task/SetReleaseNote?login=xx&userName=xx&sessionId=SESSION_ID * 设置任务发布说明 * id –任务ID * releaseNote –发布说明内容。需要base64加密 * * @param {*} id */ export const setReleaseNote = (param = {}) => { const app = getApp() const { id, releaseNote = "" } = param; let header = {} let url = `${app.globalData.apiurl.gungho}/api/task/SetReleaseNote` return http.requestGungho({ method: "POST", header, url, data: { id, releaseNote } }) }