import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { ContractChangeInfoVO, ContractChangeInfoForm, ContractChangeInfoQuery } from '@/api/oa/erp/contractChangeInfo/types';

/**
 * 查询合同变更信息列表
 * @param query
 * @returns {*}
 */

export const listContractChangeInfo = (query?: ContractChangeInfoQuery): AxiosPromise<ContractChangeInfoVO[]> => {
  return request({
    url: '/oa/erp/contractChangeInfo/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询合同变更信息详细
 * @param changeInfoId
 */
export const getContractChangeInfo = (changeInfoId: string | number): AxiosPromise<ContractChangeInfoVO> => {
  return request({
    url: '/oa/erp/contractChangeInfo/' + changeInfoId,
    method: 'get'
  });
};

/**
 * 新增合同变更信息
 * @param data
 */
export const addContractChangeInfo = (data: ContractChangeInfoForm) => {
  return request({
    url: '/oa/erp/contractChangeInfo',
    method: 'post',
    data: data
  });
};

/**
 * 修改合同变更信息
 * @param data
 */
export const updateContractChangeInfo = (data: ContractChangeInfoForm) => {
  return request({
    url: '/oa/erp/contractChangeInfo',
    method: 'put',
    data: data
  });
};

/**
 * 删除合同变更信息
 * @param changeInfoId
 */
export const delContractChangeInfo = (changeInfoId: string | number | Array<string | number>) => {
  return request({
    url: '/oa/erp/contractChangeInfo/' + changeInfoId,
    method: 'delete'
  });
};

/**
 * 下拉框查询合同变更信息列表
 * @param query
 * @returns {*}
 */
export function getErpContractChangeInfoList (query) {
    return request({
        url: '/oa/erp/contractChangeInfo/getErpContractChangeInfoList',
        method: 'get',
        params: query
    });
};
