import { defHttp } from '/@/utils/http/axios';
import { PageParams, ListGetResultModel, DelParams, roleParams, companyExcelParams } from './model';
import { Result, FileStream } from '/#/axios';
let qjurl = window.location.host == 'v4-uat.4dkankan.com'?'https://test.4dkankan.com':''
enum Api {
  buryPointList = '/service/sale/buryPoint/list',
  buryPointAdd = '/service/sale/buryPoint/add',
  buryPointDlt = '/service/sale/buryPoint/delete',
  userTotal = '/service/sale/data/userTotal',
  orderTotal = '/service/sale/data/orderTotal',
  userTrend = '/service/sale/data/userTrend',
  orderTrend = '/service/sale/data/orderTrend',
  cameraTrend = '/service/sale/data/cameraTrend',
  sceneTrend = '/service/sale/data/sceneTrend',
  sceneTotal = '/service/sale/data/sceneTotal',
  cameraExport = '/service/sale/order/camera/export',
  downExport = '/service/sale/order/down/export',
  incrementExport = '/service/sale/order/increment/export',
  workType = '/service/sale/dataCount/warrantyTypeCount',
  workTrend = '/service/sale/dataCount/faultCount',
  qjuserTrend = '/qjkankan/api/age/report/userTrend',
  volumeTrend = '/service/sale/dataCount/repairAddTrend',
}

/**
 * @description: Get sample list value
 */

export const buryPointList = (params: PageParams) =>
  defHttp.post<Result>({
    url: Api.buryPointList,
    params,
    data: params,
    headers: {
      // @ts-ignore
      ignoreCancelToken: true,
    },
  });

  export const buryPointAdd = (params: PageParams) =>
  defHttp.post<Result>({
    url: Api.buryPointAdd,
    params,
    data: params,
    headers: {
      // @ts-ignore
      ignoreCancelToken: true,
    },
  });
  export const buryPointDlt = (params: PageParams) =>
  defHttp.post<Result>({
    url: Api.buryPointDlt,
    params,
    data: params,
    headers: {
      // @ts-ignore
      ignoreCancelToken: true,
    },
  });
  export const userTotal = () =>
  defHttp.get<Result>({
    url: Api.userTotal,
    headers: {
      // @ts-ignore
      ignoreCancelToken: true,
    },
  });
  export const userTrend = (params) =>
  defHttp.get<Result>({
    url: Api.userTrend,
    params,
    data: params,
    headers: {
      // @ts-ignore
      ignoreCancelToken: true,
    },
  });
  export const orderTotal = () =>
  defHttp.get<Result>({
    url: Api.orderTotal,
    headers: {
      // @ts-ignore
      ignoreCancelToken: true,
    },
  });
  
  export const orderTrend = (params) =>
  defHttp.get<Result>({
    url: Api.orderTrend,
    params,
    data: params,
    headers: {
      // @ts-ignore
      ignoreCancelToken: true,
    },
  });
  
  export const cameraTrend = (params) =>
  defHttp.get<Result>({
    url: Api.cameraTrend,
    params,
    data: params,
    headers: {
      // @ts-ignore
      ignoreCancelToken: true,
    },
  });
  
  export const sceneTotal = () =>
  defHttp.get<Result>({
    url: Api.sceneTotal,
    headers: {
      // @ts-ignore
      ignoreCancelToken: true,
    },
  });
  
  export const sceneTrend = (params) =>
  defHttp.get<Result>({
    url: Api.sceneTrend,
    params,
    data: params,
    headers: {
      // @ts-ignore
      ignoreCancelToken: true,
    },
  });
  
  export const workType = (params) =>
  defHttp.get<Result>({
    url: Api.workType,
    params,
    data: params,
  });
    
  export const workTrend = (params) =>
  defHttp.get<Result>({
    url: Api.workTrend,
    params,
    data: params,
  });    
  export const qjuserTrend = (params) =>
  defHttp.post<Result>({
    url: qjurl + Api.qjuserTrend,
    params,
    data: params,
    headers: {
      // @ts-ignore
      appId: 'BDA385EC848C1A425F746869011C8D23',
      ignoreCancelToken: true,
    },
  });    
  export const volumeTrend = (params) =>
  defHttp.get<Result>({
    url: Api.volumeTrend,
    params,
    data: params,
    headers: {
      // @ts-ignore
      appId: 'BDA385EC848C1A425F746869011C8D23',
      ignoreCancelToken: true,
    },
  });
  export const cameraExport = (params) =>
  defHttp.downloadFile<FileStream>({
    url: Api.cameraExport,
    params: params,
    // data: params,
    fileName:'相机订单.xlsx',
    headers: {
      // @ts-ignore
      ignoreCancelToken: true,
    },
    responseType: 'blob'
  });

  export const downExport = (params) =>
  defHttp.downloadFile<FileStream>({
    url: Api.downExport,
    params: params,
    // data: params,
    fileName:'下载订单.xlsx',
    headers: {
      // @ts-ignore
      ignoreCancelToken: true,
    },
    responseType: 'blob'
  });

  export const incrementExport = (params) =>
  defHttp.downloadFile<FileStream>({
    url: Api.incrementExport,
    params: params,
    fileName:'权益订单.xlsx',
    // data: params,
    headers: {
      // @ts-ignore
      ignoreCancelToken: true,
    },
    responseType: 'blob'
  });
