import request from '@/utils/request'

// 创建部门业绩目标设置
export function createDeptTarget(data) {
  return request({
    url: '/sale/dept-target/create',
    method: 'post',
    data: data
  })
}

// 更新部门业绩目标设置
export function updateDeptTarget(data) {
  return request({
    url: '/sale/dept-target/update',
    method: 'put',
    data: data
  })
}

// 删除部门业绩目标设置
export function deleteDeptTarget(id) {
  return request({
    url: '/sale/dept-target/delete?id=' + id,
    method: 'delete'
  })
}

export function getCreateInitData() {
  return request({
    url: '/sale/dept-target/getCreateInitData',
    method: 'get'
  })
}

// 获得部门业绩目标设置
export function getDeptTarget(id) {
  return request({
    url: '/sale/dept-target/get?id=' + id,
    method: 'get'
  })
}

// 获得部门业绩目标设置分页
export function getDeptTargetPage(query) {
  return request({
    url: '/sale/dept-target/statistics/page',
    method: 'get',
    params: query
  })
}

// 导出部门业绩目标设置 Excel
export function exportDeptTargetExcel(query) {
  return request({
    url: '/sale/dept-target/export-excel',
    method: 'get',
    params: query,
    responseType: 'blob'
  })
}
