修改问题

This commit is contained in:
guanj
2026-01-20 14:39:13 +08:00
parent c09e6f54dd
commit 823d5f4475
15 changed files with 193 additions and 57 deletions

View File

@@ -1,5 +1,5 @@
import createAxios from '@/utils/request'
import { genFileId, ElMessage, ElNotification } from 'element-plus'
// 查询设备数据趋势
export function getDeviceDataTrend(data: any) {
return createAxios({
@@ -9,8 +9,6 @@ export function getDeviceDataTrend(data: any) {
})
}
// 波形下载
export function getFileZip(params: any) {
return createAxios({
@@ -27,5 +25,35 @@ export function exportModel(data: any) {
method: 'post',
data: data,
responseType: 'blob'
}).then(async res => {
let load: any = await readJsonBlob(res)
if (load.code) {
if (load.data.code == 'A0011') {
ElMessage.warning('下载失败!')
} else {
ElMessage.warning(load.data.message)
}
} else {
return res
}
})
}
async function readJsonBlob(blob) {
try {
// 1. Blob.text() 读取二进制 → 直接转为 字符串(自动处理编码)
const jsonStr = await blob.text()
// 2. JSON.parse 解析字符串 → 得到可用的 JS 对象/数组
const jsonData = JSON.parse(jsonStr)
// 3. 拿到数据,后续随便用
return {
code: true,
data: jsonData
}
} catch (err) {
return {
code: false,
data: {}
}
// console.error('解析Blob的JSON数据失败', err)
}
}

View File

@@ -1,5 +1,5 @@
import request from '@/utils/request'
import { genFileId, ElMessage, ElNotification } from 'element-plus'
// 主要监测点列表查询>>分页
export function mainLineList(data: any) {
return request({
@@ -115,7 +115,6 @@ export function limitProbabilityData(data: any) {
})
}
// 电网侧指标越限统计列表
export function gridSideLimitStatisticsList(data: any) {
return request({
@@ -152,7 +151,6 @@ export function getListByIds(data: any) {
})
}
// 上传治理报告
export function uploadReport(data: any) {
return request({
@@ -260,14 +258,42 @@ export function getSimpleLine() {
})
}
export function getLineExport(data:any) {
export function getLineExport(data: any) {
return request({
url: '/cs-harmonic-boot/eventReport/getLineExport',
method: 'post',
data: data,
responseType: 'blob'
}).then(async res => {
let load: any = await readJsonBlob(res)
if (load.code) {
if (load.data.code == 'A0011') {
ElMessage.warning('下载失败!')
} else {
ElMessage.warning(load.data.message)
}
} else {
return res
}
})
}
async function readJsonBlob(blob) {
try {
// 1. Blob.text() 读取二进制 → 直接转为 字符串(自动处理编码)
const jsonStr = await blob.text()
// 2. JSON.parse 解析字符串 → 得到可用的 JS 对象/数组
const jsonData = JSON.parse(jsonStr)
// 3. 拿到数据,后续随便用
return {
code: true,
data: jsonData
}
} catch (err) {
return {
code: false,
data: {}
}
// console.error('解析Blob的JSON数据失败', err)
}
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 124 KiB

After

Width:  |  Height:  |  Size: 213 KiB

View File

@@ -26,12 +26,21 @@
<div v-loading="tableStore.table.loading">
<my-echart
class="tall"
v-if="lineShow"
:options="echartList1"
:style="{
width: prop.width,
height: `calc(${prop.height} - ${headerHeight}px + ${fullscreen ? 0 : 56}px)`
}"
/>
<el-empty
v-else
description="暂无监测点"
:style="{
width: prop.width,
height: `calc(${prop.height} - ${headerHeight}px + ${fullscreen ? 0 : 56}px)`
}"
/>
<!-- <my-echart
class="mt10"
:options="echartList1"
@@ -68,7 +77,7 @@ const lineList = ref()
const headerHeight = ref(57)
const TableHeaderRef = ref()
const lineShow = ref(true)
const selectChange = (showSelect: any, height: any, datePickerValue?: any) => {
headerHeight.value = height
@@ -99,6 +108,11 @@ const probabilityData = ref()
const initLineList = async () => {
cslineList({}).then(res => {
if (res.data.length == 0) {
lineShow.value = false
return (tableStore.table.loading = false)
}
lineShow.value = true
lineList.value = res.data
tableStore.table.params.lineId = lineList.value[0].lineId
tableStore.index()

View File

@@ -24,6 +24,7 @@
</TableHeader>
<div v-loading="tableStore.table.loading">
<my-echart
v-if="lineShow"
class="tall"
:options="echartList"
:style="{
@@ -31,6 +32,14 @@
height: `calc(${prop.height} - ${headerHeight}px + ${fullscreen ? 0 : 56}px)`
}"
/>
<el-empty
v-else
description="暂无监测点"
:style="{
width: prop.width,
height: `calc(${prop.height} - ${headerHeight}px + ${fullscreen ? 0 : 56}px)`
}"
/>
<!-- <my-echart
class="mt10"
:options="echartList1"
@@ -59,7 +68,7 @@ const prop = defineProps({
timeValue: { type: Object },
interval: { type: Number }
})
const lineShow = ref(true)
// const options = ref(JSON.parse(window.localStorage.getItem('lineIdList') || '[]'))
const lineList = ref()
@@ -98,6 +107,11 @@ const probabilityData = ref()
const initLineList = async () => {
cslineList({}).then(res => {
if (res.data.length == 0) {
lineShow.value = false
return (tableStore.table.loading = false)
}
lineShow.value = true
lineList.value = res.data
tableStore.table.params.lineId = lineList.value[0].lineId
tableStore.index()

View File

@@ -75,12 +75,21 @@
<div v-loading="tableStore.table.loading">
<my-echart
class="tall"
v-if="lineShow"
:options="echartList"
:style="{
width: prop.width,
height: `calc(${prop.height} - ${headerHeight}px + ${fullscreen ? 0 : 56}px )`
}"
/>
<el-empty
v-else
description="暂无监测点"
:style="{
width: prop.width,
height: `calc(${prop.height} - ${headerHeight}px + ${fullscreen ? 0 : 56}px)`
}"
/>
</div>
</div>
</template>
@@ -114,7 +123,7 @@ const lineList: any = ref()
const powerList: any = ref()
const chartsList = ref<any>([])
const lineShow = ref(true)
// 计算是否全屏展示
const fullscreen = computed(() => {
const w = Number(prop.w)
@@ -141,6 +150,11 @@ const indicatorList = ref()
const initLineList = async () => {
cslineList({}).then(res => {
if (res.data.length == 0) {
lineShow.value = false
return (tableStore.table.loading = false)
}
lineShow.value = true
lineList.value = res.data
tableStore.table.params.lineId = lineList.value[0].lineId
initCode()

View File

@@ -166,8 +166,8 @@ const tableStore: any = new TableStore({
// ...row,
// duration: row.persistTime // 将 persistTime 值赋给 duration
// }
boxoList.value.featureAmplitude =
row.evtParamVVaDepth != '-' ? row.evtParamVVaDepth - 0 : null
boxoList.value.featureAmplitude = (row.amplitude - 0) / 100
// row.evtParamVVaDepth != '-' ? row.evtParamVVaDepth - 0 : null
boxoList.value.systemType = 'YPT'
wp.value = res.data
}

View File

@@ -166,8 +166,9 @@ const tableStore: any = new TableStore({
// ...row,
// duration: row.persistTime // 将 persistTime 值赋给 duration
// }
boxoList.value.featureAmplitude =
row.evtParamVVaDepth != '-' ? row.evtParamVVaDepth - 0 : null
// boxoList.value.featureAmplitude =
// row.evtParamVVaDepth != '-' ? row.evtParamVVaDepth - 0 : null
boxoList.value.featureAmplitude = (row.amplitude - 0) / 100
boxoList.value.systemType = 'YPT'
wp.value = res.data
}

View File

@@ -2,7 +2,7 @@
<div v-loading="loading" style="position: relative; height: 100%">
<div id="boxr">
<div id="rmsp" :style="`height:${vh};overflow: hidden;min-height: 200px;`">
<div class="bx" id="rms" style="min-height: 200px;"></div>
<div class="bx" id="rms" style="min-height: 200px"></div>
</div>
</div>
</div>
@@ -749,7 +749,7 @@ const initWave = (
y: -10
},
max: rmscm[0]?.[1] * 1.06 || 0,
min: rmscu[0]?.[1] - rmscu[0]?.[1] * 0.04 || 0,
min: rmscu[0]?.[1] - rmscu[0]?.[1] * 0.2 || 0,
boundaryGap: [0, '100%'],
showLastLabel: true,
opposite: false,
@@ -768,7 +768,7 @@ const initWave = (
fontSize: '12px',
color: props.DColor ? '#000' : echartsColor.WordColor,
formatter: function (value: number) {
return (value - 0).toFixed(2)
return Math.floor(value * 1000) / 1000
}
},
splitLine: {
@@ -1092,7 +1092,8 @@ const drawPics = (
fontSize: '12px',
color: props.DColor ? '#000' : echartsColor.WordColor,
formatter: function (value: number) {
return (value - 0).toFixed(2)
// return (value - 0).toFixed(2)
return Math.floor(value * 1000) / 1000
}
},
splitLine: {

View File

@@ -2,7 +2,7 @@
<div v-loading="loading" class="boxbx" style="position: relative; height: 100%">
<div id="boxsj">
<div id="shushi" :style="`height:${vh};overflow: hidden;min-height: 200px;`">
<div class="bx" id="wave" style="min-height: 200px;"></div>
<div class="bx" id="wave" style="min-height: 200px"></div>
</div>
</div>
</div>
@@ -499,7 +499,8 @@ const initWave = (
fontSize: '12px',
color: props.DColor ? '#000' : echartsColor.WordColor,
formatter: function (value: number) {
return (value - 0).toFixed(2)
// return (value - 0).toFixed(2)
return Math.floor(value * 1000) / 1000
}
},
splitLine: {
@@ -806,7 +807,8 @@ const drawPics = (
fontSize: '12px',
color: props.DColor ? '#000' : echartsColor.WordColor,
formatter: function (value: number) {
return (value - 0).toFixed(2)
// return (value - 0).toFixed(2)
return Math.floor(value * 1000) / 1000
}
},
splitLine: {

View File

@@ -2,7 +2,7 @@
<div ref="tableHeader" class="cn-table-header">
<div class="table-header ba-scroll-style" :key="num">
<el-form
style="flex: 1; height: 34px; margin-right: 20px; display: flex; flex-wrap: wrap"
style="flex: 1; height: 34px; margin-right: 0px; display: flex; flex-wrap: wrap"
ref="headerForm"
@submit.prevent=""
@keyup.enter="onComSearch"

View File

@@ -9,6 +9,7 @@
</el-form-item>
<el-form-item label="统计指标" label-width="80px">
<el-select
style="width: 200px"
multiple
:multiple-limit="3"
collapse-tags
@@ -199,7 +200,7 @@ queryByCode(
// }
// )
// } else {
countDataCopy.value[index].countOptions = range(kk.harmStart, kk.harmEnd, 1)
countDataCopy.value[index].countOptions = range(kk.harmStart, kk.harmEnd, 1)
// }
if (!countDataCopy.value[index].count || countDataCopy.value[index].count.length == 0) {
countDataCopy.value[index].count = countDataCopy.value[index].countOptions[0]
@@ -866,4 +867,13 @@ defineExpose({ getTrendRequest })
min-width: 100px;
}
}
:deep(.el-select__selected-item) {
.is-closable {
width: 100px !important;
}
}
:deep(.el-form--inline .el-form-item) {
margin-right: 15px !important;
}
</style>

View File

@@ -120,7 +120,7 @@
<template v-slot:select :key="num">
<el-form-item for="-" label="统计指标">
<el-select
style="min-width: 200px"
style="min-width: 240px"
filterable
collapse-tags
collapse-tags-tooltip
@@ -519,7 +519,7 @@ const lineStyle = [{ type: 'solid' }, { type: 'dashed' }, { type: 'dotted' }]
const titleList: any = ref('(未绑定数据)')
const init = (flag: boolean) => {
titleList.value = '(未绑定数据)'
titleList.value = ''
let list: any = []
//颜色数组

View File

@@ -23,7 +23,9 @@
</el-form-item> -->
</template>
<template #operation>
<el-button icon="el-icon-Download" type="primary" @click="exportEvent">导出</el-button>
<el-button icon="el-icon-Download" type="primary" @click="exportEvent" :loading="loading">
导出
</el-button>
</template>
</TableHeader>
<div class="box" :style="`height: calc(${tableStore.table.height} + 65px)`">
@@ -144,6 +146,7 @@ import { getLineExport } from '@/api/harmonic-boot/cockpit/cockpit'
defineOptions({
name: 'TransientReport/monitoringpointReport'
})
const loading = ref(false)
const height = mainHeight(20)
const size = ref(0)
const dictData = useDictData()
@@ -210,7 +213,7 @@ const exportEvent = () => {
return ElMessage.warning('请选择监测点进行报告生成!')
}
let a = ''
loading.value = true
// formd.value.lineId = monitoringPoint.state.lineId
// formd.value.lineName = monitoringPoint.state.lineName.split('>').at(-1)
formd.value.lineId = dotList.value.id
@@ -219,26 +222,37 @@ const exportEvent = () => {
formd.value.searchEndTime = TableHeaderRef.value.datePickerRef.timeValue[1]
formd.value.flag = TableHeaderRef.value.datePickerRef.interval
ElMessage('生成报告中,请稍等!')
const now = new Date()
const now = new Date()
const year = now.getFullYear() // 4位年份
const month = now.getMonth() + 1 // 月份0-11需+1
const day = now.getDate() // 日期1-31
// 格式化YYYY - MM - DD补零
const formattedDate = `${year}${String(month).padStart(2, '0')}${String(day).padStart(2, '0')}`
getLineExport(formd.value).then((res: any) => {
let blob = new Blob([res], {
type: 'application/vnd.openxmlformats-officedocument.wordprocessingml.document;charset=UTF-8'
getLineExport(formd.value)
.then(async (res: any) => {
if (res == undefined) {
loading.value = false
return
}
let blob = new Blob([res], {
type: 'application/vnd.openxmlformats-officedocument.wordprocessingml.document;charset=UTF-8'
})
// createObjectURL(blob); //创建下载的链接
const url = window.URL.createObjectURL(blob)
const link = document.createElement('a') // 创建a标签
link.href = url
link.download = dotList.value.name + formattedDate // 设置下载的文件名
document.body.appendChild(link)
link.click() //执行下载
document.body.removeChild(link)
loading.value = false
})
.catch((err: any) => {
loading.value = false
})
// createObjectURL(blob); //创建下载的链接
const url = window.URL.createObjectURL(blob)
const link = document.createElement('a') // 创建a标签
link.href = url
link.download = dotList.value.name+formattedDate // 设置下载的文件名
document.body.appendChild(link)
link.click() //执行下载
document.body.removeChild(link)
})
}
</script>
<style lang="scss">

View File

@@ -43,7 +43,9 @@
<el-button icon="el-icon-Upload" type="primary" class="mr10 ml10">上传接线图</el-button>
</template>
</el-upload>
<el-button icon="el-icon-Download" type="primary" @click="exportEvent">导出</el-button>
<el-button icon="el-icon-Download" type="primary" @click="exportEvent" :loading="loading">
导出
</el-button>
</template>
</TableHeader>
<div class="box">
@@ -85,7 +87,7 @@ const TableHeaderRef = ref()
const dotList: any = ref({})
const Template: any = ref({})
const uploadList: any = ref([])
const loading = ref(false)
const tableStore = new TableStore({
url: '',
method: 'POST',
@@ -125,7 +127,6 @@ const exportEvent = () => {
if (dotList.value?.level != 4) {
return ElMessage.warning('请选择监测点进行报告生成!')
}
let form = new FormData()
form.append('lineIndex', dotList.value.id)
form.append('name', dotList.value.name)
@@ -147,6 +148,8 @@ const exportEvent = () => {
message: '包含特殊字符,请注意修改!'
})
} else {
loading.value = true
ElMessage('生成报告中...')
const now = new Date()
const year = now.getFullYear() // 4位年份
@@ -155,19 +158,28 @@ const exportEvent = () => {
// 格式化YYYY - MM - DD补零
const formattedDate = `${year}${String(month).padStart(2, '0')}${String(day).padStart(2, '0')}`
exportModel(form).then((res: any) => {
let blob = new Blob([res], {
type: 'application/vnd.openxmlformats-officedocument.wordprocessingml.document;charset=UTF-8'
exportModel(form)
.then((res: any) => {
if (res == undefined) {
loading.value = false
return
}
let blob = new Blob([res], {
type: 'application/vnd.openxmlformats-officedocument.wordprocessingml.document;charset=UTF-8'
})
// createObjectURL(blob); //创建下载的链接
const url = window.URL.createObjectURL(blob)
const link = document.createElement('a') // 创建a标签
link.href = url
link.download = dotList.value.name + formattedDate // 设置下载的文件名
document.body.appendChild(link)
link.click() //执行下载
document.body.removeChild(link)
loading.value = false
})
.catch(() => {
loading.value = false
})
// createObjectURL(blob); //创建下载的链接
const url = window.URL.createObjectURL(blob)
const link = document.createElement('a') // 创建a标签
link.href = url
link.download = dotList.value.name + formattedDate // 设置下载的文件名
document.body.appendChild(link)
link.click() //执行下载
document.body.removeChild(link)
})
}
}
</script>