import request from '@/utils/request'

// 创建立档单位
export function createOrganization(data) {
  return request({
    url: '/setting/organization/create',
    method: 'post',
    data: data
  })
}

// 更新立档单位
export function updateOrganization(data) {
  return request({
    url: '/setting/organization/update',
    method: 'put',
    data: data
  })
}

// 删除立档单位
export function deleteOrganization(id) {
  return request({
    url: '/setting/organization/delete?id=' + id,
    method: 'delete'
  })
}

// 获得立档单位
export function getOrganization(id) {
  return request({
    url: '/setting/organization/get?id=' + id,
    method: 'get'
  })
}

// 获得立档单位分页
export function getOrganizationPage(query) {
  return request({
    url: '/setting/organization/page',
    method: 'get',
    params: query
  })
}

// 导出立档单位 Excel
export function exportOrganizationExcel(query) {
  return request({
    url: '/setting/organization/export-excel',
    method: 'get',
    params: query,
    responseType: 'blob'
  })
}

// 获取立档单位-库房-档案柜树状
export function getSiteTree(query) {
  return request({
    url: '/setting/organization/getTree',
    method: 'get',
    params: query
  })
}