联调电镀数据功能
This commit is contained in:
@@ -69,7 +69,8 @@ const initChart = () => {
|
|||||||
top: 15,
|
top: 15,
|
||||||
feature: {
|
feature: {
|
||||||
saveAsImage: {
|
saveAsImage: {
|
||||||
title: '保存图片'
|
title: '下载图片',
|
||||||
|
name: props.options?.title?.text || '图表'
|
||||||
},
|
},
|
||||||
...(props.options?.toolbox?.featureProps || null)
|
...(props.options?.toolbox?.featureProps || null)
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -1190,6 +1190,9 @@ const getRealDataMqttMsg = async () => {
|
|||||||
mqttRef.value.on('close', function () {
|
mqttRef.value.on('close', function () {
|
||||||
console.log('mqtt客户端已断开连接.....')
|
console.log('mqtt客户端已断开连接.....')
|
||||||
})
|
})
|
||||||
|
setTimeout(() => {
|
||||||
|
tableLoading.value = false
|
||||||
|
}, 6000)
|
||||||
} else {
|
} else {
|
||||||
ElMessage.success('设备应答失败')
|
ElMessage.success('设备应答失败')
|
||||||
tableLoading.value = false
|
tableLoading.value = false
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
<template>
|
<template>
|
||||||
<div>
|
<div>
|
||||||
<!-- 历史趋势数据 -->
|
<!-- 电镀数据数据 -->
|
||||||
<div>
|
<div>
|
||||||
<TableHeader ref="tableHeaderRef" :showSearch="false" @selectChange="selectChange">
|
<TableHeader ref="tableHeaderRef" :showSearch="false" @selectChange="selectChange">
|
||||||
<template v-slot:select>
|
<template v-slot:select>
|
||||||
@@ -30,19 +30,6 @@
|
|||||||
<el-option value="cp95" label="cp95"></el-option>
|
<el-option value="cp95" label="cp95"></el-option>
|
||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item> -->
|
</el-form-item> -->
|
||||||
<el-form-item>
|
|
||||||
<div class="history_count" v-for="(item, index) in countData" :key="index"
|
|
||||||
v-show="item.countOptions.length != 0">
|
|
||||||
<span class="mr12">
|
|
||||||
{{ item.name.includes('次数') ? item.name : item.name + '谐波次数' }}
|
|
||||||
</span>
|
|
||||||
<el-select v-model="item.count" @change="onCountChange($event, index)" placeholder="请选择谐波次数"
|
|
||||||
style="width: 100px" class="mr20">
|
|
||||||
<el-option v-for="vv in item.countOptions" :key="vv"
|
|
||||||
:label="item.name.includes('间谐波') ? vv - 0.5 : vv" :value="vv"></el-option>
|
|
||||||
</el-select>
|
|
||||||
</div>
|
|
||||||
</el-form-item>
|
|
||||||
</template>
|
</template>
|
||||||
<template #operation>
|
<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>
|
||||||
@@ -61,10 +48,9 @@
|
|||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import { mainHeight } from '@/utils/layout'
|
import { mainHeight } from '@/utils/layout'
|
||||||
import { queryByCode, queryCsDictTree } from '@/api/system-boot/dictTree'
|
import { queryByCode, queryCsDictTree } from '@/api/system-boot/dictTree'
|
||||||
import { ref, onMounted, watch } from 'vue'
|
import { ref, onMounted } from 'vue'
|
||||||
import MyEchart from '@/components/echarts/MyEchart.vue'
|
import MyEchart from '@/components/echarts/MyEchart.vue'
|
||||||
import { useDictData } from '@/stores/dictData'
|
import { useDictData } from '@/stores/dictData'
|
||||||
import { queryStatistical } from '@/api/system-boot/csstatisticalset'
|
|
||||||
import { yMethod, exportCSV, completeTimeSeries } from '@/utils/echartMethod'
|
import { yMethod, exportCSV, completeTimeSeries } 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'
|
||||||
@@ -86,7 +72,6 @@ const showEchart = ref(true)
|
|||||||
const voltageLevelList = dictData.getBasicData('Dev_Voltage_Stand')
|
const voltageLevelList = dictData.getBasicData('Dev_Voltage_Stand')
|
||||||
//接线方式
|
//接线方式
|
||||||
const volConTypeList = dictData.getBasicData('Dev_Connect')
|
const volConTypeList = dictData.getBasicData('Dev_Connect')
|
||||||
const num = ref(0)
|
|
||||||
const timeControl = ref(false)
|
const timeControl = ref(false)
|
||||||
//值类型
|
//值类型
|
||||||
const pageHeight = ref(mainHeight(290))
|
const pageHeight = ref(mainHeight(290))
|
||||||
@@ -114,7 +99,6 @@ const typeOptions = [
|
|||||||
searchForm.value = {
|
searchForm.value = {
|
||||||
index: [],
|
index: [],
|
||||||
type: typeOptions[0].id,
|
type: typeOptions[0].id,
|
||||||
count: '',
|
|
||||||
searchBeginTime: '',
|
searchBeginTime: '',
|
||||||
searchEndTime: '',
|
searchEndTime: '',
|
||||||
dataLevel: 'Primary',
|
dataLevel: 'Primary',
|
||||||
@@ -122,56 +106,12 @@ searchForm.value = {
|
|||||||
}
|
}
|
||||||
//统计指标
|
//统计指标
|
||||||
const indexOptions: any = ref([])
|
const indexOptions: any = ref([])
|
||||||
//谐波次数
|
|
||||||
const countOptions: any = ref([])
|
|
||||||
// Harmonic_Type
|
|
||||||
// portable-harmonic
|
|
||||||
const legendDictList: any = ref([])
|
|
||||||
queryByCode('Kilowatt_Hour').then(res => {
|
queryByCode('Kilowatt_Hour').then(res => {
|
||||||
queryCsDictTree(res.data.id).then(item => {
|
queryCsDictTree(res.data.id).then(item => {
|
||||||
//排序
|
|
||||||
indexOptions.value = item.data.sort((a: any, b: any) => {
|
indexOptions.value = item.data.sort((a: any, b: any) => {
|
||||||
return a.sort - b.sort
|
return a.sort - b.sort
|
||||||
})
|
})
|
||||||
searchForm.value.index[0] = indexOptions.value[0].id
|
searchForm.value.index[0] = indexOptions.value[0].id
|
||||||
})
|
|
||||||
queryStatistical(res.data.id).then(vv => {
|
|
||||||
legendDictList.value = vv.data
|
|
||||||
indexOptions.value.map((item: any, index: any) => {
|
|
||||||
if (!countDataCopy.value[index]) {
|
|
||||||
countDataCopy.value[index] = {
|
|
||||||
index: item.id,
|
|
||||||
countOptions: [],
|
|
||||||
count: [],
|
|
||||||
name: indexOptions.value.find((vv: any) => {
|
|
||||||
return vv.id == item.id
|
|
||||||
})?.name
|
|
||||||
}
|
|
||||||
}
|
|
||||||
legendDictList.value?.selectedList?.map((vv: any, vvs: any) => {
|
|
||||||
//查找相等的指标
|
|
||||||
if (item.id == vv.dataType) {
|
|
||||||
vv.eleEpdPqdVOS.map((kk: any, kks: any) => {
|
|
||||||
if (kk.harmStart && kk.harmEnd) {
|
|
||||||
range(0, 0, 0)
|
|
||||||
|
|
||||||
// if (kk.showName == '间谐波电压含有率') {
|
|
||||||
// countDataCopy.value[index].countOptions = range(kk.harmStart, kk.harmEnd, 1).map(
|
|
||||||
// (item: any) => {
|
|
||||||
// return item - 0.5
|
|
||||||
// }
|
|
||||||
// )
|
|
||||||
// } else {
|
|
||||||
countDataCopy.value[index].countOptions = range(kk.harmStart, kk.harmEnd, 1)
|
|
||||||
// }
|
|
||||||
if (!countDataCopy.value[index].count || countDataCopy.value[index].count.length == 0) {
|
|
||||||
countDataCopy.value[index].count = countDataCopy.value[index].countOptions[0]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
|
||||||
})
|
|
||||||
})
|
|
||||||
init()
|
init()
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
@@ -185,9 +125,6 @@ const echartsData = ref<any>(null)
|
|||||||
//加载echarts图表
|
//加载echarts图表
|
||||||
//历史趋势数据
|
//历史趋势数据
|
||||||
const historyDataList: any = ref([])
|
const historyDataList: any = ref([])
|
||||||
const range = (start: any, end: any, step: any) => {
|
|
||||||
return Array.from({ length: (end - start) / step + 1 }, (_, i) => start + i * step)
|
|
||||||
}
|
|
||||||
//获取请求趋势数据参数
|
//获取请求趋势数据参数
|
||||||
const trendRequestData = ref()
|
const trendRequestData = ref()
|
||||||
const getTrendRequest = (val: any) => {
|
const getTrendRequest = (val: any) => {
|
||||||
@@ -200,22 +137,7 @@ const datePickerRef = ref()
|
|||||||
const lineStyle = [{ type: 'solid' }, { type: 'dashed' }, { type: 'dotted' }]
|
const lineStyle = [{ type: 'solid' }, { type: 'dashed' }, { type: 'dotted' }]
|
||||||
const init = async () => {
|
const init = async () => {
|
||||||
loading.value = true
|
loading.value = true
|
||||||
// 选择指标的时候切换legend内容和data数据
|
|
||||||
let list: any = []
|
|
||||||
echartsData.value = {}
|
echartsData.value = {}
|
||||||
legendDictList.value?.selectedList?.map((item: any) => {
|
|
||||||
searchForm.value.index.map((vv: any) => {
|
|
||||||
if (item.dataType == vv) {
|
|
||||||
list.push(item.eleEpdPqdVOS)
|
|
||||||
}
|
|
||||||
})
|
|
||||||
})
|
|
||||||
|
|
||||||
//颜色数组
|
|
||||||
const colorList = color
|
|
||||||
//选择的指标使用方法处理
|
|
||||||
formatCountOptions()
|
|
||||||
//查询历史趋势
|
|
||||||
historyDataList.value = []
|
historyDataList.value = []
|
||||||
chartTitle.value = ''
|
chartTitle.value = ''
|
||||||
|
|
||||||
@@ -226,19 +148,10 @@ const init = async () => {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
let lists: any = []
|
const lists = searchForm.value.index.map((id: any) => ({
|
||||||
let frequencys: any = null
|
statisticalId: id,
|
||||||
countData.value.map((item: any, index: any) => {
|
frequencys: []
|
||||||
if (item.name.includes('间谐波电压')) {
|
}))
|
||||||
frequencys = item.count //+ 0.5
|
|
||||||
} else {
|
|
||||||
frequencys = item.count
|
|
||||||
}
|
|
||||||
lists[index] = {
|
|
||||||
statisticalId: item.index,
|
|
||||||
frequencys: frequencys && frequencys.length != 0 ? [frequencys] : []
|
|
||||||
}
|
|
||||||
})
|
|
||||||
let obj = {
|
let obj = {
|
||||||
...trendRequestData.value,
|
...trendRequestData.value,
|
||||||
list: lists,
|
list: lists,
|
||||||
@@ -265,7 +178,7 @@ const init = async () => {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
historyDataList.value = res.data
|
historyDataList.value = res.data
|
||||||
chartsList.value = JSON.parse(JSON.stringify(res.data))
|
chartsList.value = formatChartData(JSON.parse(JSON.stringify(res.data)))
|
||||||
loading.value = false
|
loading.value = false
|
||||||
setEchart()
|
setEchart()
|
||||||
}
|
}
|
||||||
@@ -287,12 +200,7 @@ const setEchart = () => {
|
|||||||
let unitList: any = []
|
let unitList: any = []
|
||||||
|
|
||||||
let groupedData = chartsList.value.reduce((acc: any, item: any) => {
|
let groupedData = chartsList.value.reduce((acc: any, item: any) => {
|
||||||
let key = ''
|
const key = item.statisticalName
|
||||||
if (item.phase == null) {
|
|
||||||
key = item.unit
|
|
||||||
} else {
|
|
||||||
key = item.anotherName
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!acc[key]) {
|
if (!acc[key]) {
|
||||||
acc[key] = []
|
acc[key] = []
|
||||||
@@ -395,7 +303,7 @@ const setEchart = () => {
|
|||||||
exportCSV(
|
exportCSV(
|
||||||
echartsData.value.options.series.map((item: any) => item.name),
|
echartsData.value.options.series.map((item: any) => item.name),
|
||||||
dataList,
|
dataList,
|
||||||
'历史趋势.csv'
|
'电镀数据.csv'
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -435,36 +343,19 @@ const setEchart = () => {
|
|||||||
})
|
})
|
||||||
// console.log("🚀 ~ result.forEach ~ result:", result)
|
// console.log("🚀 ~ result.forEach ~ result:", result)
|
||||||
// '电压负序分量', '电压正序分量', '电压零序分量'
|
// '电压负序分量', '电压正序分量', '电压零序分量'
|
||||||
let ABCName = [
|
let ABCName = [...new Set(chartsList.value.map((item: any) => item.statisticalName))]
|
||||||
...new Set(
|
|
||||||
chartsList.value.map((item: any) => {
|
|
||||||
return item.anotherName == '电压负序分量'
|
|
||||||
? '电压不平衡'
|
|
||||||
: item.anotherName == '电压正序分量'
|
|
||||||
? '电压不平衡'
|
|
||||||
: item.anotherName == '电压零序分量'
|
|
||||||
? '电压不平衡'
|
|
||||||
: item.anotherName
|
|
||||||
})
|
|
||||||
)
|
|
||||||
]
|
|
||||||
// console.log("🚀 ~ .then ~ ABCName:", ABCName)
|
// console.log("🚀 ~ .then ~ ABCName:", ABCName)
|
||||||
result.forEach((item: any, index: any) => {
|
result.forEach((item: any, index: any) => {
|
||||||
let yMethodList: any = []
|
let yMethodList: any = []
|
||||||
|
|
||||||
let ABCList = Object.values(
|
let ABCList = Object.values(
|
||||||
item.reduce((acc, item) => {
|
item.reduce((acc: any, cur: any) => {
|
||||||
let key = ''
|
const key = cur.phase == null ? cur.statisticalIndex : cur.phase
|
||||||
if (item.phase == null) {
|
|
||||||
key = item.anotherName
|
|
||||||
} else {
|
|
||||||
key = item.phase
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!acc[key]) {
|
if (!acc[key]) {
|
||||||
acc[key] = []
|
acc[key] = []
|
||||||
}
|
}
|
||||||
acc[key].push(item)
|
acc[key].push(cur)
|
||||||
return acc
|
return acc
|
||||||
}, {})
|
}, {})
|
||||||
)
|
)
|
||||||
@@ -472,38 +363,38 @@ const setEchart = () => {
|
|||||||
|
|
||||||
ABCList.forEach((kk: any) => {
|
ABCList.forEach((kk: any) => {
|
||||||
let colorName = kk[0].phase?.charAt(0).toUpperCase()
|
let colorName = kk[0].phase?.charAt(0).toUpperCase()
|
||||||
let lineS = ABCName.findIndex(
|
let lineS = ABCName.findIndex(name => name === kk[0].statisticalName)
|
||||||
item =>
|
const seriesLineStyle = lineStyle[lineS] || lineStyle[0]
|
||||||
item ===
|
const seriesColor = kk[0].phase
|
||||||
(kk[0].anotherName == '电压负序分量'
|
? colorName == 'A'
|
||||||
? '电压不平衡'
|
? '#DAA520'
|
||||||
: kk[0].anotherName == '电压正序分量'
|
: colorName == 'B'
|
||||||
? '电压不平衡'
|
? '#2E8B57'
|
||||||
: kk[0].anotherName == '电压零序分量'
|
: colorName == 'C'
|
||||||
? '电压不平衡'
|
? '#A52a2a'
|
||||||
: kk[0].anotherName)
|
: ''
|
||||||
)
|
: '#082e6c'
|
||||||
|
|
||||||
let seriesList: any = []
|
let seriesList: any = []
|
||||||
kk.forEach((cc: any) => {
|
const sortedData = [...kk].sort(
|
||||||
|
(a: any, b: any) => new Date(a.time).getTime() - new Date(b.time).getTime()
|
||||||
|
)
|
||||||
|
sortedData.forEach((cc: any) => {
|
||||||
if (cc.statisticalData !== null) {
|
if (cc.statisticalData !== null) {
|
||||||
yData[setList.indexOf(kk[0].unit)].push(cc.statisticalData?.toFixed(2))
|
yData[setList.indexOf(kk[0].unit)].push(cc.statisticalData?.toFixed(2))
|
||||||
}
|
}
|
||||||
|
|
||||||
seriesList.push([cc.time, cc.statisticalData?.toFixed(2), cc.unit, lineStyle[lineS].type])
|
seriesList.push([cc.time, cc.statisticalData?.toFixed(2), cc.unit, seriesLineStyle.type])
|
||||||
})
|
})
|
||||||
// console.log(kk);
|
|
||||||
|
|
||||||
echartsData.value.options.series.push({
|
echartsData.value.options.series.push({
|
||||||
name: kk[0].phase ? kk[0].phase + '相' + kk[0].anotherName : kk[0].anotherName,
|
name: kk[0].phase ? kk[0].phase + '相' + kk[0].anotherName : kk[0].anotherName,
|
||||||
type: 'line',
|
type: 'line',
|
||||||
smooth: true,
|
smooth: true,
|
||||||
color:
|
color: seriesColor,
|
||||||
colorName == 'A' ? '#DAA520' : colorName == 'B' ? '#2E8B57' : colorName == 'C' ? '#A52a2a' : '',
|
|
||||||
symbol: 'none',
|
symbol: 'none',
|
||||||
// data: seriesList,
|
|
||||||
data: timeControl.value ? completeTimeSeries(seriesList) : seriesList,
|
data: timeControl.value ? completeTimeSeries(seriesList) : seriesList,
|
||||||
lineStyle: lineStyle[lineS],
|
lineStyle: seriesLineStyle,
|
||||||
yAxisIndex: setList.indexOf(kk[0].unit)
|
yAxisIndex: setList.indexOf(kk[0].unit)
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
@@ -532,249 +423,22 @@ const selectChange = (flag: boolean) => {
|
|||||||
pageHeight.value = mainHeight(290)
|
pageHeight.value = mainHeight(290)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//导出
|
|
||||||
const historyChart = ref()
|
|
||||||
// const chart: any = ref(null)
|
|
||||||
// chart.value = echarts.init(historyChart.value)
|
|
||||||
const handleExport = async () => {
|
|
||||||
const planCsv = ref('')
|
|
||||||
const chartsCsv = ref('')
|
|
||||||
|
|
||||||
if (deviceData.value.records && deviceData.value.records.length != 0) {
|
// 电度趋势数据预处理:按时间排序
|
||||||
let csv = '',
|
const formatChartData = (data: any[]) => {
|
||||||
obj: any = {}
|
return [...data].sort((a, b) => new Date(a.time).getTime() - new Date(b.time).getTime())
|
||||||
obj = deviceData.value.records.find((item: any) => {
|
|
||||||
return item.id == activeName.value
|
|
||||||
})
|
|
||||||
if (obj) {
|
|
||||||
//测试是否与变量名长度有关系
|
|
||||||
let cell1 = deviceData.value.itemName,
|
|
||||||
cell2 = deviceData.value.describe,
|
|
||||||
cell3 = obj?.itemName,
|
|
||||||
cell4 = obj?.statisticalInterval,
|
|
||||||
cell5 = voltageLevelList.find(vv => {
|
|
||||||
return vv.id == obj.voltageLevel
|
|
||||||
})?.name,
|
|
||||||
cell6 = volConTypeList.find(vv => {
|
|
||||||
return vv.id == obj.volConType
|
|
||||||
})?.name,
|
|
||||||
cell7 = obj.capacitySscmin,
|
|
||||||
cell8 = obj.capacitySi,
|
|
||||||
cell9 = obj.capacitySscb,
|
|
||||||
cell10 = obj.capacitySt,
|
|
||||||
cell11 = obj.pt && obj.pt1 ? obj.pt / obj.pt1 + '\b' : '/',
|
|
||||||
cell12 = obj.ct && obj.ct1 ? obj.ct / obj.ct1 + '\b' : '/',
|
|
||||||
cell13 = obj.startTime ? obj.startTime : '/',
|
|
||||||
cell14 = obj.endTime ? obj.endTime : '/',
|
|
||||||
cell15 = obj.location
|
|
||||||
csv = `方案测试项信息,
|
|
||||||
方案名称, ${cell1},
|
|
||||||
方案描述, ${cell2},
|
|
||||||
测试项名称, ${cell2},
|
|
||||||
测量间隔, ${cell4 + '分钟'},
|
|
||||||
电压等级, ${cell5},
|
|
||||||
接线方式, ${cell6},
|
|
||||||
最小短路容量, ${cell7 + 'MVA'},
|
|
||||||
用户协议容量, ${cell8 + 'MVA'},
|
|
||||||
基准短路容量, ${cell9 + 'MVA'},
|
|
||||||
供电设备容量, ${cell10 + 'MVA'},
|
|
||||||
PT变比, ${cell11},
|
|
||||||
CT变比, ${cell12},
|
|
||||||
起始时间, ${cell13},
|
|
||||||
结束时间, ${cell14},
|
|
||||||
监测位置, ${cell15}\n,
|
|
||||||
`
|
|
||||||
planCsv.value = csv
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (historyDataList.value.length != 0) {
|
|
||||||
let xAxis: any = []
|
|
||||||
let timeList: any = []
|
|
||||||
historyDataList.value.map((item: any) => {
|
|
||||||
timeList.push(item.time)
|
|
||||||
})
|
|
||||||
xAxis = timeList.sort((a: any, b: any) => {
|
|
||||||
return (
|
|
||||||
a.replace('-', '').replace('-', '').replace(' ', '').replace(':', '').replace(':', '') -
|
|
||||||
0 -
|
|
||||||
(b.replace('-', '').replace('-', '').replace(' ', '').replace(':', '').replace(':', '') - 0)
|
|
||||||
)
|
|
||||||
})
|
|
||||||
xAxis = Array.from(new Set(xAxis))
|
|
||||||
// 使用这个函数转换数据为CSV格式
|
|
||||||
let csv: any = ''
|
|
||||||
const list = echartsData.value.options.series
|
|
||||||
csv = convertToCSV([], [])
|
|
||||||
chartsCsv.value = csv
|
|
||||||
// 如果你想提供下载链接
|
|
||||||
// const blob = new Blob([csv], { type: 'text/csv;charset=utf-8;' })
|
|
||||||
// const link = document.createElement('a')
|
|
||||||
// link.href = URL.createObjectURL(blob)
|
|
||||||
// link.download = '历史趋势.csv'
|
|
||||||
// link.click()
|
|
||||||
function convertToCSV(data: any, key: any) {
|
|
||||||
// 添加列头
|
|
||||||
let title = '统计时间,'
|
|
||||||
list.map((item: any, index: any) => {
|
|
||||||
index == list.length - 1 ? (title += `${item.name}\n`) : (title += `${item.name},`)
|
|
||||||
})
|
|
||||||
let csv = ''
|
|
||||||
csv = title
|
|
||||||
// 遍历数据并添加到CSV字符串中
|
|
||||||
const listLength = list.length
|
|
||||||
list[0].data.map((vv: any, indexs: any) => {
|
|
||||||
let strs = '',
|
|
||||||
count = null
|
|
||||||
list.map((item: any, index: any) => {
|
|
||||||
if (index == 0) {
|
|
||||||
count = index
|
|
||||||
}
|
|
||||||
index == list.length - 1
|
|
||||||
? (strs += list[index].data[indexs])
|
|
||||||
: (strs += list[index].data[indexs] + ',')
|
|
||||||
})
|
|
||||||
if (count == 0 && xAxis[indexs]) {
|
|
||||||
csv += '\u200B' + `${xAxis[indexs]},` + strs + '\n'
|
|
||||||
}
|
|
||||||
})
|
|
||||||
return csv
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
let csvs = ''
|
|
||||||
if (chartsCsv.value) {
|
|
||||||
csvs = planCsv.value + '历史趋势数据,\n\n' + chartsCsv.value
|
|
||||||
} else {
|
|
||||||
csvs = planCsv.value
|
|
||||||
}
|
|
||||||
|
|
||||||
// 如果你想提供下载链接
|
|
||||||
const blob = new Blob([csvs], { type: 'text/csv;charset=utf-8;' })
|
|
||||||
const link = document.createElement('a')
|
|
||||||
link.href = URL.createObjectURL(blob)
|
|
||||||
let obj = deviceData.value.records.find((item: any) => {
|
|
||||||
return item.id == activeName.value
|
|
||||||
})
|
|
||||||
const date = window.XEUtils.toDateString(new Date(), 'yyyyMMdd HHmmss').replace(' ', '_')
|
|
||||||
link.download = `${deviceData.value.itemName}_${obj?.itemName}_${date}.csv`
|
|
||||||
link.click()
|
|
||||||
return
|
|
||||||
}
|
}
|
||||||
const countData: any = ref([])
|
|
||||||
const countDataCopy: any = ref([])
|
|
||||||
|
|
||||||
//根据选择的指标处理谐波次数
|
|
||||||
const formatCountOptions = () => {
|
|
||||||
countData.value = []
|
|
||||||
if (searchForm.value.index.length != 0) {
|
|
||||||
searchForm.value.index.forEach((item: any, index: any) => {
|
|
||||||
countDataCopy.value.forEach((vv: any, vvs: any) => {
|
|
||||||
if (vv.index == item) {
|
|
||||||
countData.value.push(vv)
|
|
||||||
}
|
|
||||||
})
|
|
||||||
})
|
|
||||||
// list.map((item: any, index: any) => {
|
|
||||||
// if (!countData.value[index]) {
|
|
||||||
// countData.value[index] = {
|
|
||||||
// index: item,
|
|
||||||
// countOptions: [],
|
|
||||||
// count: '',
|
|
||||||
// name: indexOptions.value.find((vv: any) => {
|
|
||||||
// return vv.id == item
|
|
||||||
// })?.name
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// legendDictList.value?.selectedList?.map((vv: any, vvs: any) => {
|
|
||||||
// //查找相等的指标
|
|
||||||
// if (item == vv.dataType) {
|
|
||||||
// vv.eleEpdPqdVOS.map((kk: any, kks: any) => {
|
|
||||||
// if (kk.harmStart && kk.harmEnd) {
|
|
||||||
// range(0, 0, 0)
|
|
||||||
// countData.value[index].countOptions = range(kk.harmStart, kk.harmEnd, 1)
|
|
||||||
// if (kk.showName == '间谐波电压含有率') {
|
|
||||||
// countData.value[index].countOptions = range(kk.harmStart, kk.harmEnd, 1).map(
|
|
||||||
// (item: any) => {
|
|
||||||
// return item - 0.5
|
|
||||||
// }
|
|
||||||
// )
|
|
||||||
// } else {
|
|
||||||
// countData.value[index].countOptions = range(kk.harmStart, kk.harmEnd, 1)
|
|
||||||
// }
|
|
||||||
// //添加默认值
|
|
||||||
// if (countData.value[index].count.length == 0) {
|
|
||||||
// countData.value[index].count = countData.value[index].countOptions[0]
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// })
|
|
||||||
// }
|
|
||||||
// })
|
|
||||||
// })
|
|
||||||
countData.value.map((item: any, key: any) => {
|
|
||||||
if (item.name == '谐波电流有效值') {
|
|
||||||
item.name = '谐波电流次数'
|
|
||||||
} else if (item.name == '谐波电压含有率') {
|
|
||||||
item.name = '谐波电压次数'
|
|
||||||
} else if (item.name == '间谐波电压含有率') {
|
|
||||||
item.name = '间谐波电压次数'
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
|
||||||
setTimeout(() => {
|
|
||||||
tableHeaderRef.value.computedSearchRow()
|
|
||||||
}, 500)
|
|
||||||
}
|
|
||||||
// 判断下拉框是否存在
|
|
||||||
const onCountChange = (val: any, index: any) => {
|
|
||||||
if (val.length == 0) {
|
|
||||||
countData.value[index].count = countData.value[index].countOptions[0]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
const flag = ref(true)
|
|
||||||
const onIndexChange = (val: any) => {
|
const onIndexChange = (val: any) => {
|
||||||
num.value += 1
|
|
||||||
let pp: any = []
|
let pp: any = []
|
||||||
indexOptions.value.forEach((item: any) => {
|
indexOptions.value.forEach((item: any) => {
|
||||||
const filteredResult = val.filter(vv => item.id == vv)
|
const filteredResult = val.filter((vv: any) => item.id == vv)
|
||||||
if (filteredResult.length > 0) {
|
if (filteredResult.length > 0) {
|
||||||
pp.push(filteredResult[0])
|
pp.push(filteredResult[0])
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
searchForm.value.index = pp
|
searchForm.value.index = pp
|
||||||
flag.value = true
|
|
||||||
formatCountOptions()
|
|
||||||
|
|
||||||
// if (val.length == 0) {
|
|
||||||
// searchForm.value.index = [indexOptions.value[0].id]
|
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
watch(
|
|
||||||
() => searchForm.value.index,
|
|
||||||
(val: any, oldval: any) => {
|
|
||||||
// if (val) {
|
|
||||||
// setTimeout(() => {
|
|
||||||
// formatCountOptions(val)
|
|
||||||
// }, 100)
|
|
||||||
// if (val == 0) {
|
|
||||||
// countData.value = []
|
|
||||||
// }
|
|
||||||
// countData.value.map((item: any, key: any) => {
|
|
||||||
// if (
|
|
||||||
// val.findIndex((vv: any) => {
|
|
||||||
// return vv == item.index
|
|
||||||
// }) == -1
|
|
||||||
// ) {
|
|
||||||
// countData.value.splice(key, 1)
|
|
||||||
// }
|
|
||||||
// })
|
|
||||||
// }
|
|
||||||
},
|
|
||||||
{
|
|
||||||
deep: true,
|
|
||||||
immediate: true
|
|
||||||
}
|
|
||||||
)
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
datePickerRef.value.setInterval(5)
|
datePickerRef.value.setInterval(5)
|
||||||
})
|
})
|
||||||
@@ -824,12 +488,6 @@ defineExpose({ getTrendRequest })
|
|||||||
margin-top: 10px;
|
margin-top: 10px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.history_count {
|
|
||||||
.el-select {
|
|
||||||
min-width: 100px;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
:deep(.el-select__selected-item) {
|
:deep(.el-select__selected-item) {
|
||||||
.is-closable {
|
.is-closable {
|
||||||
width: 100px !important;
|
width: 100px !important;
|
||||||
|
|||||||
@@ -76,8 +76,7 @@ const open = (text: string, data?: anyObj) => {
|
|||||||
form[key] = data ? data[key] : ''
|
form[key] = data ? data[key] : ''
|
||||||
|
|
||||||
if (key == 'sort') {
|
if (key == 'sort') {
|
||||||
form[key] = data?.sort ? data[key] : 100
|
form[key] = data?.sort ?? 100
|
||||||
// console.log("🚀 ~ open ~ form[key]:", form[key])
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
dialogVisible.value = true
|
dialogVisible.value = true
|
||||||
|
|||||||
@@ -85,7 +85,7 @@
|
|||||||
import { ref, inject } from 'vue'
|
import { ref, inject } from 'vue'
|
||||||
import { CascaderValue, ElMessage } from 'element-plus'
|
import { CascaderValue, ElMessage } from 'element-plus'
|
||||||
import { addStatistical, queryStatistical } from '@/api/system-boot/csstatisticalset'
|
import { addStatistical, queryStatistical } from '@/api/system-boot/csstatisticalset'
|
||||||
import { getDictTreeById } from '@/api/system-boot/dictTree'
|
import { getDictTreeById, queryCsDictTree } from '@/api/system-boot/dictTree'
|
||||||
import PopupAdd from './add.vue'
|
import PopupAdd from './add.vue'
|
||||||
import { dicDelete } from '@/api/system-boot/dic'
|
import { dicDelete } from '@/api/system-boot/dic'
|
||||||
import List from '@/views/pms/comptroller/list.vue'
|
import List from '@/views/pms/comptroller/list.vue'
|
||||||
@@ -344,20 +344,25 @@ const dicDeleteGroup = (data: any) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const newGroup = () => {
|
const newGroup = () => {
|
||||||
|
queryCsDictTree(pid.value).then(res => {
|
||||||
addRef.value.open('新建分组', {
|
const list = res.data || []
|
||||||
sort: toData.value.length ? toData.value[toData.value.length - 1].sort + 1 : 1,
|
const sort = list.length
|
||||||
code: '',
|
? Math.max(...list.map((item: any) => Number(item.sort) || 0)) + 1
|
||||||
pid: pid.value,
|
: 1
|
||||||
id: '',
|
addRef.value.open('新建分组', {
|
||||||
remark: '',
|
sort,
|
||||||
name: ''
|
code: '',
|
||||||
|
pid: pid.value,
|
||||||
|
id: '',
|
||||||
|
remark: '',
|
||||||
|
name: ''
|
||||||
|
})
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
const editGroup = (data: any) => {
|
const editGroup = (data: any) => {
|
||||||
getDictTreeById(data.id).then(res => {
|
getDictTreeById(data.id).then(res => {
|
||||||
addRef.value.open('修改分组', {
|
addRef.value.open('修改分组', {
|
||||||
sort: res.data.sort || 100,
|
sort: res.data.sort ?? 100,
|
||||||
code: res.data.code || '',
|
code: res.data.code || '',
|
||||||
pid: res.data.pid || '',
|
pid: res.data.pid || '',
|
||||||
id: res.data.id || '',
|
id: res.data.id || '',
|
||||||
|
|||||||
Reference in New Issue
Block a user