修改测试bug

This commit is contained in:
guanj
2026-01-23 09:24:13 +08:00
parent 823d5f4475
commit def48e9c84
16 changed files with 196 additions and 123 deletions

View File

@@ -17,7 +17,7 @@ import { yMethod } from '@/utils/echartMethod'
const prop = defineProps({
width: { type: [String, Number] },
height: { type: [String, Number] },
timeKey: { type: Array as () => string[] },
timeKey: { type: Array as () => string[] },
timeValue: { type: Object }
})
@@ -47,6 +47,7 @@ const init = () => {
tooltip: {
trigger: 'axis',
formatter: (params: any) => {
console.log('🚀 ~ init ~ params:', params)
if (!params || params.length === 0) return ''
// 使用第一个项目的轴标签作为时间标题
@@ -100,28 +101,33 @@ const initData = async (row: any) => {
}
// 处理每条相位数据
const seriesData = res.data.map((item: any) => {
const values = xAxisData.map((time: string, index: number) => {
// 将传入的日期与时间拼接成完整的时间字符串
const fullTime = `${row.time} ${time}`
const value = parseFloat(item.value.split(',')[index]) || 0
return [fullTime, value]
const seriesData = res.data
.filter(item => item.valueType == 'max')
.sort((a, b) => {
return a.phasic.localeCompare(b.phasic)
})
.map((item: any) => {
const values = xAxisData.map((time: string, index: number) => {
// 将传入的日期与时间拼接成完整的时间字符串
const fullTime = `${row.time} ${time}`
const value = parseFloat(item.value.split(',')[index]) || 0
return [fullTime, value]
})
return {
name: `${item.phasic}`,
type: 'line',
showSymbol: false,
smooth: true,
data: values,
itemStyle: {
normal: {
// 根据相位设置对应颜色
color: phaseColors[item.phasic] || config.layout.elementUiPrimary[0]
return {
name: `${item.phasic}`,
type: 'line',
showSymbol: false,
smooth: true,
data: values,
itemStyle: {
normal: {
// 根据相位设置对应颜色
color: phaseColors[item.phasic] || config.layout.elementUiPrimary[0]
}
}
}
}
})
})
echartList.value.yAxis.max = max
echartList.value.yAxis.min = min
// 更新图表配置

View File

@@ -10,8 +10,8 @@
ref="TableHeaderRef"
>
<template v-slot:select>
<el-form-item label="关键">
<el-input v-model="tableStore.table.params.keywords" clearable placeholder="请输关键字" />
<el-form-item label="关键字筛选">
<el-input v-model="tableStore.table.params.keywords" clearable placeholder="请输入监测点名称" />
</el-form-item>
</template>
</TableHeader>

View File

@@ -201,7 +201,7 @@ const setEchart = () => {
result += `<br/>${item.marker}${item.seriesName}: ${valueText}`
} else {
// 对于功率数据,正常显示数值
result += `<br/>${item.marker}${item.seriesName}: ${item.value[1]}`
result += `<br/>${item.marker}${item.seriesName}: ${item.value[1]} ${item.value[2]}`
}
})
return result
@@ -292,7 +292,8 @@ const setEchart = () => {
item.time,
item.statisticalData !== null && item.statisticalData !== undefined
? parseFloat(item.statisticalData.toFixed(2))
: null
: null,
item.unit
]
})
@@ -302,7 +303,8 @@ const setEchart = () => {
item.time,
item.statisticalData !== null && item.statisticalData !== undefined
? parseFloat(item.statisticalData.toFixed(2))
: null
: null,
item.unit
]
})

View File

@@ -93,7 +93,8 @@ import { useConfig } from '@/stores/config'
import { queryByCode, queryCsDictTree } from '@/api/system-boot/dictTree'
import { getListByIds } from '@/api/harmonic-boot/cockpit/cockpit'
import { getTime } from '@/utils/formatTime'
import { yMethod, exportCSV } from '@/utils/echartMethod'
import { max } from 'lodash'
const prop = defineProps({
w: { type: [String, Number] },
h: { type: [String, Number] },
@@ -262,6 +263,11 @@ const setEchart = () => {
titleText = afterData[0].anotherName
}
// statisticalData
// chartsListBefore.value.map((item: any) => item.statisticalData)
// chartsListAfter.value = tableStore.table.data.after
// 构建图例数据
const legendData = series.map((item: any, index: number) => {
let color = config.layout.elementUiPrimary[0]
@@ -291,7 +297,10 @@ const setEchart = () => {
}
}
})
let [min, max] = yMethod(
[...chartsListBefore.value.map((item: any) => item.statisticalData),
...chartsListAfter.value.map((item: any) => item.statisticalData)]
)
echartList.value = {
title: {
text: titleText
@@ -316,12 +325,13 @@ const setEchart = () => {
const xname = params[0].value[0]
let str = `${xname}<br>`
params.forEach((el: any, index: any) => {
console.log('🚀 ~ setEchart ~ el:', el)
let marker = ''
marker = `<span style="display:inline-block;border: 2px ${el.color} ${el.value[3]};margin-right:5px;width:40px;height:0px;background-color:#ffffff00;"></span>`
str += `${marker}${el.seriesName.split('(')[0]}${
el.value[1] != null ? el.value[1] + ' ' + (el.value[2] == 'null' ? '' : el.value[2]) : '-'
el.value[1] != null ? el.value[1] + ' ' + (el.value[2] == null ? '' : el.value[2]) : '-'
}<br>`
})
return str
@@ -350,7 +360,9 @@ const setEchart = () => {
}
},
yAxis: {
name: beforeData.length > 0 ? beforeData[0].unit : afterData.length > 0 ? afterData[0].unit : ''
name: beforeData.length > 0 ? beforeData[0].unit : afterData.length > 0 ? afterData[0].unit : '',
max: max,
min: min,
},
grid: {
left: '10px',
@@ -439,7 +451,7 @@ const shouldShowHarmonicCount = () => {
return (
currentIndicator &&
(currentIndicator.name.includes('电压谐波含有率') || currentIndicator.name.includes('电流谐波含有率'))
(currentIndicator.name.includes('幅值') || currentIndicator.name.includes('含有率'))
)
}
@@ -448,9 +460,9 @@ const getHarmonicTypeName = () => {
const currentIndicator = indicatorList.value.find((item: any) => item.id === tableStore.table.params.indicator)
if (currentIndicator) {
if (currentIndicator.name.includes('电压谐波含有率')) {
if (currentIndicator.name.includes('电压')) {
return '电压'
} else if (currentIndicator.name.includes('电流谐波含有率')) {
} else if (currentIndicator.name.includes('电流')) {
return '电流'
}
}

View File

@@ -52,6 +52,7 @@ getDeviceTree().then(res => {
item2.icon = 'el-icon-List'
item2.color = config.getColorVal('elementUiPrimary')
item2.children.forEach((item3: any) => {
item3.pName = '治理设备'
item3.icon = 'el-icon-Platform'
item3.level = 2
item3.color = config.getColorVal('elementUiPrimary')
@@ -95,6 +96,7 @@ getDeviceTree().then(res => {
item2.icon = 'el-icon-List'
item2.color = config.getColorVal('elementUiPrimary')
item2.children.forEach((item3: any) => {
item3.pName = '监测设备'
item3.icon = 'el-icon-Platform'
item3.color = config.getColorVal('elementUiPrimary')
if (item3.comFlag === 1) {