From 0b6e8e6fbee96f262d89bf1ca697800d8b558a54 Mon Sep 17 00:00:00 2001 From: TsMask <340112800@qq.com> Date: Fri, 18 Apr 2025 19:20:10 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=B7=BB=E5=8A=A0=E5=91=8A=E8=AD=A6?= =?UTF-8?q?=E4=BF=A1=E6=81=AF=E5=AF=BC=E5=87=BA=E5=8A=9F=E8=83=BD=EF=BC=8C?= =?UTF-8?q?=E5=B9=B6=E4=BC=98=E5=8C=96=E5=8E=86=E5=8F=B2=E5=91=8A=E8=AD=A6?= =?UTF-8?q?=E9=A1=B5=E9=9D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/faultManage/actAlarm.ts | 15 +++++ src/api/faultManage/historyAlarm.ts | 13 ---- src/i18n/locales/en-US.ts | 4 +- src/i18n/locales/zh-CN.ts | 4 +- src/views/faultManage/active-alarm/index.vue | 54 +++++++++++---- src/views/faultManage/history-alarm/index.vue | 65 +++++++++++++++---- 6 files changed, 110 insertions(+), 45 deletions(-) diff --git a/src/api/faultManage/actAlarm.ts b/src/api/faultManage/actAlarm.ts index a53fda48..210d9023 100644 --- a/src/api/faultManage/actAlarm.ts +++ b/src/api/faultManage/actAlarm.ts @@ -116,6 +116,21 @@ export function clearAlarm(ids: number[]) { }); } +/** + * 告警信息导出 + * @param params 查询列表条件 + * @returns object + */ +export function exportAlarm(params: Record) { + return request({ + url: '/neData/alarm/export', + method: 'GET', + params: params, + responseType: 'blob', + timeout: 60_000, + }); +} + /** * 手工同步 * @param data 鉴权对象 diff --git a/src/api/faultManage/historyAlarm.ts b/src/api/faultManage/historyAlarm.ts index f6648b36..231884c7 100644 --- a/src/api/faultManage/historyAlarm.ts +++ b/src/api/faultManage/historyAlarm.ts @@ -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) { - return await request({ - url: `/neData/alarm/list`, - method: 'GET', - params: query, - }); -} - /** * 确认告警信息 * @param data 鉴权对象 diff --git a/src/i18n/locales/en-US.ts b/src/i18n/locales/en-US.ts index 81eda374..0e921ae8 100644 --- a/src/i18n/locales/en-US.ts +++ b/src/i18n/locales/en-US.ts @@ -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', diff --git a/src/i18n/locales/zh-CN.ts b/src/i18n/locales/zh-CN.ts index 7409e77c..27340829 100644 --- a/src/i18n/locales/zh-CN.ts +++ b/src/i18n/locales/zh-CN.ts @@ -1132,13 +1132,11 @@ export default { delSuss:'清除成功', delSure:'是否清除该告警', showSet:'显示过滤设置', + exportTip: "确认根据搜索条件导出xlsx表格文件吗?", exportSure:'确认是否导出全部活动告警信息', viewIdInfo:'查看{alarmId} 记录信息', closeModal:'关闭', }, - historyAlarm:{ - exportSure:'确认是否导出全部历史告警信息?', - }, faultSetting:{ interfaceType:'类型', email:'Email', diff --git a/src/views/faultManage/active-alarm/index.vue b/src/views/faultManage/active-alarm/index.vue index acdaefb7..ee48dccb 100644 --- a/src/views/faultManage/active-alarm/index.vue +++ b/src/views/faultManage/active-alarm/index.vue @@ -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') }} + + + {{ t('views.faultManage.activeAlarm.disPlayFilfter') }} + + { {{ t('views.faultManage.activeAlarm.clear') }} - - - {{ t('views.faultManage.activeAlarm.disPlayFilfter') }} - - - - - {{ t('views.faultManage.activeAlarm.exportAll') }} + + + {{ t('common.export') }} diff --git a/src/views/faultManage/history-alarm/index.vue b/src/views/faultManage/history-alarm/index.vue index 5bc1f21c..30a83323 100644 --- a/src/views/faultManage/history-alarm/index.vue +++ b/src/views/faultManage/history-alarm/index.vue @@ -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([]); - /**查询参数 */ let queryParams = reactive({ alarmStatus: 0, @@ -144,7 +141,7 @@ let tableState: TabeStateType = reactive({ }); /**表格字段列 */ -let tableColumns: ColumnsType = [ +let tableColumns = ref([ { title: t('views.faultManage.activeAlarm.alarmType'), dataIndex: 'alarmType', @@ -241,7 +238,10 @@ let tableColumns: ColumnsType = [ fixed: 'right', width: 100, }, -]; +]); + +/**表格字段列排序 */ +let tableColumnsDnd = ref([]); /**表格分页器参数 */ let tablePagination = reactive({ @@ -466,7 +466,7 @@ function mapKeysWithReduce(data: any[], titleMapping: Record) { 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(() => {