import request from "@/utils/request";

//督办保存
export function saveSupervision(data) {
  return request({
    url: "/offcial/supervision",
    method: "post",
    data: data,
  });
}
// 新增督办
export function startSupervision(data) {
  return request({
    url: "/offcial/supervision/startSupervision",
    method: "post",
    data: data,
  });
}

// 督办
export function selSuperVisionByWorkId(id) {
  return request({
    url: "/offcial/supervision/sel/" + id,
    method: "get",
  });
}

// 新增督办
export function sendFlowToUsers1(data) {
  return request({
    url: "/offcial/supervision/sendFlowToUsers1",
    method: "post",
    params: data,
  });
}

// 查询督办列表
export function listSupervision(query) {
  return request({
    url: "/offcial/supervision/list",
    method: "get",
    params: query,
  });
}

// 查询督办详细
export function getSupervision(id) {
  return request({
    url: "/offcial/supervision/" + id,
    method: "get",
  });
}

// 新增督办
export function addSupervision(data) {
  return request({
    url: "/offcial/supervision",
    method: "post",
    data: data,
  });
}

// 修改督办
export function updateSupervision(data) {
  return request({
    url: "/offcial/supervision",
    method: "put",
    data: data,
  });
}

// 删除督办
export function delSupervision(id) {
  return request({
    url: "/offcial/supervision/" + id,
    method: "delete",
  });
}
// 催办督办
export function myselfDetail(id) {
  return request({
    url: "/offcial/supervision/sel/myselfDetail/" + id,
    method: "get",
  });
}
// 修改进度详情
export function updatemyselfDetail(data) {
  let f = new FormData();
  Object.keys(data).forEach((key) => {
    f.append(key, data[key]);
  });
  return request({
    url: "/offcial/supervision/update/myselfDetail",
    method: "post",
    data: f,
  });
}
// 催办督办批量
export function plcuiban(id) {
  return request({
    url: "/offcial/supervision/plcuiban/" + id,
    method: "get",
  });
}
// 提交督办
export function submitSupervision(id) {
  return request({
    url: "/offcial/supervision/patchStartSupervision/" + id,
    method: "post",
  });
}
// // 编辑查详情
// export function selSupervisionByWorkId(id) {
//   return request({
//     url: "/offcial/supervision" + id,
//     method: "get",
//   });
// }
// 督办待办
export function dblist(query) {
  return request({
    url: "/offcial/supervision/dblist",
    method: "get",
    params: query,
  });
}
// 我发起的督办
export function dbfqlist(query) {
  return request({
    url: "/offcial/supervision/dbfqlist",
    method: "get",
    params: query,
  });
}
// 督办提交后选择领导审核提交
export function editItem(data) {
  // let f = new FormData();
  // Object.keys(data).forEach((key) => {
  //   f.append(key, data[key]);
  // });
  return request({
    url: "/offcial/supervision/editItem",
    method: "post",
    data: data,
  });
}
// 领导
export function GenerNextStepNodeEmpsNoWorkId(data) {
  let f = new FormData();
  Object.keys(data).forEach((key) => {
    f.append(key, data[key]);
  });
  return request({
    url: "/jflow/restful/GenerNextStepNodeEmpsNoWorkId",
    method: "post",
    data: f,
  });
}
// 领导退回或通过
export function leaderApprove(data) {
  // let f = new FormData();
  // Object.keys(data).forEach((key) => {
  //   f.append(key, data[key]);
  // });
  return request({
    url: "/offcial/supervision/leaderApprove",
    method: "post",
    data: data,
  });
}
// 再次发起
export function startSupervisionZaici(data) {
  return request({
    url: "/offcial/supervision",
    method: "post",
    data: data,
  });
}
