import request from '@/utils/request'

// 创建审批流程
export function createFlow(data) {
  return request({
    url: '/archives/flow/create',
    method: 'post',
    data: data
  })
}

// 更新审批流程
export function updateFlow(data) {
  return request({
    url: '/archives/flow/update',
    method: 'put',
    data: data
  })
}

// 删除审批流程
export function deleteFlow(id) {
  return request({
    url: '/archives/flow/delete?id=' + id,
    method: 'delete'
  })
}

// 获得审批流程
export function getFlow(id) {
  return request({
    url: '/archives/flow/get?id=' + id,
    method: 'get'
  })
}

// 获得审批流程分页
export function getFlowPage(query) {
  return request({
    url: '/archives/flow/page',
    method: 'get',
    params: query
  })
}

// 导出审批流程 Excel
export function exportFlowExcel(query) {
  return request({
    url: '/archives/flow/export-excel',
    method: 'get',
    params: query,
    responseType: 'blob'
  })
}

// 下载元数据
export function downloadXml(query) {
  return request({
    url: '/archives/flow/downloadXml',
    method: 'get',
    params: query,
    responseType: 'blob'
  })
}
