|
@@ -21,6 +21,7 @@ |
|
@@ -21,6 +21,7 @@ |
21
|
class="mt-4"
|
21
|
class="mt-4"
|
22
|
title="触发器"
|
22
|
title="触发器"
|
23
|
:index="index"
|
23
|
:index="index"
|
|
|
24
|
+ :provideOrgid="provideOrgid"
|
24
|
:ref="skipUnwrap.triggerItemRefs"
|
25
|
:ref="skipUnwrap.triggerItemRefs"
|
25
|
@delete="deleteTriggerOrCondition"
|
26
|
@delete="deleteTriggerOrCondition"
|
26
|
/>
|
27
|
/>
|
|
@@ -42,6 +43,7 @@ |
|
@@ -42,6 +43,7 @@ |
42
|
class="mt-4"
|
43
|
class="mt-4"
|
43
|
title="执行条件"
|
44
|
title="执行条件"
|
44
|
:index="index"
|
45
|
:index="index"
|
|
|
46
|
+ :provideOrgid="provideOrgid"
|
45
|
:ref="skipUnwrap.conditionItemRefs"
|
47
|
:ref="skipUnwrap.conditionItemRefs"
|
46
|
@delete="deleteTriggerOrCondition"
|
48
|
@delete="deleteTriggerOrCondition"
|
47
|
/>
|
49
|
/>
|
|
@@ -94,8 +96,10 @@ |
|
@@ -94,8 +96,10 @@ |
94
|
import { useMessage } from '/@/hooks/web/useMessage';
|
96
|
import { useMessage } from '/@/hooks/web/useMessage';
|
95
|
import {
|
97
|
import {
|
96
|
screenLinkPageAddApi,
|
98
|
screenLinkPageAddApi,
|
97
|
- screenLinkPageByDeptIdGetDevice,
|
99
|
+ // screenLinkPageByDeptIdGetDevice,
|
98
|
getOrganizationAlarmConfig,
|
100
|
getOrganizationAlarmConfig,
|
|
|
101
|
+ byOganizationIdGetMasterDevice,
|
|
|
102
|
+ getAttribute,
|
99
|
} from '/@/api/ruleengine/ruleengineApi';
|
103
|
} from '/@/api/ruleengine/ruleengineApi';
|
100
|
import TriggerOrCondition from './cpns/Trigger-Condition.vue';
|
104
|
import TriggerOrCondition from './cpns/Trigger-Condition.vue';
|
101
|
import Action from './cpns/Action.vue';
|
105
|
import Action from './cpns/Action.vue';
|
|
@@ -104,6 +108,7 @@ |
|
@@ -104,6 +108,7 @@ |
104
|
|
108
|
|
105
|
const emit = defineEmits(['register', 'success']);
|
109
|
const emit = defineEmits(['register', 'success']);
|
106
|
|
110
|
|
|
|
111
|
+ const provideOrgid = ref('');
|
107
|
const { createMessage } = useMessage();
|
112
|
const { createMessage } = useMessage();
|
108
|
const triggerData = ref([]);
|
113
|
const triggerData = ref([]);
|
109
|
const conditionData = ref([]);
|
114
|
const conditionData = ref([]);
|
|
@@ -120,6 +125,7 @@ |
|
@@ -120,6 +125,7 @@ |
120
|
let getConditionFormValue = ref([]);
|
125
|
let getConditionFormValue = ref([]);
|
121
|
let getActionFormValue = ref([]);
|
126
|
let getActionFormValue = ref([]);
|
122
|
const editEntryIdData = ref([]);
|
127
|
const editEntryIdData = ref([]);
|
|
|
128
|
+ let editAttrIdData = [];
|
123
|
const editAlarmConfigData = ref([]);
|
129
|
const editAlarmConfigData = ref([]);
|
124
|
const isUpdate = ref(false);
|
130
|
const isUpdate = ref(false);
|
125
|
const id = ref(undefined);
|
131
|
const id = ref(undefined);
|
|
@@ -151,21 +157,25 @@ |
|
@@ -151,21 +157,25 @@ |
151
|
await setFieldsValue(data.record);
|
157
|
await setFieldsValue(data.record);
|
152
|
id.value = recordId;
|
158
|
id.value = recordId;
|
153
|
tenantId.value = recordTenantId;
|
159
|
tenantId.value = recordTenantId;
|
|
|
160
|
+ provideOrgid.value = organizationId;
|
154
|
// 获取当前组织下的设备列表
|
161
|
// 获取当前组织下的设备列表
|
155
|
- const options = await screenLinkPageByDeptIdGetDevice({
|
|
|
156
|
- organizationId,
|
|
|
157
|
- });
|
162
|
+ const options = await byOganizationIdGetMasterDevice(organizationId);
|
158
|
// 获取当前组织下的告警配置
|
163
|
// 获取当前组织下的告警配置
|
159
|
const alarmConfig = await getOrganizationAlarmConfig({ organizationId });
|
164
|
const alarmConfig = await getOrganizationAlarmConfig({ organizationId });
|
|
|
165
|
+ // 获取当前组织下的属性列表
|
|
|
166
|
+ const attrList = await getAttribute(
|
|
|
167
|
+ organizationId,
|
|
|
168
|
+ triggers.map((m) => m.entityId).join(',')
|
|
|
169
|
+ );
|
160
|
|
170
|
|
161
|
// 生成回显时对应得组件数量
|
171
|
// 生成回显时对应得组件数量
|
162
|
triggerData.value = [...new Array(triggers.length).keys()];
|
172
|
triggerData.value = [...new Array(triggers.length).keys()];
|
163
|
conditionData.value = [...new Array(doConditions.length).keys()];
|
173
|
conditionData.value = [...new Array(doConditions.length).keys()];
|
164
|
actionData.value = [...new Array(doActions.length).keys()];
|
174
|
actionData.value = [...new Array(doActions.length).keys()];
|
165
|
// 回显设备列表
|
175
|
// 回显设备列表
|
166
|
- editEntryIdData.value = options.items.map((item) => {
|
176
|
+ editEntryIdData.value = options.map((item) => {
|
167
|
return {
|
177
|
return {
|
168
|
- value: item.tbDeviceId,
|
178
|
+ value: item.id,
|
169
|
label: item.name,
|
179
|
label: item.name,
|
170
|
};
|
180
|
};
|
171
|
});
|
181
|
});
|
|
@@ -176,11 +186,15 @@ |
|
@@ -176,11 +186,15 @@ |
176
|
};
|
186
|
};
|
177
|
});
|
187
|
});
|
178
|
deviceList.value = editEntryIdData.value;
|
188
|
deviceList.value = editEntryIdData.value;
|
|
|
189
|
+ //回显属性列表
|
|
|
190
|
+ editAttrIdData = attrList;
|
179
|
nextTick(() => {
|
191
|
nextTick(() => {
|
180
|
setEditFields(skipUnwrap.triggerItemRefs, editEntryIdData);
|
192
|
setEditFields(skipUnwrap.triggerItemRefs, editEntryIdData);
|
181
|
setEditFields(skipUnwrap.conditionItemRefs, editEntryIdData);
|
193
|
setEditFields(skipUnwrap.conditionItemRefs, editEntryIdData);
|
182
|
setEditFields(skipUnwrap.actionItemRefs, editEntryIdData);
|
194
|
setEditFields(skipUnwrap.actionItemRefs, editEntryIdData);
|
183
|
setEditAlarmConfig(skipUnwrap.actionItemRefs, editAlarmConfigData);
|
195
|
setEditAlarmConfig(skipUnwrap.actionItemRefs, editAlarmConfigData);
|
|
|
196
|
+ setEditAttr(skipUnwrap.triggerItemRefs, editAttrIdData);
|
|
|
197
|
+ setEditAttr(skipUnwrap.conditionItemRefs, editAttrIdData);
|
184
|
});
|
198
|
});
|
185
|
|
199
|
|
186
|
const map = {
|
200
|
const map = {
|
|
@@ -198,12 +212,15 @@ |
|
@@ -198,12 +212,15 @@ |
198
|
unref(skipUnwrap.triggerItemRefs)[index].isUpdate = true;
|
212
|
unref(skipUnwrap.triggerItemRefs)[index].isUpdate = true;
|
199
|
unref(skipUnwrap.triggerItemRefs)[index].alarmScheduleRef.scheduleData =
|
213
|
unref(skipUnwrap.triggerItemRefs)[index].alarmScheduleRef.scheduleData =
|
200
|
trigger.triggerCondition.schedule;
|
214
|
trigger.triggerCondition.schedule;
|
|
|
215
|
+ const getAttrKeyOption = trigger?.triggerCondition?.condition?.condition.map(
|
|
|
216
|
+ (m) => m.key.key
|
|
|
217
|
+ );
|
201
|
unref(skipUnwrap.triggerItemRefs)[index].setFieldsFormValueFun({
|
218
|
unref(skipUnwrap.triggerItemRefs)[index].setFieldsFormValueFun({
|
202
|
triggered: trigger?.triggerCondition?.condition?.spec?.type,
|
219
|
triggered: trigger?.triggerCondition?.condition?.spec?.type,
|
203
|
device: trigger?.entityType,
|
220
|
device: trigger?.entityType,
|
204
|
triggerType: trigger?.triggerType,
|
221
|
triggerType: trigger?.triggerType,
|
205
|
type1: trigger?.triggerCondition?.condition?.condition[0]?.key?.type,
|
222
|
type1: trigger?.triggerCondition?.condition?.condition[0]?.key?.type,
|
206
|
- type2: trigger?.triggerCondition?.condition?.condition[0]?.key?.key,
|
223
|
+ type2: getAttrKeyOption,
|
207
|
operationType: trigger?.triggerCondition?.condition?.condition[0]?.valueType,
|
224
|
operationType: trigger?.triggerCondition?.condition?.condition[0]?.valueType,
|
208
|
detail: trigger?.triggerCondition?.alarmDetails,
|
225
|
detail: trigger?.triggerCondition?.alarmDetails,
|
209
|
entityId: trigger?.entityId,
|
226
|
entityId: trigger?.entityId,
|
|
@@ -270,12 +287,15 @@ |
|
@@ -270,12 +287,15 @@ |
270
|
unref(skipUnwrap.conditionItemRefs)[index].isUpdate = true;
|
287
|
unref(skipUnwrap.conditionItemRefs)[index].isUpdate = true;
|
271
|
unref(skipUnwrap.conditionItemRefs)[index].alarmScheduleRef.scheduleData =
|
288
|
unref(skipUnwrap.conditionItemRefs)[index].alarmScheduleRef.scheduleData =
|
272
|
condition.triggerCondition.schedule;
|
289
|
condition.triggerCondition.schedule;
|
|
|
290
|
+ const getAttrKeyOption = condition?.triggerCondition?.condition?.condition.map(
|
|
|
291
|
+ (m) => m.key.key
|
|
|
292
|
+ );
|
273
|
unref(skipUnwrap.conditionItemRefs)[index].setFieldsFormValueFun({
|
293
|
unref(skipUnwrap.conditionItemRefs)[index].setFieldsFormValueFun({
|
274
|
triggered: condition?.triggerCondition?.condition?.spec?.type,
|
294
|
triggered: condition?.triggerCondition?.condition?.spec?.type,
|
275
|
device: condition?.entityType,
|
295
|
device: condition?.entityType,
|
276
|
triggerType: condition?.triggerType,
|
296
|
triggerType: condition?.triggerType,
|
277
|
type1: condition?.triggerCondition?.condition?.condition[0]?.key?.type,
|
297
|
type1: condition?.triggerCondition?.condition?.condition[0]?.key?.type,
|
278
|
- type2: condition?.triggerCondition?.condition?.condition[0]?.key?.key,
|
298
|
+ type2: getAttrKeyOption,
|
279
|
operationType: condition?.triggerCondition?.condition?.condition[0]?.valueType,
|
299
|
operationType: condition?.triggerCondition?.condition?.condition[0]?.valueType,
|
280
|
detail: condition?.triggerCondition?.alarmDetails,
|
300
|
detail: condition?.triggerCondition?.alarmDetails,
|
281
|
entityId: condition?.entityId,
|
301
|
entityId: condition?.entityId,
|
|
@@ -471,17 +491,26 @@ |
|
@@ -471,17 +491,26 @@ |
471
|
item.updateEditFieldAlarmConfig(alarmConfigList);
|
491
|
item.updateEditFieldAlarmConfig(alarmConfigList);
|
472
|
});
|
492
|
});
|
473
|
};
|
493
|
};
|
|
|
494
|
+ //设置设备属性的options
|
|
|
495
|
+ const setEditAttr = (linkAge, attrList) => {
|
|
|
496
|
+ unref(linkAge).map((item) => {
|
|
|
497
|
+ item.updateFieldAttr(attrList);
|
|
|
498
|
+ });
|
|
|
499
|
+ };
|
|
|
500
|
+
|
474
|
// 监听组织变化更新设备列表
|
501
|
// 监听组织变化更新设备列表
|
475
|
const deviceList = ref([]);
|
502
|
const deviceList = ref([]);
|
476
|
const alarmConfigList = ref([]);
|
503
|
const alarmConfigList = ref([]);
|
|
|
504
|
+ let watchAttrList = [];
|
477
|
watch(organizationId, async (newValue: string) => {
|
505
|
watch(organizationId, async (newValue: string) => {
|
478
|
if (!newValue) return;
|
506
|
if (!newValue) return;
|
479
|
- const { items } = await screenLinkPageByDeptIdGetDevice({ organizationId: newValue });
|
|
|
480
|
- deviceList.value = items.map((item) => ({ label: item.name, value: item.tbDeviceId }));
|
507
|
+ provideOrgid.value = newValue;
|
|
|
508
|
+ const items = await byOganizationIdGetMasterDevice(newValue);
|
|
|
509
|
+ deviceList.value = items.map((item) => ({ label: item.name, value: item.id }));
|
|
|
510
|
+ watchAttrList = await getAttribute(newValue, null);
|
481
|
setFields(skipUnwrap.triggerItemRefs, true);
|
511
|
setFields(skipUnwrap.triggerItemRefs, true);
|
482
|
setFields(skipUnwrap.conditionItemRefs, true);
|
512
|
setFields(skipUnwrap.conditionItemRefs, true);
|
483
|
setFields(skipUnwrap.actionItemRefs, true);
|
513
|
setFields(skipUnwrap.actionItemRefs, true);
|
484
|
-
|
|
|
485
|
const data = await getOrganizationAlarmConfig({ organizationId: newValue });
|
514
|
const data = await getOrganizationAlarmConfig({ organizationId: newValue });
|
486
|
alarmConfigList.value = data.map((item) => ({ label: item.name, value: item.id }));
|
515
|
alarmConfigList.value = data.map((item) => ({ label: item.name, value: item.id }));
|
487
|
setAlarmConfig(skipUnwrap.actionItemRefs, true);
|
516
|
setAlarmConfig(skipUnwrap.actionItemRefs, true);
|
|
@@ -492,6 +521,7 @@ |
|
@@ -492,6 +521,7 @@ |
492
|
unref(linkAge).map((item) => {
|
521
|
unref(linkAge).map((item) => {
|
493
|
isOrganizationChange && item.resetFieldsValueFunc();
|
522
|
isOrganizationChange && item.resetFieldsValueFunc();
|
494
|
item.updateFieldDeviceId(deviceList);
|
523
|
item.updateFieldDeviceId(deviceList);
|
|
|
524
|
+ item.updateFieldAttr(watchAttrList);
|
495
|
});
|
525
|
});
|
496
|
}
|
526
|
}
|
497
|
function setAlarmConfig(linkAge, isOrganizationChange = false) {
|
527
|
function setAlarmConfig(linkAge, isOrganizationChange = false) {
|
|
@@ -602,3 +632,10 @@ |
|
@@ -602,3 +632,10 @@ |
602
|
});
|
632
|
});
|
603
|
};
|
633
|
};
|
604
|
</script>
|
634
|
</script>
|
|
|
635
|
+
|
|
|
636
|
+<style lang="less" scoped>
|
|
|
637
|
+ ///统一下拉选择框宽度,否则超出默认宽度会造成页面样式错乱
|
|
|
638
|
+ :deep(.ant-select-selector) {
|
|
|
639
|
+ max-width: 14.2rem;
|
|
|
640
|
+ }
|
|
|
641
|
+</style> |