import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { TimesheetStandardMonthVO, TimesheetStandardMonthForm, TimesheetStandardMonthQuery } from '@/api/oa/erp/timesheetStandardMonth/types';

/**
 * 查询月标准工时信息列表
 * @param query
 * @returns {*}
 */

export const listTimesheetStandardMonth = (query?: TimesheetStandardMonthQuery): AxiosPromise<TimesheetStandardMonthVO[]> => {
  return request({
    url: '/oa/erp/timesheetStandardMonth/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询月标准工时信息详细
 * @param standardMonthId
 */
export const getTimesheetStandardMonth = (standardMonthId: string | number): AxiosPromise<TimesheetStandardMonthVO> => {
  return request({
    url: '/oa/erp/timesheetStandardMonth/' + standardMonthId,
    method: 'get'
  });
};

/**
 * 新增月标准工时信息
 * @param data
 */
export const addTimesheetStandardMonth = (data: TimesheetStandardMonthForm) => {
  return request({
    url: '/oa/erp/timesheetStandardMonth',
    method: 'post',
    data: data
  });
};

/**
 * 修改月标准工时信息
 * @param data
 */
export const updateTimesheetStandardMonth = (data: TimesheetStandardMonthForm) => {
  return request({
    url: '/oa/erp/timesheetStandardMonth',
    method: 'put',
    data: data
  });
};

/**
 * 删除月标准工时信息
 * @param standardMonthId
 */
export const delTimesheetStandardMonth = (standardMonthId: string | number | Array<string | number>) => {
  return request({
    url: '/oa/erp/timesheetStandardMonth/' + standardMonthId,
    method: 'delete'
  });
};

/**
 * 下拉框查询月标准工时信息列表
 * @param query
 * @returns {*}
 */
export function getErpTimesheetStandardMonthList (query) {
    return request({
        url: '/oa/erp/timesheetStandardMonth/getErpTimesheetStandardMonthList',
        method: 'get',
        params: query
    });
};
