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