修改波形样式

This commit is contained in:
guanj
2025-11-27 15:25:33 +08:00
parent e824f4823a
commit 800ec7f0cf
4 changed files with 383 additions and 289 deletions

View File

@@ -149,7 +149,8 @@ const tableStore: any = new TableStore({
// 在打开弹窗时立即设置高度
nextTick(() => {
if (waveFormAnalysisRef.value) {
waveFormAnalysisRef.value.setHeight(false, 360)
// waveFormAnalysisRef.value.setHeight(false, 360)
waveFormAnalysisRef.value.setHeight(1, 50, 1.8)
}
})
await analyseWave(row.id)

View File

@@ -615,7 +615,7 @@ const initWave = (waveDatas: WaveData[] | null, time: string | null, type: strin
enabled: true,
itemDistance: 5,
textStyle: {
fontSize: '14px',
fontSize: '12px',
color: props.DColor ? '#000' : echartsColor.WordColor,
rich: { a: { verticalAlign: 'middle' } },
padding: [0, 0, 0, 0]
@@ -641,13 +641,13 @@ const initWave = (waveDatas: WaveData[] | null, time: string | null, type: strin
title: {
text: 'ms',
textStyle: {
fontSize: '14px',
fontSize: '12px',
color: props.DColor ? '#000' : echartsColor.WordColor
},
enabled: true,
align: 'high'
},
nameTextStyle: { fontSize: '14px' },
nameTextStyle: { fontSize: '12px' },
labels: {
formatter: function () {
return this.value
@@ -662,7 +662,7 @@ const initWave = (waveDatas: WaveData[] | null, time: string | null, type: strin
onZero: false
},
axisLabel: {
fontSize: '14px',
fontSize: '12px',
color: props.DColor ? '#000' : echartsColor.WordColor,
formatter: function (value: number) {
if (valA.value != (value - 0).toFixed(0)) {
@@ -689,7 +689,7 @@ const initWave = (waveDatas: WaveData[] | null, time: string | null, type: strin
showLastLabel: true,
opposite: false,
nameTextStyle: {
fontSize: '14px',
fontSize: '12px',
color: props.DColor ? '#000' : echartsColor.WordColor
},
axisLine: {
@@ -700,7 +700,7 @@ const initWave = (waveDatas: WaveData[] | null, time: string | null, type: strin
onZero: false
},
axisLabel: {
fontSize: '14px',
fontSize: '12px',
color: props.DColor ? '#000' : echartsColor.WordColor,
formatter: function (value: number) {
return (value - 0).toFixed(2)
@@ -718,7 +718,7 @@ const initWave = (waveDatas: WaveData[] | null, time: string | null, type: strin
left: '1%',
right: '45px',
bottom: '40px',
top: '70px',
top: '60px',
containLabel: true
},
dataZoom: [
@@ -780,7 +780,7 @@ const initWave = (waveDatas: WaveData[] | null, time: string | null, type: strin
show: true,
position: [5, -20],
color: '#000',
fontSize: '14px',
fontSize: '12px',
fontWeight: 'bold',
borderType: 'solid',
borderWidth: 0.5,
@@ -917,7 +917,7 @@ const drawPics = (waveDataTemp: WaveData, picHeight: string, step: number, show:
enabled: true,
itemDistance: 5,
textStyle: {
fontSize: '14px',
fontSize: '12px',
color: props.DColor ? '#000' : echartsColor.WordColor,
rich: { a: { verticalAlign: 'middle' } },
padding: [0, 0, 0, 0]
@@ -932,7 +932,7 @@ const drawPics = (waveDataTemp: WaveData, picHeight: string, step: number, show:
title: {
text: 'ms',
textStyle: {
fontSize: '14px',
fontSize: '12px',
color: props.DColor ? '#000' : echartsColor.WordColor
},
enabled: true,
@@ -943,7 +943,7 @@ const drawPics = (waveDataTemp: WaveData, picHeight: string, step: number, show:
return this.value
}
},
nameTextStyle: { fontSize: '14px' },
nameTextStyle: { fontSize: '12px' },
splitLine: { show: false },
axisTick: { alignWithLabel: true },
axisLine: {
@@ -953,7 +953,7 @@ const drawPics = (waveDataTemp: WaveData, picHeight: string, step: number, show:
onZero: false
},
axisLabel: {
fontSize: '14px',
fontSize: '12px',
color: props.DColor ? '#000' : echartsColor.WordColor,
formatter: function (value: number) {
if (valB.value != (value - 0).toFixed(0)) {
@@ -978,7 +978,7 @@ const drawPics = (waveDataTemp: WaveData, picHeight: string, step: number, show:
showLastLabel: true,
opposite: false,
nameTextStyle: {
fontSize: '14px',
fontSize: '12px',
color: props.DColor ? '#000' : echartsColor.WordColor
},
axisLine: {
@@ -989,7 +989,7 @@ const drawPics = (waveDataTemp: WaveData, picHeight: string, step: number, show:
onZero: false
},
axisLabel: {
fontSize: '14px',
fontSize: '12px',
color: props.DColor ? '#000' : echartsColor.WordColor,
formatter: function (value: number) {
return (value - 0).toFixed(2)
@@ -1007,7 +1007,7 @@ const drawPics = (waveDataTemp: WaveData, picHeight: string, step: number, show:
left: '1%',
right: '45px',
bottom: '40px',
top: '70px',
top: '60px',
containLabel: true
},
dataZoom: [

View File

@@ -1,6 +1,5 @@
<template>
<div v-loading="loading" class="boxbx"
style="position: relative;height: 100%;">
<div v-loading="loading" class="boxbx" style="position: relative; height: 100%">
<div id="boxsj">
<div id="shushi" :style="`height:${vh};overflow: hidden;`">
<div class="bx" id="wave"></div>
@@ -16,7 +15,7 @@ import $ from 'jquery'
import * as echarts from 'echarts'
import url from '@/assets/img/point.png'
// 创建Worker
let waveDataWorker: Worker | null = null;
let waveDataWorker: Worker | null = null
interface WaveData {
instantF: { max: number; min: number }
instantS: { max: number; min: number }
@@ -98,18 +97,21 @@ const vh = computed(() => {
const vw = computed(() => '100%')
watch(() => props.value, (newVal) => {
watch(
() => props.value,
newVal => {
if (newVal == 2) {
initWaves()
} else {
$('#wave1').remove()
initWaves()
}
})
}
)
onMounted(() => {
const zoomValue = document.body.style.getPropertyValue('zoom');
zoom.value = 1 / (zoomValue ? parseFloat(zoomValue) : 1);
const zoomValue = document.body.style.getPropertyValue('zoom')
zoom.value = 1 / (zoomValue ? parseFloat(zoomValue) : 1)
window.addEventListener('resize', handleResize)
nextTick(() => {
@@ -120,27 +122,27 @@ onMounted(() => {
})
onBeforeUnmount(() => {
console.log('组件卸载');
console.log('组件卸载')
if (waveDataWorker) {
waveDataWorker.terminate();
waveDataWorker = null;
waveDataWorker.terminate()
waveDataWorker = null
}
backbxlb();
window.removeEventListener('resize', handleResize);
backbxlb()
window.removeEventListener('resize', handleResize)
})
const handleResize = () => {
const zoomValue = document.body.style.getPropertyValue('zoom');
zoom.value = 1 / (zoomValue ? parseFloat(zoomValue) : 1);
const zoomValue = document.body.style.getPropertyValue('zoom')
zoom.value = 1 / (zoomValue ? parseFloat(zoomValue) : 1)
}
const download = () => {
const boxsj = document.getElementById('boxsj')
if (boxsj) {
html2canvas(boxsj, {
scale: 2,
scale: 2
}).then(function (canvas) {
const creatIMg = document.createElement('a')
creatIMg.download = '瞬间波形.png'
@@ -170,49 +172,56 @@ const waveData = (instantF: any, instantS: any, shunshiF: any, shunshiS: any, ti
// 在组件中修改initWaves函数
const initWaves = () => {
if (props.wp) {
loading.value = true;
loading.value = true
iphasic.value = props.wp.iphasic || 1
// 使用Web Worker处理数据
if (!waveDataWorker) {
waveDataWorker = new Worker(new URL('./shuWorker.js', import.meta.url));
waveDataWorker = new Worker(new URL('./shuWorker.js', import.meta.url))
waveDataWorker.onmessage = function (e) {
const data = e.data;
const data = e.data
titles.value = data.titles;
iphasic.value = data.iphasic;
time.value = data.time;
type.value = data.type;
severity.value = data.severity;
titles.value = data.titles
iphasic.value = data.iphasic
time.value = data.time
type.value = data.type
severity.value = data.severity
initWave(data.waveDatas, data.time, data.type, data.severity, isOpen.value);
initWave(data.waveDatas, data.time, data.type, data.severity, isOpen.value)
loading.value = false;
};
loading.value = false
}
waveDataWorker.onerror = function (error) {
console.error('Worker error:', error);
loading.value = false;
console.error('Worker error:', error)
loading.value = false
// 备用方案:在主线程处理数据
// processDataInMainThread();
};
}
}
// 发送数据到Worker
waveDataWorker.postMessage(JSON.stringify({
waveDataWorker.postMessage(
JSON.stringify({
wp: props.wp,
value: props.value,
iphasic: iphasic.value,
isOpen: isOpen.value,
boxoList: props.boxoList
}));
})
)
} else {
initWave(null, null, null, null, null);
initWave(null, null, null, null, null)
}
}
const initWave = (waveDatas: WaveData[] | null, time: string | null, type: string | null, severity: string | null, isOpen: boolean | null) => {
const initWave = (
waveDatas: WaveData[] | null,
time: string | null,
type: string | null,
severity: string | null,
isOpen: boolean | null
) => {
$('div.bx1').remove()
let picHeight = vh.value
@@ -221,9 +230,14 @@ const initWave = (waveDatas: WaveData[] | null, time: string | null, type: strin
let cu: number[][] = []
let titleText = ''
let unit = ''
let max: any = 0, min: any = 0
let a: string | null = null, b: string | null = null, c: string | null = null
let adata: number[][] = [], bdata: number[][] = [], cdata: number[][] = []
let max: any = 0,
min: any = 0
let a: string | null = null,
b: string | null = null,
c: string | null = null
let adata: number[][] = [],
bdata: number[][] = [],
cdata: number[][] = []
const colors: string[] = []
if (!waveDatas) {
@@ -307,14 +321,34 @@ const initWave = (waveDatas: WaveData[] | null, time: string | null, type: strin
$(`#${waveId}`).css('height', picHeight).css('width', vw.value)
}
} else {
titleText = `变电站名称:${subName.value} 监测点名称:${lineName.value} 发生时刻:${time} 残余电压:${(Number(eventValue.value) * 1).toFixed(0)}% 持续时间:${persistTime.value}s`
titleText = `变电站名称:${subName.value} 监测点名称:${lineName.value} 发生时刻:${time} 残余电压:${(
Number(eventValue.value) * 1
).toFixed(0)}% 持续时间:${persistTime.value}s`
}
const wave = document.getElementById('wave')
if (!wave) return
const myChartes = echarts.init(wave)
const echartsColor = { WordColor: "#000", thread: "#000", FigureColor: ["#07CCCA ", "#00BFF5", "#FFBF00", "#77DA63", "#D5FF6B", "#Ff6600", "#FF9100", "#5B6E96", "#66FFCC", "#B3B3B3", "#FF00FF", "#CC00FF", "#FF9999"] }
const echartsColor = {
WordColor: '#000',
thread: '#000',
FigureColor: [
'#07CCCA ',
'#00BFF5',
'#FFBF00',
'#77DA63',
'#D5FF6B',
'#Ff6600',
'#FF9100',
'#5B6E96',
'#66FFCC',
'#B3B3B3',
'#FF00FF',
'#CC00FF',
'#FF9999'
]
}
setTimeout(() => {
wave.style.width = '100%'
@@ -335,7 +369,12 @@ const initWave = (waveDatas: WaveData[] | null, time: string | null, type: strin
let tips = '时刻:' + params[0].data[0] + '</br/>'
for (let i = 0; i < params.length; i++) {
if (params[i].seriesName != '暂降触发点') {
tips += params[i].marker + params[i].seriesName + ':' + (params[i].value[1] - 0).toFixed(2) + '<br/>'
tips +=
params[i].marker +
params[i].seriesName +
':' +
(params[i].value[1] - 0).toFixed(2) +
'<br/>'
}
}
return tips
@@ -364,7 +403,7 @@ const initWave = (waveDatas: WaveData[] | null, time: string | null, type: strin
enabled: true,
itemDistance: 5,
textStyle: {
fontSize: '14px',
fontSize:12,
color: props.DColor ? '#000' : echartsColor.WordColor,
rich: { a: { verticalAlign: 'middle' } },
padding: [0, 0, 0, 0]
@@ -390,14 +429,14 @@ const initWave = (waveDatas: WaveData[] | null, time: string | null, type: strin
title: {
text: 'ms',
textStyle: {
fontSize: '14px',
fontSize: '12px',
color: props.DColor ? '#000' : echartsColor.WordColor
},
enabled: true,
align: 'high'
},
splitLine: { show: false },
nameTextStyle: { fontSize: '14px' },
nameTextStyle: { fontSize: '12px' },
axisTick: { alignWithLabel: true },
axisLine: {
lineStyle: {
@@ -406,7 +445,7 @@ const initWave = (waveDatas: WaveData[] | null, time: string | null, type: strin
onZero: false
},
axisLabel: {
fontSize: '14px',
fontSize: '12px',
color: props.DColor ? '#000' : echartsColor.WordColor,
formatter: function (value: number) {
if (valA.value != (value - 0).toFixed(0)) {
@@ -433,7 +472,7 @@ const initWave = (waveDatas: WaveData[] | null, time: string | null, type: strin
min: min.toFixed(2) > 0 ? min.toFixed(2) - min.toFixed(2) * 0.1 : min.toFixed(2) * 1.1,
opposite: false,
nameTextStyle: {
fontSize: '14px',
fontSize: '12px',
color: props.DColor ? '#000' : echartsColor.WordColor
},
axisLine: {
@@ -444,7 +483,7 @@ const initWave = (waveDatas: WaveData[] | null, time: string | null, type: strin
onZero: false
},
axisLabel: {
fontSize: '14px',
fontSize: '12px',
color: props.DColor ? '#000' : echartsColor.WordColor,
formatter: function (value: number) {
return (value - 0).toFixed(2)
@@ -460,9 +499,9 @@ const initWave = (waveDatas: WaveData[] | null, time: string | null, type: strin
},
grid: {
left: '1%',
right: '2.8%',
right: '45px',
bottom: '40px',
top: '70px',
top: '60px',
containLabel: true
},
dataZoom: [
@@ -537,12 +576,25 @@ const initWave = (waveDatas: WaveData[] | null, time: string | null, type: strin
}
}
const drawPics = (waveDataTemp: WaveData, picHeight: string, step: number, show: boolean, myChartes1: echarts.ECharts, title: string) => {
const drawPics = (
waveDataTemp: WaveData,
picHeight: string,
step: number,
show: boolean,
myChartes1: echarts.ECharts,
title: string
) => {
step = step + 1
const waveId = 'wave' + step
let a: string | null = null, b: string | null = null, c: string | null = null
let max: any = 0, min: any = 0, unit = ''
let adata: number[][] = [], bdata: number[][] = [], cdata: number[][] = []
let a: string | null = null,
b: string | null = null,
c: string | null = null
let max: any = 0,
min: any = 0,
unit = ''
let adata: number[][] = [],
bdata: number[][] = [],
cdata: number[][] = []
const colors: string[] = []
switch (iphasic.value) {
@@ -612,7 +664,25 @@ const drawPics = (waveDataTemp: WaveData, picHeight: string, step: number, show:
if (!waveIds) return
const myChartes = echarts.init(waveIds)
const echartsColor = { WordColor: "#000", thread: "#000", FigureColor: ["#07CCCA ", "#00BFF5", "#FFBF00", "#77DA63", "#D5FF6B", "#Ff6600", "#FF9100", "#5B6E96", "#66FFCC", "#B3B3B3", "#FF00FF", "#CC00FF", "#FF9999"] }
const echartsColor = {
WordColor: '#000',
thread: '#000',
FigureColor: [
'#07CCCA ',
'#00BFF5',
'#FFBF00',
'#77DA63',
'#D5FF6B',
'#Ff6600',
'#FF9100',
'#5B6E96',
'#66FFCC',
'#B3B3B3',
'#FF00FF',
'#CC00FF',
'#FF9999'
]
}
const option = {
tooltip: {
@@ -651,7 +721,7 @@ const drawPics = (waveDataTemp: WaveData, picHeight: string, step: number, show:
enabled: true,
itemDistance: 5,
textStyle: {
fontSize: '14px',
fontSize: 12,
color: props.DColor ? '#000' : echartsColor.WordColor,
rich: { a: { verticalAlign: 'middle' } },
padding: [0, 0, 0, 0]
@@ -666,7 +736,7 @@ const drawPics = (waveDataTemp: WaveData, picHeight: string, step: number, show:
title: {
text: 'ms',
textStyle: {
fontSize: '14px',
fontSize: '12px',
color: props.DColor ? '#000' : echartsColor.WordColor
},
enabled: true,
@@ -680,9 +750,9 @@ const drawPics = (waveDataTemp: WaveData, picHeight: string, step: number, show:
},
onZero: false
},
nameTextStyle: { fontSize: '14px' },
nameTextStyle: { fontSize: '12px' },
axisLabel: {
fontSize: '14px',
fontSize: '12px',
color: props.DColor ? '#000' : echartsColor.WordColor,
formatter: function (value: number) {
if (valB.value != (value - 0).toFixed(0)) {
@@ -709,7 +779,7 @@ const drawPics = (waveDataTemp: WaveData, picHeight: string, step: number, show:
min: min.toFixed(2) > 0 ? min.toFixed(2) - min.toFixed(2) * 0.1 : min.toFixed(2) * 1.1,
opposite: false,
nameTextStyle: {
fontSize: '14px',
fontSize: '12px',
color: props.DColor ? '#000' : echartsColor.WordColor
},
axisLine: {
@@ -720,7 +790,7 @@ const drawPics = (waveDataTemp: WaveData, picHeight: string, step: number, show:
onZero: false
},
axisLabel: {
fontSize: '14px',
fontSize: '12px',
color: props.DColor ? '#000' : echartsColor.WordColor,
formatter: function (value: number) {
return (value - 0).toFixed(2)
@@ -736,9 +806,9 @@ const drawPics = (waveDataTemp: WaveData, picHeight: string, step: number, show:
},
grid: {
left: '1%',
right: '2.8%',
right: '45px',
bottom: '40px',
top: '70px',
top: '60px',
containLabel: true
},
dataZoom: [
@@ -793,11 +863,21 @@ const drawPics = (waveDataTemp: WaveData, picHeight: string, step: number, show:
myChartes.setOption(option)
switch (step) {
case 1: myChartess1.value = myChartes; break
case 2: myChartess2.value = myChartes; break
case 3: myChartess3.value = myChartes; break
case 4: myChartess4.value = myChartes; break
case 5: myChartess5.value = myChartes; break
case 1:
myChartess1.value = myChartes
break
case 2:
myChartess2.value = myChartes
break
case 3:
myChartess3.value = myChartes
break
case 4:
myChartess4.value = myChartes
break
case 5:
myChartess5.value = myChartes
break
}
setTimeout(() => {
@@ -810,7 +890,14 @@ const drawPics = (waveDataTemp: WaveData, picHeight: string, step: number, show:
const backbxlb = () => {
waveDatas.value = []
const charts = [myChartess.value, myChartess1.value, myChartess2.value, myChartess3.value, myChartess4.value, myChartess5.value]
const charts = [
myChartess.value,
myChartess1.value,
myChartess2.value,
myChartess3.value,
myChartess4.value,
myChartess5.value
]
charts.forEach(chart => {
if (chart) {
@@ -826,13 +913,11 @@ const backbxlb = () => {
myChartess5.value = null
// echarts.disconnect(charts.filter(Boolean) as echarts.ECharts[])
charts
.filter(Boolean)
.forEach(chart => {
charts.filter(Boolean).forEach(chart => {
if (chart && typeof chart.dispose === 'function') {
chart.dispose();
chart.dispose()
}
});
})
}
const getMax = (temp: number, tempA: number, tempB: number, tempC: number): number => {

View File

@@ -16,24 +16,34 @@
<el-radio-group v-model.trim="theTypeOfValue" @change="changeView">
<el-radio-button label="一次值" :value="1" />
<el-radio-button label="二次值" :value="2" />
</el-radio-group>
<el-button @click="handleBack" :icon="Back">返回</el-button>
</div>
<el-tabs class="home_body" type="border-card" v-model.trim="activeName1" @tab-click="handleClick"
v-loading="loading">
<el-tab-pane label="瞬时波形" name="ssbx" :style="'height:' + bxecharts + ';overflow-y: scroll;'">
<shushiboxi v-if="isWp && wp && activeName == 'ssbx' && showBoxi" :value="value" :boxoList="boxoList"
:parentHeight="parentHeight" :wp="wp">
</shushiboxi>
<el-tabs
class="home_body"
type="border-card"
v-model.trim="activeName1"
@tab-click="handleClick"
v-loading="loading"
>
<el-tab-pane label="瞬时波形" name="ssbx" :style="'height:' + bxecharts + ';overflow-y: auto;'">
<shushiboxi
v-if="isWp && wp && activeName == 'ssbx' && showBoxi"
:value="value"
:boxoList="boxoList"
:parentHeight="parentHeight"
:wp="wp"
></shushiboxi>
</el-tab-pane>
<el-tab-pane label="RMS波形" name="rmsbx" :style="'height:' + bxecharts + ';overflow-y: scroll;'">
<rmsboxi v-if="isWp && wp && activeName == 'rmsbx' && showBoxi" :value="value" :boxoList="boxoList"
:parentHeight="parentHeight" :wp="wp">
</rmsboxi>
<el-tab-pane label="RMS波形" name="rmsbx" :style="'height:' + bxecharts + ';overflow-y: auto;'">
<rmsboxi
v-if="isWp && wp && activeName == 'rmsbx' && showBoxi"
:value="value"
:boxoList="boxoList"
:parentHeight="parentHeight"
:wp="wp"
></rmsboxi>
</el-tab-pane>
</el-tabs>
</div>
@@ -96,7 +106,6 @@ const wp = ref({})
const theTypeOfValue = ref(1)
const value = ref(1)
const isWp = ref(false)
const boxoList: any = ref([])
const getWpData = (val: any, list: any) => {
@@ -131,13 +140,13 @@ const handleClick = (tab: any, event: any) => {
const handleBack = () => {
emit('handleHideCharts')
}
const setHeight = (h: any, vh: any) => {
const setHeight = (h: any, vh: any, num = 1) => {
if (h != false) {
parentHeight.value = h
}
setTimeout(() => {
bxecharts.value = mainHeight(vh).height
bxecharts.value = mainHeight(vh,num).height
}, 100)
}
onMounted(() => {})
@@ -165,7 +174,6 @@ defineExpose({ getWpData, setHeight })
position: relative;
.home_header {
height: 50px;
display: flex;
align-items: center;