import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { ErpProjectPlanStageVO, ErpProjectPlanStageForm, ErpProjectPlanStageQuery } from '@/api/oa/erp/erpProjectPlanStage/types';

/**
 * 查询项目计划阶段列表
 * @param query
 * @returns {*}
 */

export const listErpProjectPlanStage = (query?: ErpProjectPlanStageQuery): AxiosPromise<ErpProjectPlanStageVO[]> => {
  return request({
    url: '/oa/erp/erpProjectPlanStage/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询项目计划阶段详细
 * @param planStageId
 */
export const getErpProjectPlanStage = (planStageId: string | number): AxiosPromise<ErpProjectPlanStageVO> => {
  return request({
    url: '/oa/erp/erpProjectPlanStage/' + planStageId,
    method: 'get'
  });
};

/**
 * 新增项目计划阶段
 * @param data
 */
export const addErpProjectPlanStage = (data: ErpProjectPlanStageForm) => {
  return request({
    url: '/oa/erp/erpProjectPlanStage',
    method: 'post',
    data: data
  });
};

/**
 * 修改项目计划阶段
 * @param data
 */
export const updateErpProjectPlanStage = (data: ErpProjectPlanStageForm) => {
  return request({
    url: '/oa/erp/erpProjectPlanStage',
    method: 'put',
    data: data
  });
};

/**
 * 删除项目计划阶段
 * @param planStageId
 */
export const delErpProjectPlanStage = (planStageId: string | number | Array<string | number>) => {
  return request({
    url: '/oa/erp/erpProjectPlanStage/' + planStageId,
    method: 'delete'
  });
};

/**
 * 下拉框查询项目计划阶段列表
 * @param query
 * @returns {*}
 */
export function getErpProjectPlanStageList (query) {
    return request({
        url: '/oa/erp/erpProjectPlanStage/getErpProjectPlanStageList',
        method: 'get',
        params: query
    });
};
