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