import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { ErpProjectChangeProgressVO, ErpProjectChangeProgressForm, ErpProjectChangeProgressQuery } from '@/api/oa/erp/erpProjectChangeProgress/types';

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

export const listErpProjectChangeProgress = (query?: ErpProjectChangeProgressQuery): AxiosPromise<ErpProjectChangeProgressVO[]> => {
  return request({
    url: '/oa/erp/erpProjectChangeProgress/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询项目进度变更明细详细
 * @param changeProgressId
 */
export const getErpProjectChangeProgress = (changeProgressId: string | number): AxiosPromise<ErpProjectChangeProgressVO> => {
  return request({
    url: '/oa/erp/erpProjectChangeProgress/' + changeProgressId,
    method: 'get'
  });
};

/**
 * 新增项目进度变更明细
 * @param data
 */
export const addErpProjectChangeProgress = (data: ErpProjectChangeProgressForm) => {
  return request({
    url: '/oa/erp/erpProjectChangeProgress',
    method: 'post',
    data: data
  });
};

/**
 * 修改项目进度变更明细
 * @param data
 */
export const updateErpProjectChangeProgress = (data: ErpProjectChangeProgressForm) => {
  return request({
    url: '/oa/erp/erpProjectChangeProgress',
    method: 'put',
    data: data
  });
};

/**
 * 删除项目进度变更明细
 * @param changeProgressId
 */
export const delErpProjectChangeProgress = (changeProgressId: string | number | Array<string | number>) => {
  return request({
    url: '/oa/erp/erpProjectChangeProgress/' + changeProgressId,
    method: 'delete'
  });
};

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