import request from "@/utils/request";

//获取我的待办列表
export function getHandleList(token, pageSize, pageNum, title) {
  return request({
    url: "/jflow/restful/DB_Todolist",
    params: {
      token: token,
      pageSize: pageSize,
      pageNum: pageNum,
      title: title,
    },
    method: "get",
  });
}

//获取在途任务列表
export function getIntransitList(token, pageSize, pageNum, title) {
  return request({
    url: "/jflow/restful/DB_Runing",
    params: {
      token: token,
      pageSize: pageSize,
      pageNum: pageNum,
      title: title,
    },
    method: "get",
  });
}
//修改反馈
export function receive(data) {
  return request({
    url: "/offcial/receive ",
    method: "put",
    data: data,
  });
}

//获取已办列表
export function getCompletedList(token, pageSize, pageNum, title) {
  return request({
    url: "/jflow/restful/MyJoinFlows",
    params: {
      token: token,
      pageSize: pageSize,
      pageNum: pageNum,
      title: title,
    },
    method: "get",
  });
}

//获取我发起的待办
export function getInitiateList(token, pageSize, pageNum, title) {
  return request({
    url: "/jflow/restful/DB_MyStartFlowInstance",
    params: {
      token: token,
      pageSize: pageSize,
      pageNum: pageNum,
      title: title,
    },
    method: "get",
  });
}

//获得下一节点信息
export function generNextStepNode(flowNo, workid, paras, token) {
  return request({
    url: "/jflow/restful/GenerNextStepNode",
    params: {
      token: token,
      flowNo: flowNo,
      workid: workid,
      paras: paras,
    },
    method: "get",
  });
}
//获得下一节点信息 （判断是到了最后一个节点，不进行结束流程）
export function generNextStepNode1(flowNo, workid, paras, token) {
  return request({
    url: "/jflow/restful/GenerNextStepNode1",
    params: {
      token: token,
      flowNo: flowNo,
      workid: workid,
      paras: paras,
    },
    method: "get",
  });
}
// //获得下一节点信息(请假) （判断是到了最后一个节点，不进行结束流程）
// export function generNextStepNode2(flowNo, workid, paras, token, nodeId) {
//   return request({
//     url: "/jflow/restful/GenerNextStepNode1",
//     params: {
//       token: token,
//       flowNo: flowNo,
//       workid: workid,
//       paras: paras,
//       toNodeId: nodeId,
//     },
//     method: "get",
//   });
// }
//获得下一节点信息
export function generNextStepAllNode(flowNo, workid, paras, token) {
  return request({
    // url:"/jflow/restful/GenerNextStepAllNode",
    url: "/jflow/restful/GenerNextStepNode",
    params: {
      token: token,
      flowNo: flowNo,
      workid: workid,
      paras: paras,
    },
    method: "get",
  });
}
//获得下一节点信息
export function judgeNode(nodeId, token) {
  return request({
    url: "/jflow/restful/judgeNode",
    params: {
      nodeId: nodeId,
      token: token,
    },
    method: "get",
  });
}

//获得下一节点接收人信息
export function GenerNextStepNodeEmps(flowNo, toNodeID, workid, token) {
  return request({
    url: "/jflow/restful/GenerNextStepNodeEmps",
    params: {
      token: token,
      flowNo: flowNo,
      workid: workid,
      toNodeID: toNodeID,
    },
    method: "get",
  });
}
export function GenerNextStepNodeEmpsNoWorkId(flowNo, toNodeID) {
  return request({
    url: "/jflow/restful/GenerNextStepNodeEmpsNoWorkId",
    params: {
      flowNo: flowNo,
      toNodeID: toNodeID,
    },
    method: "get",
  });
}

//修改已读
export function updateIsRead(workid, token, FK_Node) {
  return request({
    url: "/jflow/restful/DB_isRead",
    params: {
      token: token,
      workid: workid,
      nodeId: FK_Node,
    },
    method: "get",
  });
}
//发送到下一节点
export function sendFlowToNext(data) {
  return request({
    url: "/offcial/receive/sendFlowToUsers",
    params: data,
    method: "post",
  });
}
//发送到下一节点 （有判断到了最后一个节点自动结束）
export function sendFlowToNext1(data) {
  return request({
    url: "/offcial/receive/sendFlowToUsers1",
    params: data,
    method: "post",
  });
}
//发送到下一节点(请假)
export function sendFlowToNextLeave(data) {
  return request({
    url: "/oa/leave/sendNextSteep",
    params: data,
    method: "post",
  });
}
//获得当前流程信息
export function currGenerWorkFlowInfo(data) {
  return request({
    url: "/jflow/restful/CurrGenerWorkFlowInfo",
    params: data,
    method: "post",
  });
}

//获得回滚节点
export function getReturnWorkNode(data) {
  return request({
    url: "/jflow/restful/getReturnWorkNode",
    params: data,
    method: "post",
  });
}

//退回到指定节点
export function node_ReturnWork(data) {
  return request({
    url: "/jflow/restful/Node_ReturnWork",
    params: data,
    method: "post",
  });
}

//获取收文节点审核信息
export function getYbjInfo(id) {
  return request({
    url: "/offcial/receive/getYbjInfo/" + id,
    method: "get",
  });
}

//获取发文节点审核信息
export function getFwYbjInfo(id) {
  return request({
    url: "/offcial/message/getFwYbjInfo/" + id,
    method: "get",
  });
}

//获取学术论文节点审核信息
export function getXslwYbjInfo(id) {
  return request({
    url: "/system/publish/getXslwYbjInfo/" + id,
    method: "get",
  });
}

//获取节点审核信息
export function getReviewMsg(flowNo, workid, nodefrom) {
  return request({
    url: "/jflow/restful/DB_ReviewMsg",
    params: {
      flowNo: flowNo,
      workid: workid,
      nodeFrom: nodefrom,
    },
    method: "get",
  });
}
//获取节点审核信息
export function selectDpPersons(data) {
  return request({
    url: "/jflow/restful/selectDpPersons",
    method: "get",
    data,
  });
}

//移交工作
export function NodeShift(workid, toEmps, msg) {
  return request({
    url: "/jflow/restful/Node_Shift",
    params: {
      workid: workid,
      toEmps: toEmps,
      msg: msg,
    },
    method: "get",
  });
}
//流转记录
export function getWfGenerWorkList(token, workID) {
  return request({
    url: "/jflow/restful/getWfGenerWorkList",
    params: {
      token: token,
      workID: workID,
    },
    method: "get",
  });
}
//获取当前节点是否可退回
export function CurrNodeInfo(token, currNodeID) {
  return request({
    url: "/jflow/restful/CurrNodeInfo",
    params: {
      token: token,
      currNodeID: currNodeID,
    },
    method: "get",
  });
}
// 收文文件删除
export function delSWFileList(fileId) {
  return request({
    url: "/offcial/receive/delFiles/" + fileId,
    method: "post",
  });
}
//查看是否可编辑
export function getSelfParas(workid) {
  return request({
    url: "/jflow/restful/getSelfParas",
    method: "get",
    params: {
      workid: workid,
    },
  });
}
