fix: bug#16279
This commit is contained in:
parent
82a4e14963
commit
10bed5a3e0
|
@ -90,10 +90,14 @@ const route = useRoute();
|
|||
let selectDisable = ref(false);
|
||||
const alarmConfigurationStore = useAlarmConfigurationStore();
|
||||
let { configurationData } = storeToRefs(alarmConfigurationStore);
|
||||
|
||||
const emit = defineEmits(['change'])
|
||||
|
||||
const queryData = () => {
|
||||
if (route.query?.id) {
|
||||
detail(route.query?.id).then((res) => {
|
||||
if (res.status === 200) {
|
||||
emit('change', res?.result?.targetType)
|
||||
form.value = res?.result;
|
||||
// form.level = res?.result?.level;
|
||||
// form.name = res?.result?.name;
|
||||
|
@ -205,6 +209,7 @@ const handleSave = async () => {
|
|||
if (res.status === 200) {
|
||||
onlyMessage('操作成功,请配置关联的场景联动');
|
||||
loading.value = false;
|
||||
emit('change', form.value.targetType)
|
||||
if (res.result?.id) {
|
||||
menuStory.jumpPage(
|
||||
'rule-engine/Alarm/Configuration/Save',
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<template>
|
||||
<div>
|
||||
<TabComponent type="detail" :id="id"/>
|
||||
<TabComponent :id="id" :type="type"/>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
|
@ -9,6 +9,13 @@ import TabComponent from '@/views/rule-engine/Alarm/Log/TabComponent/index.vue'
|
|||
import { useRoute } from 'vue-router';
|
||||
const route = useRoute();
|
||||
const id = route.query?.id
|
||||
|
||||
const props = defineProps({
|
||||
type: {
|
||||
type: String,
|
||||
default: 'detail'
|
||||
}
|
||||
})
|
||||
</script>
|
||||
<style lang="less" scoped>
|
||||
</style>
|
|
@ -3,13 +3,13 @@
|
|||
<j-card>
|
||||
<j-tabs :activeKey="activeKey" @change="changeTabs">
|
||||
<j-tab-pane key="1" tab="基础配置">
|
||||
<Base v-if="activeKey === '1'" />
|
||||
<Base v-if="activeKey === '1'" @change="typeChange" />
|
||||
</j-tab-pane>
|
||||
<j-tab-pane key="2" tab="关联场景联动">
|
||||
<Scene></Scene>
|
||||
</j-tab-pane>
|
||||
<j-tab-pane key="3" tab="告警记录">
|
||||
<Log v-if="activeKey === '3'" />
|
||||
<Log v-if="activeKey === '3'" :type="type" />
|
||||
</j-tab-pane>
|
||||
</j-tabs>
|
||||
</j-card>
|
||||
|
@ -31,6 +31,12 @@ const changeTabs = (e: any) => {
|
|||
}
|
||||
};
|
||||
const activeKey = ref('1');
|
||||
const type = ref('detail')
|
||||
|
||||
const typeChange = (_type: string) => {
|
||||
console.log(_type)
|
||||
type.value = _type
|
||||
}
|
||||
</script>
|
||||
<style lang="less" scoped>
|
||||
</style>
|
|
@ -1,35 +1,11 @@
|
|||
<template>
|
||||
<div class="alarm-log-card">
|
||||
<pro-search
|
||||
:columns="columns"
|
||||
:columns="newColumns"
|
||||
:target="`alarm-log-${props.type}`"
|
||||
v-if="['all', 'detail'].includes(props.type)"
|
||||
@search="search"
|
||||
/>
|
||||
<pro-search
|
||||
:columns="productCol"
|
||||
:target="`alarm-log-${props.type}`"
|
||||
v-else-if="props.type === 'product'"
|
||||
@search="search"
|
||||
/>
|
||||
<pro-search
|
||||
:columns="deviceCol"
|
||||
target="alarm-log-device"
|
||||
v-else-if="props.type === 'device'"
|
||||
@search="search"
|
||||
/>
|
||||
<pro-search
|
||||
:columns="orgCol"
|
||||
target="alarm-log-org"
|
||||
v-else-if="props.type === 'org'"
|
||||
@search="search"
|
||||
/>
|
||||
<pro-search
|
||||
:columns="otherCol"
|
||||
:target="`alarm-log-${props.type}`"
|
||||
v-else-if="props.type === 'other'"
|
||||
@search="search"
|
||||
/>
|
||||
|
||||
<FullPage>
|
||||
<JProTable
|
||||
:columns="columns"
|
||||
|
@ -246,123 +222,76 @@ const columns = [
|
|||
},
|
||||
},
|
||||
];
|
||||
const productCol = [
|
||||
...columns,
|
||||
{
|
||||
title: '产品名称',
|
||||
dataIndex: 'sourceId',
|
||||
key: 'sourceId',
|
||||
search: {
|
||||
type: 'select',
|
||||
options: async () => {
|
||||
const resp = await handleSearch({
|
||||
sorts: [{ name: 'alarmTime', order: 'desc' }],
|
||||
terms: [{
|
||||
column: "targetType",
|
||||
termType: "eq",
|
||||
type: "and",
|
||||
value: "product",
|
||||
}]
|
||||
});
|
||||
if (resp.status === 200) {
|
||||
return resp.result.data.map((item: any) => ({
|
||||
label: item.sourceName,
|
||||
value: item.sourceId,
|
||||
}));
|
||||
}
|
||||
return [];
|
||||
},
|
||||
},
|
||||
},
|
||||
];
|
||||
const deviceCol = [
|
||||
...columns,
|
||||
{
|
||||
title: '设备名称',
|
||||
dataIndex: 'sourceId',
|
||||
key: 'sourceId',
|
||||
search: {
|
||||
type: 'select',
|
||||
options: async () => {
|
||||
const resp = await handleSearch({
|
||||
sorts: [{ name: 'alarmTime', order: 'desc' }],
|
||||
terms: [{
|
||||
column: "targetType",
|
||||
termType: "eq",
|
||||
type: "and",
|
||||
value: "device",
|
||||
}]
|
||||
});
|
||||
if (resp.status === 200) {
|
||||
return resp.result.data.map((item: any) => ({
|
||||
label: item.sourceName,
|
||||
value: item.sourceId,
|
||||
}));
|
||||
}
|
||||
return [];
|
||||
},
|
||||
},
|
||||
},
|
||||
];
|
||||
const orgCol = [
|
||||
...columns,
|
||||
{
|
||||
title: '组织名称',
|
||||
dataIndex: 'sourceId',
|
||||
key: 'sourceId',
|
||||
search: {
|
||||
type: 'select',
|
||||
options: async () => {
|
||||
const resp = await handleSearch({
|
||||
sorts: [{ name: 'alarmTime', order: 'desc' }],
|
||||
terms: [{
|
||||
column: "targetType",
|
||||
termType: "eq",
|
||||
type: "and",
|
||||
value: "org",
|
||||
}]
|
||||
});
|
||||
if (resp.status === 200) {
|
||||
return resp.result.data.map((item: any) => ({
|
||||
label: item.sourceName,
|
||||
value: item.sourceId,
|
||||
}));
|
||||
}
|
||||
return [];
|
||||
},
|
||||
},
|
||||
},
|
||||
];
|
||||
|
||||
const otherCol = [
|
||||
...columns,
|
||||
{
|
||||
title: '场景名称',
|
||||
const newColumns = computed(() => {
|
||||
|
||||
const otherColumns = {
|
||||
title: '产品名称',
|
||||
dataIndex: 'targetId',
|
||||
key: 'targetId',
|
||||
search: {
|
||||
type: 'select',
|
||||
options: async () => {
|
||||
const resp = await handleSearch({
|
||||
sorts: [{ name: 'alarmTime', order: 'desc' }],
|
||||
terms: [{
|
||||
const termType = [
|
||||
{
|
||||
column: "targetType",
|
||||
termType: "eq",
|
||||
type: "and",
|
||||
value: "other",
|
||||
}]
|
||||
value: props.type,
|
||||
}
|
||||
]
|
||||
|
||||
if (props.id) {
|
||||
termType.push({
|
||||
termType: 'eq',
|
||||
column: 'alarmConfigId',
|
||||
value: props.id,
|
||||
type: 'and',
|
||||
},)
|
||||
}
|
||||
|
||||
const resp: any = await handleSearch({
|
||||
sorts: [{ name: 'alarmTime', order: 'desc' }],
|
||||
terms: termType
|
||||
});
|
||||
const listMap: Map<string, any> = new Map()
|
||||
|
||||
if (resp.status === 200) {
|
||||
return resp.result.data.map((item: any) => ({
|
||||
resp.result.data.forEach(item => {
|
||||
if (item.targetId) {
|
||||
listMap.set(item.targetId, {
|
||||
label: item.targetName,
|
||||
value: item.targetId,
|
||||
}));
|
||||
})
|
||||
}
|
||||
|
||||
})
|
||||
|
||||
return [...listMap.values()]
|
||||
|
||||
}
|
||||
return [];
|
||||
},
|
||||
},
|
||||
},
|
||||
]
|
||||
}
|
||||
|
||||
switch(props.type) {
|
||||
case 'device':
|
||||
otherColumns.title = '设备名称'
|
||||
break;
|
||||
case 'org':
|
||||
otherColumns.title = '组织名称'
|
||||
break;
|
||||
case 'other':
|
||||
otherColumns.title = '场景名称'
|
||||
break;
|
||||
}
|
||||
|
||||
return ['all', 'detail'].includes(props.type) ? columns : [
|
||||
otherColumns,
|
||||
...columns,
|
||||
]
|
||||
})
|
||||
|
||||
let params: any = ref({
|
||||
sorts: [{ name: 'alarmTime', order: 'desc' }],
|
||||
|
|
Loading…
Reference in New Issue