import request from '../index'
const prefix = 'resource/staff'

export function getOrderList(data: any) {
  return request({
    url: `${prefix}/order/approval/listPage?limit=${data.limit}&offset=${data.offset}`,
    method: 'post',
    data,
  })
}

// 保存至草稿箱
export function saveToDraft(data: object) {
  return request({
    url: `${prefix}/order/save`,
    method: 'post',
    data,
  })
}

// 提交流程
export function submitToFlow(data: object) {
  return request({
    url: `${prefix}/order/submit`,
    method: 'post',
    data,
  })
}

// 草稿箱编辑（不走流程审批）
export function updateInDraft(data: object) {
  return request({
    url: `${prefix}/order/draftUpdate`,
    method: 'post',
    data,
  })
}

// 未通过委托方编辑（重走流程审批）
export function failUpdateOrder(data: object) {
  return request({
    url: `${prefix}/order/failUpdate`,
    method: 'post',
    data,
  })
}

// 删除草稿箱
export function draftDelete(data: object) {
  return request({
    url: `${prefix}/order/draftDelete`,
    method: 'post',
    data,
  })
}

// 删除审批单
export function orderApprDelete(data: object) {
  return request({
    url: `${prefix}/order/approval/delete`,
    method: 'post',
    data,
  })
}

// 发起者撤回，表单状态更改为已取消
export function revokeApproval(data: object) {
  return request({
    url: `${prefix}/order/approval/revoke`,
    method: 'post',
    data,
  })
}

// 委托方名录审批-拒绝
export function refuseApproval(data: object) {
  return request({
    url: `${prefix}/order/approval/refuse`,
    method: 'post',
    data,
  })
}
