修改测试bug

This commit is contained in:
GGJ
2024-10-22 15:55:24 +08:00
parent 25ffc10857
commit aed37ba624
4 changed files with 193 additions and 252 deletions

View File

@@ -6,12 +6,12 @@ export const yMethod = (arr: any) => {
let min = 0 let min = 0
maxValue = Math.max(...arr) maxValue = Math.max(...arr)
minValue = Math.min(...arr) minValue = Math.min(...arr)
if (maxValue > 1000 ||minValue < -1000) { if (maxValue > 1000 || minValue < -1000) {
max = Math.ceil(maxValue / 100) * 100 max = Math.ceil(maxValue / 100) * 100
if (minValue == 0) { if (minValue == 0) {
min = 0 min = 0
} else { } else {
min = (Math.floor(minValue / 100) ) * 100 min = Math.floor(minValue / 100) * 100
} }
} else { } else {
max = Math.ceil(maxValue / 10) * 10 max = Math.ceil(maxValue / 10) * 10
@@ -25,26 +25,30 @@ export const yMethod = (arr: any) => {
} }
return [min, max] return [min, max]
} }
/**
* title['A相','B相',]
* data[[1,2],[3,4]]
*/
// 导出csv文件 // 导出csv文件
const convertToCSV = (title: object,data:any) => { const convertToCSV = (title: object, data: any) => {
console.log("🚀 ~ convertToCSV ~ data:", data) console.log('🚀 ~ convertToCSV ~ data:', data)
let csv = ''; let csv = ''
// 添加列头 // 添加列头
csv += ','+title.join(',') + '\n'; csv += ',' + title.join(',') + '\n'
// 遍历数据并添加到CSV字符串中 // 遍历数据并添加到CSV字符串中
data.map(item => { data?.map(item => {
csv += item.join(',') + '\n'; csv += item.join(',') + '\n'
})
}); return csv
return csv; }
export const exportCSV = (title: object, data: any, filename: string) => {
const csv = convertToCSV(title, data)
const blob = new Blob([csv], { type: 'text/csv;charset=utf-8;' })
const link = document.createElement('a')
link.href = URL.createObjectURL(blob)
link.download = filename
link.click()
// 释放URL对象
URL.revokeObjectURL(link.href)
} }
export const exportCSV = (title: object,data: any,filename:string) => {
const csv = convertToCSV(title,data);
const blob = new Blob([csv], { type: 'text/csv;charset=utf-8;' });
const link = document.createElement('a');
link.href = URL.createObjectURL(blob);
link.download = filename;
link.click();
// 释放URL对象
URL.revokeObjectURL(link.href);
}

View File

