index.ts
2.27 KB
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
import { defHttp } from '@/utils/external/http/axios';
import { DeviceAttributesRecord, GetDeviceListParams, PublicInterfaceRecord, PublicInterfaceStateEnum } from './model';
import { PaginationResult } from '/#/external/axios';
/**
* ft 更换接口
* 修改后的代码在注释之间,并标注好源代码和修改后代码,方便回溯
* 源代码 GET_PUBLIC_INTERFACE_ALL = '/data_view_interface/find_all_interface',
* 修改后代码 GET_PUBLIC_INTERFACE_ALL = '/data_view_interface/find/can_use_interfaces',
*/
enum Api {
PUBLIC_API = '/data_view_interface',
ORG_LISt = '/organization/me/list',
DEVICE_PROFILE_LIST = '/device_profile/me/list',
DEVICE_LIST = '/device/list',
DEVICE_ATTR_LIST = '/device/attributes',
GET_PUBLIC_INTERFACE_ALL = '/data_view_interface/find/can_use_interfaces',
//ft
GET_PUBLIC_INTERFACE_DETAIL = '/data_view_interface/get_interface_details'
}
export const getPublicInterface = async (params: Record<'page' | 'pageSize', number>) => {
return defHttp.get<PaginationResult<PublicInterfaceRecord>>({
url: Api.PUBLIC_API,
params
})
}
export const getOrgList = async () => {
return defHttp.get({
url: Api.ORG_LISt
})
}
export const getDeviceProfileList = async (params?: Record<'deviceType', string>) => {
return defHttp.get({
url: Api.DEVICE_PROFILE_LIST,
params
})
}
export const getDeviceList = async (params?: GetDeviceListParams) => {
return defHttp.get({
url: Api.DEVICE_LIST,
params
})
}
export const getDeviceAttrList = async (deviceProfileId: string) => {
return defHttp.get<DeviceAttributesRecord[]>({
url: `${Api.DEVICE_ATTR_LIST}/${deviceProfileId}`
})
}
export const getDeviceInterfaceDetail = async (interfaces: string[]) => {
return defHttp.get({
url: Api.GET_PUBLIC_INTERFACE_DETAIL,
params: interfaces
})
}
/**
* ft 更换接口
* 修改后的代码在注释之间,并标注好源代码和修改后代码,方便回溯
* 源代码 url: `${Api.GET_PUBLIC_INTERFACE_ALL}${params?.state ? `/${params.state}` : ''}`
* 修改后代码 url: `${Api.GET_PUBLIC_INTERFACE_ALL}`
*/
export const getAllPublicInterface = async () => {
return defHttp.get<PublicInterfaceRecord[]>({
url: `${Api.GET_PUBLIC_INTERFACE_ALL}`
})
}
//ft