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