import request from '@/utils/request'
/** 金赛临床支持管理系统 */
/********************************* 流程配置相关 **************************************/

export function getConfig(params) {
  return request({
    url: '/system/flow/getConfig',
    method: 'get',
    params
  })
}

export function saveConfig(data) {
  return request({
    url: '/system/flow/saveConfig',
    method: 'post',
    data
  })
}

export function removeConfig(data) {
  return request({
    url: '/system/flow/removeConfig',
    method: 'post',
    data
  })
}

/********************************* 流程审批相关 **************************************/

export function getFlowList(data) {
  return request({
    url: '/system/flow/list',
    method: 'get',
    params: data
  })
}

export function audit(data) {
  return request({
    url: '/system/flow/audit',
    method: 'post',
    data
  })
}

export function auditBatch(data) {
  return request({
    url: '/system/flow/auditBatch',
    method: 'post',
    data
  })
}

export function rollback(data) {
  return request({
    url: '/system/flow/rollback',
    method: 'post',
    data
  })
}

export function getTaskHistory(params) {
  return request({
    url: '/system/flow/getTaskHistory',
    method: 'get',
    params
  })
}

export function getAuditHistory(params) {
  return request({
    url: '/system/flow/getAuditHistory',
    method: 'get',
    params
  })
}

export function alertAudit(taskId) {
  return request({
    url: '/system/flow/alertAudit',
    method: 'put',
    params: {taskId}
  })
}

export function deleteAttachment(businessId, auditFlow) {
  return request({
    url: `/system/flow/deleteAttachment/${businessId}/${auditFlow}`,
    method: 'put'
  })
}


export function getTodoList(params) {
  return request({
    url: '/system/flow/getTodoList',
    method: 'get',
    params
  })
}
