import request from '/@/utils/request';

/**
 * 分页查询班费记录列表
 * @param query
 */
export const fetchList = (query?: any) => {
  return request({
    url: '/stuwork/classfeelog/page',
    method: 'get',
    params: query
  });
};

/**
 * 新增班费记录
 * @param data
 */
export const addObj = (data: any) => {
  return request({
    url: '/stuwork/classfeelog',
    method: 'post',
    data
  });
};

/**
 * 获取详情
 * @param id
 */
export const getDetail = (id: string) => {
  return request({
    url: '/stuwork/classfeelog/detail',
    method: 'get',
    params: { id }
  });
};

/**
 * 编辑班费记录
 * @param data
 */
export const editObj = (data: any) => {
  return request({
    url: '/stuwork/classfeelog/edit',
    method: 'post',
    data
  });
};

/**
 * 删除班费记录
 * @param ids
 */
export const delObj = (ids: string[]) => {
  return request({
    url: '/stuwork/classfeelog/delete',
    method: 'post',
    data: ids
  });
};

/**
 * 导出班费记录
 * @param query
 */
export const exportExcel = (query?: any) => {
  return request({
    url: '/stuwork/classfeelog/export',
    method: 'get',
    params: query,
    responseType: 'blob'
  });
};

/**
 * 班费使用汇总
 * @param schoolYear 学年
 * @param schoolTerm 学期
 */
export const getSummary = (schoolYear: string, schoolTerm: string) => {
  return request({
    url: '/stuwork/classfeelog/summary',
    method: 'get',
    params: { schoolYear, schoolTerm }
  });
};

