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