-
Notifications
You must be signed in to change notification settings - Fork 79
/
Copy pathapi.d.ts
615 lines (579 loc) · 14 KB
/
api.d.ts
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
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
/**
* Namespace Api
*
* All backend api type
*/
declare namespace Api {
namespace BaseApi {
/** 后端返回的路由数据类型 */
interface Data {
name: string;
code: number;
message: string;
}
}
namespace Common {
/** common params of paginating */
interface PaginatingCommonParams {
/** current page number */
current: number;
/** page size */
size: number;
/** total count */
total: number;
}
/** common params of paginating query list data */
interface PaginatingQueryRecord<T extends NonNullable<unknown>> extends PaginatingCommonParams {
records: T[];
}
/**
* enable status
*
* - "1": enabled
* - "2": disabled
*/
type EnableStatus = '1' | '2';
/** common record */
type CommonRecord<T extends NonNullable<unknown>> = {
/** record id */
id: number;
/** record creator */
createBy: string;
/** record create time */
createTime: string;
/** record updater */
updateBy: string;
/** record update time */
updateTime: string;
/** record status */
status: EnableStatus | null;
} & T;
}
/**
* namespace Auth
*
* backend api module: "auth"
*/
namespace Auth {
/**
* 用户角色类型(前端静态路由用角色类型进行路由权限的控制)
*
* - SYS_ADMIN: 系统管理员(该权限具有所有路由数据)
* - TENANT_ADMIN: 租户管理员
* - TENANT_USER: 用户
*/
type RoleType = 'SYS_ADMIN' | 'TENANT_ADMIN' | 'TENANT_USER';
interface LoginToken {
token: string;
refreshToken: string;
expires_in: number;
}
/** 用户信息 */
interface UserInfo {
/** 用户id */
id?: string;
userId?: string;
/** 用户名 */
userName: string;
/** 用户角色类型 */
roles?: string[];
authority: string;
[key: string]: any;
}
}
/**
* namespace Route
*
* backend api module: "route"
*/
namespace Route {
type ElegantConstRoute = import('@elegant-router/types').ElegantConstRoute;
interface MenuRoute extends ElegantConstRoute {
id: string;
/** 父节点ID */
parent_id: string;
/** 标题 */
title: string;
/** 国际化 */
multilingual: App.I18n.I18nKey;
/** 图标 */
param2: string;
/** 组件名称 */
element_code: string;
/** 组件路径 */
param1: string;
/** 是否隐藏 0 1 */
param3: string;
/** 排序 */
orders: number;
/** 类型 */
// element_type: 1 | 2 | 3 | 4 | 5;
element_type: 1 | 3;
/** 访问标识 */
authority: any;
/** 描述 */
description: string;
/** 描述 */
remark: string;
/** 组件地址 */
route_path: string;
/** 子节点 */
children: MenuRoute[];
}
interface Data {
list: MenuRoute[];
total: number;
}
interface UserRoute {
list: ElegantConstRoute[];
home: import('@elegant-router/types').LastLevelRouteKey;
}
}
/**
* namespace SystemManage
*
* backend api module: "systemManage"
*/
namespace SystemManage {
type CommonSearchParams = Pick<Common.PaginatingCommonParams, 'current' | 'size'>;
/** role */
type Role = Common.CommonRecord<{
/** role name */
roleName: string;
/** role code */
roleCode: string;
/** role description */
roleDesc: string;
}>;
/** role search params */
type RoleSearchParams = CommonType.RecordNullable<
Pick<Api.SystemManage.Role, 'roleName' | 'roleCode' | 'status'> & CommonSearchParams
>;
/** role list */
type RoleList = Common.PaginatingQueryRecord<Role>;
/** all role */
type AllRole = Pick<Role, 'id' | 'roleName' | 'roleCode'>;
/**
* user gender
*
* - "1": "male"
* - "2": "female"
*/
type UserGender = '1' | '2';
/** user */
type User = Common.CommonRecord<{
/** user name */
userName: string;
/** user gender */
userGender: UserGender | null;
/** user nickname */
nickName: string;
/** user phone */
userPhone: string;
/** user email */
userEmail: string;
/** user role code collection */
userRoles: string[];
}>;
/** user search params */
type UserSearchParams = CommonType.RecordNullable<
Pick<Api.SystemManage.User, 'userName' | 'userGender' | 'nickName' | 'userPhone' | 'userEmail' | 'status'> &
CommonSearchParams
>;
/** user list */
type UserList = Common.PaginatingQueryRecord<User>;
/**
* menu type
*
* - "1": directory
* - "2": menu
*/
type MenuType = '1' | '2';
type MenuButton = {
/**
* button code
*
* it can be used to control the button permission
*/
code: string;
/** button description */
desc: string;
};
/**
* icon type
*
* - "1": iconify icon
* - "2": local icon
*/
type IconType = '1' | '2';
type Menu = Common.CommonRecord<{
/** parent menu id */
parentId: number;
/** menu type */
menuType: MenuType;
/** menu name */
menuName: string;
/** route name */
routeName: string;
/** route path */
routePath: string;
/** component */
component?: string;
/**
* i18n key
*
* it is for internationalization
*/
i18nKey?: App.I18n.I18nKey;
/** iconify icon name or local icon name */
icon: string;
/** icon type */
iconType: IconType;
/** menu order */
order: number;
/** whether to cache the route */
keepAlive?: boolean;
/** outer link */
href?: string;
/** whether to hide the route in the menu */
hideInMenu?: boolean;
/**
* The menu key will be activated when entering the route
*
* The route is not in the menu
*
* @example
* the route is "user_detail", if it is set to "user_list", the menu "user_list" will be activated
*/
activeMenu?: import('@elegant-router/types').LastLevelRouteKey;
/** By default, the same route path will use one tab, if set to true, it will use multiple tabs */
multiTab?: boolean;
/** If set, the route will be fixed in tabs, and the value is the order of fixed tabs */
fixedIndexInTab?: number;
/** menu buttons */
buttons?: MenuButton[];
/** children menu */
children?: Menu[];
}>;
type SystemLogSearchParams = {
page: number;
page_size: number;
username?: string | null;
start_time?: string | null;
end_time?: string | null;
};
type SystemLogList = {
id?: string;
ip?: string;
path?: string;
user_id?: string;
name?: null | string;
created_at?: Date;
latency?: number;
request_message?: string;
response_message?: string;
tenant_id?: string;
remark?: null;
};
}
/** 系统设置-路由管理 */
namespace ApiApplyManagement {
interface Service {
/** id */
id: string;
/** 服务名称 */
name: string | null;
/** 设备类型 */
device_type: string | number;
/** 协议类型 */
protocol_type: string;
/** 介绍 */
description: string | null;
/** HTTP服务地址 */
http_address: string | null;
/** 接入地址 */
access_address: string | null;
/** 插件订阅主题前缀 */
sub_topic_prefix: string | null;
/** 链接参数 */
additional_info: string;
ts: string;
language_code: string;
}
interface Data {
list: Service[];
total: number;
}
}
/** 常规设置 */
namespace GeneralSetting {
/** 主题设置 */
interface ThemeSetting {
/** id */
id: string;
/** 系统标题 */
system_name: string | null;
/** 首页和后台 logo */
logo_background: string | undefined;
/** 加载页面 logo */
logo_loading: string | undefined;
/** 站标 logo */
logo_cache: string | undefined;
/** 背景图片 */
home_background: string | undefined;
}
/** 数据清理设置 */
interface DataClearSetting {
/** id */
id: string;
/** 清理类型 */
data_type: string;
/** 是否启用 */
enabled: string;
/** 保留天数 */
retention_days: number;
/** 上次清理时间 */
last_cleanup_time: string | null;
/** 上次清理数据时间节点 */
last_cleanup_data_time: string | null;
/** 备注 */
remark: string | null;
}
interface DataClear {
list: DataClearSetting[];
total: number;
}
interface Theme {
list: ThemeSetting[];
total: number;
}
}
namespace NotificationServices {
interface Email {
id: string;
config: string;
email_config: any;
notice_type: string;
remark: string;
status: string;
}
}
namespace UserManagement {
interface User {
/** 用户id */
id: string;
/** 用户邮箱 */
email: string | null;
/** 用户名 */
name: string | null;
description: string | null;
/** 用户手机号码 */
phone_number: string;
/**
* 用户状态
*
* - N: 正常
* - F: 冻结
*/
status: 'F' | 'N' | null;
/**
* 用户性别
*
* - 0: 女
* - 1: 男
*/
gender: '0' | '1' | null;
/** 备注 */
remark: string | null;
/** 创建时间 */
created_at: string | null;
/** 更新時間 */
updated_at: string | null;
/** 上次访问时间 */
lastVisitTime: string | null;
}
interface UserKey {
/** 用户id */
id: string;
/** 用户名 */
name: string | null;
/** key */
api_key: string | null;
/**
* 用户状态
*
* - N: 正常
* - F: 冻结
*/
status: 0 | 1 | null;
/** 创建时间 */
created_at: string | null;
/** 更新時間 */
updated_at: string | null;
/** 是否明文显示 */
show: boolean | false;
/** 租户id */
tenant_id: string | null;
}
interface Data {
list: User[];
total: number;
}
interface KeyData {
list: UserKey[];
total: number;
}
}
/** 规则引擎 */
namespace RuleEngine {
interface Rule {
/** id */
id: string;
/** 规则名 */
name: string | null;
/**
* 规则状态
*
* - 1: 已启动
* - 2: 已暂停
*/
status: '1' | '2' | null;
}
}
namespace DataService {
interface Data {
/** id */
id: string;
/** 规则名 */
name: string | null;
/** app_key */
appKey: string | null;
/** 签名方式 */
signMode: string | null;
/** IP白名单 */
ip: string | null;
/** 接口支持标志 */
flag: string | null;
/** 推送数据间隔 */
dataInterval: string | null;
/** 描述 */
desc: string | null;
/** 创建时间 */
createTime: string | null;
/**
* 规则状态
*
* - 1: 已启动
* - 2: 已停止
*/
status: '1' | '2' | null;
}
}
namespace ApplyManagement {
interface Service {
/** id */
id: string;
/** 服务名称 */
name: string | null;
/** 服务类别 */
serviceType: string | null;
/** 介绍 */
desc: string | null;
/** 作者 */
author: string | null;
/** 版本 */
version: string | null;
/**
* 规则状态
*
* - 1: 已启动
* - 2: 已停止
*/
status: '1' | '2' | null;
}
}
/** 设备管理 */
namespace device {
interface addDeviceModel {
additional_info: string;
created_at: string;
data_identifier: string;
data_name: string;
data_type: string;
description: string;
device_template_id: string;
id: string;
read_write_flag: string;
remark: string;
tenant_id: string;
unit: string;
updated_at: string;
[property: string]: any;
}
}
/** 告警 */
namespace Alarm {
interface NotificationGroupParams {
name?: string;
notification_type?: string;
page: number;
page_size: number;
status?: string;
tenant_id?: string;
}
interface AddNotificationGroupParams {
name: string;
description?: string;
notification_config?: string;
notification_type: string;
remark?: string;
status: string;
tenant_id?: string;
}
interface NotificationGroupList {
created_at: Date;
description: string;
id: string;
name: string;
notification_config: string;
notification_type: string;
remark: string;
status: string;
tenant_id: string;
updated_at: Date;
}
interface NotificationHistoryParams {
page: number;
page_size: number;
notification_type: string;
send_target?: string;
send_time_start?: string;
send_time_stop?: string;
}
interface NotificationHistoryList {
page: number;
page_size: number;
notification_type: string;
send_target?: string;
send_time_start?: string;
send_time_stop?: string;
}
}
/** 灌溉计划 */
namespace Irrigation {
interface AddTimeIrrigation {
name: string | null;
space_id: string | null;
district_id: string | null;
device_id: string | null;
irrigation_time: string | null;
schedule: string | null;
control_type: string | null;
irrigation_duration: number | null;
valve_opening: number | null;
status?: string | null;
remark: string | null;
[key: string]: any;
}
}
}