feat: 暂时屏蔽告警配置绑定场景联动新逻辑
This commit is contained in:
parent
1c50005161
commit
e40af1855b
|
@ -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);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 保存关联场景
|
* 保存关联场景
|
||||||
|
|
|
@ -9,13 +9,13 @@
|
||||||
@ok="saveCorrelation"
|
@ok="saveCorrelation"
|
||||||
:maskClosable="false"
|
:maskClosable="false"
|
||||||
>
|
>
|
||||||
<div v-if="type !== 'other'" style="padding: 0 24px">
|
<!-- <div v-if="type !== 'other'" style="padding: 0 24px">
|
||||||
<j-steps :current="current" >
|
<j-steps :current="current" >
|
||||||
<j-step title="选择场景"></j-step>
|
<j-step title="选择场景"></j-step>
|
||||||
<j-step title="选择条件"></j-step>
|
<j-step title="选择条件"></j-step>
|
||||||
</j-steps>
|
</j-steps>
|
||||||
</div>
|
</div> -->
|
||||||
<template v-if="current === 0 || type === 'other' ">
|
<!-- <template v-if="current === 0 || type === 'other' "> -->
|
||||||
<pro-search :columns="columns" type="simple" @search="handleSearch"/>
|
<pro-search :columns="columns" type="simple" @search="handleSearch"/>
|
||||||
<div style="height: 500px; overflow-y: auto">
|
<div style="height: 500px; overflow-y: auto">
|
||||||
<JProTable
|
<JProTable
|
||||||
|
@ -86,8 +86,8 @@
|
||||||
</template>
|
</template>
|
||||||
</JProTable>
|
</JProTable>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
<!-- </template> -->
|
||||||
<template v-if="current === 1">
|
<!-- <template v-if="current === 1">
|
||||||
<div class="branch-terms-items">
|
<div class="branch-terms-items">
|
||||||
<j-tree
|
<j-tree
|
||||||
v-if="branchGroup.length"
|
v-if="branchGroup.length"
|
||||||
|
@ -97,7 +97,7 @@
|
||||||
@check="branchCheck"
|
@check="branchCheck"
|
||||||
>
|
>
|
||||||
|
|
||||||
</j-tree>
|
</j-tree> -->
|
||||||
<!-- <CardBox-->
|
<!-- <CardBox-->
|
||||||
<!-- v-for="(item, index) in branchGroup.branches"-->
|
<!-- v-for="(item, index) in branchGroup.branches"-->
|
||||||
<!-- :showStatus="false"-->
|
<!-- :showStatus="false"-->
|
||||||
|
@ -124,14 +124,14 @@
|
||||||
<!-- </div>-->
|
<!-- </div>-->
|
||||||
<!-- </template>-->
|
<!-- </template>-->
|
||||||
<!-- </CardBox>-->
|
<!-- </CardBox>-->
|
||||||
</div>
|
<!-- </div>
|
||||||
</template>
|
</template>
|
||||||
<template #footer>
|
<template #footer>
|
||||||
<j-button v-if="current === 0" @click="closeModal">取消</j-button>
|
<j-button v-if="current === 0" @click="closeModal">取消</j-button>
|
||||||
<j-button v-if="current === 0" type="primary" @click="next">下一步</j-button>
|
<j-button v-if="current === 0" type="primary" @click="next">下一步</j-button>
|
||||||
<j-button v-if="current === 1" @click="prev">上一步</j-button>
|
<j-button v-if="current === 1" @click="prev">上一步</j-button>
|
||||||
<j-button v-if="current === 1" type="primary" @click="saveCorrelation">完成</j-button>
|
<j-button v-if="current === 1" type="primary" @click="saveCorrelation">完成</j-button>
|
||||||
</template>
|
</template> -->
|
||||||
</j-modal>
|
</j-modal>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
@ -231,21 +231,40 @@ const props = defineProps({
|
||||||
type: String,
|
type: String,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
// 告警改造后的逻辑,后端没有接口暂时屏蔽
|
||||||
|
// const current = ref(0)
|
||||||
|
// const branchGroup = ref<any[]>([])
|
||||||
|
// const branchActiveKey = ref([])
|
||||||
|
// const branchCheckKeys = ref([])
|
||||||
|
|
||||||
const current = ref(0)
|
// const terms = [
|
||||||
const branchGroup = ref<any[]>([])
|
// {
|
||||||
const branchActiveKey = ref([])
|
// terms: [
|
||||||
const branchCheckKeys = ref([])
|
|
||||||
|
|
||||||
const terms = [
|
|
||||||
{
|
|
||||||
terms: [
|
|
||||||
// {
|
// {
|
||||||
// column: 'id',
|
// column: 'id',
|
||||||
// termType: 'alarm-bind-rule$not',
|
// termType: 'alarm-bind-rule$not',
|
||||||
// value: props.id,
|
// value: props.id,
|
||||||
// type: 'and',
|
// 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',
|
column: 'triggerType',
|
||||||
termType: 'eq',
|
termType: 'eq',
|
||||||
|
@ -292,68 +311,86 @@ const onSelectChange = (arr: any[]) => {
|
||||||
_selectedRowKeys.value = arr
|
_selectedRowKeys.value = arr
|
||||||
};
|
};
|
||||||
|
|
||||||
const branchClick = (id: string) => {
|
// const branchClick = (id: string) => {
|
||||||
const keys = new Set(branchActiveKey.value)
|
// const keys = new Set(branchActiveKey.value)
|
||||||
|
|
||||||
|
|
||||||
}
|
// }
|
||||||
|
|
||||||
const handleSearch = (e: any) => {
|
const handleSearch = (e: any) => {
|
||||||
params.value = e;
|
params.value = e;
|
||||||
};
|
};
|
||||||
const emit = defineEmits(['closeSave', 'saveScene']);
|
const emit = defineEmits(['closeSave', 'saveScene']);
|
||||||
|
|
||||||
const next = () => {
|
// const next = () => {
|
||||||
if (_selectedRowKeys.value.length) {
|
// if (_selectedRowKeys.value.length) {
|
||||||
query({
|
// query({
|
||||||
pageSize: 99,
|
// pageSize: 99,
|
||||||
terms: [{column: 'id', termType: 'in', value: _selectedRowKeys.value.join(',')}]
|
// terms: [{column: 'id', termType: 'in', value: _selectedRowKeys.value.join(',')}]
|
||||||
}).then(res => {
|
// }).then(res => {
|
||||||
if (res.success) {
|
// if (res.success) {
|
||||||
branchGroup.value = handleSceneBranches(res.result.data) || []
|
// branchGroup.value = handleSceneBranches(res.result.data) || []
|
||||||
|
|
||||||
console.log(branchGroup.value)
|
// console.log(branchGroup.value)
|
||||||
}
|
// }
|
||||||
})
|
// })
|
||||||
current.value += 1
|
// current.value += 1
|
||||||
|
|
||||||
} else {
|
// } else {
|
||||||
onlyMessage('请选择场景', 'warning')
|
// onlyMessage('请选择场景', 'warning')
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
|
||||||
const branchCheck = (checkedKeys: string[], { checkedNodes }) => {
|
// const branchCheck = (checkedKeys: string[], { checkedNodes }) => {
|
||||||
branchCheckKeys.value = checkedNodes.filter(item => item.branchId).map(item => ({
|
// branchCheckKeys.value = checkedNodes.filter(item => item.branchId).map(item => ({
|
||||||
branchIndex: item.branchId,
|
// branchIndex: item.branchId,
|
||||||
ruleId: item.sceneId,
|
// ruleId: item.sceneId,
|
||||||
alarmId: props.id,
|
// alarmId: props.id,
|
||||||
}))
|
// }))
|
||||||
}
|
// }
|
||||||
|
|
||||||
const prev = () => {
|
// const prev = () => {
|
||||||
current.value -= 1
|
// 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 () => {
|
const saveCorrelation = async () => {
|
||||||
if (_selectedRowKeys.value.length === 0 && branchCheckKeys.value.length === 0) {
|
if (_selectedRowKeys.value.length > 0) {
|
||||||
onlyMessage('请选择至少一条数据', 'error')
|
const list = _selectedRowKeys.value.map((item: any) => {
|
||||||
return
|
return {
|
||||||
}
|
alarmId: props.id,
|
||||||
|
ruleId: item,
|
||||||
const list = props.type === 'other' ? _selectedRowKeys.value.map((item: any) => {
|
};
|
||||||
return {
|
});
|
||||||
alarmId: props.id,
|
const res = await bindScene([...list]);
|
||||||
ruleId: item,
|
if (res.status === 200) {
|
||||||
};
|
onlyMessage('操作成功');
|
||||||
}) : branchCheckKeys.value
|
emit('saveScene');
|
||||||
|
}
|
||||||
const res = await bindScene([...list]);
|
} else {
|
||||||
if (res.status === 200) {
|
onlyMessage('请选择至少一条数据', 'error');
|
||||||
onlyMessage('操作成功');
|
}
|
||||||
emit('saveScene');
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
const closeModal = () => {
|
const closeModal = () => {
|
||||||
emit('closeSave');
|
emit('closeSave');
|
||||||
|
|
|
@ -100,7 +100,7 @@
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import { queryBranch} from '@/api/rule-engine/scene';
|
import { queryBranch , query} from '@/api/rule-engine/scene';
|
||||||
import { unbindScene } from '@/api/rule-engine/configuration';
|
import { unbindScene } from '@/api/rule-engine/configuration';
|
||||||
import { useRoute } from 'vue-router';
|
import { useRoute } from 'vue-router';
|
||||||
import type { ActionsType } from '@/components/Table';
|
import type { ActionsType } from '@/components/Table';
|
||||||
|
@ -159,7 +159,8 @@ const getActions = (
|
||||||
popConfirm: {
|
popConfirm: {
|
||||||
title: '确定解绑?',
|
title: '确定解绑?',
|
||||||
onConfirm: async () => {
|
onConfirm: async () => {
|
||||||
const res = await unbindScene(id, [data.id], data.branchIndex);
|
// const res = await unbindScene(id, [data.id], data.branchIndex);
|
||||||
|
const res = await unbindScene(id, [data.id]);
|
||||||
if (res.status === 200) {
|
if (res.status === 200) {
|
||||||
onlyMessage('操作成功');
|
onlyMessage('操作成功');
|
||||||
actionRef.value.reload();
|
actionRef.value.reload();
|
||||||
|
@ -172,7 +173,7 @@ const getActions = (
|
||||||
};
|
};
|
||||||
|
|
||||||
const queryTable = (_terms: any) => {
|
const queryTable = (_terms: any) => {
|
||||||
return queryBranch(_terms, id)
|
return query(_terms, id)
|
||||||
}
|
}
|
||||||
|
|
||||||
const visible = ref(false);
|
const visible = ref(false);
|
||||||
|
|
Loading…
Reference in New Issue