import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { ProjectReportVO, ProjectReportForm, ProjectReportQuery } from '@/api/oa/erp/projectReport/types';

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

export const listProjectReport = (query?: ProjectReportQuery): AxiosPromise<ProjectReportVO[]> => {
  return request({
    url: '/oa/erp/projectReport/list',
    method: 'get',
    params: query
  });
};
/**
 * 根据部门ID查询项目周报信息列表
 * @param query
 * @returns {*}
 */

export const listProjectReportByDept = (query?: ProjectReportQuery): AxiosPromise<ProjectReportVO[]> => {
  return request({
    url: '/oa/erp/projectReport/listByDept',
    method: 'get',
    params: query
  });
};

/**
 * 查询项目周报信息详细
 * @param reportId
 */
export const getProjectReport = (reportId: string | number): AxiosPromise<ProjectReportVO> => {
  return request({
    url: '/oa/erp/projectReport/' + reportId,
    method: 'get'
  });
};

/**
 * 新增项目周报信息
 * @param data
 */
export const addProjectReport = (data: ProjectReportForm) => {
  return request({
    url: '/oa/erp/projectReport',
    method: 'post',
    data: data
  });
};

/**
 * 修改项目周报信息
 * @param data
 */
export const updateProjectReport = (data: ProjectReportForm) => {
  return request({
    url: '/oa/erp/projectReport',
    method: 'put',
    data: data
  });
};

/**
 * 删除项目周报信息
 * @param reportId
 */
export const delProjectReport = (reportId: string | number | Array<string | number>) => {
  return request({
    url: '/oa/erp/projectReport/' + reportId,
    method: 'delete'
  });
};

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