修改测试问题

This commit is contained in:
guanj
2026-06-30 08:38:05 +08:00
parent 490b52b525
commit 536f22584d
103 changed files with 3220 additions and 2394 deletions

View File

@@ -477,10 +477,6 @@ const handleTolerableEventClick = async (row: any) => {
})
}
// 不可容忍事件点击处理函数
const handleIntolerableEventClick = (params: any) => {
console.log('不可容忍事件详情:', params)
}
watch(
() => prop.timeKey,

View File

@@ -409,10 +409,6 @@ const handleTolerableEventClick = async (row: any) => {
})
}
// 不可容忍事件点击处理函数
const handleIntolerableEventClick = (params: any) => {
console.log('不可容忍事件详情:', params)
}
watch(
() => prop.timeKey,

View File

@@ -141,7 +141,6 @@ provide('tableStore', tableStore)
tableStore.table.params.sortBy = ''
tableStore.table.params.orderBy = ''
const open = async (row: any, searchBeginTime: any, searchEndTime: any, data: any = []) => {
console.log("🚀 ~ open ~ row:", row)
dialogVisible.value = true
// initCSlineList()
options.value = data

View File

@@ -148,7 +148,6 @@ const open = async (row: any) => {
// 点击行
const cellClickEvent = ({ row, column }: any) => {
console.log(row, '1111')
if (column.field != 'name' && column.field != 'time') {
harmonicRatioRef.value.openDialog(row)
}

View File

@@ -169,18 +169,85 @@ const formatExceedanceValue = (value: any) => {
return value
}
const COLOR_NOT_EXCEED = '#2ab914'
const COLOR_EXCEED = '#e26257'
const mapExceedanceChartValue = (val: number) => {
if (val == 1) return 1
if (val == 0) return 10
return val
}
const getExceedanceChartText = (val: number | string) => {
if (val === 1 || val === '1') return '越限'
if (val === 10 || val === '10') return '不越限'
return formatExceedanceValue(val)
}
/** 越限阶梯线分段着色:不越限绿色,越限红色 */
const buildColoredExceedanceSeries = (data: any[], seriesName: string) => {
const points = data.filter(item => item[1] != null).map(item => [item[0], mapExceedanceChartValue(item[1])])
if (points.length === 0) return []
const series: any[] = []
let i = 0
while (i < points.length) {
const value = points[i][1]
const color = value === 1 ? COLOR_EXCEED : COLOR_NOT_EXCEED
const segment: any[] = []
if (i > 0 && points[i][1] !== points[i - 1][1]) {
segment.push([points[i][0], points[i - 1][1]])
}
segment.push(points[i])
let j = i + 1
while (j < points.length && points[j][1] === value) {
segment.push(points[j])
j++
}
if (j < points.length) {
segment.push([points[j][0], value])
}
series.push({
name: seriesName,
type: 'line',
step: 'end',
showSymbol: false,
clip: true,
data: segment,
yAxisIndex: 1,
lineStyle: { color, width: 2 }
})
i = j
}
return series
}
const qualityChartData = ref<any[]>([])
const getSeriesForCsvExport = () => {
const indicatorSeriesName = indicatorList.value?.find(
(item: any) => item.id === tableStore.table.params.indicator
)?.name
return echartList.value.options.series.map((item: any) => ({
name: item.name,
data: item.data?.map((point: any) => [
point[0],
item.name === indicatorSeriesName ? formatExceedanceValue(point[1]) : point[1],
point[2]
])
}))
const powerName = powerList.value?.find((item: any) => item.id === tableStore.table.params.power)?.name
const powerSeries = echartList.value.options.series.find((item: any) => item.type === 'bar')
return [
{
name: powerSeries?.name || powerName,
data: powerSeries?.data || []
},
{
name: indicatorSeriesName,
data: qualityChartData.value.map(point => [point[0], formatExceedanceValue(point[1]), point[2]])
}
]
}
const getChartExportFileName = () => ({
@@ -218,19 +285,17 @@ const setEchart = () => {
trigger: 'axis',
formatter: function (params: any) {
let result = params[0].axisValueLabel
params.forEach((item: any) => {
if (item.seriesName === indicatorName) {
// 对于电能质量指标格式化Y轴值显示
let valueText = formatExceedanceValue(item.value[1])
if (valueText === item.value[1]) {
valueText = item.value[1]
}
result += `<br/>${item.marker}${item.seriesName}: ${valueText}`
} else {
// 对于功率数据,正常显示数值
result += `<br/>${item.marker}${item.seriesName}: ${item.value[1]} ${item.value[2]}`
}
})
const powerItem = params.find((item: any) => item.seriesName === powerName)
if (powerItem) {
result += `<br/>${powerItem.marker}${powerItem.seriesName}: ${powerItem.value[1]} ${powerItem.value[2] || ''}`
}
const indicatorItems = params.filter(
(item: any) => item.seriesName === indicatorName && item?.data?.[1] != null
)
if (indicatorItems.length) {
const item = indicatorItems[indicatorItems.length - 1]
result += `<br/>${item.marker}${indicatorName}: ${getExceedanceChartText(item.data[1])}`
}
return result
}
},
@@ -244,23 +309,47 @@ const setEchart = () => {
}
}
},
dataZoom: [
{
type: 'inside',
height: 13,
start: 0,
bottom: '20px',
end: 100,
filterMode: 'filter'
},
{
start: 0,
height: 13,
bottom: '20px',
end: 100,
filterMode: 'filter'
}
],
yAxis: [
{},
indicatorName
? {
min: 0,
max: 1,
axisLabel: {
formatter: function (value: number) {
if (value === 0) {
return '不越限'
} else if (value === 1) {
return '越限'
}
return value
}
}
}
position: 'right',
min: 0,
max: 11,
interval: 1,
splitLine: {
lineStyle: {
color: ['#ccc'],
type: 'dashed',
opacity: 0
}
},
axisLabel: {
formatter: function (value: number) {
if (value === 1) return '越限'
if (value === 10) return '不越限'
return ''
}
}
}
: {}
],
// grid: {
@@ -287,7 +376,7 @@ const setEchart = () => {
series: [
{
type: 'bar',
name: powerName, // 动态设置功率名称
name: powerName,
data: [],
clip: true,
itemStyle: {
@@ -302,15 +391,6 @@ const setEchart = () => {
}
},
yAxisIndex: 0
},
{
name: indicatorName, // 动态设置指标名称
type: 'line',
step: 'end',
showSymbol: false,
clip: true,
data: [],
yAxisIndex: 1
}
]
}
@@ -356,9 +436,12 @@ const setEchart = () => {
const hasPowerData = processedPowerData.length > 0 && processedPowerData.some(item => item[1] !== null)
const hasQualityData = processedQualityData.length > 0 && processedQualityData.some(item => item[1] !== null)
// 更新图表配置
qualityChartData.value = processedQualityData
echartList.value.options.series = [
echartList.value.options.series[0],
...buildColoredExceedanceSeries(processedQualityData, indicatorName)
]
echartList.value.options.series[0].data = processedPowerData
echartList.value.options.series[1].data = processedQualityData
} catch (error) {
console.error('处理图表数据时出错:', error)
}

View File

@@ -29,7 +29,7 @@
<template #footer>
<span class="dialog-footer">
<el-button @click="uploadDialogVisible = false">取消</el-button>
<el-button type="primary" @click="handleUpload">确定</el-button>
<el-button type="primary" @click="handleUpload" :loading="loading">确定</el-button>
</span>
</template>
</el-dialog>
@@ -66,7 +66,7 @@ const uploadDialogVisible = ref(false)
const currentUploadRow = ref<any>(null)
const uploadRef = ref()
const fileList = ref([])
const loading = ref(false)
const selectChange = (showSelect: any, height: any, datePickerValue?: any) => {
headerHeight.value = height
@@ -139,20 +139,13 @@ const tableStore: any = new TableStore({
render: 'tag',
width: 90,
custom: {
// 0运行1检修2停运3调试4退运
0: 'success',
1: 'warning',
2: 'danger',
3: 'warning',
4: 'info',
null: 'info'
},
replaceValue: {
0: '运行',
1: '检修',
2: '停运',
3: '调试',
4: '退运',
0: '在线',
2: '离线',
null: '/'
}
},
@@ -405,7 +398,7 @@ const beforeUpload = (file: any) => {
const handleUpload = async () => {
// return
loading.value = true
const formData = new FormData()
formData.append('file', fileList.value[0]?.raw)
formData.append('lineId', currentUploadRow.value?.lineId || currentUploadRow.value?.id || '')
@@ -416,9 +409,12 @@ const handleUpload = async () => {
uploadDialogVisible.value = false
tableStore.index()
return Promise.resolve(result)
} catch (error: any) {
ElMessage.error('上传失败: ' + (error.message || '未知错误'))
return Promise.reject(error)
} finally {
loading.value = false
}
}

View File

@@ -122,7 +122,6 @@ provide('tableStore', tableStore)
// 点击行
const cellClickEvent = ({ row, column }: any) => {
if (column.field != 'name') {
console.log(row)
OverLimitDetailsRef.value.open(row)
}
}