Showing
5 changed files
with
71 additions
and
6 deletions
@@ -76,9 +76,10 @@ export const deleteDevice = (ids: string[]) => { | @@ -76,9 +76,10 @@ export const deleteDevice = (ids: string[]) => { | ||
76 | * 查询设备配置 | 76 | * 查询设备配置 |
77 | * @param params pageSize page name | 77 | * @param params pageSize page name |
78 | */ | 78 | */ |
79 | -export const deviceProfile = () => { | 79 | +export const deviceProfile = (params) => { |
80 | return defHttp.get({ | 80 | return defHttp.get({ |
81 | url: DeviceManagerApi.DEVICE_PROFILE_URL_ME, | 81 | url: DeviceManagerApi.DEVICE_PROFILE_URL_ME, |
82 | + params, | ||
82 | }); | 83 | }); |
83 | }; | 84 | }; |
84 | 85 |
@@ -21,7 +21,7 @@ enum ScreenManagerApi { | @@ -21,7 +21,7 @@ enum ScreenManagerApi { | ||
21 | // GET_ATTRBUTELIST = '/device/keys', | 21 | // GET_ATTRBUTELIST = '/device/keys', |
22 | GET_ATTRBUTELIST = '/device/attributes/', | 22 | GET_ATTRBUTELIST = '/device/attributes/', |
23 | ALARM_PROFILE = '/alarm/profile/', | 23 | ALARM_PROFILE = '/alarm/profile/', |
24 | - MASTER_GET_DEVICE = '/device/list/master', | 24 | + MASTER_GET_DEVICE = '/device/list', |
25 | } | 25 | } |
26 | 26 | ||
27 | /** | 27 | /** |
@@ -125,8 +125,8 @@ export const byOrganizationIdGetMasterDevice = (params: { | @@ -125,8 +125,8 @@ export const byOrganizationIdGetMasterDevice = (params: { | ||
125 | }) => { | 125 | }) => { |
126 | const { organizationId, deviceProfileId } = params; | 126 | const { organizationId, deviceProfileId } = params; |
127 | return defHttp.get({ | 127 | return defHttp.get({ |
128 | - url: `${ScreenManagerApi.MASTER_GET_DEVICE}/${organizationId}`, | ||
129 | - params: { deviceProfileId }, | 128 | + url: `${ScreenManagerApi.MASTER_GET_DEVICE}`, |
129 | + params: { deviceProfileId, organizationId }, | ||
130 | }); | 130 | }); |
131 | }; | 131 | }; |
132 | //TODO-fengtao | 132 | //TODO-fengtao |
@@ -245,6 +245,7 @@ | @@ -245,6 +245,7 @@ | ||
245 | operationType: trigger?.triggerCondition?.condition?.condition[0]?.valueType, | 245 | operationType: trigger?.triggerCondition?.condition?.condition[0]?.valueType, |
246 | detail: trigger?.triggerCondition?.alarmDetails, | 246 | detail: trigger?.triggerCondition?.alarmDetails, |
247 | entityId: trigger?.entityId, | 247 | entityId: trigger?.entityId, |
248 | + deviceType: trigger?.deviceType, | ||
248 | deviceProfileId: trigger?.deviceProfileId, | 249 | deviceProfileId: trigger?.deviceProfileId, |
249 | replaceValue: trigger?.triggerCondition?.condition?.spec?.predicate?.defaultValue, | 250 | replaceValue: trigger?.triggerCondition?.condition?.spec?.predicate?.defaultValue, |
250 | time: trigger?.triggerCondition?.condition?.spec?.predicate?.defaultValue, | 251 | time: trigger?.triggerCondition?.condition?.spec?.predicate?.defaultValue, |
@@ -325,6 +326,7 @@ | @@ -325,6 +326,7 @@ | ||
325 | operationType: condition?.triggerCondition?.condition?.condition[0]?.valueType, | 326 | operationType: condition?.triggerCondition?.condition?.condition[0]?.valueType, |
326 | detail: condition?.triggerCondition?.alarmDetails, | 327 | detail: condition?.triggerCondition?.alarmDetails, |
327 | entityId: condition?.entityId, | 328 | entityId: condition?.entityId, |
329 | + deviceType: condition?.deviceType, | ||
328 | deviceProfileId: condition?.deviceProfileId, | 330 | deviceProfileId: condition?.deviceProfileId, |
329 | replaceValue: condition?.triggerCondition?.condition?.spec?.predicate?.defaultValue, | 331 | replaceValue: condition?.triggerCondition?.condition?.spec?.predicate?.defaultValue, |
330 | time: condition?.triggerCondition?.condition?.spec?.predicate?.defaultValue, | 332 | time: condition?.triggerCondition?.condition?.spec?.predicate?.defaultValue, |
@@ -397,6 +399,7 @@ | @@ -397,6 +399,7 @@ | ||
397 | deviceId: action.deviceId, | 399 | deviceId: action.deviceId, |
398 | alarm_config: action.alarmProfileId, | 400 | alarm_config: action.alarmProfileId, |
399 | alarm_level: action.doContext.alarmLevel, | 401 | alarm_level: action.doContext.alarmLevel, |
402 | + deviceType: action.deviceType, | ||
400 | }); | 403 | }); |
401 | // 如果是设备输出设置脚本值 | 404 | // 如果是设备输出设置脚本值 |
402 | if (action.outTarget === 'DEVICE_OUT') { | 405 | if (action.outTarget === 'DEVICE_OUT') { |
@@ -436,6 +439,7 @@ | @@ -436,6 +439,7 @@ | ||
436 | .valueType, | 439 | .valueType, |
437 | detail: action.doContext.clearRule[index].triggerCondition.alarmDetails, | 440 | detail: action.doContext.clearRule[index].triggerCondition.alarmDetails, |
438 | entityId: action.doContext.clearRule[index].entityId, | 441 | entityId: action.doContext.clearRule[index].entityId, |
442 | + deviceType: action.doContext.clearRule[index].entityId?.deviceType, | ||
439 | deviceProfileId: action.doContext.clearRule[index]?.deviceProfileId, | 443 | deviceProfileId: action.doContext.clearRule[index]?.deviceProfileId, |
440 | replaceValue: | 444 | replaceValue: |
441 | action.doContext.clearRule[index].triggerCondition.condition.spec.predicate | 445 | action.doContext.clearRule[index].triggerCondition.condition.spec.predicate |
@@ -193,6 +193,7 @@ export const trigger_condition_schema: FormSchema[] = [ | @@ -193,6 +193,7 @@ export const trigger_condition_schema: FormSchema[] = [ | ||
193 | field: 'triggered', | 193 | field: 'triggered', |
194 | label: '', | 194 | label: '', |
195 | component: 'Select', | 195 | component: 'Select', |
196 | + defaultValue: 'SIMPLE', | ||
196 | componentProps: { | 197 | componentProps: { |
197 | placeholder: '请选择触发类型', | 198 | placeholder: '请选择触发类型', |
198 | options: [ | 199 | options: [ |
@@ -204,14 +205,44 @@ export const trigger_condition_schema: FormSchema[] = [ | @@ -204,14 +205,44 @@ export const trigger_condition_schema: FormSchema[] = [ | ||
204 | colProps: { span: 6 }, | 205 | colProps: { span: 6 }, |
205 | }, | 206 | }, |
206 | { | 207 | { |
207 | - field: 'deviceProfileId', | 208 | + field: 'deviceType', |
208 | label: '', | 209 | label: '', |
209 | component: 'ApiSelect', | 210 | component: 'ApiSelect', |
210 | colProps: { span: 6 }, | 211 | colProps: { span: 6 }, |
212 | + defaultValue: 'SENSOR', | ||
211 | componentProps: ({ formActionType }) => { | 213 | componentProps: ({ formActionType }) => { |
214 | + const { setFieldsValue } = formActionType; | ||
215 | + return { | ||
216 | + api: findDictItemByCode, | ||
217 | + params: { | ||
218 | + dictCode: 'device_type', | ||
219 | + }, | ||
220 | + placeholder: '请选择类型', | ||
221 | + labelField: 'itemText', | ||
222 | + valueField: 'itemValue', | ||
223 | + getPopupContainer: () => document.body, | ||
224 | + onChange(e) { | ||
225 | + if (e) { | ||
226 | + setFieldsValue({ deviceProfileId: '' }); | ||
227 | + } | ||
228 | + }, | ||
229 | + }; | ||
230 | + }, | ||
231 | + }, | ||
232 | + { | ||
233 | + field: 'deviceProfileId', | ||
234 | + label: '', | ||
235 | + component: 'ApiSelect', | ||
236 | + colProps: { span: 6 }, | ||
237 | + componentProps: ({ formActionType, formModel }) => { | ||
212 | const { updateSchema, setFieldsValue } = formActionType; | 238 | const { updateSchema, setFieldsValue } = formActionType; |
239 | + const deviceType = formModel['deviceType']; | ||
213 | return { | 240 | return { |
214 | api: deviceProfile, | 241 | api: deviceProfile, |
242 | + params: { | ||
243 | + deviceType, | ||
244 | + }, | ||
245 | + showSearch: true, | ||
215 | placeholder: '请选择产品', | 246 | placeholder: '请选择产品', |
216 | labelField: 'name', | 247 | labelField: 'name', |
217 | valueField: 'id', | 248 | valueField: 'id', |
@@ -372,14 +403,38 @@ export const actionSchema: FormSchema[] = [ | @@ -372,14 +403,38 @@ export const actionSchema: FormSchema[] = [ | ||
372 | colProps: { span: 6 }, | 403 | colProps: { span: 6 }, |
373 | }, | 404 | }, |
374 | { | 405 | { |
406 | + field: 'deviceType', | ||
407 | + label: '', | ||
408 | + component: 'ApiSelect', | ||
409 | + colProps: { span: 6 }, | ||
410 | + defaultValue: 'SENSOR', | ||
411 | + componentProps: () => { | ||
412 | + return { | ||
413 | + api: findDictItemByCode, | ||
414 | + params: { | ||
415 | + dictCode: 'device_type', | ||
416 | + }, | ||
417 | + placeholder: '请选择类型', | ||
418 | + labelField: 'itemText', | ||
419 | + valueField: 'itemValue', | ||
420 | + getPopupContainer: () => document.body, | ||
421 | + }; | ||
422 | + }, | ||
423 | + ifShow: ({ values }) => isDeviceOut(values.outTarget), | ||
424 | + }, | ||
425 | + { | ||
375 | field: 'deviceProfileId', | 426 | field: 'deviceProfileId', |
376 | label: '', | 427 | label: '', |
377 | component: 'ApiSelect', | 428 | component: 'ApiSelect', |
378 | colProps: { span: 6 }, | 429 | colProps: { span: 6 }, |
379 | - componentProps: ({ formActionType }) => { | 430 | + componentProps: ({ formActionType, formModel }) => { |
380 | const { setFieldsValue } = formActionType; | 431 | const { setFieldsValue } = formActionType; |
432 | + const deviceType = formModel['deviceType']; | ||
381 | return { | 433 | return { |
382 | api: deviceProfile, | 434 | api: deviceProfile, |
435 | + params: { | ||
436 | + deviceType, | ||
437 | + }, | ||
383 | placeholder: '请选择产品', | 438 | placeholder: '请选择产品', |
384 | labelField: 'name', | 439 | labelField: 'name', |
385 | valueField: 'id', | 440 | valueField: 'id', |
@@ -18,6 +18,7 @@ export const genTriggerOrConditionData = (triggerData) => { | @@ -18,6 +18,7 @@ export const genTriggerOrConditionData = (triggerData) => { | ||
18 | timeUnit, | 18 | timeUnit, |
19 | replaceValue, | 19 | replaceValue, |
20 | deviceProfileId, | 20 | deviceProfileId, |
21 | + deviceType, | ||
21 | } = triggerData; | 22 | } = triggerData; |
22 | const mapPredicate = predicate?.map((item) => { | 23 | const mapPredicate = predicate?.map((item) => { |
23 | return { | 24 | return { |
@@ -45,6 +46,7 @@ export const genTriggerOrConditionData = (triggerData) => { | @@ -45,6 +46,7 @@ export const genTriggerOrConditionData = (triggerData) => { | ||
45 | triggerType, | 46 | triggerType, |
46 | entityType: device, | 47 | entityType: device, |
47 | entityId: entityId?.length ? entityId : null, | 48 | entityId: entityId?.length ? entityId : null, |
49 | + deviceType, | ||
48 | triggerCondition: { | 50 | triggerCondition: { |
49 | alarmDetails: detail, | 51 | alarmDetails: detail, |
50 | condition: { | 52 | condition: { |
@@ -83,6 +85,7 @@ export const genActionData = (actionData) => { | @@ -83,6 +85,7 @@ export const genActionData = (actionData) => { | ||
83 | callType, | 85 | callType, |
84 | service, | 86 | service, |
85 | thingsModelId, | 87 | thingsModelId, |
88 | + deviceType, | ||
86 | } = actionData; | 89 | } = actionData; |
87 | const clearRule = clearRules.map((item) => { | 90 | const clearRule = clearRules.map((item) => { |
88 | const mapPredicate = item.predicate.map((pred) => { | 91 | const mapPredicate = item.predicate.map((pred) => { |
@@ -117,6 +120,7 @@ export const genActionData = (actionData) => { | @@ -117,6 +120,7 @@ export const genActionData = (actionData) => { | ||
117 | triggerType: item.triggerType, | 120 | triggerType: item.triggerType, |
118 | entityType: item.device, | 121 | entityType: item.device, |
119 | entityId: item.device === 'PART' ? item.entityId : null, | 122 | entityId: item.device === 'PART' ? item.entityId : null, |
123 | + deviceType, | ||
120 | deviceProfileId: item.deviceProfileId, | 124 | deviceProfileId: item.deviceProfileId, |
121 | triggerCondition: { | 125 | triggerCondition: { |
122 | alarmDetails: item.detail, | 126 | alarmDetails: item.detail, |
@@ -138,6 +142,7 @@ export const genActionData = (actionData) => { | @@ -138,6 +142,7 @@ export const genActionData = (actionData) => { | ||
138 | { | 142 | { |
139 | alarmProfileId: alarm_config, | 143 | alarmProfileId: alarm_config, |
140 | outTarget, | 144 | outTarget, |
145 | + deviceType, | ||
141 | entityType: device ?? 'ALL', | 146 | entityType: device ?? 'ALL', |
142 | deviceId: device === 'PART' ? deviceId : null, | 147 | deviceId: device === 'PART' ? deviceId : null, |
143 | deviceProfileId, | 148 | deviceProfileId, |