diff --git a/src/api/rule-engine/configuration.ts b/src/api/rule-engine/configuration.ts
index cba16632..5570a740 100644
--- a/src/api/rule-engine/configuration.ts
+++ b/src/api/rule-engine/configuration.ts
@@ -42,7 +42,9 @@ export const detail = (id:string) => server.get(`/alarm/config/${id}`);
/**
* 解除场景联动绑定
*/
-export const unbindScene = (id:string,data:any, branchId: string) => server.post(`/alarm/rule/bind/${id}/_delete?branchIndex=${branchId}`,data);
+// export const unbindScene = (id:string,data:any, branchId: string) => server.post(`/alarm/rule/bind/${id}/_delete?branchIndex=${branchId}`,data); // 新解绑接口
+
+export const unbindScene = (id:string,data:any) => server.post(`/alarm/rule/bind/${id}/_delete`,data);
/**
* 保存关联场景
diff --git a/src/views/rule-engine/Alarm/Configuration/Save/Scene/Save/index.vue b/src/views/rule-engine/Alarm/Configuration/Save/Scene/Save/index.vue
index 69d6e477..249891be 100644
--- a/src/views/rule-engine/Alarm/Configuration/Save/Scene/Save/index.vue
+++ b/src/views/rule-engine/Alarm/Configuration/Save/Scene/Save/index.vue
@@ -9,13 +9,13 @@
@ok="saveCorrelation"
:maskClosable="false"
>
-
+
+
-
-
+
+
@@ -124,14 +124,14 @@
-
+
@@ -231,21 +231,40 @@ const props = defineProps({
type: String,
},
});
+// 告警改造后的逻辑,后端没有接口暂时屏蔽
+// const current = ref(0)
+// const branchGroup = ref([])
+// const branchActiveKey = ref([])
+// const branchCheckKeys = ref([])
-const current = ref(0)
-const branchGroup = ref([])
-const branchActiveKey = ref([])
-const branchCheckKeys = ref([])
-
-const terms = [
- {
- terms: [
+// const terms = [
+// {
+// terms: [
// {
// column: 'id',
// termType: 'alarm-bind-rule$not',
// value: props.id,
// type: 'and',
// },
+// {
+// column: 'triggerType',
+// termType: 'eq',
+// value: props.type === 'other' ? undefined : 'device',
+// },
+// ],
+// type: 'and',
+// },
+// ];
+
+const terms = [
+ {
+ terms: [
+ {
+ column: 'id',
+ termType: 'alarm-bind-rule$not',
+ value: props.id,
+ type: 'and',
+ },
{
column: 'triggerType',
termType: 'eq',
@@ -292,68 +311,86 @@ const onSelectChange = (arr: any[]) => {
_selectedRowKeys.value = arr
};
-const branchClick = (id: string) => {
- const keys = new Set(branchActiveKey.value)
+// const branchClick = (id: string) => {
+// const keys = new Set(branchActiveKey.value)
-}
+// }
const handleSearch = (e: any) => {
params.value = e;
};
const emit = defineEmits(['closeSave', 'saveScene']);
-const next = () => {
- if (_selectedRowKeys.value.length) {
- query({
- pageSize: 99,
- terms: [{column: 'id', termType: 'in', value: _selectedRowKeys.value.join(',')}]
- }).then(res => {
- if (res.success) {
- branchGroup.value = handleSceneBranches(res.result.data) || []
+// const next = () => {
+// if (_selectedRowKeys.value.length) {
+// query({
+// pageSize: 99,
+// terms: [{column: 'id', termType: 'in', value: _selectedRowKeys.value.join(',')}]
+// }).then(res => {
+// if (res.success) {
+// branchGroup.value = handleSceneBranches(res.result.data) || []
- console.log(branchGroup.value)
- }
- })
- current.value += 1
+// console.log(branchGroup.value)
+// }
+// })
+// current.value += 1
- } else {
- onlyMessage('请选择场景', 'warning')
- }
-}
+// } else {
+// onlyMessage('请选择场景', 'warning')
+// }
+// }
-const branchCheck = (checkedKeys: string[], { checkedNodes }) => {
- branchCheckKeys.value = checkedNodes.filter(item => item.branchId).map(item => ({
- branchIndex: item.branchId,
- ruleId: item.sceneId,
- alarmId: props.id,
- }))
-}
+// const branchCheck = (checkedKeys: string[], { checkedNodes }) => {
+// branchCheckKeys.value = checkedNodes.filter(item => item.branchId).map(item => ({
+// branchIndex: item.branchId,
+// ruleId: item.sceneId,
+// alarmId: props.id,
+// }))
+// }
-const prev = () => {
- current.value -= 1
-}
+// const prev = () => {
+// current.value -= 1
+// }
/**
* 保存选中关联场景
*/
+// const saveCorrelation = async () => {
+// if (_selectedRowKeys.value.length === 0 && branchCheckKeys.value.length === 0) {
+// onlyMessage('请选择至少一条数据', 'error')
+// return
+// }
+
+// const list = props.type === 'other' ? _selectedRowKeys.value.map((item: any) => {
+// return {
+// alarmId: props.id,
+// ruleId: item,
+// };
+// }) : branchCheckKeys.value
+
+// const res = await bindScene([...list]);
+// if (res.status === 200) {
+// onlyMessage('操作成功');
+// emit('saveScene');
+// }
+// };
+
const saveCorrelation = async () => {
- if (_selectedRowKeys.value.length === 0 && branchCheckKeys.value.length === 0) {
- onlyMessage('请选择至少一条数据', 'error')
- return
- }
-
- const list = props.type === 'other' ? _selectedRowKeys.value.map((item: any) => {
- return {
- alarmId: props.id,
- ruleId: item,
- };
- }) : branchCheckKeys.value
-
- const res = await bindScene([...list]);
- if (res.status === 200) {
- onlyMessage('操作成功');
- emit('saveScene');
- }
+ if (_selectedRowKeys.value.length > 0) {
+ const list = _selectedRowKeys.value.map((item: any) => {
+ return {
+ alarmId: props.id,
+ ruleId: item,
+ };
+ });
+ const res = await bindScene([...list]);
+ if (res.status === 200) {
+ onlyMessage('操作成功');
+ emit('saveScene');
+ }
+ } else {
+ onlyMessage('请选择至少一条数据', 'error');
+ }
};
const closeModal = () => {
emit('closeSave');
diff --git a/src/views/rule-engine/Alarm/Configuration/Save/Scene/index.vue b/src/views/rule-engine/Alarm/Configuration/Save/Scene/index.vue
index 3561dbab..e9b4a600 100644
--- a/src/views/rule-engine/Alarm/Configuration/Save/Scene/index.vue
+++ b/src/views/rule-engine/Alarm/Configuration/Save/Scene/index.vue
@@ -100,7 +100,7 @@