feat: 告警记录
This commit is contained in:
parent
67bb94ed7c
commit
a298904a02
|
@ -33,4 +33,9 @@ export const detail = (id:string) => server.get(`/alarm/record/${id}`);
|
||||||
/**
|
/**
|
||||||
* 告警历史记录
|
* 告警历史记录
|
||||||
*/
|
*/
|
||||||
export const queryHistoryList = (data:any) => server.post('/alarm/history/_query',data)
|
export const queryHistoryList = (data:any) => server.post('/alarm/history/_query',data);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取告警处理结果
|
||||||
|
*/
|
||||||
|
export const queryHandleHistory = (data:any) => server.post('/alarm/record/handle-history/_query',data);
|
|
@ -0,0 +1,79 @@
|
||||||
|
<template>
|
||||||
|
<a-modal
|
||||||
|
title="告警处理"
|
||||||
|
okText="确定"
|
||||||
|
cancelText="取消"
|
||||||
|
visible
|
||||||
|
@cancel="handleCancel"
|
||||||
|
@ok="handleSave"
|
||||||
|
destroyOnClose
|
||||||
|
:confirmLoading="loading"
|
||||||
|
>
|
||||||
|
<a-form :rules="rules" layout="vertical" ref="formRef" :model="form">
|
||||||
|
<a-form-item label="处理结果" name="describe">
|
||||||
|
<a-textarea
|
||||||
|
:rows="8"
|
||||||
|
:maxlength="200"
|
||||||
|
showCount
|
||||||
|
placeholder="请输入处理结果"
|
||||||
|
v-model:value="form.describe"
|
||||||
|
></a-textarea>
|
||||||
|
</a-form-item>
|
||||||
|
</a-form>
|
||||||
|
</a-modal>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script lang="ts" setup>
|
||||||
|
import { handleLog } from '@/api/rule-engine/log';
|
||||||
|
import { onlyMessage } from '@/utils/comm';
|
||||||
|
const props = defineProps({
|
||||||
|
data: {
|
||||||
|
type: Object,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
const loading = ref<boolean>(false);
|
||||||
|
const formRef = ref();
|
||||||
|
const rules = {
|
||||||
|
describe: [
|
||||||
|
{
|
||||||
|
required: true,
|
||||||
|
message: '请输入处理结果',
|
||||||
|
},
|
||||||
|
],
|
||||||
|
};
|
||||||
|
const form = reactive({
|
||||||
|
describe: '',
|
||||||
|
});
|
||||||
|
let visible = ref(true);
|
||||||
|
const emit = defineEmits(['closeSolve'])
|
||||||
|
const handleCancel = () => {
|
||||||
|
emit('closeSolve');
|
||||||
|
};
|
||||||
|
const handleSave = () => {
|
||||||
|
loading.value = true;
|
||||||
|
formRef.value
|
||||||
|
.validate()
|
||||||
|
.then(async () => {
|
||||||
|
const res = await handleLog({
|
||||||
|
describe: form.describe,
|
||||||
|
type: 'user',
|
||||||
|
state: 'normal',
|
||||||
|
alarmRecordId: props.data?.current?.id || '',
|
||||||
|
alarmConfigId: props.data?.current?.alarmConfigId || '',
|
||||||
|
alarmTime: props?.data?.current?.alarmTime || '',
|
||||||
|
});
|
||||||
|
if (res.status === 200) {
|
||||||
|
onlyMessage('操作成功!');
|
||||||
|
} else {
|
||||||
|
onlyMessage('操作失败!', 'error');
|
||||||
|
}
|
||||||
|
loading.value = false;
|
||||||
|
})
|
||||||
|
.catch((error) => {
|
||||||
|
console.log(error);
|
||||||
|
loading.value = false;
|
||||||
|
});
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
<style lang="less" scoped>
|
||||||
|
</style>
|
|
@ -1,79 +1,96 @@
|
||||||
<template>
|
<template>
|
||||||
<a-modal
|
<a-modal
|
||||||
title="告警处理"
|
|
||||||
okText="确定"
|
|
||||||
cancelText="取消"
|
|
||||||
visible
|
visible
|
||||||
@cancel="handleCancel"
|
title="处理记录"
|
||||||
@ok="handleSave"
|
:width="1200"
|
||||||
destroyOnClose
|
cancelText="取消"
|
||||||
:confirmLoading="loading"
|
okText="确定"
|
||||||
>
|
>
|
||||||
<a-form :rules="rules" layout="vertical" ref="formRef" :model="form">
|
<Search :columns="columns" target="bind-channel"></Search>
|
||||||
<a-form-item label="处理结果" name="describe">
|
<JTable
|
||||||
<a-textarea
|
model="TABLE"
|
||||||
:rows="8"
|
:columns="columns"
|
||||||
:maxlength="200"
|
:defaultParams="{
|
||||||
showCount
|
sorts: [{ name: 'createTime', order: 'desc' }],
|
||||||
placeholder="请输入处理结果"
|
terms,
|
||||||
v-model:value="form.describe"
|
}"
|
||||||
></a-textarea>
|
:request="queryHandleHistory"
|
||||||
</a-form-item>
|
>
|
||||||
</a-form>
|
<template #alarmTime="slotProps">
|
||||||
|
<span>
|
||||||
|
{{
|
||||||
|
moment(slotProps.alarmTime).format(
|
||||||
|
'YYYY-MM-DD HH:mm:ss',
|
||||||
|
)
|
||||||
|
}}
|
||||||
|
</span>
|
||||||
|
</template>
|
||||||
|
</JTable>
|
||||||
</a-modal>
|
</a-modal>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import { handleLog } from '@/api/rule-engine/log';
|
import { queryHandleHistory } from '@/api/rule-engine/log';
|
||||||
import { onlyMessage } from '@/utils/comm';
|
import moment from 'moment';
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
data: {
|
data: {
|
||||||
type: Object,
|
type: Object,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
const loading = ref<boolean>(false);
|
const terms = [
|
||||||
const formRef = ref();
|
{
|
||||||
const rules = {
|
column: 'alarmRecordId',
|
||||||
describe: [
|
termType: 'eq',
|
||||||
{
|
value: props.data.id,
|
||||||
required: true,
|
type: 'and',
|
||||||
message: '请输入处理结果',
|
},
|
||||||
|
];
|
||||||
|
const columns = [
|
||||||
|
{
|
||||||
|
title: '处理时间',
|
||||||
|
dataIndex: 'handleTime',
|
||||||
|
key: 'handleTime',
|
||||||
|
search: {
|
||||||
|
type: 'string',
|
||||||
},
|
},
|
||||||
],
|
},
|
||||||
};
|
{
|
||||||
const form = reactive({
|
dataIndex: 'handleType',
|
||||||
describe: '',
|
title: '处理类型',
|
||||||
});
|
key: 'handleType',
|
||||||
let visible = ref(true);
|
scopedSlots: true,
|
||||||
const emit = defineEmits(['closeSolve'])
|
search: {
|
||||||
const handleCancel = () => {
|
type: 'select',
|
||||||
emit('closeSolve');
|
options: [
|
||||||
};
|
{
|
||||||
const handleSave = () => {
|
label: '系统',
|
||||||
loading.value = true;
|
value: 'system',
|
||||||
formRef.value
|
},
|
||||||
.validate()
|
{
|
||||||
.then(async () => {
|
label: '人工',
|
||||||
const res = await handleLog({
|
value: 'user',
|
||||||
describe: form.describe,
|
},
|
||||||
type: 'user',
|
],
|
||||||
state: 'normal',
|
},
|
||||||
alarmRecordId: props.data?.current?.id || '',
|
},
|
||||||
alarmConfigId: props.data?.current?.alarmConfigId || '',
|
{
|
||||||
alarmTime: props?.data?.current?.alarmTime || '',
|
title: '告警时间',
|
||||||
});
|
dataIndex: 'alarmTime',
|
||||||
if (res.status === 200) {
|
key: 'alarmTime',
|
||||||
onlyMessage('操作成功!');
|
scopedSlots: true,
|
||||||
} else {
|
search: {
|
||||||
onlyMessage('操作失败!', 'error');
|
type: 'date',
|
||||||
}
|
},
|
||||||
loading.value = false;
|
},
|
||||||
})
|
{
|
||||||
.catch((error) => {
|
title: '告警处理',
|
||||||
console.log(error);
|
dataIndex: 'description',
|
||||||
loading.value = false;
|
key: 'description',
|
||||||
});
|
search: {
|
||||||
};
|
type: 'string',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
];
|
||||||
</script>
|
</script>
|
||||||
<style lang="less" scoped>
|
<style lang="less" scoped>
|
||||||
</style>
|
</style>
|
|
@ -115,7 +115,8 @@
|
||||||
</CardBox>
|
</CardBox>
|
||||||
</template>
|
</template>
|
||||||
</JTable>
|
</JTable>
|
||||||
<SolveLog :data="data" v-if="data.solveVisible" @closeSolve="closeSolve"/>
|
<SolveComponent :data="data" v-if="data.solveVisible" @closeSolve="closeSolve"/>
|
||||||
|
<SolveLog :data="data.current" v-if="data.logVisible"/>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
@ -134,6 +135,7 @@ import { storeToRefs } from 'pinia';
|
||||||
import { Store } from 'jetlinks-store';
|
import { Store } from 'jetlinks-store';
|
||||||
import moment from 'moment';
|
import moment from 'moment';
|
||||||
import type { ActionsType } from '@/components/Table';
|
import type { ActionsType } from '@/components/Table';
|
||||||
|
import SolveComponent from '../SolveComponent/index.vue';
|
||||||
import SolveLog from '../SolveLog/index.vue'
|
import SolveLog from '../SolveLog/index.vue'
|
||||||
import { useMenuStore } from '@/store/menu';
|
import { useMenuStore } from '@/store/menu';
|
||||||
const menuStory = useMenuStore();
|
const menuStory = useMenuStore();
|
||||||
|
@ -390,6 +392,10 @@ const getActions = (
|
||||||
title: '处理记录',
|
title: '处理记录',
|
||||||
},
|
},
|
||||||
icon: 'FileTextOutlined',
|
icon: 'FileTextOutlined',
|
||||||
|
onClick:() =>{
|
||||||
|
data.value.current = currentData;
|
||||||
|
data.value.logVisible = true;
|
||||||
|
}
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
return actions;
|
return actions;
|
||||||
|
|
Loading…
Reference in New Issue