From dbb6a9f72b9e5748d2c6fae70867b91a3faed54e Mon Sep 17 00:00:00 2001 From: sjl <1716605279@qq.com> Date: Wed, 24 Dec 2025 10:41:04 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E9=83=A8=E5=88=86=E9=A2=84?= =?UTF-8?q?=E8=A7=88=EF=BC=8C=E6=95=B0=E6=8D=AE=E5=AE=8C=E6=95=B4=E6=80=A7?= =?UTF-8?q?=EF=BC=8C=E6=9A=82=E6=80=81=E5=88=97=E8=A1=A8=E7=AD=89bug?= =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/PreviewFile/index.vue | 18 ++++++---- src/utils/fileDownLoad.ts | 35 ++++++++++++++++++- src/views/pqs/database/standard/index.vue | 18 +++++----- src/views/pqs/database/stencil/index.vue | 5 ++- .../getIntegrityData/components/charts.vue | 2 +- .../components/monitorLedgerTable.vue | 4 +-- .../terminal/components/substationLedger.vue | 8 ++++- .../Region/transientList/index.vue | 24 ++++++------- .../analyse/eventwaveform/index.vue | 22 +++++++++--- .../voltageSags/analyse/impactscope/index.vue | 2 +- 10 files changed, 100 insertions(+), 38 deletions(-) diff --git a/src/components/PreviewFile/index.vue b/src/components/PreviewFile/index.vue index e11fb4c5..de6a93af 100644 --- a/src/components/PreviewFile/index.vue +++ b/src/components/PreviewFile/index.vue @@ -1,10 +1,10 @@ @@ -19,22 +19,28 @@ import VueOfficeExcel from '@vue-office/excel' //引入VueOfficePdf组件 import VueOfficePdf from '@vue-office/pdf' import { downloadFile } from '@/api/system-boot/file' +import{previewFile} from '@/utils/fileDownLoad' + const { push, options, currentRoute } = useRouter() const VITE_FLAG = import.meta.env.VITE_NAME == 'jibei' // const url = 'http://192.168.1.22:9009/excelreport' + currentRoute.value.href?.split('?')[1] const url = ref('') const excelOptions = ref({}) +const urlKey = currentRoute.value?.href?.split('?')[1] if(VITE_FLAG){ url.value = '/api-docx/excelreport' + currentRoute.value?.href?.split('?')[1] excelOptions.value = ref({ xls: currentRoute.value.href?.split('?')[1].split('.')[1] == 'xls' ? true : false }) }else{ - //下载 - + + const previewUrl = await previewFile(currentRoute.value?.href?.split('?')[1]) + url.value = previewUrl } onMounted(() => { + // 从路由参数获取文件路径 + console.log() }) diff --git a/src/utils/fileDownLoad.ts b/src/utils/fileDownLoad.ts index 13792e7f..de1d3f3d 100644 --- a/src/utils/fileDownLoad.ts +++ b/src/utils/fileDownLoad.ts @@ -1,7 +1,7 @@ import { downloadFile } from '@/api/system-boot/file' // 下载文件 export const download = (urls: any) => { - + console.log('下载',urls) downloadFile({ filePath: urls }).then((res: any) => { let blob = new Blob([res], { type: urls.includes('.pdf') @@ -40,3 +40,36 @@ function removeLastDotSuffix(str: string) { // 如果存在 .,截取到 . 之前的部分;否则返回原字符串 return lastDotIndex !== -1 ? str.slice(0, lastDotIndex) : str } + + +// 预览文件 +export const previewFile = async (urls: any) => { + console.log('预览',urls) + let url = '' + await downloadFile({ filePath: urls }).then((res: any) => { + let blob = new Blob([res], { + type: urls.includes('.pdf') + ? 'application/pdf' + : urls.includes('.zip') + ? 'application/zip' + : urls.includes('.doc') + ? 'application/msword' + : urls.includes('.docx') + ? 'application/vnd.openxmlformats-officedocument.wordprocessingml.document' + : urls.includes('.xls') + ? 'application/vnd.ms-excel' + : urls.includes('.xlsx') + ? 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet' + : urls.includes('.png') + ? 'image/png' + : urls.includes('.jpeg') + ? 'image/jpeg' + : urls.includes('.jpg') + ? 'image/jpg' + : '' + }) + url = window.URL.createObjectURL(blob) + }) + console.log('url',url) + return url +} diff --git a/src/views/pqs/database/standard/index.vue b/src/views/pqs/database/standard/index.vue index b7a4e249..9b55e8f9 100644 --- a/src/views/pqs/database/standard/index.vue +++ b/src/views/pqs/database/standard/index.vue @@ -20,13 +20,13 @@
- - + - +
@@ -56,6 +56,7 @@ import VueOfficeExcel from '@vue-office/excel' import VueOfficePdf from '@vue-office/pdf' import { deleteyLibstandard } from '@/api/supervision-boot/database/index' import { useAdminInfo } from '@/stores/adminInfo' +import {previewFile } from '@/utils/fileDownLoad' const adminInfo = useAdminInfo() defineOptions({ name: 'database/standard' @@ -77,7 +78,7 @@ onMounted(() => { } }) - +const urlKey=ref('') const VITE_FLAG = import.meta.env.VITE_NAME == 'jibei' const handleNodeClick = (data: any, node: any) => { console.log("🚀 ~ handleNodeClick ~ data:", data) @@ -86,13 +87,14 @@ const handleNodeClick = (data: any, node: any) => { flag.value = false if (data?.url != null && data?.url != '') { flag.value = true - - setTimeout(() => { + urlKey.value = data.url + setTimeout(async () => { if(VITE_FLAG){ url.value = `/api-docx/excelreport` + data.url excelOptions.value = { xls: data.url.split('.')[1] == 'xls' ? true : false } }else{ - + const previewUrl = await previewFile(data.url); + url.value = previewUrl; } // getFileNameAndFilePath({ filePath: data.url }).then(res => { diff --git a/src/views/pqs/database/stencil/index.vue b/src/views/pqs/database/stencil/index.vue index bc91cd75..016799e6 100644 --- a/src/views/pqs/database/stencil/index.vue +++ b/src/views/pqs/database/stencil/index.vue @@ -36,7 +36,7 @@ defineOptions({ }) const information = adminInfo.roleCode.includes('information_info') const popupEditRef = ref() - +const VITE_FLAG = import.meta.env.VITE_NAME == 'jibei' const TableHeaderRef = ref() const tableStore = new TableStore({ @@ -59,6 +59,9 @@ const tableStore = new TableStore({ type: 'primary', icon: 'el-icon-Plus', render: 'basicButton', + disabled: row => { + return !VITE_FLAG + }, click: row => { window.open(window.location.origin + '/#/previewFile?' + row.url) } diff --git a/src/views/pqs/harmonicMonitoring/area/getIntegrityData/components/charts.vue b/src/views/pqs/harmonicMonitoring/area/getIntegrityData/components/charts.vue index be765fa4..257640fa 100644 --- a/src/views/pqs/harmonicMonitoring/area/getIntegrityData/components/charts.vue +++ b/src/views/pqs/harmonicMonitoring/area/getIntegrityData/components/charts.vue @@ -76,7 +76,7 @@ const tableStore = new TableStore({ chartsData.value.map((item: any) => { xData.push(item.type) if (item.single == 0 || item.single == 3.14159) { - yData.push(1) + yData.push(0) } else { yData.push(item.single) } diff --git a/src/views/pqs/supervise/terminal/components/monitorLedgerTable.vue b/src/views/pqs/supervise/terminal/components/monitorLedgerTable.vue index 451244c2..6f9136b5 100644 --- a/src/views/pqs/supervise/terminal/components/monitorLedgerTable.vue +++ b/src/views/pqs/supervise/terminal/components/monitorLedgerTable.vue @@ -91,7 +91,7 @@ const tableStore = new TableStore({ }, { field: 'devCapacity', - title: '供电终端容量(MVA )', + title: '供电设备容量(MVA )', minWidth: 160 }, { @@ -167,7 +167,7 @@ tableStore.table.params.runFlag = [] tableStore.table.params.searchValue = '' const runFlagList = [ - { id: 0, name: '运行' }, + { id: 0, name: '投运' }, { id: 1, name: '检修' }, { id: 2, name: '停运' }, { id: 3, name: '调试' }, diff --git a/src/views/pqs/supervise/terminal/components/substationLedger.vue b/src/views/pqs/supervise/terminal/components/substationLedger.vue index 3add1956..fe873270 100644 --- a/src/views/pqs/supervise/terminal/components/substationLedger.vue +++ b/src/views/pqs/supervise/terminal/components/substationLedger.vue @@ -62,7 +62,13 @@ const tableStore = new TableStore({ tableStore.table.params.searchValue = '' provide('tableStore', tableStore) -onMounted(() => { +onMounted(() => { + TableHeaderRef.value.setDatePicker([ + { label: '月份', value: 3 }, + { label: '周', value: 4 }, + { label: '自定义', value: 5 } + ]) tableStore.index() + }) diff --git a/src/views/pqs/voltageSags/Region/transientList/index.vue b/src/views/pqs/voltageSags/Region/transientList/index.vue index 1446af45..75344499 100644 --- a/src/views/pqs/voltageSags/Region/transientList/index.vue +++ b/src/views/pqs/voltageSags/Region/transientList/index.vue @@ -51,15 +51,15 @@ :value="item.id"> --> - - + - - + @@ -68,7 +68,7 @@ + placeholder="请选择变电站(监测点)" :show-all-levels="true" />