import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { ProjectTypeVO, ProjectTypeForm, ProjectTypeQuery } from '@/api/oa/erp/projectType/types';

/**
 * 查询项目类型信息列表
 * @param query
 * @returns {*}
 */

export const listProjectType = (query?: ProjectTypeQuery): AxiosPromise<ProjectTypeVO[]> => {
  return request({
    url: '/oa/erp/projectType/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询项目类型信息详细
 * @param projectTypeId
 */
export const getProjectType = (projectTypeId: string | number): AxiosPromise<ProjectTypeVO> => {
  return request({
    url: '/oa/erp/projectType/' + projectTypeId,
    method: 'get'
  });
};

/**
 * 新增项目类型信息
 * @param data
 */
export const addProjectType = (data: ProjectTypeForm) => {
  return request({
    url: '/oa/erp/projectType',
    method: 'post',
    data: data
  });
};

/**
 * 修改项目类型信息
 * @param data
 */
export const updateProjectType = (data: ProjectTypeForm) => {
  return request({
    url: '/oa/erp/projectType',
    method: 'put',
    data: data
  });
};

/**
 * 删除项目类型信息
 * @param projectTypeId
 */
export const delProjectType = (projectTypeId: string | number | Array<string | number>) => {
  return request({
    url: '/oa/erp/projectType/' + projectTypeId,
    method: 'delete'
  });
};

/**
 * 下拉框查询项目类型信息列表
 * @param query
 * @returns {*}
 */
export function getErpProjectTypeList (query) {
    return request({
        url: '/oa/erp/projectType/getErpProjectTypeList',
        method: 'get',
        params: query
    });
};
