修改部分预览,数据完整性,暂态列表等bug调整

This commit is contained in:
sjl
2025-12-24 10:41:04 +08:00
parent a52021572a
commit dbb6a9f72b
10 changed files with 100 additions and 38 deletions

View File

@@ -1,10 +1,10 @@
<template>
<div style="overflow: auto; height: 100vh">
<vue-office-docx v-if="url.includes('.doc') || url.includes('.docx')" :src="url" />
<vue-office-excel v-if="url.includes('.xls') || url.includes('.xlsx')" :src="url" :options="excelOptions" />
<vue-office-docx v-if="urlKey.includes('.doc') || urlKey.includes('.docx')" :src="url" />
<vue-office-excel v-if="urlKey.includes('.xls') || urlKey.includes('.xlsx')" :src="url" :options="excelOptions" />
<!-- <vue-office-pdf v-if="url.includes('.pdf')" :src="url" /> -->
<iframe v-if="url.includes('.pdf')" :src="url" style="width: 100%; height: 99%"></iframe>
<img v-if="url.includes('.png') || url.includes('.jpg') || url.includes('.gif') || url.includes('.bmp')"
<iframe v-if="urlKey.includes('.pdf')" :src="url" style="width: 100%; height: 99%"></iframe>
<img v-if="urlKey.includes('.png') || urlKey.includes('.jpg') || urlKey.includes('.gif') || urlKey.includes('.bmp')"
:src="url" />
</div>
</template>
@@ -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()
})
</script>

View File

@@ -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
}

View File

@@ -20,13 +20,13 @@
<el-empty v-if="url.length == 0" description="暂无数据" class="custom-empty"
:style="`height: calc(${height.height} - 60px);`" />
<div :style="`height: calc(${height.height} - 60px);overflow: auto;`" v-else>
<vue-office-docx v-if="url.includes('.doc') || url.includes('.docx')" :src="url" />
<vue-office-excel v-if="url.includes('.xls') || url.includes('.xlsx')" :src="url"
<vue-office-docx v-if="urlKey.includes('.doc') || urlKey.includes('.docx')" :src="url" />
<vue-office-excel v-if="urlKey.includes('.xls') || urlKey.includes('.xlsx')" :src="url"
:options="excelOptions" />
<!-- <vue-office-pdf v-if="url.includes('.pdf')" :src="url"/> -->
<iframe v-if="url.includes('.pdf')" :src="url" style="width: 100%; height: 99%"></iframe>
<iframe v-if="urlKey.includes('.pdf')" :src="url" style="width: 100%; height: 99%"></iframe>
<img v-if="
url.includes('.png') || url.includes('.jpg') || url.includes('.gif') || url.includes('.bmp')
urlKey.includes('.png') || urlKey.includes('.jpg') || urlKey.includes('.gif') || urlKey.includes('.bmp')
" :src="url" />
</div>
</pane>
@@ -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 => {

View File

@@ -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)
}

View File

@@ -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)
}

View File

@@ -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: '调试' },

View File

@@ -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()
})
</script>

View File

