deviceConfigApi.ts
4.19 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
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
import { defHttp } from '/@/utils/http/axios';
import {
TDeviceConfigParams,
IDeviceConfigAddOrEditModel,
ProfileRecord,
RuleChainRecord,
DeviceProfileDetail,
BatchUpdateDeviceProfileRuleChainParams,
} from '/@/api/device/model/deviceConfigModel';
import { PaginationResult } from '/#/axios';
import { QueryDeviceProfileListParams } from './model/deviceModel';
enum EDeviceConfigApi {
/**
* 设备配置URL
*/
DEVICE_CONFIG_GET_PAGE = '/device_profile',
DEVICE_CONFIG_POST_ADD_OR_EDIT = '/device_profile',
DEVICE_CONFIG_GET_DETAIL = '/device_profile/',
DEVICE_CONFIG_DELETE = '/device_profile',
DEVICE_CONFIG_GET_RULECHAIN = '/rule_chain/me/list',
ALARM_CONTACT_GET_PAGE = '/alarm_contact',
DEVICE_CONFIG_EXPORT = '/device_profile/export',
DEVICE_CONFIG_IMPORT = '/device_profile/import',
SET_DEVICE_ISDEFAULT = '/deviceProfile',
FRP_API = '/frp/',
GET_TB_DEVICE_ID = '/device/get_subset',
COMMODRECORD = '/rpc',
DEVICE_PROFILE_LIST = '/device_profile/me/list',
DEVICE_PROFILE_BATCH_UPDATE_RULE_CHAIN = '/batch/change/ruleChain',
}
/**
* 设备配置详情
*/
export const deviceConfigGetDetail = (id: string) => {
return defHttp.get<DeviceProfileDetail>({
url: `${EDeviceConfigApi.DEVICE_CONFIG_GET_DETAIL}${id}`,
});
};
/**
* 获取规则链
*/
export const doQueryRuleChainList = () => {
return defHttp.get<RuleChainRecord[]>({
url: EDeviceConfigApi.DEVICE_CONFIG_GET_RULECHAIN,
});
};
/**
* 获取告警联系人
*/
export const alarmContactGetPage = () => {
return defHttp.get({
url: `${EDeviceConfigApi.ALARM_CONTACT_GET_PAGE}?page=1&pageSize=10`,
});
};
/**
* 分页查询设备配置页面
*/
export const deviceConfigGetQuery = (params?: TDeviceConfigParams) => {
return defHttp.get<PaginationResult<ProfileRecord>>({
url: EDeviceConfigApi.DEVICE_CONFIG_GET_PAGE,
params,
});
};
/**
* 新增或者编辑设备配置
*/
export const deviceConfigAddOrEdit = (params: IDeviceConfigAddOrEditModel) => {
return defHttp.post<IDeviceConfigAddOrEditModel>({
url: EDeviceConfigApi.DEVICE_CONFIG_POST_ADD_OR_EDIT,
params,
});
};
/**
* 删除设备配置
*/
export const deviceConfigDelete = (ids: string[]) => {
return defHttp.delete({
url: EDeviceConfigApi.DEVICE_CONFIG_DELETE,
data: {
ids,
},
});
};
/**
* 导出设备配置
*/
export const deviceConfigExport = (params: IDeviceConfigAddOrEditModel) => {
return defHttp.post<IDeviceConfigAddOrEditModel>({
url: EDeviceConfigApi.DEVICE_CONFIG_EXPORT,
params,
});
};
/**
* 导入设备配置
*/
export const deviceConfigImport = (params: IDeviceConfigAddOrEditModel) => {
return defHttp.post<IDeviceConfigAddOrEditModel>({
url: EDeviceConfigApi.DEVICE_CONFIG_IMPORT,
params,
});
};
/**
*
* 设置该设备配置为默认
*/
export const setDeviceProfileIsDefaultApi = (id: string, v, params?: {}) => {
return defHttp.post(
{
url: EDeviceConfigApi.SET_DEVICE_ISDEFAULT + '/' + id + '/' + v,
params,
},
{
joinPrefix: false,
}
);
};
/**
* Frp内网穿透信息API
*/
export const frpGetInfoApi = (proxyName: string) => {
return defHttp.get({
url: `${EDeviceConfigApi.FRP_API}${proxyName}`,
});
};
export const frpPutInfoApi = (proxyName: string, enableRemote: number) => {
return defHttp.put({
url: `${EDeviceConfigApi.FRP_API}${proxyName}/${enableRemote}`,
});
};
export const getTbDeviceId = (params: string) => {
return defHttp.get({
url: `${EDeviceConfigApi.GET_TB_DEVICE_ID}/${params}`,
});
};
/**
* 命令下发记录
*/
export const deviceCommandRecordGetQuery = (params?: TDeviceConfigParams) => {
return defHttp.get({
url: EDeviceConfigApi.COMMODRECORD,
params,
});
};
/**
* @description 获取设备配置列表
* @param params
* @returns
*/
export const doQueryDeviceProfileList = (params?: QueryDeviceProfileListParams) => {
return defHttp.get({
url: EDeviceConfigApi.DEVICE_PROFILE_LIST,
params,
});
};
export const doBatchChangeRuleChain = (data: BatchUpdateDeviceProfileRuleChainParams) => {
return defHttp.post(
{
url: EDeviceConfigApi.DEVICE_PROFILE_BATCH_UPDATE_RULE_CHAIN,
data,
},
{
joinPrefix: false,
}
);
};