import axios from 'axios'; export interface BulletinCreateRecord { title: string; top: boolean; content: string; remark: string; attachmentIds?: string[]; } export interface AttachmentRecord { id: string; fileName: string; url: string; uploadTime?: string; mimeType?: string; } export interface BulletinRecord extends BulletinCreateRecord { id: number; createTime: string; createBy: string; updateTime: string; state: string; editUserId: number; publishUserId: number; publishTime: string; closeUserId: number; attachments?: AttachmentRecord[]; } export interface BulletinsRecord { title?: string; state?: string[]; publishTimeBegin?: string[]; publishTimeEnd?: string[]; total?: number; current: number; size: number; } // 查看详情 export function queryBulletinDetail(id: number) { return axios.get(`/api/rest/bulletin/${id}`); } // 分页查询 export function queryBulletinList(data: BulletinsRecord) { return axios({ url: '/api/rest/bulletin', method: 'get', params: data, }); } // 添加公告 export function create(data: BulletinCreateRecord) { return axios.post(`/api/rest/bulletin`, data); } // 更新公告 export function update(data: BulletinRecord) { return axios.patch(`/api/rest/bulletin/${data.id}`, data); } // 置顶状态 export function toggle(id: number) { return axios.patch(`/api/rest/bulletin/${id}/toggle-top`); } // 发布编辑 export function publish(data: number[]) { return axios.patch(`/api/rest/bulletin/publish`, data); } // 关闭公告 export function close(id: number) { return axios.patch(`/api/rest/bulletin/${id}/toggleClose`); } // 删除公告 export function remove(id: number) { return axios.delete(`/api/rest/bulletin/${id}`); } // 添加附件 export function addAttachments(data: any) { return axios({ method: 'post', url: '/api/rest/attachment', headers: { 'Content-Type': 'multipart/form-data', }, data, }) } // 获取附件信息 export function addAttachment(id: string) { return axios.get(`/api/rest/attachment/find/${id}`); } // 删除附件 export function deleteAttachment(id: string) { return axios.delete(`/api/rest/attachment/delete/${id}`); } // 获取部门树 export function queryDeptTreeList() { return axios.get(`/api/deptTree`); }