import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { TimesheetSummaryDetailVO, TimesheetSummaryDetailForm, TimesheetSummaryDetailQuery } from '@/api/oa/erp/timesheetSummaryDetail/types';

/**
 * 查询月汇总工时明细列表
 * @param query
 * @returns {*}
 */

export const listTimesheetSummaryDetail = (query?: TimesheetSummaryDetailQuery): AxiosPromise<TimesheetSummaryDetailVO[]> => {
  return request({
    url: '/oa/erp/timesheetSummaryDetail/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询月汇总工时明细详细
 * @param summaryDetailId
 */
export const getTimesheetSummaryDetail = (summaryDetailId: string | number): AxiosPromise<TimesheetSummaryDetailVO> => {
  return request({
    url: '/oa/erp/timesheetSummaryDetail/' + summaryDetailId,
    method: 'get'
  });
};

/**
 * 新增月汇总工时明细
 * @param data
 */
export const addTimesheetSummaryDetail = (data: TimesheetSummaryDetailForm) => {
  return request({
    url: '/oa/erp/timesheetSummaryDetail',
    method: 'post',
    data: data
  });
};

/**
 * 修改月汇总工时明细
 * @param data
 */
export const updateTimesheetSummaryDetail = (data: TimesheetSummaryDetailForm) => {
  return request({
    url: '/oa/erp/timesheetSummaryDetail',
    method: 'put',
    data: data
  });
};

/**
 * 删除月汇总工时明细
 * @param summaryDetailId
 */
export const delTimesheetSummaryDetail = (summaryDetailId: string | number | Array<string | number>) => {
  return request({
    url: '/oa/erp/timesheetSummaryDetail/' + summaryDetailId,
    method: 'delete'
  });
};

/**
 * 下拉框查询月汇总工时明细列表
 * @param query
 * @returns {*}
 */
export function getErpTimesheetSummaryDetailList (query) {
    return request({
        url: '/oa/erp/timesheetSummaryDetail/getErpTimesheetSummaryDetailList',
        method: 'get',
        params: query
    });
};
