fix: bug#11094 11099 11107
This commit is contained in:
parent
1cf71a8e8c
commit
2ee291a7f0
|
@ -5,9 +5,16 @@
|
||||||
<template #title>
|
<template #title>
|
||||||
<div style="display: flex">
|
<div style="display: flex">
|
||||||
<h3>配置信息</h3>
|
<h3>配置信息</h3>
|
||||||
<div style="margin: 0 0px 0 15px; color: #1d39c4">
|
<!-- <div style="margin: 0 0px 0 15px; color: #1d39c4">
|
||||||
<AIcon type="EditOutlined" @click="editConfig"/>
|
<AIcon type="EditOutlined" @click="editConfig" />
|
||||||
</div>
|
</div> -->
|
||||||
|
<PermissionButton
|
||||||
|
type="link"
|
||||||
|
@click="editConfig"
|
||||||
|
hasPermission="device/Product:update"
|
||||||
|
>
|
||||||
|
<template #icon><AIcon type="EditOutlined" /></template>
|
||||||
|
</PermissionButton>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
|
|
@ -44,15 +44,33 @@
|
||||||
</j-radio-group>
|
</j-radio-group>
|
||||||
</j-form-item>
|
</j-form-item>
|
||||||
<j-form-item label="说明" name="description">
|
<j-form-item label="说明" name="description">
|
||||||
<j-textarea v-model:value="form.description" showCount :maxlength="200"></j-textarea>
|
<j-textarea
|
||||||
|
v-model:value="form.description"
|
||||||
|
showCount
|
||||||
|
:maxlength="200"
|
||||||
|
></j-textarea>
|
||||||
</j-form-item>
|
</j-form-item>
|
||||||
<PermissionButton type="primary" :loading="loading" @click="handleSave" :hasPermission="['rule-engine/Alarm/Configuration:add','rule-engine/Alarm/Configuration:update']">保存</PermissionButton>
|
<PermissionButton
|
||||||
|
type="primary"
|
||||||
|
:loading="loading"
|
||||||
|
@click="handleSave"
|
||||||
|
:hasPermission="[
|
||||||
|
'rule-engine/Alarm/Configuration:add',
|
||||||
|
'rule-engine/Alarm/Configuration:update',
|
||||||
|
]"
|
||||||
|
>保存</PermissionButton
|
||||||
|
>
|
||||||
</j-form>
|
</j-form>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import { getTargetTypes, save, detail , updata} from '@/api/rule-engine/configuration';
|
import {
|
||||||
|
getTargetTypes,
|
||||||
|
save,
|
||||||
|
detail,
|
||||||
|
updata,
|
||||||
|
} from '@/api/rule-engine/configuration';
|
||||||
import { queryLevel } from '@/api/rule-engine/config';
|
import { queryLevel } from '@/api/rule-engine/config';
|
||||||
import { query } from '@/api/rule-engine/scene';
|
import { query } from '@/api/rule-engine/scene';
|
||||||
import { getImage } from '@/utils/comm';
|
import { getImage } from '@/utils/comm';
|
||||||
|
@ -63,15 +81,14 @@ import { useAlarmConfigurationStore } from '@/store/alarm';
|
||||||
import { storeToRefs } from 'pinia';
|
import { storeToRefs } from 'pinia';
|
||||||
import { usePermissionStore } from '@/store/permission';
|
import { usePermissionStore } from '@/store/permission';
|
||||||
const route = useRoute();
|
const route = useRoute();
|
||||||
const id = route.query?.id;
|
|
||||||
let selectDisable = ref(false);
|
let selectDisable = ref(false);
|
||||||
const alarmConfigurationStore = useAlarmConfigurationStore();
|
const alarmConfigurationStore = useAlarmConfigurationStore();
|
||||||
let { configurationData } = storeToRefs(alarmConfigurationStore);
|
let { configurationData } = storeToRefs(alarmConfigurationStore);
|
||||||
const queryData = () => {
|
const queryData = () => {
|
||||||
if (id) {
|
if (route.query?.id) {
|
||||||
detail(id).then((res) => {
|
detail(route.query?.id).then((res) => {
|
||||||
if (res.status === 200) {
|
if (res.status === 200) {
|
||||||
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;
|
||||||
// form.targetType = res?.result?.targetType;
|
// form.targetType = res?.result?.targetType;
|
||||||
|
@ -84,7 +101,7 @@ const queryData = () => {
|
||||||
{
|
{
|
||||||
column: 'id',
|
column: 'id',
|
||||||
termType: 'alarm-bind-rule',
|
termType: 'alarm-bind-rule',
|
||||||
value: id,
|
value: route.query?.id,
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
type: 'and',
|
type: 'and',
|
||||||
|
@ -176,18 +193,22 @@ const handleSave = async () => {
|
||||||
formRef.value
|
formRef.value
|
||||||
.validate()
|
.validate()
|
||||||
.then(async () => {
|
.then(async () => {
|
||||||
const res = id ? await updata(form.value) : await save(form.value);
|
const res = route.query?.id
|
||||||
|
? await updata(form.value)
|
||||||
|
: await save(form.value);
|
||||||
if (res.status === 200) {
|
if (res.status === 200) {
|
||||||
message.success('操作成功,请配置关联的场景联动');
|
message.success('操作成功,请配置关联的场景联动');
|
||||||
loading.value = false;
|
loading.value = false;
|
||||||
menuStory.jumpPage(
|
if (res.result?.id) {
|
||||||
'rule-engine/Alarm/Configuration/Save',
|
menuStory.jumpPage(
|
||||||
{},
|
'rule-engine/Alarm/Configuration/Save',
|
||||||
{ id: res.result?.id },
|
{},
|
||||||
);
|
{ id: res.result?.id },
|
||||||
if (!id) {
|
);
|
||||||
|
}
|
||||||
|
if (!route.query?.id) {
|
||||||
configurationData.value.current = res.result;
|
configurationData.value.current = res.result;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.catch((error) => {
|
.catch((error) => {
|
||||||
|
@ -196,6 +217,12 @@ const handleSave = async () => {
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
queryData();
|
queryData();
|
||||||
|
watch(
|
||||||
|
() => route.query?.id,
|
||||||
|
() => {
|
||||||
|
queryData();
|
||||||
|
},
|
||||||
|
);
|
||||||
</script>
|
</script>
|
||||||
<style lang="less" scoped>
|
<style lang="less" scoped>
|
||||||
.ant-radio-button-wrapper {
|
.ant-radio-button-wrapper {
|
||||||
|
@ -203,7 +230,7 @@ queryData();
|
||||||
width: 20%;
|
width: 20%;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
}
|
}
|
||||||
.levelSelect{
|
.levelSelect {
|
||||||
display: flex;
|
display: flex;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
}
|
}
|
||||||
|
|
|
@ -40,12 +40,13 @@
|
||||||
</j-space>
|
</j-space>
|
||||||
</template>
|
</template>
|
||||||
</JProTable>
|
</JProTable>
|
||||||
<Info v-if="visiable" :data="current" @close="close"/>
|
<Info v-if="visiable" :data="current" @close="close" :description="description"/>
|
||||||
</page-container>
|
</page-container>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import { detail, queryHistoryList } from '@/api/rule-engine/log';
|
import { detail, queryHistoryList } from '@/api/rule-engine/log';
|
||||||
|
import { detail as configurationDetail} from '@/api/rule-engine/configuration'
|
||||||
import { useRoute } from 'vue-router';
|
import { useRoute } from 'vue-router';
|
||||||
import dayjs from 'dayjs';
|
import dayjs from 'dayjs';
|
||||||
import type { ActionsType } from '@/components/Table/index.vue';
|
import type { ActionsType } from '@/components/Table/index.vue';
|
||||||
|
@ -58,6 +59,7 @@ const route = useRoute();
|
||||||
const id = route.params?.id;
|
const id = route.params?.id;
|
||||||
const { params: routerParams } = useRouterParams()
|
const { params: routerParams } = useRouterParams()
|
||||||
let visiable = ref(false);
|
let visiable = ref(false);
|
||||||
|
let description = ref<string>();
|
||||||
const columns = [
|
const columns = [
|
||||||
{
|
{
|
||||||
title: '告警时间',
|
title: '告警时间',
|
||||||
|
@ -168,6 +170,11 @@ watchEffect(async () => {
|
||||||
key: 'targetName',
|
key: 'targetName',
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
configurationDetail(res.result?.alarmConfigId).then((res:any)=>{
|
||||||
|
if(res.status === 200){
|
||||||
|
description.value = res.result?.description;
|
||||||
|
}
|
||||||
|
})
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
const handleSearch = (_params: any) => {
|
const handleSearch = (_params: any) => {
|
||||||
|
|
|
@ -1,8 +1,26 @@
|
||||||
<template>
|
<template>
|
||||||
<j-modal visible title="详情" okText="确定" cancelText="取消" :width="1000" @ok="closeModal" @cancel="closeModal">
|
<j-modal
|
||||||
|
visible
|
||||||
|
title="详情"
|
||||||
|
okText="确定"
|
||||||
|
cancelText="取消"
|
||||||
|
:width="1000"
|
||||||
|
@ok="closeModal"
|
||||||
|
@cancel="closeModal"
|
||||||
|
>
|
||||||
<j-descriptions bordered :column="2">
|
<j-descriptions bordered :column="2">
|
||||||
<j-descriptions-item v-if="props.data.targetType==='device'" label="告警设备" :span="1">{{props.data?.targetName || ''}}</j-descriptions-item>
|
<j-descriptions-item
|
||||||
<j-descriptions-item v-if="props.data.targetType==='device'" label="设备ID" :span="1">{{props.data?.targetId || ''}}</j-descriptions-item>
|
v-if="props.data.targetType === 'device'"
|
||||||
|
label="告警设备"
|
||||||
|
:span="1"
|
||||||
|
>{{ props.data?.targetName || '' }}</j-descriptions-item
|
||||||
|
>
|
||||||
|
<j-descriptions-item
|
||||||
|
v-if="props.data.targetType === 'device'"
|
||||||
|
label="设备ID"
|
||||||
|
:span="1"
|
||||||
|
>{{ props.data?.targetId || '' }}</j-descriptions-item
|
||||||
|
>
|
||||||
<j-descriptions-item label="告警名称" :span="1">{{
|
<j-descriptions-item label="告警名称" :span="1">{{
|
||||||
props.data?.alarmConfigName
|
props.data?.alarmConfigName
|
||||||
}}</j-descriptions-item>
|
}}</j-descriptions-item>
|
||||||
|
@ -23,22 +41,20 @@
|
||||||
</Ellipsis>
|
</Ellipsis>
|
||||||
</j-tooltip>
|
</j-tooltip>
|
||||||
</j-descriptions-item>
|
</j-descriptions-item>
|
||||||
<j-descriptions-item label="告警说明" :span="1"
|
<j-descriptions-item label="告警说明" :span="1">
|
||||||
><j-tooltip
|
<Ellipsis style="width: calc(100% - 20px)">
|
||||||
placement="topLeft"
|
<span>
|
||||||
:title="data?.description || ''"
|
{{ description || '' }}
|
||||||
>
|
</span>
|
||||||
<Ellipsis>
|
</Ellipsis>
|
||||||
<span>
|
</j-descriptions-item>
|
||||||
{{ data?.description || '' }}
|
<j-descriptions-item label="告警流水" :span="2"
|
||||||
</span> </Ellipsis
|
><div style="max-height: 500px; overflow-y: auto">
|
||||||
>
|
<JsonViewer
|
||||||
</j-tooltip></j-descriptions-item
|
:value="JSON.parse(data?.alarmInfo || '{}')"
|
||||||
>
|
:expand-depth="5"
|
||||||
<j-descriptions-item
|
></JsonViewer></div
|
||||||
label="告警流水"
|
></j-descriptions-item>
|
||||||
:span="2"
|
|
||||||
><div style="max-height: 500px; overflow-y: auto;"><JsonViewer :value="JSON.parse(data?.alarmInfo || '{}')" :expand-depth="5"></JsonViewer></div></j-descriptions-item>
|
|
||||||
</j-descriptions>
|
</j-descriptions>
|
||||||
</j-modal>
|
</j-modal>
|
||||||
</template>
|
</template>
|
||||||
|
@ -49,11 +65,12 @@ import { Store } from 'jetlinks-store';
|
||||||
import JsonViewer from 'vue-json-viewer';
|
import JsonViewer from 'vue-json-viewer';
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
data: Object,
|
data: Object,
|
||||||
|
description: String,
|
||||||
});
|
});
|
||||||
const emit = defineEmits(['close'])
|
const emit = defineEmits(['close']);
|
||||||
const closeModal = () => {
|
const closeModal = () => {
|
||||||
emit('close');
|
emit('close');
|
||||||
}
|
};
|
||||||
</script>
|
</script>
|
||||||
<style lang="less" scoped>
|
<style lang="less" scoped>
|
||||||
</style>
|
</style>
|
Loading…
Reference in New Issue