import request from '@/utils/request'
import { download } from '@/utils/request'
// 查询standardCompany列表
export function listStandardCompany(query) {
  request.defaults.baseURL = '/ezhizao-yzbh-entrust'
  return request({
    url: '/business/standardCompany/list',
    method: 'get',
    params: query
  })
}

// 查询standardCompany详细
export function getStandardCompany(id) {
  request.defaults.baseURL = '/ezhizao-yzbh-entrust'
  return request({
    url: '/business/standardCompany/' + id,
    method: 'get'
  })
}

// 新增standardCompany
export function addStandardCompany(data) {
  request.defaults.baseURL = '/ezhizao-yzbh-entrust'
  return request({
    url: '/business/standardCompany',
    method: 'post',
    data: data
  })
}

// 修改standardCompany
export function updateStandardCompany(data) {
  request.defaults.baseURL = '/ezhizao-yzbh-entrust'
  return request({
    url: '/business/standardCompany',
    method: 'put',
    data: data
  })
}

// 修改standardCompany负责人
export function updateStandardCompanyName(id, userId) {
  request.defaults.baseURL = '/ezhizao-yzbh-entrust'
  return request({
    url: '/business/standardCompany/Leader/' + id,
    method: 'post',
    data: userId
  })
}

// 修改standardCompany客服
export function updateStandardCompanyAdviser(id, userId) {
  request.defaults.baseURL = '/ezhizao-yzbh-entrust'
  return request({
    url: '/business/standardCompany/Adviser/' + id,
    method: 'post',
    data: userId
  })
}

//循环工单
export function setLoopEntrust(data) {
  request.defaults.baseURL = '/ezhizao-yzbh-entrust'
  return request({
    url: '/business/standardCompany/setLoopEntrust/',
    method: 'post',
    data: data
  })
}

// 新增档案入库
export function addOrder(data) {
  request.defaults.baseURL = '/ezhizao-yzbh-crm'
  return request({
    url: '/business/standardCompany/order',
    method: 'post',
    data: data
  })
}

// 单次工单
export function setOneEntrust(data) {
  request.defaults.baseURL = '/ezhizao-yzbh-entrust'
  return request({
    url: '/business/standardCompany/setOneEntrust',
    method: 'post',
    data: data
  })
}

// 导出
export function exportCompany(data) {
  request.defaults.baseURL = '/ezhizao-yzbh-entrust'
  download(
    "business/standardCompany/export",
    {
      ...data,
    },
    `客户信息${new Date().getTime()}.xlsx`
  );
}



// 删除standardCompany
export function delStandardCompany(id) {
  request.defaults.baseURL = '/ezhizao-yzbh-entrust'
  return request({
    url: '/business/standardCompany/' + id,
    method: 'delete'
  })
}
