修改 测试bug

This commit is contained in:
GGJ
2024-11-12 11:41:46 +08:00
parent c56c301365
commit 299301d4f7
4 changed files with 182 additions and 219 deletions

View File

@@ -20,7 +20,7 @@
<!-- <div class="history_title">
<p>测试项信息</p>
</div> -->
<el-tabs v-model="activeName" type="border-card" @click.self="handleClickTabs">
<el-tabs v-model="activeName" type="border-card" @click="handleClickTabs">
<el-tab-pane v-for="(item, index) in deviceData?.records" :label="item.itemName"
:name="item.id" :key="index">
<template #label>
@@ -104,7 +104,7 @@
<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">
<template v-slot:select >
<el-form-item for="-" label="统计指标">
<el-select style="min-width: 200px" collapse-tags collapse-tags-tooltip
v-model="searchForm.index" placeholder="请选择统计指标" @change="onIndexChange($event)"
@@ -135,7 +135,7 @@
:value="vv"></el-option>
</el-select>
</el-form-item>
</template>
<template v-slot:operation>
<el-button type="primary" icon="el-icon-Download" @click="handleExport">
@@ -145,10 +145,10 @@
</template>
</TableHeader>
</div>
<div class="history_title">
<!-- <div class="history_title">
<p>{{ chartTitle }}</p>
</div>
<div class="history_chart" v-loading="loading" :style="EcharHeight" :key="EcharHeight.height"
</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>
@@ -176,6 +176,7 @@ import { yMethod } from '@/utils/echartMethod'
import { color, gradeColor3 } from '@/components/echarts/color'
import TableHeader from '@/components/table/header/index.vue'
import { useConfig } from '@/stores/config'
import { getDeviceList } from '@/api/cs-device-boot/planData'
const dictData = useDictData()
defineOptions({
name: 'govern/device/planData/index'
@@ -189,7 +190,7 @@ const voltageLevelList = dictData.getBasicData('Dev_Voltage_Stand')
const volConTypeList = dictData.getBasicData('Dev_Connect')
//值类型
const pageHeight = mainHeight(20)
const EcharHeight = ref(mainHeight(510))
const EcharHeight = ref(mainHeight(458))
const loading = ref(false)
const searchForm: any = ref({})
const typeOptions = [
@@ -343,9 +344,11 @@ const refreshTree = () => {
const range = (start: any, end: any, step: any) => {
return Array.from({ length: (end - start) / step + 1 }, (_, i) => start + i * step)
}
const titleList: any = ref('')
const init = (flag: boolean) => {
titleList.value = ''
let list: any = []
//颜色数组
if (historyDevId.value && legendDictList.value && legendDictList.value.selectedList) {
@@ -358,6 +361,7 @@ const init = (flag: boolean) => {
})
})
//选择的指标使用方法处理
formatCountOptions(searchForm.value.index)
//查询历史趋势
@@ -377,7 +381,7 @@ const init = (flag: boolean) => {
middleTitle = ''
}
let indexList = searchForm.value.index
chartTitle.value = deviceData.value.itemName + '_' + middleTitle + '_'
chartTitle.value = ''//deviceData.value.itemName + '_' + middleTitle + '_'
indexList.map((item: any, indexs: any) => {
indexOptions.value.map((vv: any) => {
if (vv.id == item) {
@@ -385,6 +389,7 @@ const init = (flag: boolean) => {
}
})
})
let lists: any = []
let frequencys: any = null
countData.value.map((item: any, index: any) => {
@@ -398,6 +403,10 @@ const init = (flag: boolean) => {
frequencys: frequencys && frequencys.length != 0 ? [frequencys] : []
}
})
let obj = {
devId: historyDevId.value,
list: lists,
@@ -409,6 +418,17 @@ const init = (flag: boolean) => {
return
}
if (flag) {
getDeviceList({
id: historyDevId.value,
isTrueFlag: 1
}).then(res => {
if (res.data.length == 0) {
titleList.value = '(未绑定数据)'
}
chartTitle.value = chartTitle.value + titleList.value
})
loading.value = true
getHistoryTrend(obj)
.then((res: any) => {
@@ -443,6 +463,10 @@ const init = (flag: boolean) => {
}
echartsData.value = {
title:{
text:chartTitle.value,
left:'0',
},
legend: {
itemWidth: 20,
itemHeight: 10,
@@ -764,32 +788,35 @@ const formatCountOptions = (list: any) => {
const flag = ref(false)
const selectChange = (e: boolean) => {
flag.value = e
if (activeColName.value == '0') {
if (flag.value) {
EcharHeight.value = mainHeight(565)
EcharHeight.value = mainHeight(502)
} else {
EcharHeight.value = mainHeight(510)
EcharHeight.value = mainHeight(458)
}
} else {
if (flag.value) {
EcharHeight.value = mainHeight(365)
EcharHeight.value = mainHeight(332)
} else {
EcharHeight.value = mainHeight(310)
EcharHeight.value = mainHeight(280)
}
}
}
const handleChange = () => {
console.log("🚀 ~ handleChange ~ activeColName.value:", activeColName.value,flag.value)
if (activeColName.value == '0') {
if (flag.value) {
EcharHeight.value = mainHeight(565)
EcharHeight.value = mainHeight(502)
} else {
EcharHeight.value = mainHeight(510)
EcharHeight.value = mainHeight(458)
}
} else {
if (flag.value) {
EcharHeight.value = mainHeight(365)
EcharHeight.value = mainHeight(332)
} else {
EcharHeight.value = mainHeight(310)
EcharHeight.value = mainHeight(280)
}
}
}