Commit 5f90559623e467eed39cabcae03fc1fddfaa7c71
1 parent
dba305be
fix:场景联动-触发器和执行条件的获取设备接口,改回之前的,解决设备id回显问题
Showing
3 changed files
with
33 additions
and
8 deletions
... | ... | @@ -17,7 +17,7 @@ enum ScreenManagerApi { |
17 | 17 | SCREEN_UPDATE_URL = '/sceneLinkage/update', |
18 | 18 | SCREEN_ORGANIZATION_URL = '/organization/me/list', |
19 | 19 | SCREEN_CHANGE_STATUS = '/convert/update/scene', |
20 | - SCREEN_GET_BY_DEPTID = '/sceneLinkage/device', | |
20 | + SCREEN_GET_BY_DEPTID = '/sceneLinkage/device/', | |
21 | 21 | GET_ATTRBUTELIST = '/device/keys', |
22 | 22 | ALARM_PROFILE = '/alarm/profile/', |
23 | 23 | MASTER_GET_DEVICE = '/device/list/master', | ... | ... |
... | ... | @@ -96,7 +96,7 @@ |
96 | 96 | import { useMessage } from '/@/hooks/web/useMessage'; |
97 | 97 | import { |
98 | 98 | screenLinkPageAddApi, |
99 | - // screenLinkPageByDeptIdGetDevice, | |
99 | + screenLinkPageByDeptIdGetDevice, | |
100 | 100 | getOrganizationAlarmConfig, |
101 | 101 | byOganizationIdGetMasterDevice, |
102 | 102 | getAttribute, |
... | ... | @@ -125,6 +125,7 @@ |
125 | 125 | let getConditionFormValue = ref([]); |
126 | 126 | let getActionFormValue = ref([]); |
127 | 127 | const editEntryIdData = ref([]); |
128 | + const editEntryIdExcludeDoActionData = ref([]); | |
128 | 129 | let editAttrIdData = []; |
129 | 130 | const editAlarmConfigData = ref([]); |
130 | 131 | const isUpdate = ref(false); |
... | ... | @@ -160,6 +161,7 @@ |
160 | 161 | provideOrgid.value = organizationId; |
161 | 162 | // 获取当前组织下的设备列表 |
162 | 163 | const options = await byOganizationIdGetMasterDevice(organizationId); |
164 | + const optionsExcludeDoAction = await screenLinkPageByDeptIdGetDevice({ organizationId }); | |
163 | 165 | // 获取当前组织下的告警配置 |
164 | 166 | const alarmConfig = await getOrganizationAlarmConfig({ organizationId }); |
165 | 167 | // 获取当前组织下的属性列表 |
... | ... | @@ -179,6 +181,12 @@ |
179 | 181 | label: item.name, |
180 | 182 | }; |
181 | 183 | }); |
184 | + editEntryIdExcludeDoActionData.value = optionsExcludeDoAction.items.map((item) => { | |
185 | + return { | |
186 | + value: item.tbDeviceId, | |
187 | + label: item.name, | |
188 | + }; | |
189 | + }); | |
182 | 190 | editAlarmConfigData.value = alarmConfig.map((item) => { |
183 | 191 | return { |
184 | 192 | value: item.id, |
... | ... | @@ -189,8 +197,8 @@ |
189 | 197 | //回显属性列表 |
190 | 198 | editAttrIdData = attrList; |
191 | 199 | nextTick(() => { |
192 | - setEditFields(skipUnwrap.triggerItemRefs, editEntryIdData); | |
193 | - setEditFields(skipUnwrap.conditionItemRefs, editEntryIdData); | |
200 | + setEditFields(skipUnwrap.triggerItemRefs, editEntryIdExcludeDoActionData); | |
201 | + setEditFields(skipUnwrap.conditionItemRefs, editEntryIdExcludeDoActionData); | |
194 | 202 | setEditFields(skipUnwrap.actionItemRefs, editEntryIdData); |
195 | 203 | setEditAlarmConfig(skipUnwrap.actionItemRefs, editAlarmConfigData); |
196 | 204 | setEditAttr(skipUnwrap.triggerItemRefs, editAttrIdData); |
... | ... | @@ -482,7 +490,11 @@ |
482 | 490 | // 设置设备的options |
483 | 491 | const setEditFields = (linkAge, deviceList) => { |
484 | 492 | unref(linkAge).map((item) => { |
485 | - item.updateFieldDeviceId(deviceList); | |
493 | + if (item.isTriggerAndConditionFlag == 'isTriggerAndConditionFlag') { | |
494 | + item.updateExcludeActionFieldDeviceId(deviceList); | |
495 | + } else { | |
496 | + item.updateFieldDeviceId(deviceList); | |
497 | + } | |
486 | 498 | }); |
487 | 499 | }; |
488 | 500 | // 设置告警配置options |
... | ... | @@ -502,10 +514,16 @@ |
502 | 514 | const deviceList = ref([]); |
503 | 515 | const alarmConfigList = ref([]); |
504 | 516 | let watchAttrList = []; |
517 | + const deviceExcludeDoAction = ref([]); | |
505 | 518 | watch(organizationId, async (newValue: string) => { |
506 | 519 | if (!newValue) return; |
507 | 520 | provideOrgid.value = newValue; |
508 | 521 | const items = await byOganizationIdGetMasterDevice(newValue); |
522 | + const itemExcludeDoAction = await screenLinkPageByDeptIdGetDevice({ organizationId: newValue }); | |
523 | + deviceExcludeDoAction.value = itemExcludeDoAction.items.map((item) => ({ | |
524 | + label: item.name, | |
525 | + value: item.tbDeviceId, | |
526 | + })); | |
509 | 527 | deviceList.value = items.map((item) => ({ label: item.name, value: item.id })); |
510 | 528 | watchAttrList = await getAttribute(newValue, null); |
511 | 529 | setFields(skipUnwrap.triggerItemRefs, true); |
... | ... | @@ -520,7 +538,12 @@ |
520 | 538 | function setFields(linkAge, isOrganizationChange = false) { |
521 | 539 | unref(linkAge).map((item) => { |
522 | 540 | isOrganizationChange && item.resetFieldsValueFunc(); |
523 | - item.updateFieldDeviceId(deviceList); | |
541 | + console.log(item); | |
542 | + if (item.isTriggerAndConditionFlag == 'isTriggerAndConditionFlag') { | |
543 | + item.updateExcludeActionFieldDeviceId(deviceExcludeDoAction); | |
544 | + } else { | |
545 | + item.updateFieldDeviceId(deviceList); | |
546 | + } | |
524 | 547 | // item.updateFieldAttr(watchAttrList); |
525 | 548 | }); |
526 | 549 | } | ... | ... |
... | ... | @@ -98,7 +98,7 @@ |
98 | 98 | ); |
99 | 99 | return { ...getFieldsValue(), predicate, schedule: alarmScheduleRef.value.scheduleData }; |
100 | 100 | }; |
101 | - const updateFieldDeviceId = (deviceList: any[]) => { | |
101 | + const updateExcludeActionFieldDeviceId = (deviceList: any[]) => { | |
102 | 102 | updateSchema({ |
103 | 103 | field: 'entityId', |
104 | 104 | componentProps: { |
... | ... | @@ -195,9 +195,11 @@ |
195 | 195 | currentIndex.value = index; |
196 | 196 | }; |
197 | 197 | const scheduleData = ref(null); |
198 | + const isTriggerAndConditionFlag = 'isTriggerAndConditionFlag'; | |
198 | 199 | defineExpose({ |
200 | + isTriggerAndConditionFlag, | |
199 | 201 | getFieldsValueFunc, |
200 | - updateFieldDeviceId, | |
202 | + updateExcludeActionFieldDeviceId, | |
201 | 203 | updateFieldAttr, |
202 | 204 | resetFieldsValueFunc, |
203 | 205 | setFieldsFormValueFun, | ... | ... |