谐波数据处理
This commit is contained in:
@@ -1,6 +1,7 @@
|
|||||||
<template>
|
<template>
|
||||||
<view>
|
<view>
|
||||||
<uni-data-checkbox v-model="radio" :localdata="sex"></uni-data-checkbox>
|
<uni-data-checkbox v-model="parity" :localdata="parityOption" @change="initEcharts"></uni-data-checkbox>
|
||||||
|
<uni-data-checkbox v-model="dataRadio" :localdata="dataOptions" @change="initEcharts"></uni-data-checkbox>
|
||||||
<view class="charts-box">
|
<view class="charts-box">
|
||||||
<qiun-data-charts type="column" :ontouch='true' :opts="opts" :chartData="chartData"/>
|
<qiun-data-charts type="column" :ontouch='true' :opts="opts" :chartData="chartData"/>
|
||||||
</view>
|
</view>
|
||||||
@@ -17,10 +18,28 @@ export default {
|
|||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
radio: 0,
|
parityOption: [
|
||||||
|
{
|
||||||
|
text: '奇次',
|
||||||
|
value: 2,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
text: '偶次',
|
||||||
|
value: 1,
|
||||||
|
}
|
||||||
|
],
|
||||||
|
parity: 2,
|
||||||
|
dataOptions: [],
|
||||||
|
dataRadio: 0,
|
||||||
renderData: {
|
renderData: {
|
||||||
电网侧: {},
|
电网侧: {
|
||||||
负载侧: {},
|
Apf_HarmI: {},
|
||||||
|
Apf_HarmUR: {},
|
||||||
|
},
|
||||||
|
负载侧: {
|
||||||
|
Apf_HarmI: {},
|
||||||
|
Apf_HarmUR: {},
|
||||||
|
},
|
||||||
},
|
},
|
||||||
chartData: {},
|
chartData: {},
|
||||||
//您可以通过修改 config-ucharts.js 文件中下标为 ['column'] 的节点来配置全局默认参数,如都是默认参数,此处可以不传 opts 。实际应用过程中 opts 只需传入与全局默认参数中不一致的【某一个属性】即可实现同类型的图表显示不同的样式,达到页面简洁的需求。
|
//您可以通过修改 config-ucharts.js 文件中下标为 ['column'] 的节点来配置全局默认参数,如都是默认参数,此处可以不传 opts 。实际应用过程中 opts 只需传入与全局默认参数中不一致的【某一个属性】即可实现同类型的图表显示不同的样式,达到页面简洁的需求。
|
||||||
@@ -71,87 +90,114 @@ export default {
|
|||||||
handler: function (newVal, oldVal) {
|
handler: function (newVal, oldVal) {
|
||||||
console.log(this.basicData)
|
console.log(this.basicData)
|
||||||
let basicData = JSON.parse(JSON.stringify(this.basicData))
|
let basicData = JSON.parse(JSON.stringify(this.basicData))
|
||||||
|
this.dataRadio = 0
|
||||||
|
this.renderData = {
|
||||||
|
电网侧: {
|
||||||
|
Apf_HarmI: {},
|
||||||
|
Apf_HarmUR: {},
|
||||||
|
},
|
||||||
|
负载侧: {
|
||||||
|
Apf_HarmI: {},
|
||||||
|
Apf_HarmUR: {},
|
||||||
|
},
|
||||||
|
}
|
||||||
let arr = [
|
let arr = [
|
||||||
{
|
{
|
||||||
name: '电网侧',
|
name: '电网侧',
|
||||||
key: 'Apf_HarmI_Sys',
|
key: 'Apf_HarmI_Sys',
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
name: '电网侧',
|
||||||
|
key: 'Apf_HarmUR_Sys',
|
||||||
|
},
|
||||||
{
|
{
|
||||||
name: '负载侧',
|
name: '负载侧',
|
||||||
key: 'Apf_HarmI_Load',
|
key: 'Apf_HarmI_Load',
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
name: '负载侧',
|
||||||
|
key: 'Apf_HarmUR_Load',
|
||||||
|
},
|
||||||
]
|
]
|
||||||
basicData.forEach((item) => {
|
basicData.forEach((item) => {
|
||||||
if (item.statisticalName.indexOf('HarmI') === -1) {
|
let have = arr.find((item2) => {
|
||||||
return
|
|
||||||
}
|
|
||||||
let index = arr.findIndex((item2) => {
|
|
||||||
return item.statisticalName.indexOf(item2.key) > -1
|
return item.statisticalName.indexOf(item2.key) > -1
|
||||||
})
|
})
|
||||||
if (index > -1) {
|
if (!have) return
|
||||||
if (this.renderData[arr[index]['name']][item.phase]) {
|
let name1 = have['name']
|
||||||
this.renderData[arr[index]['name']][item.phase][item.statisticalName] =
|
let name2 = have.key.split('_')[0] + '_' + have.key.split('_')[1]
|
||||||
|
if (this.renderData[name1][name2][item.phase]) {
|
||||||
|
this.renderData[name1][name2][item.phase][item.statisticalName] =
|
||||||
item.statisticalData || 0
|
item.statisticalData || 0
|
||||||
} else {
|
} else {
|
||||||
this.renderData[arr[index]['name']][item.phase] = {
|
this.renderData[name1][name2][item.phase] = {
|
||||||
[item.statisticalName]: item.statisticalData || 0,
|
[item.statisticalName]: item.statisticalData || 0,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
})
|
})
|
||||||
console.log(this.renderData)
|
console.log(this.renderData)
|
||||||
this.sex = Object.keys(this.renderData['电网侧']).map((item, index) => {
|
let dataOptions = []
|
||||||
return {
|
let type = [
|
||||||
text: item,
|
{
|
||||||
value: index,
|
name: 'Apf_HarmI',
|
||||||
|
key: 'Apf_HarmI',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'Apf_HarmUR',
|
||||||
|
key: 'Apf_HarmUR',
|
||||||
}
|
}
|
||||||
|
]
|
||||||
|
Object.keys(this.renderData['电网侧']['Apf_HarmI']).forEach((item, index) => {
|
||||||
|
type.forEach(item2 => {
|
||||||
|
dataOptions.push({
|
||||||
|
text: item + '_' + item2.name,
|
||||||
|
pointer: item2.key + '_' + item,
|
||||||
|
value: dataOptions.length,
|
||||||
})
|
})
|
||||||
|
})
|
||||||
|
})
|
||||||
|
this.dataOptions = dataOptions
|
||||||
|
console.log(dataOptions)
|
||||||
|
this.initEcharts()
|
||||||
|
|
||||||
let obj = JSON.parse(
|
|
||||||
JSON.stringify(this.renderData['电网侧'][Object.keys(this.renderData['电网侧'])[0]]),
|
|
||||||
)
|
|
||||||
console.log(
|
|
||||||
Object.keys(obj).map((item) => {
|
|
||||||
// Apf_HarmI_Sys_36(A) 匹配36
|
|
||||||
return item.match(/\d+/)[0]
|
|
||||||
|
|
||||||
}),
|
|
||||||
)
|
|
||||||
console.log(
|
|
||||||
Object.values(this.renderData['电网侧'][this.sex[this.radio].text]).filter((item) => {
|
|
||||||
return typeof item === 'number'
|
|
||||||
}),
|
|
||||||
)
|
|
||||||
console.log(
|
|
||||||
Object.values(this.renderData['负载侧'][this.sex[this.radio].text]).filter((item) => {
|
|
||||||
return typeof item === 'number'
|
|
||||||
}),
|
|
||||||
)
|
|
||||||
this.chartData = {
|
|
||||||
categories: Object.keys(obj).map((item) => {
|
|
||||||
// Apf_HarmI_Sys_36(A) 匹配36
|
|
||||||
return Number(item.match(/\d+/)[0])
|
|
||||||
}),
|
|
||||||
series: [
|
|
||||||
{
|
|
||||||
name: '电网侧',
|
|
||||||
data: Object.values(this.renderData['电网侧'][this.sex[this.radio].text]).filter((item) => {
|
|
||||||
return typeof item === 'number'
|
|
||||||
}),
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: '负载侧',
|
|
||||||
data: Object.values(this.renderData['负载侧'][this.sex[this.radio].text]).filter((item) => {
|
|
||||||
return typeof item === 'number'
|
|
||||||
}),
|
|
||||||
},
|
|
||||||
],
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
deep: true,
|
deep: true,
|
||||||
immediate: true,
|
immediate: true,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
methods: {
|
||||||
|
initEcharts() {
|
||||||
|
let obj = JSON.parse(
|
||||||
|
JSON.stringify(this.renderData['电网侧']['Apf_HarmI'][Object.keys(this.renderData['电网侧']['Apf_HarmI'])[0]]),
|
||||||
|
)
|
||||||
|
let key = this.dataOptions[this.dataRadio].pointer.split('_')
|
||||||
|
console.log(key)
|
||||||
|
let name1 = key[0] + '_' + key[1]
|
||||||
|
let name2 = key[2]
|
||||||
|
this.chartData = {
|
||||||
|
categories: Object.keys(obj).map((item) => {
|
||||||
|
// Apf_HarmI_Sys_36(A) 匹配36
|
||||||
|
return Number(item.match(/\d+/)[0])
|
||||||
|
}).filter((item) => {
|
||||||
|
return item % 2 === this.parity - 1
|
||||||
|
}),
|
||||||
|
series: [
|
||||||
|
{
|
||||||
|
name: '电网侧',
|
||||||
|
data: Object.values(this.renderData['电网侧'][name1][name2]).filter((item, index) => {
|
||||||
|
return index % 2 === this.parity - 1
|
||||||
|
}),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: '负载侧',
|
||||||
|
data: Object.values(this.renderData['负载侧'][name1][name2]).filter((item, index) => {
|
||||||
|
return index % 2 === this.parity - 1
|
||||||
|
}),
|
||||||
|
},
|
||||||
|
],
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user