修改测试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 { interface Props {
nextFlag?: boolean nextFlag?: boolean
theCurrentTime: boolean theCurrentTime?: boolean
} }
const props = withDefaults(defineProps<Props>(), { const props = withDefaults(defineProps<Props>(), {

View File

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

View File

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