feat: 添加告警信息导出功能,并优化历史告警页面
This commit is contained in:
@@ -116,6 +116,21 @@ export function clearAlarm(ids: number[]) {
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 告警信息导出
|
||||
* @param params 查询列表条件
|
||||
* @returns object
|
||||
*/
|
||||
export function exportAlarm(params: Record<string, any>) {
|
||||
return request({
|
||||
url: '/neData/alarm/export',
|
||||
method: 'GET',
|
||||
params: params,
|
||||
responseType: 'blob',
|
||||
timeout: 60_000,
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 手工同步
|
||||
* @param data 鉴权对象
|
||||
|
||||
@@ -4,19 +4,6 @@ import { parseObjLineToHump } from '@/utils/parse-utils';
|
||||
import { parseDateToStr } from '@/utils/date-utils';
|
||||
import useUserStore from '@/store/modules/user';
|
||||
|
||||
/**
|
||||
* 查询列表
|
||||
* @param query 查询参数
|
||||
* @returns object
|
||||
*/
|
||||
export async function listAct(query: Record<string, any>) {
|
||||
return await request({
|
||||
url: `/neData/alarm/list`,
|
||||
method: 'GET',
|
||||
params: query,
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 确认告警信息
|
||||
* @param data 鉴权对象
|
||||
|
||||
@@ -1132,13 +1132,11 @@ export default {
|
||||
delSuss:'Clear successfully',
|
||||
delSure:'Whether to clear this alarm',
|
||||
showSet:'Show filter settings',
|
||||
exportTip: "Confirm exporting xlsx table files based on search criteria?",
|
||||
exportSure:'Confirm whether to export all active alarm information',
|
||||
viewIdInfo:'View {alarmId} record information',
|
||||
closeModal:'Close',
|
||||
},
|
||||
historyAlarm:{
|
||||
exportSure:'Confirm whether to export all historical alarm information',
|
||||
},
|
||||
faultSetting:{
|
||||
interfaceType:'Type',
|
||||
email:'Email',
|
||||
|
||||
@@ -1132,13 +1132,11 @@ export default {
|
||||
delSuss:'清除成功',
|
||||
delSure:'是否清除该告警',
|
||||
showSet:'显示过滤设置',
|
||||
exportTip: "确认根据搜索条件导出xlsx表格文件吗?",
|
||||
exportSure:'确认是否导出全部活动告警信息',
|
||||
viewIdInfo:'查看{alarmId} 记录信息',
|
||||
closeModal:'关闭',
|
||||
},
|
||||
historyAlarm:{
|
||||
exportSure:'确认是否导出全部历史告警信息?',
|
||||
},
|
||||
faultSetting:{
|
||||
interfaceType:'类型',
|
||||
email:'Email',
|
||||
|
||||
@@ -14,6 +14,7 @@ import {
|
||||
showPass,
|
||||
getPass,
|
||||
exportAll,
|
||||
exportAlarm,
|
||||
} from '@/api/faultManage/actAlarm';
|
||||
import useI18n from '@/hooks/useI18n';
|
||||
import useNeInfoStore from '@/store/modules/neinfo';
|
||||
@@ -730,6 +731,38 @@ function fnModalCancel() {
|
||||
modalState.helpShowView = false;
|
||||
}
|
||||
|
||||
/**列表导出 */
|
||||
function fnExportList() {
|
||||
if (modalState.confirmLoading) return;
|
||||
Modal.confirm({
|
||||
title: t('common.tipTitle'),
|
||||
content: t('views.faultManage.activeAlarm.exportTip'),
|
||||
onOk() {
|
||||
const hide = message.loading(t('common.loading'), 0);
|
||||
const querys = toRaw(queryParams);
|
||||
exportAlarm(querys)
|
||||
.then(res => {
|
||||
if (res.code === RESULT_CODE_SUCCESS) {
|
||||
message.success({
|
||||
content: t('common.operateOk'),
|
||||
duration: 3,
|
||||
});
|
||||
saveAs(res.data, `active_alarm_export_${Date.now()}.xlsx`);
|
||||
} else {
|
||||
message.error({
|
||||
content: `${res.msg}`,
|
||||
duration: 3,
|
||||
});
|
||||
}
|
||||
})
|
||||
.finally(() => {
|
||||
hide();
|
||||
modalState.confirmLoading = false;
|
||||
});
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
/**查询列表, pageNum初始页数 */
|
||||
function fnGetList(pageNum?: number) {
|
||||
if (tableState.loading) return;
|
||||
@@ -934,6 +967,11 @@ onMounted(() => {
|
||||
{{ t('views.faultManage.activeAlarm.syncMyself') }}
|
||||
</a-button>
|
||||
|
||||
<a-button type="primary" @click.prevent="fnShowSet()" v-if="false">
|
||||
<template #icon> <SettingOutlined /> </template>
|
||||
{{ t('views.faultManage.activeAlarm.disPlayFilfter') }}
|
||||
</a-button>
|
||||
|
||||
<a-button
|
||||
type="primary"
|
||||
danger
|
||||
@@ -946,19 +984,9 @@ onMounted(() => {
|
||||
{{ t('views.faultManage.activeAlarm.clear') }}
|
||||
</a-button>
|
||||
|
||||
<a-button type="primary" @click.prevent="fnShowSet()" v-if="false">
|
||||
<template #icon> <SettingOutlined /> </template>
|
||||
{{ t('views.faultManage.activeAlarm.disPlayFilfter') }}
|
||||
</a-button>
|
||||
|
||||
<a-button
|
||||
type="primary"
|
||||
@click.prevent="fnExportAll()"
|
||||
:disabled="tableState.data.length <= 0"
|
||||
v-if="false"
|
||||
>
|
||||
<template #icon> <export-outlined /> </template>
|
||||
{{ t('views.faultManage.activeAlarm.exportAll') }}
|
||||
<a-button type="dashed" @click.prevent="fnExportList()">
|
||||
<template #icon><ExportOutlined /></template>
|
||||
{{ t('common.export') }}
|
||||
</a-button>
|
||||
</a-space>
|
||||
</template>
|
||||
|
||||
@@ -7,11 +7,11 @@ import { SizeType } from 'ant-design-vue/es/config-provider';
|
||||
import { MenuInfo } from 'ant-design-vue/es/menu/src/interface';
|
||||
import { ColumnsType } from 'ant-design-vue/es/table';
|
||||
import {
|
||||
listAct,
|
||||
updateConfirm,
|
||||
cancelConfirm,
|
||||
exportAll,
|
||||
} from '@/api/faultManage/historyAlarm';
|
||||
import { listAct, exportAlarm } from '@/api/faultManage/actAlarm';
|
||||
import useI18n from '@/hooks/useI18n';
|
||||
import useDictStore from '@/store/modules/dict';
|
||||
import useNeInfoStore from '@/store/modules/neinfo';
|
||||
@@ -59,9 +59,6 @@ let rangePickerPresets = ref([
|
||||
},
|
||||
]);
|
||||
|
||||
/**表格字段列排序 */
|
||||
let tableColumnsDnd = ref<ColumnsType>([]);
|
||||
|
||||
/**查询参数 */
|
||||
let queryParams = reactive({
|
||||
alarmStatus: 0,
|
||||
@@ -144,7 +141,7 @@ let tableState: TabeStateType = reactive({
|
||||
});
|
||||
|
||||
/**表格字段列 */
|
||||
let tableColumns: ColumnsType = [
|
||||
let tableColumns = ref<ColumnsType>([
|
||||
{
|
||||
title: t('views.faultManage.activeAlarm.alarmType'),
|
||||
dataIndex: 'alarmType',
|
||||
@@ -241,7 +238,10 @@ let tableColumns: ColumnsType = [
|
||||
fixed: 'right',
|
||||
width: 100,
|
||||
},
|
||||
];
|
||||
]);
|
||||
|
||||
/**表格字段列排序 */
|
||||
let tableColumnsDnd = ref<ColumnsType>([]);
|
||||
|
||||
/**表格分页器参数 */
|
||||
let tablePagination = reactive({
|
||||
@@ -466,7 +466,7 @@ function mapKeysWithReduce(data: any[], titleMapping: Record<string, string>) {
|
||||
function fnExportAll() {
|
||||
Modal.confirm({
|
||||
title: 'Tip',
|
||||
content: t('views.faultManage.historyAlarm.exportSure'),
|
||||
content: t('views.faultManage.activeAlarm.exportSure'),
|
||||
onOk() {
|
||||
const key = 'exportAlarmHis';
|
||||
message.loading({ content: t('common.loading'), key });
|
||||
@@ -543,6 +543,38 @@ function fnModalCancel() {
|
||||
modalState.openByShowSet = false;
|
||||
}
|
||||
|
||||
/**列表导出 */
|
||||
function fnExportList() {
|
||||
if (modalState.confirmLoading) return;
|
||||
Modal.confirm({
|
||||
title: t('common.tipTitle'),
|
||||
content: t('views.faultManage.activeAlarm.exportTip'),
|
||||
onOk() {
|
||||
const hide = message.loading(t('common.loading'), 0);
|
||||
const querys = toRaw(queryParams);
|
||||
exportAlarm(querys)
|
||||
.then(res => {
|
||||
if (res.code === RESULT_CODE_SUCCESS) {
|
||||
message.success({
|
||||
content: t('common.operateOk'),
|
||||
duration: 3,
|
||||
});
|
||||
saveAs(res.data, `history_alarm_export_${Date.now()}.xlsx`);
|
||||
} else {
|
||||
message.error({
|
||||
content: `${res.msg}`,
|
||||
duration: 3,
|
||||
});
|
||||
}
|
||||
})
|
||||
.finally(() => {
|
||||
hide();
|
||||
modalState.confirmLoading = false;
|
||||
});
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
/**查询列表, pageNum初始页数 */
|
||||
function fnGetList(pageNum?: number) {
|
||||
if (tableState.loading) return;
|
||||
@@ -712,11 +744,17 @@ onMounted(() => {
|
||||
<a-card :bordered="false" :body-style="{ padding: '0px' }">
|
||||
<!-- 插槽-卡片左侧侧 -->
|
||||
<template #title>
|
||||
<a-space :size="8" align="center" v-if="false">
|
||||
<a-space :size="8" align="center">
|
||||
<a-button type="dashed" @click.prevent="fnExportList()">
|
||||
<template #icon><ExportOutlined /></template>
|
||||
{{ t('common.export') }}
|
||||
</a-button>
|
||||
|
||||
<a-button
|
||||
type="primary"
|
||||
@click.prevent="fnCancelConfirm()"
|
||||
:disabled="state.selectedRowKeys.length <= 0"
|
||||
v-if="false"
|
||||
>
|
||||
<template #icon>
|
||||
<CloseOutlined />
|
||||
@@ -727,6 +765,7 @@ onMounted(() => {
|
||||
type="primary"
|
||||
@click.prevent="fnExportAll()"
|
||||
:disabled="tableState.data.length <= 0"
|
||||
v-if="false"
|
||||
>
|
||||
<template #icon> <export-outlined /> </template>
|
||||
{{ t('views.faultManage.activeAlarm.exportAll') }}
|
||||
@@ -796,28 +835,28 @@ onMounted(() => {
|
||||
:scroll="{ x: tableColumns.length * 150, y: 'calc(100vh - 480px)' }"
|
||||
>
|
||||
<template #bodyCell="{ column, record }">
|
||||
<template v-if="column.key === 'origSeverity'">
|
||||
<template v-if="column?.key === 'origSeverity'">
|
||||
<DictTag
|
||||
:options="dict.activeAlarmSeverity"
|
||||
:value="record.origSeverity"
|
||||
/>
|
||||
</template>
|
||||
<template v-if="column.key === 'alarmType'">
|
||||
<template v-if="column?.key === 'alarmType'">
|
||||
<DictTag
|
||||
:options="dict.activeAlarmType"
|
||||
:value="record.alarmType"
|
||||
/>
|
||||
</template>
|
||||
<template v-if="column.key === 'clearType'">
|
||||
<template v-if="column?.key === 'clearType'">
|
||||
<DictTag
|
||||
:options="dict.activeClearType"
|
||||
:value="record.clearType"
|
||||
/>
|
||||
</template>
|
||||
<template v-if="column.key === 'ackState'">
|
||||
<template v-if="column?.key === 'ackState'">
|
||||
<DictTag :options="dict.activeAckState" :value="record.ackState" />
|
||||
</template>
|
||||
<template v-if="column.key === 'id'">
|
||||
<template v-if="column?.key === 'id'">
|
||||
<a-space :size="8" align="center">
|
||||
<a-tooltip>
|
||||
<template #title>{{ t('common.viewText') }}</template>
|
||||
|
||||
Reference in New Issue
Block a user