曹睿
2025-04-22 578d0a7584b4301278012a7ca8941c90723a7283
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
import request from "@/utils/request";
 
const NOTICE_BASE_URL = "/api/v1/notices";
 
const NoticeAPI = {
  /** 获取通知公告分页数据 */
  getPage(queryParams?: NoticePageQuery) {
    return request<PageResult<NoticePageVO[]>>({
      url: `${NOTICE_BASE_URL}/page`,
      method: "GET",
      data: queryParams,
    });
  },
 
  /**
   * 获取通知公告表单数据
   *
   * @param id NoticeID
   * @returns Notice表单数据
   */
  getFormData(id: number) {
    return request<NoticeForm>({
      url: `${NOTICE_BASE_URL}/${id}/form`,
      method: "GET",
    });
  },
 
  /**
   * 添加通知公告
   *
   * @param data Notice表单数据
   * @returns
   */
  add(data: NoticeForm) {
    return request({
      url: `${NOTICE_BASE_URL}`,
      method: "POST",
      data: data,
    });
  },
 
  /**
   * 更新通知公告
   *
   * @param id NoticeID
   * @param data Notice表单数据
   */
  update(id: number, data: NoticeForm) {
    return request({
      url: `${NOTICE_BASE_URL}/${id}`,
      method: "PUT",
      data: data,
    });
  },
 
  /**
   * 批量删除通知公告,多个以英文逗号(,)分割
   *
   * @param ids 通知公告ID字符串,多个以英文逗号(,)分割
   */
  deleteByIds(ids: string) {
    return request({
      url: `${NOTICE_BASE_URL}/${ids}`,
      method: "DELETE",
    });
  },
 
  /**
   * 发布通知
   *
   * @param id 被发布的通知公告id
   * @returns
   */
  publish(id: number) {
    return request({
      url: `${NOTICE_BASE_URL}/${id}/publish`,
      method: "PUT",
    });
  },
 
  /**
   * 撤回通知
   *
   * @param id 撤回的通知id
   * @returns
   */
  revoke(id: number) {
    return request({
      url: `${NOTICE_BASE_URL}/${id}/revoke`,
      method: "PUT",
    });
  },
  /**
   * 查看通知
   *
   * @param id
   */
  getDetail(id: string) {
    return request<NoticeDetailVO>({
      url: `${NOTICE_BASE_URL}/${id}/detail`,
      method: "GET",
    });
  },
 
  /* 全部已读 */
  readAll() {
    return request({
      url: `${NOTICE_BASE_URL}/read-all`,
      method: "PUT",
    });
  },
 
  /** 获取我的通知分页列表 */
  getMyNoticePage(queryParams?: NoticePageQuery) {
    return request<PageResult<NoticePageVO[]>>({
      url: `${NOTICE_BASE_URL}/my-page`,
      method: "GET",
      data: queryParams,
    });
  },
};
 
export default NoticeAPI;
 
/** 通知公告分页查询参数 */
export interface NoticePageQuery extends PageQuery {
  /** 标题 */
  title?: string;
  /** 发布状态(0:未发布,1:已发布,-1:已撤回) */
  publishStatus?: number;
 
  isRead?: number;
}
 
/** 通知公告表单对象 */
export interface NoticeForm {
  id?: number;
  /** 通知标题 */
  title?: string;
  /** 通知内容 */
  content?: string;
  /** 通知类型 */
  type?: number;
  /** 优先级(L:低,M:中,H:高) */
  level?: string;
  /** 目标类型(1-全体 2-指定) */
  targetType?: number;
  /** 目标ID合集,以,分割 */
  targetUserIds?: string;
}
 
/** 通知公告分页对象 */
export interface NoticePageVO {
  id: string;
  /** 通知标题 */
  title?: string;
  /** 通知内容 */
  content?: string;
  /** 通知类型 */
  type?: number;
  /** 发布人 */
  publisherName?: string;
  /** 优先级(0-低 1-中 2-高) */
  priority?: number;
  /** 目标类型(0-全体 1-指定) */
  targetType?: number;
  /** 发布状态(0-未发布 1已发布 2已撤回) */
  publishStatus?: number;
  /** 发布时间 */
  publishTime?: Date;
  /** 撤回时间 */
  revokeTime?: Date;
  /** 优先级(L-低 M-中 H-高) */
  level?: string | number;
}
 
export interface NoticeDetailVO {
  /** 通知ID */
  id?: string;
 
  /** 通知标题 */
  title?: string;
 
  /** 通知内容 */
  content?: string;
 
  /** 通知类型 */
  type?: number;
 
  /** 发布人 */
  publisherName?: string;
 
  /** 优先级(L-低 M-中 H-高) */
  level?: string;
 
  /** 发布时间 */
  publishTime?: Date;
 
  /** 发布状态 */
  publishStatus?: number;
}