import request from '@/utils/request';
import { AxiosPromise } from 'axios';

//查询科目余额
export const CostBalanceList = (query) => {
  return request({
    url: '/bfs/bussnessQury/quryCostBalance',
    method: 'get',
    params: query
  });
};

//查询科目定义信息
export const getCacheList = () => {
  return request({
    url: '/bfs/bussnessQury/getCacheList',
    method: 'post'
  });
};

//往来科目查询
export const getSubjectTransList = (query) => {
  return request({
    url: '/bfs/bussnessQury/querySubjectTransList',
    method: 'get',
    params: query
  });
};
//会计制证
export const accountingCertificateId = (data) => {
  return request({
    url: '/bfs/bussnessQury/accountingCertificateId',
    method: 'post',
    data: data
  });
};

//查询科目明细
export const getDatatransList = (query) => {
  return request({
    url: '/bfs/bussnessQury/getDatatransList',
    method: 'get',
    params: query
  });
};

export const datatransRollbackByOne = (data) => {
  return request({
    url: '/bfs/bussnessQury/datatransRollbackByOne',
    method: 'post',
    data: data
  });
};

//查询科目定义信息
export const getCacheListCertify = () => {
  return request({
    url: '/bfs/bussnessQury/getCacheListCertify',
    method: 'post'
  });
};

export const getBussnessData = (query) => {
  return request({
    url: '/bfs/bussnessQury/getBussnessData',
    method: 'get',
    params: query
  });
};

export const getSupplierInfoList = (query) => {
  return request({
    url: '/bfs/bussnessQury/getSupplierInfoList',
    method: 'get',
    params: query
  });
};

export const getSapAllData = (query) => {
  return request({
    url: '/bfs/bussnessQury/getSapAllData',
    method: 'post'
  });
};

export const getSapIncrease = (query) => {
  return request({
    url: '/bfs/bussnessQury/getSapIncrease',
    method: 'post'
  });
};

export const getCollectionBank = (query) => {
  return request({
    url: '/bfs/bussnessQury/getCollectionBankList',
    method: 'get',
    params: query
  });
};


//查询内转科目
export const getCacheInterList = () => {
  return request({
    url: '/bfs/bussnessQury/getCacheInterList',
    method: 'post'
  });
};

/**
 * 科目明细查询列表
 */
//查询科目余额
export const datatransResultList = (query) => {
  return request({
    url: '/bfs/bussnessQury/qurydatatransResult',
    method: 'get',
    params: query
  });
};

/**
 * 费用明细异步导出费用明细
 */
export const exportDatatransResultAsync = (data: any): AxiosPromise<any> => {
  return request({
    url: '/bfs/bussnessQury/exportDatatransResult/async',
    method: 'post',
    data: data
  });
};

/**
 * 费用明细查询导出任务进度
 */
export const getDatatransExportProgress = (taskId: string): AxiosPromise<any> => {
  return request({
    url: '/bfs/bussnessQury/exportDatatransResult/progress/' + taskId,
    method: 'get'
  });
};

/**
 * 费用明细下载导出的Excel文件
 */
export const datatransDownloadExport = (taskId: string): AxiosPromise<any> => {
  return request({
    url: '/bfs/bussnessQury/exportDatatransResult/download/' + taskId,
    method: 'post'
  });
};

/**
 * 费用明细取消导出任务
 */
export const datatranscancelExport = (taskId: string): AxiosPromise<any> => {
  return request({
    url: '/bfs/bussnessQury/exportDatatransResult/cancel/' + taskId,
    method: 'post'
  });
};

/**
 * 费用明细查询当前用户最近的未完成导出任务
 */
export const getDatatransLatestExportTask = (): AxiosPromise<any> => {
  return request({
    url: '/bfs/bussnessQury/exportDatatransResult/latest',
    method: 'get'
  });
};

/**
 * 数据源异步导出业务数据
 */
export const exportBussnessData = (data: any): AxiosPromise<any> => {
  return request({
    url: '/bfs/bussnessQury/exportBussnessData/async',
    method: 'post',
    data: data
  });
};

/**
 * 数据源查询导出任务进度
 */
export const getBussnessExportProgress = (taskId: string): AxiosPromise<any> => {
  return request({
    url: '/bfs/bussnessQury/exportBussnessData/progress/' + taskId,
    method: 'get'
  });
};

/**
 * 数据源下载导出的Excel文件
 */
export const bussnessDownloadExport = (taskId: string): AxiosPromise<any> => {
  return request({
    url: '/bfs/bussnessQury/exportBussnessData/download/' + taskId,
    method: 'post'
  });
};

/**
 * 数据源取消导出任务
 */
export const bussnessCancelExport = (taskId: string): AxiosPromise<any> => {
  return request({
    url: '/bfs/bussnessQury/exportBussnessData/cancel/' + taskId,
    method: 'post'
  });
};

/**
 * 数据源查询当前用户最近的未完成导出任务
 */
export const getBussnessLatestExportTask = (): AxiosPromise<any> => {
  return request({
    url: '/bfs/bussnessQury/exportBussnessData/latest',
    method: 'get'
  });
};
