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

/**
 * 分页查询学生请假列表
 * @param query
 */
export const fetchList = (query?: any) => {
  return request({
    url: '/stuwork/stuleaveapply/page',
    method: 'get',
    params: query
  });
};

/**
 * 新增学生请假
 * @param data
 */
export const addObj = (data: any) => {
  return request({
    url: '/stuwork/stuleaveapply',
    method: 'post',
    data
  });
};

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

/**
 * 编辑学生请假
 * @param data
 */
export const editObj = (data: any) => {
  return request({
    url: '/stuwork/stuleaveapply/edit',
    method: 'post',
    data
  });
};

/**
 * 删除学生请假
 * @param ids
 */
export const delObj = (ids: string[]) => {
  return request({
    url: '/stuwork/stuleaveapply/delete',
    method: 'post',
    data: ids
  });
};

/**
 * 导出学生请假
 * @param query
 */
export const exportData = (query?: any) => {
  return request({
    url: '/stuwork/stuleaveapply/export',
    method: 'post',
    data: query,
    responseType: 'blob'
  });
};

/**
 * 撤销学生请假
 * @param id
 */
export const cancelObj = (id: string) => {
  return request({
    url: '/stuwork/stuleaveapply/cancel',
    method: 'post',
    data: { id }
  });
};

/**
 * 获取待办任务
 * @param query
 */
export const getStuLeaveApplyTask = (query?: any) => {
  return request({
    url: '/stuwork/stuleaveapply/task',
    method: 'get',
    params: query
  });
};

