修改测试bug

This commit is contained in:
GGJ
2024-12-11 11:33:44 +08:00
parent 22d85dfca1
commit 26c971f3b0
10 changed files with 197 additions and 108 deletions

View File

@@ -1,5 +1,6 @@
<template>
<div class="default-main device-manage" :style="{ height: pageHeight.height }">
<!-- @node-change="nodeClick" -->
<schemeTree @node-change="nodeClick" @node-click="nodeClick" @init="nodeClick" @onAdd="onAdd" @bind="bind"
ref="schemeTreeRef"></schemeTree>
@@ -102,64 +103,71 @@
<div v-if="JSON.stringify(echartsData) != '{}' && deviceData?.records?.length != 0">
<!-- <h3 class="mt10 mb10">历史趋势</h3> -->
<el-tabs type="border-card" class="mt10">
<el-tab-pane label="历史趋势"> <div class="history_trend" v-if="titleList != '(未绑定数据)'">
<div class="history_header" ref="headerRef">
<!-- <el-form :model="searchForm" class="history_select" id="history_select"> -->
<TableHeader :showSearch="false" ref="tableHeaderRef" @selectChange="selectChange">
<template v-slot:select :key="num">
<el-form-item for="-" label="统计指标">
<el-select style="min-width: 200px" collapse-tags collapse-tags-tooltip
v-model="searchForm.index" placeholder="请选择统计指标" @change="onIndexChange($event)"
multiple :multiple-limit="3">
<el-option v-for="item in indexOptions" :key="item.id" :label="item.name"
:value="item.id"></el-option>
</el-select>
</el-form-item>
<el-form-item for="-" label="统计类型" label-width="80px">
<el-select style="width: 120px" v-model="searchForm.type" placeholder="请选择值类型">
<el-option v-for="item in typeOptions" :key="item.id" :label="item.name"
:value="item.id"></el-option>
</el-select>
</el-form-item>
<el-form-item for="-" label="值类型">
<el-select style="width: 12px !important" v-model="searchForm.dataLevel">
<el-option value="Primary" label="一次值"></el-option>
<el-option value="Secondary" label="二次值"></el-option>
</el-select>
</el-form-item>
<el-form-item for="-" v-for="(item, index) in countData" :key="index"
:label="item.name.includes('次数') ? item.name : item.name.includes('幅值') ? item.name.slice(0, -2) + '次数' : item.name + '谐波次数'"
v-show="item.countOptions.length != 0">
<el-tab-pane label="历史趋势">
<div class="history_trend" v-if="titleList != '(未绑定数据)'">
<div class="history_header" ref="headerRef">
<!-- <el-form :model="searchForm" class="history_select" id="history_select"> -->
<TableHeader :showSearch="false" ref="tableHeaderRef" @selectChange="selectChange">
<template v-slot:select :key="num">
<el-form-item for="-" label="统计指标">
<el-select style="min-width: 200px" collapse-tags collapse-tags-tooltip
v-model="searchForm.index" placeholder="请选择统计指标"
@change="onIndexChange($event)" multiple :multiple-limit="3">
<el-option v-for="item in indexOptions" :key="item.id"
:label="item.name" :value="item.id"></el-option>
</el-select>
</el-form-item>
<el-form-item for="-" label="统计类型" label-width="80px">
<el-select style="width: 120px" v-model="searchForm.type"
placeholder="请选择值类型">
<el-option v-for="item in typeOptions" :key="item.id" :label="item.name"
:value="item.id"></el-option>
</el-select>
</el-form-item>
<el-form-item for="-" label="值类型">
<el-select style="width: 12px !important" v-model="searchForm.dataLevel">
<el-option value="Primary" label="一次值"></el-option>
<el-option value="Secondary" label="二次值"></el-option>
</el-select>
</el-form-item>
<el-form-item for="-" v-for="(item, index) in countData" :key="index"
:label="item.name.includes('次数') ? item.name : item.name.includes('幅值') ? item.name.slice(0, -2) + '次数' : item.name + '谐波次数'"
v-show="item.countOptions.length != 0">
<el-select v-model="item.count" collapse-tags collapse-tags-tooltip
placeholder="请选择谐波次数" style="width: 120px">
<el-option v-for="vv in item.countOptions" :key="vv" :label="vv"
:value="vv"></el-option>
</el-select>
</el-form-item>
<el-select v-model="item.count" collapse-tags collapse-tags-tooltip
placeholder="请选择谐波次数" style="width: 120px">
<el-option v-for="vv in item.countOptions" :key="vv" :label="vv"
:value="vv"></el-option>
</el-select>
</el-form-item>
</template>
<template v-slot:operation>
<!-- <el-button type="primary" icon="el-icon-Download" @click="handleExport">
</template>
<template v-slot:operation>
<!-- <el-button type="primary" icon="el-icon-Download" @click="handleExport">
数据导出
</el-button> -->
<el-button type="primary" icon="el-icon-Search" @click="init(true)">查询</el-button>
</template>
</TableHeader>
</div>
<!-- <div class="history_title">
<el-button type="primary" icon="el-icon-Search"
@click="init(true)">查询</el-button>
</template>
</TableHeader>
</div>
<!-- <div class="history_title">
<p>{{ chartTitle }}</p>
</div> -->
<div class="history_chart mt5" v-loading="loading" :style="EcharHeight" :key="EcharHeight.height"
ref="chartRef">
<MyEchart ref="historyChart" v-if="echartsData" :isExport="true" :options="echartsData" />
</div>
</div>
<el-empty :style="EcharHeight" v-else description="未绑定数据" /></el-tab-pane>
<el-tab-pane label="暂态数据">Config</el-tab-pane>
<div class="history_chart mt5" v-loading="loading" :style="EcharHeight"
:key="EcharHeight.height" ref="chartRef">
<MyEchart ref="historyChart" v-if="echartsData" :isExport="true"
:options="echartsData" />
</div>
</div>
<el-empty :style="EcharHeight" v-else description="未绑定数据" />
</el-tab-pane>
<el-tab-pane label="暂态数据">
暂态数据
</el-tab-pane>
</el-tabs>
</div>
</div>
<el-empty v-else description="请选择设备" class="device-manage-right" />
@@ -310,6 +318,14 @@ const nodeClick = async (e: anyObj) => {
}
const onIndexChange = (val: any) => {
num.value += 1
let pp: any = []
indexOptions.value.forEach((item: any) => {
const filteredResult = val.filter(vv => item.id == vv);
if (filteredResult.length > 0) {
pp.push(filteredResult[0]);
}
})
searchForm.value.index = pp
// if (val.length == 0) {
// searchForm.value.index = [indexOptions.value[0].id]
// }
@@ -469,7 +485,7 @@ const init = (flag: boolean) => {
if (item.phase == null) {
key = item.unit
} else {
key = item.unit
key = item.anotherName
}
if (!acc[key]) {
acc[key] = []
@@ -493,6 +509,7 @@ const init = (flag: boolean) => {
// textStyle: {
// color: '#000',
// fontSize: '16'
// },
// },
@@ -543,9 +560,18 @@ const init = (flag: boolean) => {
const xname = params[0].value[0]
let str = `${xname}<br>`
params.forEach((el: any, index: any) => {
let marker = ''
str += `${el.marker}${el.seriesName.split('(')[0]}${el.value[1] ? el.value[1] + ' ' + (el.value[2] || '') : '-'
if (el.value[3] == 'dashed') {
for (let i = 0; i < 3; i++) {
marker+= `<span style="display:inline-block;border: 2px ${el.color} solid;margin-right:5px;width:10px;height:0px;background-color:#ffffff00;"></span>`
}
} else {
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] ? el.value[1] + ' ' + (el.value[2] || '') : '-'
}<br>`
})
return str
}
@@ -590,13 +616,15 @@ const init = (flag: boolean) => {
...(index > 0 ? right : null)
})
})
console.log("🚀 ~ result.forEach ~ result:", result)
// console.log("🚀 ~ result.forEach ~ result:", result)
let ABCName = [...new Set(chartsList.map((item: any) => { return item.anotherName == '电压负序分量' ? '电压不平衡' : item.anotherName == '电压正序分量' ? '电压不平衡' : item.anotherName == '电压零序分量' ? '电压不平衡' : item.anotherName }))];
// console.log("🚀 ~ result.forEach ~ result:", result)
result.forEach((item: any, index: any) => {
let yMethodList: any = []
@@ -623,6 +651,10 @@ const init = (flag: boolean) => {
ABCList.forEach((kk: any) => {
let colorName = kk[0].phase?.charAt(0).toUpperCase()
@@ -632,9 +664,9 @@ const init = (flag: boolean) => {
let seriesList: any = []
kk.forEach((cc: any) => {
if (cc.statisticalData !== null) {
yMethodList.push(cc.statisticalData?.toFixed(2) - 0)
yMethodList.push(cc.statisticalData?.toFixed(2))
}
seriesList.push([cc.time, cc.statisticalData?.toFixed(2), cc.unit])
seriesList.push([cc.time, cc.statisticalData?.toFixed(2), cc.unit, lineStyle[lineS].type])
})
echartsData.value.options.series.push({
name: kk[0].phase
@@ -646,7 +678,7 @@ const init = (flag: boolean) => {
symbol: 'none',
lineStyle: lineStyle[lineS],
data: seriesList,
yAxisIndex: index
yAxisIndex: setList.indexOf(kk[0].unit)
})
})
@@ -793,6 +825,7 @@ const countData: any = ref([])
const tableHeaderRef = ref()
//根据选择的指标处理谐波次数
const formatCountOptions = (list: any) => {
countData.value = []
if (list.length != 0) {
list.map((item: any, index: any) => {
if (!countData.value[index]) {
@@ -852,7 +885,7 @@ const formatCountOptions = (list: any) => {
const flag = ref(false)
const selectChange = (e: boolean) => {
flag.value = e
console.log("🚀 ~ handleChange ~ activeColName.value:", activeColName.value, flag.value)
// console.log("🚀 ~ handleChange ~ activeColName.value:", activeColName.value, flag.value)
if (activeColName.value == '0') {
if (flag.value) {
@@ -888,7 +921,11 @@ const handleChange = () => {
watch(
() => searchForm.value.index,
(val: any, oldval: any) => {
if (val) {
let list = val
setTimeout(() => {
formatCountOptions(list)
@@ -902,6 +939,7 @@ watch(
countData.value.splice(key, 1)
}
})
init(false)
}
},