import request from '@/utils/request'
import { download } from '@/utils/request'

// 查询划款管理列表
export function listDeduction(query) {
  request.defaults.baseURL = '/ezhizao-yzbh-production'
  return request({
    url: '/business/deduction/list',
    method: 'get',
    params: query
  })
}

// 查询划款管理详细
export function getDeduction(id) {
  request.defaults.baseURL = '/ezhizao-yzbh-production'
  return request({
    url: '/business/deduction/' + id,
    method: 'get'
  })
}

// 新增划款管理
export function addDeduction(data) {
  request.defaults.baseURL = '/ezhizao-yzbh-production'
  return request({
    url: '/business/deduction',
    method: 'post',
    data: data
  })
}

// 修改划款管理
export function updateDeduction(data) {
  request.defaults.baseURL = '/ezhizao-yzbh-production'
  return request({
    url: '/business/deduction',
    method: 'put',
    data: data
  })
}

// 删除划款管理
export function delDeduction(id) {
  request.defaults.baseURL = '/ezhizao-yzbh-production'
  return request({
    url: '/business/deduction/' + id,
    method: 'delete'
  })
}

export function exportDeposition(query) {
  request.defaults.baseURL = '/ezhizao-yzbh-production'
  download(
    "business/deduction/export",
    {
      ...query,
    },
    `划款导出_${new Date().getTime()}.xlsx`
  )
}

// 修改划款管理
export function saveDeduction(data) {
  request.defaults.baseURL = '/ezhizao-yzbh-production'
  return request({
    url: '/business/deduction/save',
    method: 'post',
    data: data
  })
}

export function getAmountView(data) {
  request.defaults.baseURL = '/ezhizao-yzbh-production'
  return request({
    url: '/business/deduction/getAmountView',
    method: 'post',
    data: data
  })
}
export function saveFiles(data) {
  request.defaults.baseURL = '/ezhizao-yzbh-production'
  return request({
    url: '/business/deduction/saveFiles',
    method: 'post',
    data: data
  })

}

export function remove(data) {
  request.defaults.baseURL = '/ezhizao-yzbh-production'
  return request({
    url: '/business/deduction/delFile',
      method: 'post',
      data: data
  })

}