From 2106e2e9c1ddc703ed96822d9b187f8aae221cd9 Mon Sep 17 00:00:00 2001 From: guanj Date: Thu, 2 Jul 2026 09:53:56 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=B5=8B=E8=AF=95=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../cockpit/monitoringPointList/index.vue | 70 +++++------- .../components/transientList.vue | 2 +- .../components/transientStatisticsDetail.vue | 2 +- src/components/echarts/shushiboxi.vue | 1 - src/styles/element.scss | 2 +- src/views/govern/alarm/Device.vue | 2 +- src/views/govern/alarm/Front.vue | 8 +- src/views/govern/alarm/Transient.vue | 2 +- src/views/govern/analyze/DVR/index.vue | 2 +- src/views/govern/device/control/index.vue | 2 +- .../govern/device/control/tabs/event.vue | 2 +- .../govern/device/control/tabs/realtime.vue | 102 +++++++++--------- .../device/planData/components/transient.vue | 2 +- src/views/govern/manage/basic/dictionary.vue | 2 +- src/views/govern/monitorRecall/index.vue | 2 +- .../mxgraph/graphList/components/popup.vue | 4 +- .../statisticsWx/components/sheet.vue | 10 +- .../sags/operationsManagement/index.vue | 2 +- .../sags/operationsManagement/point.vue | 2 +- 19 files changed, 105 insertions(+), 116 deletions(-) diff --git a/src/components/cockpit/monitoringPointList/index.vue b/src/components/cockpit/monitoringPointList/index.vue index da0ad83..32fb2a8 100644 --- a/src/components/cockpit/monitoringPointList/index.vue +++ b/src/components/cockpit/monitoringPointList/index.vue @@ -45,7 +45,7 @@ import OverLimitDetails from '@/components/cockpit/monitoringPointList/component import TableHeader from '@/components/table/header/index.vue' import { uploadReport, getReportUrl } from '@/api/harmonic-boot/cockpit/cockpit' - +import { downLoadFile } from '@/api/cs-system-boot/manage' const prop = defineProps({ w: { type: [String, Number] }, h: { type: [String, Number] }, @@ -110,7 +110,7 @@ const tableStore: any = new TableStore({ minWidth: 150, render: 'customTemplate', customTemplate: (row: any) => { - return `${row.lineName}` + return `${row?.cellValue || '/'}` } }, { title: '设备名称', field: 'devName', minWidth: 150, align: 'center' }, @@ -237,7 +237,7 @@ const tableStore: any = new TableStore({ icon: 'el-icon-EditPen', render: 'basicButton', click: row => { - downloadTheReport(row.lineId, row.reportFilePath) + downloadTheReport(row.reportFilePath) }, disabled: row => { return row.reportFilePath == null || row.reportFilePath.length == 0 @@ -302,46 +302,32 @@ const cellClickEvent = ({ row, column }: any) => { } } -// 下载报告 -const downloadTheReport = (lineId: string, name: string) => { - getReportUrl({ lineId: lineId }).then((res: any) => { - ElMessage.info('下载中......') - forceDownloadPdf(res.data, name.split('/').pop() || '') - }) -} -const forceDownloadPdf = async (pdfUrl: any, fileName = '文件.pdf') => { +// 下载报告(支持 doc/docx/pdf) +const downloadTheReport = async (reportFilePath: string) => { + if (!reportFilePath) { + ElMessage.warning('暂无报告可下载') + return + } + ElMessage.info('下载中......') try { - // 1. 请求 PDF 并转为 Blob(关键:绕开浏览器直接解析) - const response = await fetch(pdfUrl, { - method: 'GET' - // 若需要鉴权,添加请求头(如 token) - }) - - // 校验响应是否成功 - if (!response.ok) throw new Error(`请求失败:${response.status}`) - - // 2. 将响应转为 Blob(指定类型为 PDF,确保兼容性) - const blob = await response.blob() - const pdfBlob = new Blob([blob], { type: 'application/pdf' }) - - // 3. 创建临时 URL 并触发下载 - const blobUrl = URL.createObjectURL(pdfBlob) - const a = document.createElement('a') - a.href = blobUrl - a.download = fileName // 此时 Blob URL 是同源的,download 必生效 - a.style.display = 'none' - document.body.appendChild(a) - a.click() // 触发下载 - - // 4. 清理资源(避免内存泄漏) - document.body.removeChild(a) - URL.revokeObjectURL(blobUrl) - setTimeout(() => { - ElMessage.success('下载成功') - }, 2000) - } catch (error) { - console.error('下载失败:', error) - // ElMessage.error('文件下载失败,请检查网络或文件地址') // 适配 Element Plus + const resp = (await downLoadFile(reportFilePath)) as unknown as Blob + if (resp?.type === 'application/json') { + ElMessage.error('下载失败') + return + } + const fileName = reportFilePath.split('/').pop() || '报告' + const blob = new Blob([resp], { type: resp.type || 'application/octet-stream' }) + const url = window.URL.createObjectURL(blob) + const link = document.createElement('a') + link.href = url + link.download = fileName + document.body.appendChild(link) + link.click() + document.body.removeChild(link) + window.URL.revokeObjectURL(url) + ElMessage.success('下载成功') + } catch (error: any) { + ElMessage.error('下载失败: ' + (error.message || '未知错误')) } } diff --git a/src/components/cockpit/transientDetails/components/transientList.vue b/src/components/cockpit/transientDetails/components/transientList.vue index ccf2c4d..2da3a34 100644 --- a/src/components/cockpit/transientDetails/components/transientList.vue +++ b/src/components/cockpit/transientDetails/components/transientList.vue @@ -105,7 +105,7 @@ const tableStore: any = new TableStore({ field: 'sagSource', minWidth: 120, align: 'center', - formatter: (row: any) => row.cellValue == 1 ? '上游' : row.cellValue == 2 ? '下游' : '未知' + formatter: (row: any) => row.cellValue == 1 ? '上游' : row.cellValue == 2 ? '下游' : '暂无' }, { title: '操作', diff --git a/src/components/cockpit/transientStatistics/components/transientStatisticsDetail.vue b/src/components/cockpit/transientStatistics/components/transientStatisticsDetail.vue index 99378fe..b50604e 100644 --- a/src/components/cockpit/transientStatistics/components/transientStatisticsDetail.vue +++ b/src/components/cockpit/transientStatistics/components/transientStatisticsDetail.vue @@ -131,7 +131,7 @@ const tableStore: any = new TableStore({ field: 'sagSource', minWidth: 120, align: 'center', - formatter: (row: any) => row.cellValue == 1 ? '上游' : row.cellValue == 2 ? '下游' : '未知' + formatter: (row: any) => row.cellValue == 1 ? '上游' : row.cellValue == 2 ? '下游' : '暂无' }, { title: '操作', diff --git a/src/components/echarts/shushiboxi.vue b/src/components/echarts/shushiboxi.vue index f24e49e..c358f54 100644 --- a/src/components/echarts/shushiboxi.vue +++ b/src/components/echarts/shushiboxi.vue @@ -711,7 +711,6 @@ const drawPics = ( if (props.boxoList.systemType == 'ZL' || props.boxoList.systemType == 'YPT') { const str = waveId.split('e') const str1 = Number(str[1]) - console.log("🚀 ~ drawPics ~ props.wp.channelNames:", props.wp.channelNames) props.wp.channelNames.forEach((element: string, i: number) => { if ((str1 == 1 && i == 4) || (str1 == 2 && i == 7) || (str1 == 3 && i == 10)) { diff --git a/src/styles/element.scss b/src/styles/element.scss index c1bb352..448f237 100644 --- a/src/styles/element.scss +++ b/src/styles/element.scss @@ -242,5 +242,5 @@ } .el-tree > .el-tree-node { min-width: 100% !important; - display: inline-block !important; + // display: inline-block !important; } diff --git a/src/views/govern/alarm/Device.vue b/src/views/govern/alarm/Device.vue index fa36cc0..274504f 100644 --- a/src/views/govern/alarm/Device.vue +++ b/src/views/govern/alarm/Device.vue @@ -15,7 +15,7 @@ --> + v-model.trim="tableStore.table.params.searchValue" clearable placeholder="请输入设备名称/告警代码" /> diff --git a/src/views/govern/alarm/Front.vue b/src/views/govern/alarm/Front.vue index 4280042..965d028 100644 --- a/src/views/govern/alarm/Front.vue +++ b/src/views/govern/alarm/Front.vue @@ -3,10 +3,8 @@