import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { FinAccountReceivableStageVO, FinAccountReceivableStageForm, FinAccountReceivableStageQuery } from '@/api/oa/erp/finAccountReceivableStage/types';

/**
 * 查询应收款节点信息列表
 * @param query
 * @returns {*}
 */

export const listFinAccountReceivableStage = (query?: FinAccountReceivableStageQuery): AxiosPromise<FinAccountReceivableStageVO[]> => {
  return request({
    url: '/oa/erp/finAccountReceivableStage/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询应收款节点信息详细
 * @param receivableStageId
 */
export const getFinAccountReceivableStage = (receivableStageId: string | number): AxiosPromise<FinAccountReceivableStageVO> => {
  return request({
    url: '/oa/erp/finAccountReceivableStage/' + receivableStageId,
    method: 'get'
  });
};

/**
 * 新增应收款节点信息
 * @param data
 */
export const addFinAccountReceivableStage = (data: FinAccountReceivableStageForm) => {
  return request({
    url: '/oa/erp/finAccountReceivableStage',
    method: 'post',
    data: data
  });
};

/**
 * 修改应收款节点信息
 * @param data
 */
export const updateFinAccountReceivableStage = (data: FinAccountReceivableStageForm) => {
  return request({
    url: '/oa/erp/finAccountReceivableStage',
    method: 'put',
    data: data
  });
};

/**
 * 删除应收款节点信息
 * @param receivableStageId
 */
export const delFinAccountReceivableStage = (receivableStageId: string | number | Array<string | number>) => {
  return request({
    url: '/oa/erp/finAccountReceivableStage/' + receivableStageId,
    method: 'delete'
  });
};

/**
 * 下拉框查询应收款节点信息列表
 * @param query
 * @returns {*}
 */
export function getErpFinAccountReceivableStageList (query) {
    return request({
        url: '/oa/erp/finAccountReceivableStage/getErpFinAccountReceivableStageList',
        method: 'get',
        params: query
    });
};