@@ -1,10 +1,6 @@
<template> <template>
<div <div class="default-main device-control" :style="{ height: pageHeight.height }" v-loading="loading"
class="default-main device-control" style="position: relative">
:style="{ height: pageHeight.height }"
v-loading="loading"
style="position: relative"
>
<PointTree @node-click="nodeClick" @init="nodeClick" @pointTypeChange="pointTypeChange"></PointTree> <PointTree @node-click="nodeClick" @init="nodeClick" @pointTypeChange="pointTypeChange"></PointTree>
<div class="device-control-right" v-if="deviceData"> <div class="device-control-right" v-if="deviceData">
<el-descriptions title="设备基本信息" class="mb10" :column="3" border> <el-descriptions title="设备基本信息" class="mb10" :column="3" border>
@@ -18,12 +14,8 @@
<el-button v-if="deviceType == '1'" type="primary" icon="el-icon-Monitor" @click="handleaddDevice"> <el-button v-if="deviceType == '1'" type="primary" icon="el-icon-Monitor" @click="handleaddDevice">
在线补召 在线补召
</el-button> </el-button>
<el-button <el-button v-if="deviceType == '1'" type="primary" icon="el-icon-Tickets"
v-if="deviceType == '1'" @click="handleAnalysisList">
type="primary"
icon="el-icon-Tickets"
@click="handleAnalysisList"
>
补召日志 补召日志
</el-button> </el-button>
</template> </template>
@@ -48,13 +40,8 @@
</el-descriptions-item> </el-descriptions-item>
</el-descriptions> </el-descriptions>
<el-tabs v-model="dataSet" type="border-card" class="device-control-box-card" @tab-click="handleClick"> <el-tabs v-model="dataSet" type="border-card" class="device-control-box-card" @tab-click="handleClick">
<el-tab-pane <el-tab-pane lazy :label="item.name" :name="item.id" v-for="(item, index) in deviceData.dataSetList"
lazy :key="index">
:label="item.name"
:name="item.id"
v-for="(item, index) in deviceData.dataSetList"
:key="index"
>
<template #label> <template #label>
<span class="custom-tabs-label"> <span class="custom-tabs-label">
<el-icon> <el-icon>
@@ -63,59 +50,44 @@
<DataAnalysis v-if="item.name.includes('趋势数据')" /> <DataAnalysis v-if="item.name.includes('趋势数据')" />
<Timer v-if="item.name.includes('实时数据')" /> <Timer v-if="item.name.includes('实时数据')" />
<Monitor v-if="item.name.includes('暂态事件')" /> <Monitor v-if="item.name.includes('暂态事件')" />
<Odometer <Odometer v-if="
v-if=" item.name != 'APF模块数据' &&
item.name != 'APF模块数据' && item.name != '历史APF模块数据' &&
item.name != '历史APF模块数据' && !item.name.includes('历史监测') &&
!item.name.includes('历史监测') && !item.name.includes('趋势数据') &&
!item.name.includes('趋势数据') && !item.name.includes('实时数据') &&
!item.name.includes('实时数据') && !item.name.includes('暂态事件')
!item.name.includes('暂态事件') " />
" <Histogram v-if="
/> item.name != 'APF模块数据' &&
<Histogram item.name != '历史APF模块数据' &&
v-if=" item.name.includes('历史监测') &&
item.name != 'APF模块数据' && !item.name.includes('趋势数据') &&
item.name != '历史APF模块数据' && !item.name.includes('实时数据') &&
item.name.includes('历史监测') && !item.name.includes('暂态事件')
!item.name.includes('趋势数据') && " />
!item.name.includes('实时数据') &&
!item.name.includes('暂态事件')
"
/>
</el-icon> </el-icon>
<span>{{ item.name }}</span> <span>{{ item.name }}</span>
</span> </span>
</template> </template>
</el-tab-pane> </el-tab-pane>
<TableHeader <TableHeader :showSearch="false" v-if="
:showSearch="false" (dataSet.indexOf('_trenddata') == -1 &&
v-if=" dataSet.indexOf('_realtimedata') == -1 &&
(dataSet.indexOf('_trenddata') == -1 && dataSet.indexOf('_event') == -1) ||
dataSet.indexOf('_realtimedata') == -1 && realTimeFlag
dataSet.indexOf('_event') == -1) || ">
realTimeFlag
"
>
<template #select> <template #select>
<el-form-item label="日期" v-show="dataSet.indexOf('_history') != -1"> <el-form-item label="日期" v-show="dataSet.indexOf('_history') != -1">
<DatePicker ref="datePickerRef"></DatePicker> <DatePicker ref="datePickerRef"></DatePicker>
</el-form-item> </el-form-item>
<el-form-item label="指标" v-show="!realTimeFlag"> <el-form-item label="指标" v-show="!realTimeFlag">
<el-input <el-input style="width: 160px" v-model="formInline.searchValue" autocomplete="off" clearable
style="width: 160px" placeholder="请输入关键词"></el-input>
v-model="formInline.searchValue"
autocomplete="off"
clearable
placeholder="请输入关键词"
></el-input>
</el-form-item> </el-form-item>
<el-form-item label="值类型"> <el-form-item label="值类型">
<el-select <el-select style="min-width: 120px !important" v-model="formInline.dataLevel"
style="min-width: 120px !important" :disabled="dataLevel == 'Primary' && deviceType == '0'">
v-model="formInline.dataLevel"
:disabled="dataLevel == 'Primary' && deviceType == '0'"
>
<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>
@@ -129,48 +101,32 @@
<el-button type="primary" v-if="realTimeFlag" :icon="DataLine" @click="handleTrend"> <el-button type="primary" v-if="realTimeFlag" :icon="DataLine" @click="handleTrend">
谐波频谱 谐波频谱
</el-button> </el-button>
<el-button <el-button type="primary" v-if="realTimeFlag" :icon="TrendCharts"
type="primary" @click="handleHarmonicSpectrum">
v-if="realTimeFlag"
:icon="TrendCharts"
@click="handleHarmonicSpectrum"
>
实时趋势 实时趋势
</el-button> </el-button>
</template> </template>
</TableHeader> </TableHeader>
<div <div style="height: calc(100vh - 300px)" v-if="
style="height: calc(100vh - 300px)" dataSet.indexOf('_trenddata') == -1 &&
v-if=" dataSet.indexOf('_realtimedata') == -1 &&
dataSet.indexOf('_trenddata') == -1 && dataSet.indexOf('_event') == -1 &&
dataSet.indexOf('_realtimedata') == -1 && tableData.length == 0
dataSet.indexOf('_event') == -1 && " v-loading="tableLoading"></div>
tableData.length == 0 <div style="overflow: auto" :style="{ height: tableHeight }" v-if="
" dataSet.indexOf('_trenddata') == -1 &&
v-loading="tableLoading" dataSet.indexOf('_realtimedata') == -1 &&
></div> dataSet.indexOf('_event') == -1 &&
<div tableData.length != 0
style="overflow: auto" ">
:style="{ height: tableHeight }"
v-if="
dataSet.indexOf('_trenddata') == -1 &&
dataSet.indexOf('_realtimedata') == -1 &&
dataSet.indexOf('_event') == -1 &&
tableData.length != 0
"
>
<!-- 循环渲染的card 最新数据/历史数据显示 --> <!-- 循环渲染的card 最新数据/历史数据显示 -->
<div class="content" v-loading="tableLoading"> <div class="content" v-loading="tableLoading">
<el-card class="box-card" v-for="(item, index) in tableData" :key="index"> <el-card class="box-card" v-for="(item, index) in tableData" :key="index">
<template #header> <template #header>
<div class="clearfix"> <div class="clearfix">
<span style="flex: 1">{{ item.name }}</span> <span style="flex: 1">{{ item.name }}</span>
<Icon <Icon name="el-icon-TrendCharts" class="ml10" @click="getDeviceDataTrend(item)"
name="el-icon-TrendCharts" style="font-size: 26px; cursor: pointer; color: #fff"></Icon>
class="ml10"
@click="getDeviceDataTrend(item)"
style="font-size: 26px; cursor: pointer; color: #fff"
></Icon>
</div> </div>
</template> </template>
<!-- 模块数据 --> <!-- 模块数据 -->
@@ -185,49 +141,37 @@
</div> </div>
<div v-else-if="item.children.length"> <div v-else-if="item.children.length">
<div style="display: flex; align-items: center"> <div style="display: flex; align-items: center">
<el-tag <el-tag effect="dark" type="danger" style="width: 40px; text-align: center"
effect="dark" class="mr10">
type="danger"
style="width: 40px; text-align: center"
class="mr10"
>
MAX MAX
</el-tag> </el-tag>
{{ {{
item.children[0].maxValue === 3.1415956 || item.children[0].maxValue === 3.1415956 ||
typeof item.children[0].maxValue != 'number' typeof item.children[0].maxValue != 'number'
? '暂无数据' ? '暂无数据'
: item.children[0].maxValue : item.children[0].maxValue
}} }}
</div> </div>
<div style="display: flex; align-items: center" class="mt10"> <div style="display: flex; align-items: center" class="mt10">
<el-tag <el-tag effect="dark" type="success" style="width: 40px; text-align: center"
effect="dark" class="mr10">
type="success"
style="width: 40px; text-align: center"
class="mr10"
>
AVG AVG
</el-tag> </el-tag>
{{ {{
item.children[0].avgValue === 3.1415956 || item.children[0].avgValue === 3.1415956 ||
typeof item.children[0].avgValue != 'number' typeof item.children[0].avgValue != 'number'
? '暂无数据' ? '暂无数据'
: item.children[0].avgValue : item.children[0].avgValue
}} }}
</div> </div>
<div style="display: flex; align-items: center" class="mt10"> <div style="display: flex; align-items: center" class="mt10">
<el-tag <el-tag effect="dark" type="warning" style="width: 40px; text-align: center"
effect="dark" class="mr10">
type="warning"
style="width: 40px; text-align: center"
class="mr10"
>
MIN MIN
</el-tag> </el-tag>
{{ {{
item.children[0].minValue === 3.1415956 || item.children[0].minValue === 3.1415956 ||
typeof item.children[0].minValue != 'number' typeof item.children[0].minValue != 'number'
? '暂无数据' ? '暂无数据'
: item.children[0].minValue : item.children[0].minValue
}} }}
@@ -237,39 +181,24 @@
<el-empty description="暂无数据" v-if="tableData.length === 0"></el-empty> <el-empty description="暂无数据" v-if="tableData.length === 0"></el-empty>
</div> </div>
</div> </div>
<el-pagination <el-pagination v-if="
v-if=" tableData.length &&
tableData.length && dataSet.indexOf('_trenddata') == -1 &&
dataSet.indexOf('_trenddata') == -1 && dataSet.indexOf('_realtimedata') == -1 &&
dataSet.indexOf('_realtimedata') == -1 && dataSet.indexOf('_event') == -1
dataSet.indexOf('_event') == -1 " background class="mr2 mt10" style="float: right" @size-change="handleSizeChange"
" @current-change="pageChange" :current-page="formInline.pageNum" :page-sizes="[20, 30, 40, 50, 100]"
background :page-size="formInline.pageSize" layout="total, sizes, prev, pager, next, jumper"
class="mr2 mt10" :total="formInline.total"></el-pagination>
style="float: right"
@size-change="handleSizeChange"
@current-change="pageChange"
:current-page="formInline.pageNum"
:page-sizes="[20, 30, 40, 50, 100]"
:page-size="formInline.pageSize"
layout="total, sizes, prev, pager, next, jumper"
:total="formInline.total"
></el-pagination>
<!-- 趋势数据 --> <!-- 趋势数据 -->
<div <div style="height: calc(100vh - 340px)" v-if="dataSet.indexOf('_trenddata') != -1"
style="height: calc(100vh - 340px)" v-loading="tableLoading">
v-if="dataSet.indexOf('_trenddata') != -1"
v-loading="tableLoading"
>
<Trend ref="trendRef"></Trend> <Trend ref="trendRef"></Trend>
</div> </div>
<!-- 实时数据 --> <!-- 实时数据 -->
<div <div style="height: calc(100vh - 340px)" v-if="dataSet.indexOf('_realtimedata') != -1"
style="height: calc(100vh - 340px)" v-loading="tableLoading">
v-if="dataSet.indexOf('_realtimedata') != -1"
v-loading="tableLoading"
>
<!-- <div class="view_top_btn" v-if="realTimeFlag"> <!-- <div class="view_top_btn" v-if="realTimeFlag">
<el-button type="primary" :icon="Platform" @click="handleRecordWaves"> <el-button type="primary" :icon="Platform" @click="handleRecordWaves">
实时录波 实时录波
@@ -284,23 +213,16 @@
<!-- 实时数据-实时录波组件 --> <!-- 实时数据-实时录波组件 -->
<recordWoves v-if="!realTimeFlag && sonTab == 0"></recordWoves> <recordWoves v-if="!realTimeFlag && sonTab == 0"></recordWoves>
<!-- 实时数据-实时趋势组件 --> <!-- 实时数据-实时趋势组件 -->
<realTrend <realTrend v-if="!realTimeFlag && sonTab == 1" ref="realTrendRef"
v-if="!realTimeFlag && sonTab == 1" @changeTrendType="changeTrendType">
ref="realTrendRef" </realTrend>
@changeTrendType="changeTrendType"
></realTrend>
<!-- 实时数据-谐波频谱组件 --> <!-- 实时数据-谐波频谱组件 -->
<harmonicSpectrum <harmonicSpectrum v-show="!realTimeFlag && sonTab == 2" ref="harmonicSpectrumRef">
v-show="!realTimeFlag && sonTab == 2" </harmonicSpectrum>
ref="harmonicSpectrumRef"
></harmonicSpectrum>
</div> </div>
<!-- 暂态事件 --> <!-- 暂态事件 -->
<div <div style="height: calc(100vh - 340px)" v-if="dataSet.indexOf('_event') != -1"
style="height: calc(100vh - 340px)" v-loading="tableLoading">
v-if="dataSet.indexOf('_event') != -1"
v-loading="tableLoading"
>
<Event ref="eventRef"></Event> <Event ref="eventRef"></Event>
</div> </div>
<div v-if="!tableData" style="height: 42px"></div> <div v-if="!tableData" style="height: 42px"></div>
@@ -418,6 +340,7 @@ const handleTrend = async () => {
) )
let obj = JSON.parse(JSON.stringify(JSON.parse(new TextDecoder().decode(message)))) || {} let obj = JSON.parse(JSON.stringify(JSON.parse(new TextDecoder().decode(message)))) || {}
if (obj.data1) { if (obj.data1) {
realTrendRef.value && realTrendRef.value.setRealTrendData(obj) realTrendRef.value && realTrendRef.value.setRealTrendData(obj)
} }
}) })
@@ -428,8 +351,10 @@ const handleTrend = async () => {
.catch(e => { .catch(e => {
realTrendRef.value && realTrendRef.value.setRealTrendData(false) realTrendRef.value && realTrendRef.value.setRealTrendData(false)
}) })
//每隔30s调用一下接口通知后台推送mqtt消息 //每隔30s调用一下接口通知后台推送mqtt消息
trendTimer.value = setInterval(() => { trendTimer.value = setInterval(() => {
getHarmRealData(lineId.value, activeTrendName.value).then((res: any) => { getHarmRealData(lineId.value, activeTrendName.value).then((res: any) => {
console.log(res, '获取谐波频谱数据') console.log(res, '获取谐波频谱数据')
connectMqtt() connectMqtt()
@@ -467,14 +392,21 @@ const harmonicSpectrumRef = ref()
//实时趋势 //实时趋势
const handleHarmonicSpectrum = () => { const handleHarmonicSpectrum = () => {
realTimeFlag.value = false realTimeFlag.value = false
window.clearInterval(timer.value) // window.clearInterval(timer.value)
clearInterval(realDataTimer.value) // clearInterval(realDataTimer.value)
sonTab.value = 2 sonTab.value = 2
harmonicSpectrumRef.value && harmonicSpectrumRef.value.resetData() harmonicSpectrumRef.value && harmonicSpectrumRef.value.resetData()
getRealDataMqttMsg() // getRealDataMqttMsg()
} }
//返回 //返回
const handleReturn = () => { const handleReturn = () => {
console.log("🚀 ~ handleReturn ~ realDataTimer.value:", trendTimer.value)
clearInterval(trendTimer.value)
clearInterval(realDataTimer.value)
realTimeFlag.value = true realTimeFlag.value = true
sonTab.value = null sonTab.value = null
activeTrendName.value = 0 activeTrendName.value = 0
@@ -619,7 +551,7 @@ const getRealDataMqttMsg = async () => {
connectMqtt() connectMqtt()
mqttRef.value.on('connect', (e: any) => { mqttRef.value.on('connect', (e: any) => {
// ElMessage.success('连接mqtt服务器成功!') // ElMessage.success('连接mqtt服务器成功!')
console.log('mqtt客户端已连接....')
// mqttRef.value.subscribe('/Web/Progress') // mqttRef.value.subscribe('/Web/Progress')
mqttRef.value.subscribe('/Web/RealData/+') mqttRef.value.subscribe('/Web/RealData/+')
//假数据 //假数据
@@ -748,6 +680,7 @@ const getRealDataMqttMsg = async () => {
//更新实时数据值 //更新实时数据值
realTimeFlag.value && realTimeRef.value && realTimeRef.value.setRealData(mqttMessage.value) realTimeFlag.value && realTimeRef.value && realTimeRef.value.setRealData(mqttMessage.value)
//更新实时趋势数据 //更新实时趋势数据
!realTimeFlag.value && !realTimeFlag.value &&
sonTab.value == 2 && sonTab.value == 2 &&
harmonicSpectrumRef.value && harmonicSpectrumRef.value &&
@@ -893,7 +826,7 @@ const handleClick = async (tab?: any) => {
} }
} }
//模版下载 //模版下载
const handleDownLoadTemplate = () => {} const handleDownLoadTemplate = () => { }
//补召日志 //补召日志
const analysisListRef = ref() const analysisListRef = ref()
//打开补召日志 //打开补召日志
@@ -930,7 +863,7 @@ const echoName = (value: any, arr: any[]) => {
return value ? arr.find(item => item.value == value)?.label : '/' return value ? arr.find(item => item.value == value)?.label : '/'
} }
onMounted(() => {}) onMounted(() => { })
onUnmounted(() => { onUnmounted(() => {
clearInterval(timer.value) clearInterval(timer.value)
clearInterval(realDataTimer.value) clearInterval(realDataTimer.value)
@@ -1020,6 +953,7 @@ onUnmounted(() => {
margin-right: 5px; margin-right: 5px;
} }
} }
.el-form { .el-form {
width: 100%; width: 100%;
height: auto; height: auto;

View File

@@ -4,33 +4,18 @@
<div class="harmonic_select"> <div class="harmonic_select">
<el-form :model="searchForm" id="history_select"> <el-form :model="searchForm" id="history_select">
<el-form-item label="稳态指标"> <el-form-item label="稳态指标">
<el-select <el-select multiple collapse-tags collapse-tags-tooltip v-model="searchForm.index"
multiple placeholder="请选择统计指标" :multiple-limit="3" value-key="id">
collapse-tags <el-option v-for="(item, index) in indexOptions" :label="item.name" :key="index"
collapse-tags-tooltip :value="item"></el-option>
v-model="searchForm.index"
placeholder="请选择统计指标"
:multiple-limit="3"
value-key="id"
>
<el-option
v-for="(item, index) in indexOptions"
:label="item.name"
:key="index"
:value="item"
></el-option>
</el-select> </el-select>
</el-form-item> </el-form-item>
<!-- <el-button type="primary" :loading="loading" @click="init">查询</el-button> --> <!-- <el-button type="primary" :loading="loading" @click="init">查询</el-button> -->
</el-form> </el-form>
</div> </div>
<div class="harmonic_body"> <div class="harmonic_body">
<div <div class="harmonic_body_charts" :style="{ height: height }" v-for="(item, index) in searchForm.index"
class="harmonic_body_charts" :key="index">
:style="{ height: height }"
v-for="(item, index) in searchForm.index"
:key="index"
>
<MyEchart :ref="setChildRef(index)" :options="item.echartsData" :isInterVal="true"></MyEchart> <MyEchart :ref="setChildRef(index)" :options="item.echartsData" :isInterVal="true"></MyEchart>
</div> </div>
</div> </div>
@@ -271,6 +256,7 @@ const resetData = () => {
resetData() resetData()
const mqttMessage: any = ref() const mqttMessage: any = ref()
const setHarmonicSpectrumData = (val: any) => { const setHarmonicSpectrumData = (val: any) => {
console.log("🚀 ~ setHarmonicSpectrumData ~ val:", val)
mqttMessage.value = val mqttMessage.value = val
init() init()
} }
@@ -280,7 +266,7 @@ const setChildRef = (index: any) => {
} }
const childRefs: any = {} const childRefs: any = {}
const init = () => { const init = () => {
resetData() // resetData()
console.log(searchForm.value.index, '----------') console.log(searchForm.value.index, '----------')
loading.value = true loading.value = true
searchForm.value.index.map((item: any, index: any) => { searchForm.value.index.map((item: any, index: any) => {
@@ -324,13 +310,21 @@ const init = () => {
// right: '4%' // right: '4%'
// }, // },
tooltip: { tooltip: {
trigger: 'axis',
axisPointer: { axisPointer: {
type: 'cross', type: 'cross',
label: { label: {
show: false color: '#fff',
fontSize: 16
} }
} },
textStyle: {
color: '#fff',
fontStyle: 'normal',
opacity: 0.35,
fontSize: 14
},
backgroundColor: 'rgba(0,0,0,0.35)',
borderWidth: 0
}, },
xAxis: { xAxis: {
name: '时间', name: '时间',
@@ -347,20 +341,7 @@ const init = () => {
yAxis: { yAxis: {
type: 'value', type: 'value',
name: item.unit, name: item.unit,
splitLine: {
show: false
},
axisTick: {
show: true
},
axisLine: {
show: true,
lineStyle: {
color: '#000'
}
},
splitNumber: 5,
minInterval: 1
}, },
series: [] series: []
} }
@@ -390,7 +371,7 @@ const init = () => {
loading.value = false loading.value = false
} }
onMounted(() => {}) onMounted(() => { })
defineExpose({ resetData, setHarmonicSpectrumData }) defineExpose({ resetData, setHarmonicSpectrumData })
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
@@ -418,6 +399,7 @@ defineExpose({ resetData, setHarmonicSpectrumData })
.harmonic_body { .harmonic_body {
flex: 1; flex: 1;
overflow-y: auto; overflow-y: auto;
.harmonic_body_charts { .harmonic_body_charts {
border: 1px solid #eee; border: 1px solid #eee;
position: relative; position: relative;

View File

@@ -16,28 +16,17 @@
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item <el-form-item v-for="(item, index) in countData" :key="index" :label="item.name + '谐波次数'"
v-for="(item, index) in countData" :key="index" label-width="180px" v-show="item.countOptions.length != 0">
:label="item.name + '谐波次数'" <!-- v-if="item.countOptions.length != 0" -->
<el-select v-model="item.count" @change="onCountChange($event, index)"
label-width="180px" placeholder="请选择谐波次数">
> <el-option v-for="vv in item.countOptions" :key="vv" :label="vv"
<!-- v-if="item.countOptions.length != 0" --> :value="vv"></el-option>
<el-select
v-model="item.count"
@change="onCountChange($event, index)"
placeholder="请选择谐波次数"
>
<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>
<!-- </el-form> --> <!-- </el-form> -->
</template> </template>
<template #operation> <template #operation>
@@ -67,7 +56,7 @@ import { position } from 'html2canvas/dist/types/css/property-descriptors/positi
import { read, writeFile, utils } from 'xlsx' import { read, writeFile, utils } from 'xlsx'
import TableStore from '@/utils/tableStore' import TableStore from '@/utils/tableStore'
import Table from '@/components/table/index.vue' import Table from '@/components/table/index.vue'
import { yMethod } from '@/utils/echartMethod' import { yMethod, exportCSV } from '@/utils/echartMethod'
import TableHeader from '@/components/table/header/index.vue' import TableHeader from '@/components/table/header/index.vue'
import { getTabsDataByType } from '@/api/cs-device-boot/EquipmentDelivery' import { getTabsDataByType } from '@/api/cs-device-boot/EquipmentDelivery'
import DatePicker from '@/components/form/datePicker/index.vue' import DatePicker from '@/components/form/datePicker/index.vue'
@@ -269,7 +258,36 @@ const init = async () => {
} }
}, },
yAxis: [{}], yAxis: [{}],
toolbox: {
featureProps: {
myTool1: {
show: true,
title: '下载csv',
icon: 'path://M588.8 551.253333V512H352v39.253333h236.373333z m0 78.933334v-39.253334H352v39.253334h236.373333z m136.533333 78.933333V334.933333l-157.866666-157.866666H273.066667A59.306667 59.306667 0 0 0 213.333333 236.373333v551.253334a59.306667 59.306667 0 0 0 59.306667 59.306666h274.773333v42.666667H853.333333v-180.48zM568.746667 234.666667l100.266666 100.693333h-81.066666a20.053333 20.053333 0 0 1-19.626667-20.053333z m-20.48 573.013333H273.066667a19.2 19.2 0 0 1-17.493334-19.626667V236.373333a19.2 19.2 0 0 1 19.626667-19.626666h256v98.133333a58.88 58.88 0 0 0 58.88 59.306667h96.426667v334.933333h-98.133334v-39.68H352v39.68h196.266667z m100.266666 23.04a37.973333 37.973333 0 0 1-32 15.786667 38.826667 38.826667 0 0 1-32.426666-15.786667 53.76 53.76 0 0 1-10.24-32.853333 42.666667 42.666667 0 0 1 42.666666-47.786667 35.84 35.84 0 0 1 37.546667 29.866667h-12.8a23.893333 23.893333 0 0 0-24.746667-19.2c-17.066667 0-29.013333 14.08-29.013333 35.84s11.52 37.546667 28.586667 37.546666a26.453333 26.453333 0 0 0 26.453333-25.6h12.8a39.253333 39.253333 0 0 1-7.253333 22.186667z m59.733334 15.786667a35.84 35.84 0 0 1-40.106667-34.56H682.666667a23.893333 23.893333 0 0 0 26.88 23.04c12.8 0 22.613333-6.4 22.613333-15.786667s-4.266667-11.52-14.506667-13.653333l-21.333333-5.12c-17.066667-4.266667-24.32-11.52-24.32-23.893334s12.8-26.453333 34.133333-26.453333a31.573333 31.573333 0 0 1 35.413334 30.293333h-13.653334a19.626667 19.626667 0 0 0-22.613333-18.773333c-12.8 0-20.48 5.12-20.48 12.8s5.12 11.093333 17.066667 13.653333l14.933333 2.986667a42.666667 42.666667 0 0 1 20.906667 8.96 23.893333 23.893333 0 0 1 7.68 17.92c-0.426667 17.066667-14.506667 28.16-37.12 28.16z m88.746666 0h-14.506666l-32.426667-92.16h14.08l19.626667 59.733333 6.4 20.053333c0-9.386667 3.413333-12.8 5.546666-20.053333l19.2-59.733333h14.08z',
onclick: (e) => {
// console.log("🚀 ~ init ~ echartsData.value:", echartsData.value.options.series.map(item => item.data))
let list = echartsData.value.options.series?.map(item => item.data)
let dataList = list[0]?.map((item, index) => {
let value = [item[0], item[1]]
list.forEach((item1: any, index1: any) => {
if (index1 > 0) {
value.push(item1 && item1[index] ? item1[index][1] : null)
}
})
return value;
});
exportCSV(echartsData.value.options.series.map(item => item.name), dataList, '历史趋势.csv')
}
}
}
},
options: { options: {
series: [] series: []
} }
@@ -508,11 +526,16 @@ const initSearchFormIndexAndCount = (list: any) => {
}) })
} }
}) })
}) })
countData.value = countData.value.filter(item => item.countOptions.length > 0); console.log("🚀 ~ initSearchFormIndexAndCount ~ countData.value:", countData.value)
// countData.value = countData.value.filter(item => item.countOptions.length > 0);
} }
setTimeout(() => {
tableHeaderRef.value.computedSearchRow()
}, 100)
} }
// 判断下拉框是否存在 // 判断下拉框是否存在
const onCountChange = (val: any, index: any) => { const onCountChange = (val: any, index: any) => {
@@ -521,14 +544,12 @@ const onCountChange = (val: any, index: any) => {
} }
} }
const onIndexChange = (val: any) => { const onIndexChange = (val: any) => {
num.value +=1 num.value += 1
if (val.length == 0) { if (val.length == 0) {
searchForm.value.index = [indexOptions.value[0].id] searchForm.value.index = [indexOptions.value[0].id]
} }
setTimeout(() => {
tableHeaderRef.value.computedSearchRow()
},500)
} }
watch( watch(
() => searchForm.value.index, () => searchForm.value.index,