@@ -51,15 +51,15 @@
:value="item.id"></el-option>
</el-select>
</el-form-item> -->
<el-form-item label="暂原因:">
<el-select v-model="tableStore.table.params.eventReason" placeholder="请选择暂原因" clearable
<el-form-item label="暂原因:">
<el-select v-model="tableStore.table.params.eventReason" placeholder="请选择暂原因" clearable
multiple collapse-tags style="width: 100%">
<el-option v-for="item in reasonoptions" :key="item.id" :label="item.name"
:value="item.id"></el-option>
</el-select>
</el-form-item>
<el-form-item label="暂核实原因:">
<el-select v-model="tableStore.table.params.verifyReason" placeholder="请选择暂核实原因" clearable
<el-form-item label="暂核实原因:">
<el-select v-model="tableStore.table.params.verifyReason" placeholder="请选择暂核实原因" clearable
multiple collapse-tags collapse-tags-tooltip>
<el-option v-for="item in verifyReasonList" :key="item.id" :label="item.name"
:value="item.id"></el-option>
@@ -68,7 +68,7 @@
<el-form-item label="变电站(监测点):">
<el-cascader v-model="tableStore.table.params.lineIds" :options="options" :props="defaultProps"
collapse-tags-tooltip style="width: 257px;" filterable clearable collapse-tags
placeholder="请选择变电站(监测点)" :show-all-levels="false" />
placeholder="请选择变电站(监测点)" :show-all-levels="true" />
</el-form-item>
</template>
<template #operation>
@@ -151,11 +151,11 @@ const tableStore = new TableStore({
{ field: 'ip', title: '网络参数' ,width:'120px' },
{ field: 'lineName', title: '监测点', minWidth: '100' },
{ field: 'scale', title: '电压等级(kV)', minWidth: '120', },
// {
// field: 'verifyReason', title: '暂核实原因', minWidth: '120', formatter: function (row) {
// return verifyReasonList.filter(item => item.id == row.cellValue)[0]?.name || '/' //row.cellValue ? row.cellValue : '/'
// }
// },
{
field: 'verifyReason', title: '暂核实原因', minWidth: '120', formatter: function (row) {
return verifyReasonList.filter(item => item.id == row.cellValue)[0]?.name || '/' //row.cellValue ? row.cellValue : '/'
}
},
// {
// field: 'verifyReasonDetail', title: '暂降核实原因详情', minWidth: '200', formatter: function (row) {
// return row.cellValue ? row.cellValue : '/'
@@ -177,7 +177,7 @@ const tableStore = new TableStore({
}
},
// { field: 'advanceType', title: '暂降类型', minWidth: '100', },
{ field: 'advanceReason', title: '暂原因', minWidth: '100' },
{ field: 'advanceReason', title: '暂原因', minWidth: '100' },
{
field: 'depth',
title: '暂降深度(%)',
@@ -301,7 +301,7 @@ onMounted(() => {
list.forEach((item: any) => {
options.value.push(...item)
})
})
})
const backbxlb = () => {

View File

@@ -12,7 +12,7 @@
</TableHeader>
<Table ref="tableRef" />
<!-- 波形分析 -->
<el-dialog draggable v-model="dialogAnalysis" title="波形分析" width="70%">
<el-dialog draggable v-model="dialogAnalysis" title="事件查看" width="70%">
<div class="mb10" style="display: flex; justify-content: space-between">
<span>事件关联编号为{{ AssociationNumber }}</span>
<div>
@@ -175,6 +175,8 @@ const bxcontrast = () => {
} else {
}
}
// 波形分析
const source = () => {
queryEventDetailByAssId(form.value).then(res => {
@@ -230,25 +232,35 @@ const exportEvent = () => {
pageSize: tableStore.table.total
}).then(res => {
tableRef.value.getRef().exportData({
filename: '影响范围分析', // 文件名字
filename: '事件波形分析', // 文件名字
sheetName: 'Sheet1',
type: 'xlsx', //导出文件类型 xlsx 和 csv
useStyle: true,
data: res.data.records, // 数据源 // 过滤那个字段导出
columnFilterMethod: function (column, $columnIndex) {
return !(column.$columnIndex === 0)
return !(column.$columnIndex === 0 || column.$columnIndex === 4)
}
})
})
}
// 导出波形分析
const positioningexport = () => {
const selectedRecords = positioningtableRef.value.getCheckboxRecords();
if (selectedRecords.length === 0) {
ElMessage({
message: '请先选择要导出的数据!',
type: 'warning'
});
return;
}
positioningtableRef.value.exportData({
filename: '事件波形分析', // 文件名字
filename: '事件分析', // 文件名字
sheetName: 'Sheet1',
type: 'xlsx', //导出文件类型 xlsx 和 csv
useStyle: true,
data: dialogAnalysis.value, // 数据源 // 过滤那个字段导出
data: selectedRecords, // 数据源 // 过滤那个字段导出
columnFilterMethod: function (column, $columnIndex) {
return !(column.$columnIndex === 0)
}

View File

@@ -1,7 +1,7 @@
<template>
<div class="default-main">
<div v-show="view">
<TableHeader datePicker ref="TableHeaderRef" showExport>
<TableHeader datePicker ref="TableHeaderRef" >
<template #select>
<el-form-item label="关键字">
<el-input v-model="tableStore.table.params.searchValue" clearable placeholder="输入事件关联分析描述"