import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { ErpProjectChangeBudgetVO, ErpProjectChangeBudgetForm, ErpProjectChangeBudgetQuery } from '@/api/oa/erp/erpProjectChangeBudget/types';

/**
 * 查询项目预算变更明细列表
 * @param query
 * @returns {*}
 */

export const listErpProjectChangeBudget = (query?: ErpProjectChangeBudgetQuery): AxiosPromise<ErpProjectChangeBudgetVO[]> => {
  return request({
    url: '/oa/erp/erpProjectChangeBudget/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询项目预算变更明细详细
 * @param changeBudgetId
 */
export const getErpProjectChangeBudget = (changeBudgetId: string | number): AxiosPromise<ErpProjectChangeBudgetVO> => {
  return request({
    url: '/oa/erp/erpProjectChangeBudget/' + changeBudgetId,
    method: 'get'
  });
};

/**
 * 新增项目预算变更明细
 * @param data
 */
export const addErpProjectChangeBudget = (data: ErpProjectChangeBudgetForm) => {
  return request({
    url: '/oa/erp/erpProjectChangeBudget',
    method: 'post',
    data: data
  });
};

/**
 * 修改项目预算变更明细
 * @param data
 */
export const updateErpProjectChangeBudget = (data: ErpProjectChangeBudgetForm) => {
  return request({
    url: '/oa/erp/erpProjectChangeBudget',
    method: 'put',
    data: data
  });
};

/**
 * 删除项目预算变更明细
 * @param changeBudgetId
 */
export const delErpProjectChangeBudget = (changeBudgetId: string | number | Array<string | number>) => {
  return request({
    url: '/oa/erp/erpProjectChangeBudget/' + changeBudgetId,
    method: 'delete'
  });
};

/**
 * 下拉框查询项目预算变更明细列表
 * @param query
 * @returns {*}
 */
export function getErpProjectChangeBudgetList (query) {
    return request({
        url: '/oa/erp/erpProjectChangeBudget/getErpProjectChangeBudgetList',
        method: 'get',
        params: query
    });
};
