mirror of
https://github.com/fastapiadmin/FastapiAdmin.git
synced 2026-09-22 13:05:18 +00:00
refactor: 重构用户、角色、部门等模块的字段长度和校验逻辑 fix: 修复前端接口类型定义和字段显示问题 style: 优化代码格式和注释 perf: 提升数据库连接性能和查询效率 docs: 更新README和配置文档 test: 添加字段校验和数据库连接测试 chore: 更新依赖包和配置文件
95 lines
1.9 KiB
TypeScript
95 lines
1.9 KiB
TypeScript
import request from "@/utils/request";
|
|
|
|
const API_PATH = "/system/notice";
|
|
|
|
const NoticeAPI = {
|
|
listNotice(query: NoticePageQuery) {
|
|
return request<ApiResponse<PageResult<NoticeTable[]>>>({
|
|
url: `${API_PATH}/list`,
|
|
method: "get",
|
|
params: query,
|
|
});
|
|
},
|
|
|
|
listNoticeAvailable() {
|
|
return request<ApiResponse<PageResult<NoticeTable[]>>>({
|
|
url: `${API_PATH}/available`,
|
|
method: "get",
|
|
});
|
|
},
|
|
|
|
detailNotice(query: number) {
|
|
return request<ApiResponse<NoticeTable>>({
|
|
url: `${API_PATH}/detail/${query}`,
|
|
method: "get",
|
|
});
|
|
},
|
|
|
|
createNotice(body: NoticeForm) {
|
|
return request<ApiResponse>({
|
|
url: `${API_PATH}/create`,
|
|
method: "post",
|
|
data: body,
|
|
});
|
|
},
|
|
|
|
updateNotice(id: number, body: NoticeForm) {
|
|
return request<ApiResponse>({
|
|
url: `${API_PATH}/update/${id}`,
|
|
method: "put",
|
|
data: body,
|
|
});
|
|
},
|
|
|
|
deleteNotice(body: number[]) {
|
|
return request<ApiResponse>({
|
|
url: `${API_PATH}/delete`,
|
|
method: "delete",
|
|
data: body,
|
|
});
|
|
},
|
|
|
|
batchNotice(body: BatchType) {
|
|
return request<ApiResponse>({
|
|
url: `${API_PATH}/available/setting`,
|
|
method: "patch",
|
|
data: body,
|
|
});
|
|
},
|
|
|
|
exportNotice(body: NoticePageQuery) {
|
|
return request<Blob>({
|
|
url: `${API_PATH}/export`,
|
|
method: "post",
|
|
data: body,
|
|
responseType: "blob",
|
|
});
|
|
},
|
|
};
|
|
|
|
export default NoticeAPI;
|
|
|
|
export interface NoticePageQuery extends PageQuery {
|
|
notice_title?: string;
|
|
notice_type?: string;
|
|
status?: string;
|
|
created_time?: string[];
|
|
updated_time?: string[];
|
|
created_id?: number;
|
|
updated_id?: number;
|
|
}
|
|
|
|
export interface NoticeTable extends BaseType {
|
|
notice_title?: string;
|
|
notice_type?: string;
|
|
notice_content?: string;
|
|
created_by?: CommonType;
|
|
updated_by?: CommonType;
|
|
}
|
|
|
|
export interface NoticeForm extends BaseFormType {
|
|
notice_title?: string;
|
|
notice_type?: string;
|
|
notice_content?: string;
|
|
}
|