Showing
3 changed files
with
467 additions
and
416 deletions
1 | -import { defHttp } from '/@/utils/http/axios'; | |
2 | -import { | |
3 | - TDeviceConfigParams, | |
4 | - IDeviceConfigAddOrEditModel, | |
5 | - ProfileRecord, | |
6 | - RuleChainRecord, | |
7 | -} from '/@/api/device/model/deviceConfigModel'; | |
8 | -import { PaginationResult } from '/#/axios'; | |
9 | - | |
10 | -enum EDeviceConfigApi { | |
11 | - /** | |
12 | - * 设备配置URL | |
13 | - */ | |
14 | - DEVICE_CONFIG_GET_PAGE = '/device_profile', | |
15 | - DEVICE_CONFIG_POST_ADD_OR_EDIT = '/device_profile', | |
16 | - DEVICE_CONFIG_GET_DETAIL = '/device_profile/', | |
17 | - DEVICE_CONFIG_DELETE = '/device_profile', | |
18 | - DEVICE_CONFIG_GET_RULECHAIN = '/rule_chain/me/list', | |
19 | - ALARM_CONTACT_GET_PAGE = '/alarm_contact', | |
20 | - DEVICE_CONFIG_EXPORT = '/device_profile/export', | |
21 | - DEVICE_CONFIG_IMPORT = '/device_profile/import', | |
22 | - SET_DEVICE_ISDEFAULT = '/deviceProfile', | |
23 | - FRP_API = '/frp/', | |
24 | - GET_TB_DEVICE_ID = '/device/get_subset', | |
25 | - COMMODRECORD = '/rpc', | |
26 | -} | |
27 | - | |
28 | -/** | |
29 | - * 设备配置详情 | |
30 | - */ | |
31 | -export const deviceConfigGetDetail = (id: string) => { | |
32 | - return defHttp.get({ | |
33 | - url: `${EDeviceConfigApi.DEVICE_CONFIG_GET_DETAIL}${id}`, | |
34 | - }); | |
35 | -}; | |
36 | - | |
37 | -/** | |
38 | - * 获取规则链 | |
39 | - */ | |
40 | -export const deviceConfigGetRuleChain = () => { | |
41 | - return defHttp.get<RuleChainRecord[]>({ | |
42 | - url: EDeviceConfigApi.DEVICE_CONFIG_GET_RULECHAIN, | |
43 | - }); | |
44 | -}; | |
45 | - | |
46 | -/** | |
47 | - * 获取告警联系人 | |
48 | - */ | |
49 | -export const alarmContactGetPage = () => { | |
50 | - return defHttp.get({ | |
51 | - url: `${EDeviceConfigApi.ALARM_CONTACT_GET_PAGE}?page=1&pageSize=10`, | |
52 | - }); | |
53 | -}; | |
54 | - | |
55 | -/** | |
56 | - * 分页查询设备配置页面 | |
57 | - */ | |
58 | -export const deviceConfigGetQuery = (params?: TDeviceConfigParams) => { | |
59 | - return defHttp.get<PaginationResult<ProfileRecord>>({ | |
60 | - url: EDeviceConfigApi.DEVICE_CONFIG_GET_PAGE, | |
61 | - params, | |
62 | - }); | |
63 | -}; | |
64 | - | |
65 | -/** | |
66 | - * 新增或者编辑设备配置 | |
67 | - | |
68 | - */ | |
69 | -export const deviceConfigAddOrEdit = (params: IDeviceConfigAddOrEditModel) => { | |
70 | - return defHttp.post<IDeviceConfigAddOrEditModel>({ | |
71 | - url: EDeviceConfigApi.DEVICE_CONFIG_POST_ADD_OR_EDIT, | |
72 | - params, | |
73 | - }); | |
74 | -}; | |
75 | - | |
76 | -/** | |
77 | - * 删除设备配置 | |
78 | - */ | |
79 | -export const deviceConfigDelete = (ids: string[]) => { | |
80 | - return defHttp.delete({ | |
81 | - url: EDeviceConfigApi.DEVICE_CONFIG_DELETE, | |
82 | - data: { | |
83 | - ids, | |
84 | - }, | |
85 | - }); | |
86 | -}; | |
87 | - | |
88 | -/** | |
89 | - * 导出设备配置 | |
90 | - */ | |
91 | -export const deviceConfigExport = (params: IDeviceConfigAddOrEditModel) => { | |
92 | - return defHttp.post<IDeviceConfigAddOrEditModel>({ | |
93 | - url: EDeviceConfigApi.DEVICE_CONFIG_EXPORT, | |
94 | - params, | |
95 | - }); | |
96 | -}; | |
97 | - | |
98 | -/** | |
99 | - * 导入设备配置 | |
100 | - */ | |
101 | -export const deviceConfigImport = (params: IDeviceConfigAddOrEditModel) => { | |
102 | - return defHttp.post<IDeviceConfigAddOrEditModel>({ | |
103 | - url: EDeviceConfigApi.DEVICE_CONFIG_IMPORT, | |
104 | - params, | |
105 | - }); | |
106 | -}; | |
107 | - | |
108 | -/** | |
109 | - * | |
110 | - * 设置该设备配置为默认 | |
111 | - */ | |
112 | -export const setDeviceProfileIsDefaultApi = (id: string, v, params?: {}) => { | |
113 | - return defHttp.post( | |
114 | - { | |
115 | - url: EDeviceConfigApi.SET_DEVICE_ISDEFAULT + '/' + id + '/' + v, | |
116 | - params, | |
117 | - }, | |
118 | - { | |
119 | - joinPrefix: false, | |
120 | - } | |
121 | - ); | |
122 | -}; | |
123 | - | |
124 | -/** | |
125 | - * Frp内网穿透信息API | |
126 | - */ | |
127 | -export const frpGetInfoApi = (proxyName: string) => { | |
128 | - return defHttp.get({ | |
129 | - url: `${EDeviceConfigApi.FRP_API}${proxyName}`, | |
130 | - }); | |
131 | -}; | |
132 | - | |
133 | -export const frpPutInfoApi = (proxyName: string, enableRemote: number) => { | |
134 | - return defHttp.put({ | |
135 | - url: `${EDeviceConfigApi.FRP_API}${proxyName}/${enableRemote}`, | |
136 | - }); | |
137 | -}; | |
138 | - | |
139 | -export const getTbDeviceId = (params: string) => { | |
140 | - return defHttp.get({ | |
141 | - url: `${EDeviceConfigApi.GET_TB_DEVICE_ID}/${params}`, | |
142 | - }); | |
143 | -}; | |
144 | - | |
145 | -/** | |
146 | - * 命令下发记录 | |
147 | - */ | |
148 | -export const deviceCommandRecordGetQuery = (params?: TDeviceConfigParams) => { | |
149 | - return defHttp.get({ | |
150 | - url: EDeviceConfigApi.COMMODRECORD, | |
151 | - params, | |
152 | - }); | |
153 | -}; | |
1 | +import { defHttp } from '/@/utils/http/axios'; | |
2 | +import { | |
3 | + TDeviceConfigParams, | |
4 | + IDeviceConfigAddOrEditModel, | |
5 | + ProfileRecord, | |
6 | + RuleChainRecord, | |
7 | + DeviceProfileDetail, | |
8 | +} from '/@/api/device/model/deviceConfigModel'; | |
9 | +import { PaginationResult } from '/#/axios'; | |
10 | + | |
11 | +enum EDeviceConfigApi { | |
12 | + /** | |
13 | + * 设备配置URL | |
14 | + */ | |
15 | + DEVICE_CONFIG_GET_PAGE = '/device_profile', | |
16 | + DEVICE_CONFIG_POST_ADD_OR_EDIT = '/device_profile', | |
17 | + DEVICE_CONFIG_GET_DETAIL = '/device_profile/', | |
18 | + DEVICE_CONFIG_DELETE = '/device_profile', | |
19 | + DEVICE_CONFIG_GET_RULECHAIN = '/rule_chain/me/list', | |
20 | + ALARM_CONTACT_GET_PAGE = '/alarm_contact', | |
21 | + DEVICE_CONFIG_EXPORT = '/device_profile/export', | |
22 | + DEVICE_CONFIG_IMPORT = '/device_profile/import', | |
23 | + SET_DEVICE_ISDEFAULT = '/deviceProfile', | |
24 | + FRP_API = '/frp/', | |
25 | + GET_TB_DEVICE_ID = '/device/get_subset', | |
26 | + COMMODRECORD = '/rpc', | |
27 | +} | |
28 | + | |
29 | +/** | |
30 | + * 设备配置详情 | |
31 | + */ | |
32 | +export const deviceConfigGetDetail = (id: string) => { | |
33 | + return defHttp.get<DeviceProfileDetail>({ | |
34 | + url: `${EDeviceConfigApi.DEVICE_CONFIG_GET_DETAIL}${id}`, | |
35 | + }); | |
36 | +}; | |
37 | + | |
38 | +/** | |
39 | + * 获取规则链 | |
40 | + */ | |
41 | +export const deviceConfigGetRuleChain = () => { | |
42 | + return defHttp.get<RuleChainRecord[]>({ | |
43 | + url: EDeviceConfigApi.DEVICE_CONFIG_GET_RULECHAIN, | |
44 | + }); | |
45 | +}; | |
46 | + | |
47 | +/** | |
48 | + * 获取告警联系人 | |
49 | + */ | |
50 | +export const alarmContactGetPage = () => { | |
51 | + return defHttp.get({ | |
52 | + url: `${EDeviceConfigApi.ALARM_CONTACT_GET_PAGE}?page=1&pageSize=10`, | |
53 | + }); | |
54 | +}; | |
55 | + | |
56 | +/** | |
57 | + * 分页查询设备配置页面 | |
58 | + */ | |
59 | +export const deviceConfigGetQuery = (params?: TDeviceConfigParams) => { | |
60 | + return defHttp.get<PaginationResult<ProfileRecord>>({ | |
61 | + url: EDeviceConfigApi.DEVICE_CONFIG_GET_PAGE, | |
62 | + params, | |
63 | + }); | |
64 | +}; | |
65 | + | |
66 | +/** | |
67 | + * 新增或者编辑设备配置 | |
68 | + | |
69 | + */ | |
70 | +export const deviceConfigAddOrEdit = (params: IDeviceConfigAddOrEditModel) => { | |
71 | + return defHttp.post<IDeviceConfigAddOrEditModel>({ | |
72 | + url: EDeviceConfigApi.DEVICE_CONFIG_POST_ADD_OR_EDIT, | |
73 | + params, | |
74 | + }); | |
75 | +}; | |
76 | + | |
77 | +/** | |
78 | + * 删除设备配置 | |
79 | + */ | |
80 | +export const deviceConfigDelete = (ids: string[]) => { | |
81 | + return defHttp.delete({ | |
82 | + url: EDeviceConfigApi.DEVICE_CONFIG_DELETE, | |
83 | + data: { | |
84 | + ids, | |
85 | + }, | |
86 | + }); | |
87 | +}; | |
88 | + | |
89 | +/** | |
90 | + * 导出设备配置 | |
91 | + */ | |
92 | +export const deviceConfigExport = (params: IDeviceConfigAddOrEditModel) => { | |
93 | + return defHttp.post<IDeviceConfigAddOrEditModel>({ | |
94 | + url: EDeviceConfigApi.DEVICE_CONFIG_EXPORT, | |
95 | + params, | |
96 | + }); | |
97 | +}; | |
98 | + | |
99 | +/** | |
100 | + * 导入设备配置 | |
101 | + */ | |
102 | +export const deviceConfigImport = (params: IDeviceConfigAddOrEditModel) => { | |
103 | + return defHttp.post<IDeviceConfigAddOrEditModel>({ | |
104 | + url: EDeviceConfigApi.DEVICE_CONFIG_IMPORT, | |
105 | + params, | |
106 | + }); | |
107 | +}; | |
108 | + | |
109 | +/** | |
110 | + * | |
111 | + * 设置该设备配置为默认 | |
112 | + */ | |
113 | +export const setDeviceProfileIsDefaultApi = (id: string, v, params?: {}) => { | |
114 | + return defHttp.post( | |
115 | + { | |
116 | + url: EDeviceConfigApi.SET_DEVICE_ISDEFAULT + '/' + id + '/' + v, | |
117 | + params, | |
118 | + }, | |
119 | + { | |
120 | + joinPrefix: false, | |
121 | + } | |
122 | + ); | |
123 | +}; | |
124 | + | |
125 | +/** | |
126 | + * Frp内网穿透信息API | |
127 | + */ | |
128 | +export const frpGetInfoApi = (proxyName: string) => { | |
129 | + return defHttp.get({ | |
130 | + url: `${EDeviceConfigApi.FRP_API}${proxyName}`, | |
131 | + }); | |
132 | +}; | |
133 | + | |
134 | +export const frpPutInfoApi = (proxyName: string, enableRemote: number) => { | |
135 | + return defHttp.put({ | |
136 | + url: `${EDeviceConfigApi.FRP_API}${proxyName}/${enableRemote}`, | |
137 | + }); | |
138 | +}; | |
139 | + | |
140 | +export const getTbDeviceId = (params: string) => { | |
141 | + return defHttp.get({ | |
142 | + url: `${EDeviceConfigApi.GET_TB_DEVICE_ID}/${params}`, | |
143 | + }); | |
144 | +}; | |
145 | + | |
146 | +/** | |
147 | + * 命令下发记录 | |
148 | + */ | |
149 | +export const deviceCommandRecordGetQuery = (params?: TDeviceConfigParams) => { | |
150 | + return defHttp.get({ | |
151 | + url: EDeviceConfigApi.COMMODRECORD, | |
152 | + params, | |
153 | + }); | |
154 | +}; | ... | ... |
1 | -import { BasicPageParams } from '/@/api/model/baseModel'; | |
2 | - | |
3 | -export type TDeviceConfigPageQueryParam = BasicPageParams & TDeviceConfigParams; | |
4 | - | |
5 | -export type TDeviceConfigParams = { | |
6 | - page?: any; | |
7 | - pageSize?: any; | |
8 | - name?: string; | |
9 | - transportType?: string; | |
10 | - orderFiled?: string; | |
11 | - orderType?: string; | |
12 | - tbDeviceId?: string; | |
13 | -}; | |
14 | - | |
15 | -export interface IDeviceConfigAddOrEditModel { | |
16 | - defaultQueueName?: string; //处理队列 | |
17 | - alarmProfile?: { | |
18 | - alarmContactId: string; | |
19 | - createTime: '2021-12-15T02:17:26.644Z'; | |
20 | - creator: string; | |
21 | - defaultConfig: string; | |
22 | - description: string; | |
23 | - deviceProfileId: string; | |
24 | - enabled: true; | |
25 | - icon: string; | |
26 | - id: string; | |
27 | - messageMode: string; | |
28 | - name: string; | |
29 | - roleIds: [string]; | |
30 | - tenantExpireTime: '2021-12-15T02:17:26.644Z'; | |
31 | - tenantId: string; | |
32 | - tenantStatus: 'DISABLED'; | |
33 | - updateTime: '2021-12-15T02:17:26.644Z'; | |
34 | - updater: string; | |
35 | - }; | |
36 | - convertJs?: string; | |
37 | - createTime?: '2021-12-15T02:17:26.644Z'; | |
38 | - creator?: string; | |
39 | - defaultConfig?: string; | |
40 | - defaultRuleChainId?: string; | |
41 | - description?: string; | |
42 | - enabled?: true; | |
43 | - icon?: string; | |
44 | - id?: string; | |
45 | - name?: string; | |
46 | - profileData?: { | |
47 | - configuration: {}; | |
48 | - transportConfiguration: {}; | |
49 | - provisionConfiguration: { | |
50 | - provisionDeviceSecret: string; | |
51 | - }; | |
52 | - //报警类型字段 | |
53 | - alarms: [ | |
54 | - { | |
55 | - id: 'highTemperatureAlarmID'; | |
56 | - alarmType: 'High Temperature Alarm'; | |
57 | - createRules: { | |
58 | - additionalProp1: { | |
59 | - condition: { | |
60 | - condition: [ | |
61 | - { | |
62 | - key: { | |
63 | - type: 'TIME_SERIES'; | |
64 | - key: 'temp'; | |
65 | - }; | |
66 | - valueType: 'NUMERIC'; | |
67 | - value: {}; | |
68 | - predicate: {}; | |
69 | - } | |
70 | - ]; | |
71 | - spec: {}; | |
72 | - }; | |
73 | - schedule: { | |
74 | - type: 'ANY_TIME'; | |
75 | - }; | |
76 | - alarmDetails: string; | |
77 | - dashboardId: { | |
78 | - id: '784f394c-42b6-435a-983c-b7beff2784f9'; | |
79 | - entityType: 'DASHBOARD'; | |
80 | - }; | |
81 | - }; | |
82 | - additionalProp2: { | |
83 | - condition: { | |
84 | - condition: [ | |
85 | - { | |
86 | - key: { | |
87 | - type: 'TIME_SERIES'; | |
88 | - key: 'temp'; | |
89 | - }; | |
90 | - valueType: 'NUMERIC'; | |
91 | - value: {}; | |
92 | - predicate: {}; | |
93 | - } | |
94 | - ]; | |
95 | - spec: {}; | |
96 | - }; | |
97 | - schedule: { | |
98 | - type: 'ANY_TIME'; | |
99 | - }; | |
100 | - alarmDetails: string; | |
101 | - dashboardId: { | |
102 | - id: '784f394c-42b6-435a-983c-b7beff2784f9'; | |
103 | - entityType: 'DASHBOARD'; | |
104 | - }; | |
105 | - }; | |
106 | - additionalProp3: { | |
107 | - condition: { | |
108 | - condition: [ | |
109 | - { | |
110 | - key: { | |
111 | - type: 'TIME_SERIES'; | |
112 | - key: 'temp'; | |
113 | - }; | |
114 | - valueType: 'NUMERIC'; | |
115 | - value: {}; | |
116 | - predicate: {}; | |
117 | - } | |
118 | - ]; | |
119 | - spec: {}; | |
120 | - }; | |
121 | - schedule: { | |
122 | - type: 'ANY_TIME'; | |
123 | - }; | |
124 | - alarmDetails: string; | |
125 | - dashboardId: { | |
126 | - id: '784f394c-42b6-435a-983c-b7beff2784f9'; | |
127 | - entityType: 'DASHBOARD'; | |
128 | - }; | |
129 | - }; | |
130 | - }; | |
131 | - clearRule: { | |
132 | - condition: { | |
133 | - condition: [ | |
134 | - { | |
135 | - key: { | |
136 | - type: 'TIME_SERIES'; | |
137 | - key: 'temp'; | |
138 | - }; | |
139 | - valueType: 'NUMERIC'; | |
140 | - value: {}; | |
141 | - predicate: {}; | |
142 | - } | |
143 | - ]; | |
144 | - spec: {}; | |
145 | - }; | |
146 | - schedule: { | |
147 | - type: 'ANY_TIME'; | |
148 | - }; | |
149 | - alarmDetails: string; | |
150 | - dashboardId: { | |
151 | - id: '784f394c-42b6-435a-983c-b7beff2784f9'; | |
152 | - entityType: 'DASHBOARD'; | |
153 | - }; | |
154 | - }; | |
155 | - propagate: true; | |
156 | - propagateRelationTypes: [string]; | |
157 | - } | |
158 | - ]; | |
159 | - }; | |
160 | - roleIds?: [string]; | |
161 | - tbProfileId?: string; | |
162 | - tenantExpireTime?: '2021-12-15T02:17:26.645Z'; | |
163 | - tenantId?: string; | |
164 | - tenantStatus?: 'DISABLED'; | |
165 | - transportType?: string; | |
166 | - updateTime?: '2021-12-15T02:17:26.645Z'; | |
167 | - updater?: string; | |
168 | -} | |
169 | - | |
170 | -export interface Data { | |
171 | - CO: number; | |
172 | -} | |
173 | - | |
174 | -export interface Details { | |
175 | - data: Data; | |
176 | -} | |
177 | - | |
178 | -export interface AlarmLogItem { | |
179 | - id: string; | |
180 | - tenantId: string; | |
181 | - creator?: any; | |
182 | - updater?: any; | |
183 | - createdTime: string; | |
184 | - updatedTime: string; | |
185 | - customerId: string; | |
186 | - tbDeviceId: string; | |
187 | - originatorType: number; | |
188 | - deviceId: string; | |
189 | - deviceName: string; | |
190 | - type: string; | |
191 | - severity: string; | |
192 | - status: string; | |
193 | - startTs: string; | |
194 | - endTs: string; | |
195 | - ackTs: string; | |
196 | - clearTs: string; | |
197 | - details: Details; | |
198 | - propagate: boolean; | |
199 | - propagateRelationTypes?: any; | |
200 | - organizationId: string; | |
201 | - organizationName: string; | |
202 | -} | |
203 | - | |
204 | -export interface Configuration { | |
205 | - type: string; | |
206 | -} | |
207 | - | |
208 | -export interface TransportConfiguration { | |
209 | - type: string; | |
210 | -} | |
211 | - | |
212 | -export interface ProvisionConfiguration { | |
213 | - type: string; | |
214 | - provisionDeviceSecret?: any; | |
215 | -} | |
216 | - | |
217 | -export interface ProfileData { | |
218 | - configuration: Configuration; | |
219 | - transportConfiguration: TransportConfiguration; | |
220 | - provisionConfiguration: ProvisionConfiguration; | |
221 | - alarms?: any; | |
222 | -} | |
223 | - | |
224 | -export interface ProfileRecord { | |
225 | - id: string; | |
226 | - creator: string; | |
227 | - createTime: string; | |
228 | - updater: string; | |
229 | - updateTime: string; | |
230 | - name: string; | |
231 | - tenantId: string; | |
232 | - transportType: string; | |
233 | - provisionType: string; | |
234 | - deviceType: string; | |
235 | - tbProfileId: string; | |
236 | - profileData: ProfileData; | |
237 | - defaultRuleChainId: string; | |
238 | - defaultQueueName: string; | |
239 | - image: string; | |
240 | - type: string; | |
241 | - default: boolean; | |
242 | - | |
243 | - checked?: boolean; | |
244 | -} | |
245 | - | |
246 | -export interface IDRecord { | |
247 | - entityType: string; | |
248 | - id: string; | |
249 | -} | |
250 | - | |
251 | -export interface RuleChainRecord { | |
252 | - id: IDRecord; | |
253 | - createdTime: number; | |
254 | - additionalInfo?: any; | |
255 | - tenantId: IDRecord; | |
256 | - name: string; | |
257 | - type: string; | |
258 | - firstRuleNodeId: IDRecord; | |
259 | - root: boolean; | |
260 | - debugMode: boolean; | |
261 | - configuration?: any; | |
262 | -} | |
1 | +import { BasicPageParams } from '/@/api/model/baseModel'; | |
2 | + | |
3 | +export type TDeviceConfigPageQueryParam = BasicPageParams & TDeviceConfigParams; | |
4 | + | |
5 | +export type TDeviceConfigParams = { | |
6 | + page?: any; | |
7 | + pageSize?: any; | |
8 | + name?: string; | |
9 | + transportType?: string; | |
10 | + orderFiled?: string; | |
11 | + orderType?: string; | |
12 | + tbDeviceId?: string; | |
13 | +}; | |
14 | + | |
15 | +export interface IDeviceConfigAddOrEditModel { | |
16 | + defaultQueueName?: string; //处理队列 | |
17 | + alarmProfile?: { | |
18 | + alarmContactId: string; | |
19 | + createTime: '2021-12-15T02:17:26.644Z'; | |
20 | + creator: string; | |
21 | + defaultConfig: string; | |
22 | + description: string; | |
23 | + deviceProfileId: string; | |
24 | + enabled: true; | |
25 | + icon: string; | |
26 | + id: string; | |
27 | + messageMode: string; | |
28 | + name: string; | |
29 | + roleIds: [string]; | |
30 | + tenantExpireTime: '2021-12-15T02:17:26.644Z'; | |
31 | + tenantId: string; | |
32 | + tenantStatus: 'DISABLED'; | |
33 | + updateTime: '2021-12-15T02:17:26.644Z'; | |
34 | + updater: string; | |
35 | + }; | |
36 | + convertJs?: string; | |
37 | + createTime?: '2021-12-15T02:17:26.644Z'; | |
38 | + creator?: string; | |
39 | + defaultConfig?: string; | |
40 | + defaultRuleChainId?: string; | |
41 | + description?: string; | |
42 | + enabled?: true; | |
43 | + icon?: string; | |
44 | + id?: string; | |
45 | + name?: string; | |
46 | + profileData?: { | |
47 | + configuration: {}; | |
48 | + transportConfiguration: {}; | |
49 | + provisionConfiguration: { | |
50 | + provisionDeviceSecret: string; | |
51 | + }; | |
52 | + //报警类型字段 | |
53 | + alarms: [ | |
54 | + { | |
55 | + id: 'highTemperatureAlarmID'; | |
56 | + alarmType: 'High Temperature Alarm'; | |
57 | + createRules: { | |
58 | + additionalProp1: { | |
59 | + condition: { | |
60 | + condition: [ | |
61 | + { | |
62 | + key: { | |
63 | + type: 'TIME_SERIES'; | |
64 | + key: 'temp'; | |
65 | + }; | |
66 | + valueType: 'NUMERIC'; | |
67 | + value: {}; | |
68 | + predicate: {}; | |
69 | + } | |
70 | + ]; | |
71 | + spec: {}; | |
72 | + }; | |
73 | + schedule: { | |
74 | + type: 'ANY_TIME'; | |
75 | + }; | |
76 | + alarmDetails: string; | |
77 | + dashboardId: { | |
78 | + id: '784f394c-42b6-435a-983c-b7beff2784f9'; | |
79 | + entityType: 'DASHBOARD'; | |
80 | + }; | |
81 | + }; | |
82 | + additionalProp2: { | |
83 | + condition: { | |
84 | + condition: [ | |
85 | + { | |
86 | + key: { | |
87 | + type: 'TIME_SERIES'; | |
88 | + key: 'temp'; | |
89 | + }; | |
90 | + valueType: 'NUMERIC'; | |
91 | + value: {}; | |
92 | + predicate: {}; | |
93 | + } | |
94 | + ]; | |
95 | + spec: {}; | |
96 | + }; | |
97 | + schedule: { | |
98 | + type: 'ANY_TIME'; | |
99 | + }; | |
100 | + alarmDetails: string; | |
101 | + dashboardId: { | |
102 | + id: '784f394c-42b6-435a-983c-b7beff2784f9'; | |
103 | + entityType: 'DASHBOARD'; | |
104 | + }; | |
105 | + }; | |
106 | + additionalProp3: { | |
107 | + condition: { | |
108 | + condition: [ | |
109 | + { | |
110 | + key: { | |
111 | + type: 'TIME_SERIES'; | |
112 | + key: 'temp'; | |
113 | + }; | |
114 | + valueType: 'NUMERIC'; | |
115 | + value: {}; | |
116 | + predicate: {}; | |
117 | + } | |
118 | + ]; | |
119 | + spec: {}; | |
120 | + }; | |
121 | + schedule: { | |
122 | + type: 'ANY_TIME'; | |
123 | + }; | |
124 | + alarmDetails: string; | |
125 | + dashboardId: { | |
126 | + id: '784f394c-42b6-435a-983c-b7beff2784f9'; | |
127 | + entityType: 'DASHBOARD'; | |
128 | + }; | |
129 | + }; | |
130 | + }; | |
131 | + clearRule: { | |
132 | + condition: { | |
133 | + condition: [ | |
134 | + { | |
135 | + key: { | |
136 | + type: 'TIME_SERIES'; | |
137 | + key: 'temp'; | |
138 | + }; | |
139 | + valueType: 'NUMERIC'; | |
140 | + value: {}; | |
141 | + predicate: {}; | |
142 | + } | |
143 | + ]; | |
144 | + spec: {}; | |
145 | + }; | |
146 | + schedule: { | |
147 | + type: 'ANY_TIME'; | |
148 | + }; | |
149 | + alarmDetails: string; | |
150 | + dashboardId: { | |
151 | + id: '784f394c-42b6-435a-983c-b7beff2784f9'; | |
152 | + entityType: 'DASHBOARD'; | |
153 | + }; | |
154 | + }; | |
155 | + propagate: true; | |
156 | + propagateRelationTypes: [string]; | |
157 | + } | |
158 | + ]; | |
159 | + }; | |
160 | + roleIds?: [string]; | |
161 | + tbProfileId?: string; | |
162 | + tenantExpireTime?: '2021-12-15T02:17:26.645Z'; | |
163 | + tenantId?: string; | |
164 | + tenantStatus?: 'DISABLED'; | |
165 | + transportType?: string; | |
166 | + updateTime?: '2021-12-15T02:17:26.645Z'; | |
167 | + updater?: string; | |
168 | +} | |
169 | + | |
170 | +export interface Data { | |
171 | + CO: number; | |
172 | +} | |
173 | + | |
174 | +export interface Details { | |
175 | + data: Data; | |
176 | +} | |
177 | + | |
178 | +export interface AlarmLogItem { | |
179 | + id: string; | |
180 | + tenantId: string; | |
181 | + creator?: any; | |
182 | + updater?: any; | |
183 | + createdTime: string; | |
184 | + updatedTime: string; | |
185 | + customerId: string; | |
186 | + tbDeviceId: string; | |
187 | + originatorType: number; | |
188 | + deviceId: string; | |
189 | + deviceName: string; | |
190 | + type: string; | |
191 | + severity: string; | |
192 | + status: string; | |
193 | + startTs: string; | |
194 | + endTs: string; | |
195 | + ackTs: string; | |
196 | + clearTs: string; | |
197 | + details: Details; | |
198 | + propagate: boolean; | |
199 | + propagateRelationTypes?: any; | |
200 | + organizationId: string; | |
201 | + organizationName: string; | |
202 | +} | |
203 | + | |
204 | +export interface Configuration { | |
205 | + type: string; | |
206 | +} | |
207 | + | |
208 | +export interface TransportConfiguration { | |
209 | + type: string; | |
210 | +} | |
211 | + | |
212 | +export interface ProvisionConfiguration { | |
213 | + type: string; | |
214 | + provisionDeviceSecret?: any; | |
215 | +} | |
216 | + | |
217 | +export interface ProfileData { | |
218 | + configuration: Configuration; | |
219 | + transportConfiguration: TransportConfiguration; | |
220 | + provisionConfiguration: ProvisionConfiguration; | |
221 | + alarms?: any; | |
222 | +} | |
223 | + | |
224 | +export interface ProfileRecord { | |
225 | + id: string; | |
226 | + creator: string; | |
227 | + createTime: string; | |
228 | + updater: string; | |
229 | + updateTime: string; | |
230 | + name: string; | |
231 | + tenantId: string; | |
232 | + transportType: string; | |
233 | + provisionType: string; | |
234 | + deviceType: string; | |
235 | + tbProfileId: string; | |
236 | + profileData: ProfileData; | |
237 | + defaultRuleChainId: string; | |
238 | + defaultQueueName: string; | |
239 | + image: string; | |
240 | + type: string; | |
241 | + default: boolean; | |
242 | + | |
243 | + checked?: boolean; | |
244 | +} | |
245 | + | |
246 | +export interface IDRecord { | |
247 | + entityType: string; | |
248 | + id: string; | |
249 | +} | |
250 | + | |
251 | +export interface RuleChainRecord { | |
252 | + id: IDRecord; | |
253 | + createdTime: number; | |
254 | + additionalInfo?: any; | |
255 | + tenantId: IDRecord; | |
256 | + name: string; | |
257 | + type: string; | |
258 | + firstRuleNodeId: IDRecord; | |
259 | + root: boolean; | |
260 | + debugMode: boolean; | |
261 | + configuration?: any; | |
262 | +} | |
263 | + | |
264 | +export interface DeviceProfileDetail { | |
265 | + id: string; | |
266 | + creator: string; | |
267 | + createTime: string; | |
268 | + updater: string; | |
269 | + updateTime: string; | |
270 | + name: string; | |
271 | + description: string; | |
272 | + tenantId: string; | |
273 | + transportType: string; | |
274 | + provisionType: string; | |
275 | + deviceType: string; | |
276 | + tbProfileId: string; | |
277 | + profileData: ProfileData; | |
278 | + defaultQueueName: string; | |
279 | + type: string; | |
280 | + deviceCount: number; | |
281 | + default: boolean; | |
282 | +} | |
283 | + | |
284 | +export interface ProfileData { | |
285 | + configuration: Configuration; | |
286 | + transportConfiguration: TransportConfiguration; | |
287 | + provisionConfiguration: ProvisionConfiguration; | |
288 | + alarms: any; | |
289 | + thingsModel: any; | |
290 | +} | |
291 | + | |
292 | +export interface Configuration { | |
293 | + type: string; | |
294 | +} | |
295 | + | |
296 | +export interface TransportConfiguration { | |
297 | + type: string; | |
298 | +} | |
299 | + | |
300 | +export interface ProvisionConfiguration { | |
301 | + type: string; | |
302 | + provisionDeviceSecret: any; | |
303 | +} | ... | ... |
... | ... | @@ -84,6 +84,7 @@ |
84 | 84 | import DeviceConfigurationStep from './step/DeviceConfigurationStep.vue'; |
85 | 85 | import TransportConfigurationStep from './step/TransportConfigurationStep.vue'; |
86 | 86 | import PhysicalModelManagementStep from './step/PhysicalModelManagementStep.vue'; |
87 | + import { DeviceProfileDetail } from '/@/api/device/model/deviceConfigModel'; | |
87 | 88 | |
88 | 89 | const emits = defineEmits(['success', 'register']); |
89 | 90 | const activeKey = ref('1'); |
... | ... | @@ -105,15 +106,22 @@ |
105 | 106 | }); |
106 | 107 | const transportTypeStr = ref(''); |
107 | 108 | const dynamicWidth = ref('55rem'); |
109 | + | |
110 | + const isDefault = ref(false); | |
108 | 111 | const [register, { closeModal, setModalProps }] = useModalInner(async (data) => { |
109 | 112 | setModalProps({ confirmLoading: false }); |
110 | 113 | current.value = 0; |
111 | 114 | isUpdate.value = data.isUpdate; |
112 | 115 | isViewDetail.value = data.isView; |
113 | - const res = data.record !== undefined ? await deviceConfigGetDetail(data.record.id) : {}; | |
116 | + const res = | |
117 | + data.record !== undefined | |
118 | + ? await deviceConfigGetDetail(data.record.id) | |
119 | + : ({} as DeviceProfileDetail); | |
114 | 120 | isEditId.value = data.record !== undefined ? data.record.id : null; |
115 | 121 | isEditCreatTime.value = data.record !== undefined ? data.record.createTime : null; |
116 | 122 | |
123 | + isDefault.value = res.default; | |
124 | + | |
117 | 125 | const title = unref(isUpdate) ? '编辑产品' : '新增产品'; |
118 | 126 | setModalProps({ title, showOkBtn: true, showCancelBtn: true }); |
119 | 127 | if (unref(isUpdate)) { |
... | ... | @@ -183,6 +191,7 @@ |
183 | 191 | ...{ profileData: !isEmptyObj ? transportConfData.profileData : null }, |
184 | 192 | ...{ id: isUpdate.value ? isEditId.value : null }, |
185 | 193 | ...{ createTime: isUpdate.value ? isEditCreatTime.value : null }, |
194 | + default: !!unref(isDefault), | |
186 | 195 | }); |
187 | 196 | createMessage.success(isUpdate.value ? `编辑成功` : `新增成功`); |
188 | 197 | handleCancel(); | ... | ... |