stationnotifyApi.ts 3.04 KB
import { defHttp } from '/@/utils/http/axios';
import {
  NoticeQueryParam,
  NoticeUserParam,
  NotifyAddDraftModel,
  NotifyAddreLeaseModel,
} from '/@/api/stationnotification/model/stationnotifyModel';

enum NotifyManagerApi {
  /**
   * 场景URL
   */
  NOTICE_GET_URL = '/notice/page',
  NOTICE_GET_DETAIL_URL = '/notice',
  NOTICE_ADD_DRAFT_URL = '/notice/save',
  NOTICE_ADD_LEASE_URL = '/notice/send',
  NOTICE_DELETE_URL = '/notice/delete',
  NOTICE_GET_MYDETAIL_URL = '/notice_user',
  NOTICE_GET_PAGE_URL = '/notice_user/page',
  NOTICE_GET_READ_URL = '/notice_user/read',
  NOTICE_GET_DICT_URL = '/dict_item',
  NOTICE_GET_DEPT_URL = '/organization/me/organizations',
}

/**
 * 获取详情
 * @param
 */
export const noticeByIdGetInfo = (id: string) => {
  return defHttp.get({
    url: `${NotifyManagerApi.NOTICE_GET_DETAIL_URL}/${id}`,
  });
};

/**
 * 分页查询通知表格页面
 * @param params pageSize page name
 */
export const notifyGetTableApi = (params?: NoticeQueryParam) => {
  return defHttp.get({
    url: NotifyManagerApi.NOTICE_GET_URL,
    params,
  });
};

/**
 * 新增草稿
 * @param params pageSize page name
 */
export const notifyAddDraftApi = (params) => {
  return defHttp.post<NotifyAddDraftModel>({
    url: NotifyManagerApi.NOTICE_ADD_DRAFT_URL,
    params,
  });
};

/**
 * 新增通知
 * @param params pageSize page name
 */
export const notifyAddLeaseApi = (params) => {
  return defHttp.post<NotifyAddreLeaseModel>({
    url: NotifyManagerApi.NOTICE_ADD_LEASE_URL,
    params,
  });
};

/**
 * 批量删除
 * @param params pageSize page name
 */
export const notifyDeleteApi = (ids: string[]) => {
  return defHttp.delete({
    url: NotifyManagerApi.NOTICE_DELETE_URL,
    data: {
      ids,
    },
  });
};

/**
 * 查询我的通知详情
 * @param params pageSize page name
 */
export const notifyMyGetDetailApi = (id: string) => {
  return defHttp.get({
    url: `${NotifyManagerApi.NOTICE_GET_MYDETAIL_URL}/${id}`,
  });
};

/**
 * 查询我的通知表格分页
 * @param params pageSize page name
 */
export const notifyMyGetrPageApi = (params?: NoticeQueryParam) => {
  return defHttp.get({
    url: NotifyManagerApi.NOTICE_GET_PAGE_URL,
    params,
  });
};

/**
 * 查询人员阅读情况分页
 * @param params pageSize page name
 */
export const notifyMyGetrReadApi = (params?: NoticeQueryParam) => {
  return defHttp.get({
    url: NotifyManagerApi.NOTICE_GET_READ_URL,
    params,
  });
};

/**
 * 获取字典----id
 * @param 无参数
 */
export const notifyDictGetApi = () => {
  return defHttp.get({
    url: `${NotifyManagerApi.NOTICE_GET_DICT_URL}?page=1&pageSize=10&dictId=74a3878d-1bb9-4a59-bd2d-d5e4646c7239&_t=1638928298910`,
  });
};

/**
 * 获取部门
 * @param 无参数
 */
export const notifyOrganizationGetApi = () => {
  return defHttp.get({
    url: NotifyManagerApi.NOTICE_GET_DEPT_URL,
  });
};

// 获取通知管理的查看表格数据
export const getNotifyDetailPage = (params: NoticeUserParam) => {
  return defHttp.get({
    url: NotifyManagerApi.NOTICE_GET_PAGE_URL + '/' + params.noticeId,
    params,
  });
};