修改测试bug

This commit is contained in:
GGJ
2024-10-28 09:52:23 +08:00
parent 3a74a08ec7
commit c078adad5a
3 changed files with 73 additions and 110 deletions

View File

@@ -19,7 +19,7 @@ import { ref, onMounted, nextTick, watch } from 'vue'
interface Props {
nextFlag?: boolean
theCurrentTime: boolean
theCurrentTime?: boolean
}
const props = withDefaults(defineProps<Props>(), {

View File

@@ -1,14 +1,7 @@
<template>
<div class="device-control-detail child-router">
<div class="custom-table-header">
<el-form :inline="true">
<el-form-item label="">
<el-page-header @back="$emit('close')">
<template #content>
<!-- <span class="text-large font-600 mr-3"></span> -->
</template>
</el-page-header>
</el-form-item>
<TableHeader :showSearch="false">
<template #select>
<el-form-item label="日期">
<DatePicker ref="datePickerRef"></DatePicker>
</el-form-item>
@@ -24,11 +17,13 @@
:value="item.id"></el-option>
</el-select>
</el-form-item>
<el-form-item>
<el-button type="primary" icon="el-icon-Search" @click="init">查询</el-button>
</el-form-item>
</el-form>
</div>
</template>
<template #operation>
<el-button type="primary" icon="el-icon-Search" @click="init">查询</el-button>
<el-button icon="el-icon-Back" @click="$emit('close')">返回</el-button>
</template>
</TableHeader>
<MyEchart :options="echartsData" v-if="echartsData" style="flex: 1" class="mt10" />
<el-empty description="暂无数据" v-else style="flex: 1" v-loading="loading"></el-empty>
</div>
@@ -38,6 +33,7 @@ import { ref, inject, nextTick, onMounted } from 'vue'
import { reactive } from 'vue'
import DatePicker from '@/components/form/datePicker/index.vue'
import { getDeviceDataTrend } from '@/api/cs-harmonic-boot/datatrend'
import TableHeader from '@/components/table/header/index.vue'
import MyEchart from '@/components/echarts/MyEchart.vue'
import { yMethod, exportCSV } from '@/utils/echartMethod'
import { ITEM_RENDER_EVT } from 'element-plus/es/components/virtual-list/src/defaults'
@@ -263,7 +259,7 @@ const init = () => {
const value2 = list[2] && list[2][index] ? list[2][index][1] : null;
const value3 = list[3] && list[3][index] ? list[3][index][1] : null;
return [item[0], item[1], value1, value2,value3];
return [item[0], item[1], value1, value2, value3];
});
exportCSV(echartsData.value.options.series.map(item => item.name), dataList, echartsData.value.title.text + '.csv')

View File

@@ -21,12 +21,8 @@
<p>测试项信息</p>
</div> -->
<el-tabs v-model="activeName" type="border-card" @click.self="handleClickTabs">
<el-tab-pane
v-for="(item, index) in deviceData?.records"
:label="item.itemName"
:name="item.id"
:key="index"
>
<el-tab-pane v-for="(item, index) in deviceData?.records" :label="item.itemName"
:name="item.id" :key="index">
<template #label>
<span class="custom-tabs-label">
<el-icon>
@@ -98,84 +94,47 @@
<div class="history_trend">
<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>
<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="请选择统计指标"
multiple
:multiple-limit="3"
>
<el-option
v-for="item in indexOptions"
:key="item.id"
:label="item.name"
:value="item.id"
></el-option>
<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="值类型">
<el-select
style="width: 12px !important"
v-model="searchForm.dataLevel"
>
<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>
<div v-for="(item, index) in countData" :key="index">
<el-form-item
for="-"
:label="item.name + '谐波次数'"
label-width="180px"
v-if="item.countOptions.length != 0"
>
<!-- multiple -->
<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>
</div>
<el-form-item for="-" v-for="(item, index) in countData"
:key="index" :label="item.name + '谐波次数'" label-width="180px"
v-show="item.countOptions.length != 0">
<!-- multiple -->
<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-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 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>
</template>
<template v-slot:operation>
<el-button
type="primary"
icon="el-icon-Download"
@click="handleExport"
>
<el-button type="primary" icon="el-icon-Download"
@click="handleExport">
数据导出
</el-button>
<el-button type="primary" icon="el-icon-Search" @click="init(true)">
@@ -187,19 +146,10 @@
<div class="history_title">
<p>{{ chartTitle }}</p>
</div>
<div
class="history_chart"
v-loading="loading"
:style="EcharHeight"
:key="EcharHeight.height"
ref="chartRef"
>
<MyEchart
ref="historyChart"
v-if="echartsData"
:isExport="true"
:options="echartsData"
/>
<div class="history_chart" v-loading="loading" :style="EcharHeight"
:key="EcharHeight.height" ref="chartRef">
<MyEchart ref="historyChart" v-if="echartsData" :isExport="true"
:options="echartsData" />
</div>
</div>
</div>
@@ -237,6 +187,7 @@ const dictData = useDictData()
defineOptions({
name: 'govern/device/planData/index'
})
const num = ref(0)
const config = useConfig()
color[0] = config.layout.elementUiPrimary[0]
//电压等级
@@ -309,7 +260,7 @@ const nodeClick = async (e: anyObj) => {
if (e == undefined) {
return
}
// onIndexChange([])
deviceData.value = []
historyDevId.value = e?.children && e?.children.length != 0 ? e?.children[0].id : e?.id
let id = e.pid ? e.pid : e.id
@@ -333,9 +284,9 @@ const nodeClick = async (e: anyObj) => {
}
})
}
if (searchForm.value.index.length == 0) {
searchForm.value.index = [indexOptions.value[0].id]
}
// if (searchForm.value.index.length == 0) {
// searchForm.value.index = [indexOptions.value[0].id]
// }
schemeTreeRef.value.getPlanData(deviceData.value)
await setTimeout(() => {
@@ -354,6 +305,14 @@ const nodeClick = async (e: anyObj) => {
})
}
}
const onIndexChange = (val: any) => {
num.value += 1
if (val.length == 0) {
searchForm.value.index = [indexOptions.value[0].id]
}
}
const dialogRef = ref()
const dailogForm = ref()
const handleOpen = (val: any) => {
@@ -509,9 +468,8 @@ const init = (flag: boolean) => {
const xname = params[0].value[0]
let str = `${xname}<br>`
params.forEach((el: any, index: any) => {
str += `${el.marker}${el.seriesName.split('(')[0]}${
el.value[1] ? el.value[1] + ' ' + el.value[2] : '-'
}<br>`
str += `${el.marker}${el.seriesName.split('(')[0]}${el.value[1] ? el.value[1] + ' ' + el.value[2] : '-'
}<br>`
})
return str
}
@@ -725,7 +683,7 @@ const handleExport = async () => {
return
}
const countData: any = ref([])
const tableHeaderRef = ref()
//根据选择的指标处理谐波次数
const formatCountOptions = (list: any) => {
if (list.length != 0) {
@@ -755,9 +713,14 @@ const formatCountOptions = (list: any) => {
}
})
})
} else {
countData.value = []
}
setTimeout(() => {
tableHeaderRef.value[activeName.value]?.computedSearchRow()
}, 100)
}
const flag = ref(false)
const selectChange = (e: boolean) => {
@@ -791,7 +754,7 @@ const handleChange = () => {
}
}
}
const tableHeaderRef = ref<any>()
const searchFormIndex = ref<any>()
watch(
() => searchForm.value.index,
@@ -799,7 +762,9 @@ watch(
if (val) {
let list = val
searchFormIndex.value = val
formatCountOptions(list)
setTimeout(() => {
formatCountOptions(list)
}, 100)
countData.value.map((item: any, key: any) => {
if (
list.findIndex((vv: any) => {
@@ -828,6 +793,7 @@ onMounted(() => {
::v-deep .el-select {
min-width: 120px;
}
.device-manage {
display: flex;
height: calc(100vh - 100px);
@@ -867,6 +833,7 @@ onMounted(() => {
.history_title {
width: 100%;
padding-left: 10px;
p {
height: 32px;
line-height: 32px;