实时数据-谐波频谱接口调试
This commit is contained in:
@@ -227,7 +227,10 @@
|
|||||||
<!-- 实时数据-实时趋势组件 -->
|
<!-- 实时数据-实时趋势组件 -->
|
||||||
<realTrend v-show="!realTimeFlag && sonTab == 1" ref="realTrendRef"></realTrend>
|
<realTrend v-show="!realTimeFlag && sonTab == 1" ref="realTrendRef"></realTrend>
|
||||||
<!-- 实时数据-谐波频谱组件 -->
|
<!-- 实时数据-谐波频谱组件 -->
|
||||||
<harmonicSpectrum v-show="!realTimeFlag && sonTab == 2" ref="harmonicSpectrumRef"></harmonicSpectrum>
|
<harmonicSpectrum
|
||||||
|
v-show="!realTimeFlag && sonTab == 2"
|
||||||
|
ref="harmonicSpectrumRef"
|
||||||
|
></harmonicSpectrum>
|
||||||
</div>
|
</div>
|
||||||
<!-- 暂态事件 -->
|
<!-- 暂态事件 -->
|
||||||
<div style="height: calc(100vh - 200px)" v-show="dataSet.indexOf('_event') != -1">
|
<div style="height: calc(100vh - 200px)" v-show="dataSet.indexOf('_event') != -1">
|
||||||
@@ -292,43 +295,6 @@ const formInline = reactive({
|
|||||||
lineId: ''
|
lineId: ''
|
||||||
})
|
})
|
||||||
const detail = ref<any>(null)
|
const detail = ref<any>(null)
|
||||||
// WebSocket
|
|
||||||
const socket: any = ref(null)
|
|
||||||
const url = 'wss://your-websocket-url'
|
|
||||||
//连接websocket
|
|
||||||
const connectWebSocket = () => {
|
|
||||||
return
|
|
||||||
socket.value = new WebSocket(url)
|
|
||||||
socket.value.onopen = () => {
|
|
||||||
console.log('WebSocket connected')
|
|
||||||
socket.value.isConnected = true
|
|
||||||
}
|
|
||||||
|
|
||||||
socket.value.onerror = (error: any) => {
|
|
||||||
console.error('WebSocket error:', error)
|
|
||||||
}
|
|
||||||
|
|
||||||
socket.value.onmessage = (message: any) => {
|
|
||||||
console.log('Received message:', message.data)
|
|
||||||
}
|
|
||||||
|
|
||||||
socket.value.onclose = () => {
|
|
||||||
console.log('WebSocket disconnected')
|
|
||||||
socket.value.isConnected = false
|
|
||||||
}
|
|
||||||
}
|
|
||||||
//建立连接发送消息
|
|
||||||
const sendMessage = () => {
|
|
||||||
if (socket.value.isConnected) {
|
|
||||||
socket.value.send('Your message here')
|
|
||||||
}
|
|
||||||
}
|
|
||||||
//关闭websocket
|
|
||||||
const disconnectWebSocket = () => {
|
|
||||||
if (socket.value.isConnected) {
|
|
||||||
socket.value.close()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
//是否显示实时数据默认内容
|
//是否显示实时数据默认内容
|
||||||
const realTimeFlag = ref(true)
|
const realTimeFlag = ref(true)
|
||||||
//实时数据子菜单
|
//实时数据子菜单
|
||||||
@@ -353,13 +319,15 @@ const harmonicSpectrumRef = ref()
|
|||||||
const handleHarmonicSpectrum = () => {
|
const handleHarmonicSpectrum = () => {
|
||||||
realTimeFlag.value = false
|
realTimeFlag.value = false
|
||||||
sonTab.value = 2
|
sonTab.value = 2
|
||||||
harmonicSpectrumRef.value && harmonicSpectrumRef.value.getHarmonicSpectrumParams({ devId: deviceId.value, lineId: lineId.value })
|
harmonicSpectrumRef.value &&
|
||||||
|
harmonicSpectrumRef.value.getHarmonicSpectrumParams({ devId: deviceId.value, lineId: lineId.value })
|
||||||
window.clearInterval(timer.value)
|
window.clearInterval(timer.value)
|
||||||
}
|
}
|
||||||
//返回
|
//返回
|
||||||
const handleReturn = () => {
|
const handleReturn = () => {
|
||||||
realTimeFlag.value = true
|
realTimeFlag.value = true
|
||||||
sonTab.value = null
|
sonTab.value = null
|
||||||
|
handleClick()
|
||||||
}
|
}
|
||||||
const getDeviceDataTrend = (e: any) => {
|
const getDeviceDataTrend = (e: any) => {
|
||||||
detail.value = {
|
detail.value = {
|
||||||
@@ -621,9 +589,7 @@ watch(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
onMounted(() => {
|
onMounted(() => {})
|
||||||
connectWebSocket()
|
|
||||||
})
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss">
|
<style lang="scss">
|
||||||
|
|||||||
@@ -2,12 +2,10 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="harmonic">
|
<div class="harmonic">
|
||||||
<div class="harmonic_select">
|
<div class="harmonic_select">
|
||||||
<!-- {{ searchForm.index }} -->
|
|
||||||
<el-form :model="searchForm" class="history_select" id="history_select">
|
<el-form :model="searchForm" class="history_select" id="history_select">
|
||||||
<el-form-item label="稳态指标">
|
<el-form-item label="稳态指标">
|
||||||
<el-select
|
<el-select
|
||||||
multiple
|
multiple
|
||||||
:multiple-limit="3"
|
|
||||||
collapse-tags
|
collapse-tags
|
||||||
collapse-tags-tooltip
|
collapse-tags-tooltip
|
||||||
v-model="searchForm.index"
|
v-model="searchForm.index"
|
||||||
@@ -22,17 +20,18 @@
|
|||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-form>
|
</el-form>
|
||||||
<el-button type="primary" @click="init">查询</el-button>
|
<el-button type="primary" :loading="loading" @click="init">查询</el-button>
|
||||||
</div>
|
</div>
|
||||||
<div class="harmonic_body">
|
<div class="harmonic_body" v-loading="loading">
|
||||||
<div class="harmonic_body_charts" v-if="searchForm.index[0]">
|
<div class="harmonic_body_charts" v-for="(item, index) in chartsList" :key="index">
|
||||||
<MyEchart ref="barCharts1" :options="echartsData1"></MyEchart>
|
<p class="charts_title">
|
||||||
</div>
|
{{
|
||||||
<div class="harmonic_body_charts" v-if="searchForm.index[1]">
|
indexOptions.find((item: any) => {
|
||||||
<MyEchart ref="barCharts2" :options="echartsData2"></MyEchart>
|
return item.id == searchForm.index[index]
|
||||||
</div>
|
})?.name
|
||||||
<div class="harmonic_body_charts" v-if="searchForm.index[2]">
|
}}
|
||||||
<MyEchart ref="barCharts3" :options="echartsData3"></MyEchart>
|
</p>
|
||||||
|
<MyEchart :ref="setChildRef(index)" :options="item.echartsData"></MyEchart>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -43,7 +42,7 @@ import { queryByCode, queryByid, queryCsDictTree } from '@/api/system-boot/dictT
|
|||||||
import { queryStatistical } from '@/api/system-boot/csstatisticalset'
|
import { queryStatistical } from '@/api/system-boot/csstatisticalset'
|
||||||
import MyEchart from '@/components/echarts/MyEchart.vue'
|
import MyEchart from '@/components/echarts/MyEchart.vue'
|
||||||
import { getDeviceHarmonicSpectrumData, getRealTimeTableList } from '@/api/cs-device-boot/EquipmentDelivery.ts'
|
import { getDeviceHarmonicSpectrumData, getRealTimeTableList } from '@/api/cs-device-boot/EquipmentDelivery.ts'
|
||||||
const searchForm = ref({})
|
const searchForm: any = ref({})
|
||||||
searchForm.value = {
|
searchForm.value = {
|
||||||
index: []
|
index: []
|
||||||
}
|
}
|
||||||
@@ -59,471 +58,171 @@ queryByCode('portable-harmonic').then(res => {
|
|||||||
legendDictList.value = vv.data
|
legendDictList.value = vv.data
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
const tableList: any = ref([])
|
|
||||||
for (let i = 0; i < 10000; i++) {
|
|
||||||
tableList.value.push({
|
|
||||||
name: i + 1,
|
|
||||||
// value: Math.floor(Math.random() * 101)
|
|
||||||
value: i + 2
|
|
||||||
})
|
|
||||||
}
|
|
||||||
const echartsData1: any = ref([]),
|
|
||||||
echartsData2: any = ref([]),
|
|
||||||
echartsData3: any = ref([]),
|
|
||||||
barCharts1 = ref(),
|
|
||||||
barCharts2 = ref(),
|
|
||||||
barCharts3 = ref()
|
|
||||||
//查询谐波频谱折线图
|
|
||||||
const chartsTitle1 = ref('')
|
|
||||||
const chartsTitle2 = ref('')
|
|
||||||
const chartsTitle3 = ref('')
|
|
||||||
//谐波频谱参数
|
//谐波频谱参数
|
||||||
const params = ref({})
|
const params: any = ref({})
|
||||||
const getHarmonicSpectrumParams = (val: any) => {
|
const getHarmonicSpectrumParams = (val: any) => {
|
||||||
params.value = val
|
params.value = val
|
||||||
params.value.list = []
|
init()
|
||||||
console.log(params.value, '+++++++++++++')
|
return
|
||||||
//查询稳态指标
|
//查询稳态指标
|
||||||
getRealTimeTableList().then(res => {
|
getRealTimeTableList().then(res => {
|
||||||
console.log('稳态指标', res)
|
console.log('稳态指标', res)
|
||||||
})
|
})
|
||||||
|
}
|
||||||
|
const chartsList: any = ref([])
|
||||||
|
const loading = ref(false)
|
||||||
|
// 为每个子组件实例设置ref
|
||||||
|
const setChildRef = (index: any) => {
|
||||||
|
return `child-${index}`
|
||||||
|
}
|
||||||
|
const childRefs = {}
|
||||||
|
const init = () => {
|
||||||
|
loading.value = true
|
||||||
|
params.value.list = []
|
||||||
|
searchForm.value.index.map((item: any) => {
|
||||||
|
params.value.list.push({ statisticalId: item })
|
||||||
|
})
|
||||||
//查询谐波频谱
|
//查询谐波频谱
|
||||||
getDeviceHarmonicSpectrumData(params.value).then(res => {
|
getDeviceHarmonicSpectrumData(params.value).then(res => {
|
||||||
console.log('谐波频谱')
|
chartsList.value = res.data
|
||||||
})
|
//数据根据相别组装成新数组
|
||||||
}
|
chartsList.value.map((item: any) => {
|
||||||
const init = () => {
|
item.countList = []
|
||||||
const xDataList: any = [],
|
item.thdDataVOS = item.thdDataVOS.reduce((acc: any, current: any) => {
|
||||||
yDataList1: any = [],
|
const existing = acc.find((redu: any) => redu.phase == current.phase)
|
||||||
yDataList2: any = [],
|
if (existing) {
|
||||||
yDataList3: any = []
|
existing.list.push(current)
|
||||||
tableList.value.map((item: any) => {
|
} else {
|
||||||
xDataList.push(item.name)
|
acc.push({
|
||||||
yDataList1.push(item.value)
|
phase: current.phase,
|
||||||
yDataList2.push(item.value + 1000)
|
list: [current]
|
||||||
yDataList3.push(item.value + 2000)
|
})
|
||||||
})
|
}
|
||||||
|
return acc
|
||||||
|
}, [])
|
||||||
|
return
|
||||||
|
})
|
||||||
|
|
||||||
indexOptions.value.map((item: any) => {
|
//循环渲染图表
|
||||||
if (item.id == searchForm.value.index[0]) {
|
chartsList.value &&
|
||||||
chartsTitle1.value = item.name
|
chartsList.value.map((item: any, index: any) => {
|
||||||
}
|
const refName = setChildRef(index)
|
||||||
if (item.id == searchForm.value.index[1]) {
|
childRefs[refName] = ref(null) // 初始化ref
|
||||||
chartsTitle2.value = item.name
|
item.echartsData = {
|
||||||
}
|
options: {
|
||||||
if (item.id == searchForm.value.index[2]) {
|
title: [
|
||||||
chartsTitle3.value = item.name
|
{
|
||||||
}
|
left: '10%',
|
||||||
})
|
top: 0
|
||||||
console.log(chartsTitle1.value, chartsTitle2.value, chartsTitle3.value, '666677777')
|
// text: item.showName
|
||||||
if (searchForm.value.index[0]) {
|
|
||||||
echartsData1.value = {
|
|
||||||
options: {
|
|
||||||
// backgroundColor: '#0f375f',
|
|
||||||
title: [
|
|
||||||
{
|
|
||||||
left: '10%',
|
|
||||||
top: 0,
|
|
||||||
text: chartsTitle1.value
|
|
||||||
}
|
|
||||||
],
|
|
||||||
grid: {
|
|
||||||
top: '8%',
|
|
||||||
bottom: '15%', //也可设置left和right设置距离来控制图表的大小
|
|
||||||
left: '3%',
|
|
||||||
right: '5%'
|
|
||||||
},
|
|
||||||
tooltip: {
|
|
||||||
trigger: 'axis',
|
|
||||||
axisPointer: {
|
|
||||||
type: 'cross',
|
|
||||||
label: {
|
|
||||||
show: false
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
legend: {
|
|
||||||
data: ['A相', 'B相', 'C相'],
|
|
||||||
top: '2%',
|
|
||||||
right: '2%'
|
|
||||||
// icon: 'icon'
|
|
||||||
// icon: "circle", //icon 长方形 circle 圆形 arrow箭头型 diamond菱形
|
|
||||||
// itemWidth: 14,
|
|
||||||
// itemHeight: 14,
|
|
||||||
// textStyle: {
|
|
||||||
// inside: true,
|
|
||||||
// color: '#000',
|
|
||||||
// padding: [11, 0, 10, 0],
|
|
||||||
// align: 'left',
|
|
||||||
// verticalAlign: 'center',
|
|
||||||
// fontSize: 14,
|
|
||||||
// rich: {}
|
|
||||||
// }
|
|
||||||
},
|
|
||||||
xAxis: {
|
|
||||||
// name: '时间(ms)',
|
|
||||||
data: xDataList,
|
|
||||||
axisLine: {
|
|
||||||
show: true, //隐藏X轴轴线
|
|
||||||
lineStyle: {
|
|
||||||
color: '#000'
|
|
||||||
}
|
|
||||||
},
|
|
||||||
axisTick: {
|
|
||||||
show: true //隐藏X轴刻度
|
|
||||||
},
|
|
||||||
axisPointer: {
|
|
||||||
type: 'shadow'
|
|
||||||
},
|
|
||||||
axisLabel: {
|
|
||||||
show: true,
|
|
||||||
textStyle: {
|
|
||||||
color: '#000' //X轴文字颜色
|
|
||||||
}
|
|
||||||
},
|
|
||||||
boundaryGap: false
|
|
||||||
},
|
|
||||||
yAxis: [
|
|
||||||
{
|
|
||||||
type: 'value',
|
|
||||||
name: 'kv',
|
|
||||||
splitLine: {
|
|
||||||
show: false
|
|
||||||
},
|
|
||||||
axisTick: {
|
|
||||||
show: true
|
|
||||||
},
|
|
||||||
axisLine: {
|
|
||||||
show: true,
|
|
||||||
lineStyle: {
|
|
||||||
color: '#000'
|
|
||||||
}
|
}
|
||||||
}
|
],
|
||||||
|
grid: {
|
||||||
|
top: '16%',
|
||||||
|
bottom: '15%', //也可设置left和right设置距离来控制图表的大小
|
||||||
|
left: '3%',
|
||||||
|
right: '4%'
|
||||||
|
},
|
||||||
|
tooltip: {
|
||||||
|
trigger: 'axis',
|
||||||
|
axisPointer: {
|
||||||
|
type: 'cross',
|
||||||
|
label: {
|
||||||
|
show: false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
legend: {
|
||||||
|
data: [],
|
||||||
|
top: '2%',
|
||||||
|
right: '2%'
|
||||||
|
},
|
||||||
|
xAxis: {
|
||||||
|
name: '次数',
|
||||||
|
data: [],
|
||||||
|
axisLine: {
|
||||||
|
show: true, //隐藏X轴轴线
|
||||||
|
lineStyle: {
|
||||||
|
color: '#000'
|
||||||
|
}
|
||||||
|
},
|
||||||
|
axisTick: {
|
||||||
|
show: true //隐藏X轴刻度
|
||||||
|
},
|
||||||
|
axisPointer: {
|
||||||
|
type: 'shadow'
|
||||||
|
},
|
||||||
|
axisLabel: {
|
||||||
|
show: true,
|
||||||
|
textStyle: {
|
||||||
|
color: '#000' //X轴文字颜色
|
||||||
|
}
|
||||||
|
},
|
||||||
|
boundaryGap: false
|
||||||
|
},
|
||||||
|
yAxis: [
|
||||||
|
{
|
||||||
|
type: 'value',
|
||||||
|
name:
|
||||||
|
item.thdDataVOS.length != 0 &&
|
||||||
|
item.thdDataVOS[0].list &&
|
||||||
|
item.thdDataVOS[0].list[0].unit,
|
||||||
|
splitLine: {
|
||||||
|
show: false
|
||||||
|
},
|
||||||
|
axisTick: {
|
||||||
|
show: true
|
||||||
|
},
|
||||||
|
axisLine: {
|
||||||
|
show: true,
|
||||||
|
lineStyle: {
|
||||||
|
color: '#000'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
series: []
|
||||||
}
|
}
|
||||||
],
|
}
|
||||||
series: [
|
//横轴数据
|
||||||
{
|
item.echartsData.options.xAxis.data =
|
||||||
name: 'A相',
|
item.thdDataVOS.length != 0 &&
|
||||||
|
item.thdDataVOS[0].list &&
|
||||||
|
item.thdDataVOS[0].list.map((ss: any) => {
|
||||||
|
return ss.frequency + '次'
|
||||||
|
})
|
||||||
|
|
||||||
|
//y轴数据
|
||||||
|
item.thdDataVOS.map((vv: any) => {
|
||||||
|
item.echartsData.options.series.push({
|
||||||
|
name: vv.phase + '相',
|
||||||
type: 'line',
|
type: 'line',
|
||||||
barMaxWidth: 24, //使用的 y 轴的 index,在单个图表实例中存在多个 y轴的时候有用
|
barMaxWidth: 24, //使用的 y 轴的 index,在单个图表实例中存在多个 y轴的时候有用
|
||||||
itemStyle: {
|
itemStyle: {
|
||||||
// normal: {
|
// normal: {
|
||||||
barBorderRadius: [3, 3, 0, 0],
|
barBorderRadius: [3, 3, 0, 0]
|
||||||
color: '#00CC99'
|
// color: '#00CC99'
|
||||||
// }e
|
// }e
|
||||||
},
|
},
|
||||||
data: yDataList1,
|
data: vv.list.map((vvs: any) => {
|
||||||
|
return vvs.statisticalData
|
||||||
|
}),
|
||||||
smooth: true, // 这里设置平滑曲线
|
smooth: true, // 这里设置平滑曲线
|
||||||
symbol: 'none' // 设置为 'none' 去掉折点小圆
|
symbol: 'none' // 设置为 'none' 去掉折点小圆
|
||||||
},
|
})
|
||||||
{
|
//legend数据
|
||||||
name: 'B相',
|
item.echartsData.options.legend.data.push(vv.phase + '相')
|
||||||
type: 'line',
|
})
|
||||||
barMaxWidth: 24,
|
})
|
||||||
itemStyle: {
|
loading.value = false
|
||||||
// normal: {
|
})
|
||||||
barBorderRadius: [3, 3, 0, 0],
|
return
|
||||||
|
|
||||||
color: '#FF9900'
|
|
||||||
// }
|
|
||||||
},
|
|
||||||
data: yDataList2,
|
|
||||||
smooth: true, // 这里设置平滑曲线
|
|
||||||
symbol: 'none' // 设置为 'none' 去掉折点小圆
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'C相',
|
|
||||||
type: 'line',
|
|
||||||
barMaxWidth: 24,
|
|
||||||
itemStyle: {
|
|
||||||
// normal: {
|
|
||||||
barBorderRadius: [3, 3, 0, 0]
|
|
||||||
// color: '#FF9900'
|
|
||||||
// }
|
|
||||||
},
|
|
||||||
data: yDataList3,
|
|
||||||
smooth: true, // 这里设置平滑曲线
|
|
||||||
symbol: 'none' // 设置为 'none' 去掉折点小圆
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
barCharts1.value && barCharts1.value.initChart()
|
|
||||||
}
|
|
||||||
if (searchForm.value.index[1]) {
|
|
||||||
echartsData2.value = {
|
|
||||||
options: {
|
|
||||||
// backgroundColor: '#0f375f',
|
|
||||||
title: [
|
|
||||||
{
|
|
||||||
left: '10%',
|
|
||||||
top: 0,
|
|
||||||
text: chartsTitle2.value
|
|
||||||
}
|
|
||||||
],
|
|
||||||
grid: {
|
|
||||||
top: '8%',
|
|
||||||
bottom: '15%', //也可设置left和right设置距离来控制图表的大小
|
|
||||||
left: '3%',
|
|
||||||
right: '5%'
|
|
||||||
},
|
|
||||||
tooltip: {
|
|
||||||
trigger: 'axis',
|
|
||||||
axisPointer: {
|
|
||||||
type: 'cross',
|
|
||||||
label: {
|
|
||||||
show: false
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
legend: {
|
|
||||||
data: ['A相', 'B相', 'C相'],
|
|
||||||
top: '2%',
|
|
||||||
right: '2%'
|
|
||||||
// icon: 'icon'
|
|
||||||
// icon: "circle", //icon 长方形 circle 圆形 arrow箭头型 diamond菱形
|
|
||||||
// itemWidth: 14,
|
|
||||||
// itemHeight: 14,
|
|
||||||
// textStyle: {
|
|
||||||
// inside: true,
|
|
||||||
// color: '#000',
|
|
||||||
// padding: [11, 0, 10, 0],
|
|
||||||
// align: 'left',
|
|
||||||
// verticalAlign: 'center',
|
|
||||||
// fontSize: 14,
|
|
||||||
// rich: {}
|
|
||||||
// }
|
|
||||||
},
|
|
||||||
xAxis: {
|
|
||||||
// name: '时间(ms)',
|
|
||||||
data: xDataList,
|
|
||||||
axisLine: {
|
|
||||||
show: true, //隐藏X轴轴线
|
|
||||||
lineStyle: {
|
|
||||||
color: '#000'
|
|
||||||
}
|
|
||||||
},
|
|
||||||
axisTick: {
|
|
||||||
show: true //隐藏X轴刻度
|
|
||||||
},
|
|
||||||
axisPointer: {
|
|
||||||
type: 'shadow'
|
|
||||||
},
|
|
||||||
axisLabel: {
|
|
||||||
show: true,
|
|
||||||
textStyle: {
|
|
||||||
color: '#000' //X轴文字颜色
|
|
||||||
}
|
|
||||||
},
|
|
||||||
boundaryGap: false
|
|
||||||
},
|
|
||||||
yAxis: [
|
|
||||||
{
|
|
||||||
type: 'value',
|
|
||||||
name: 'kv',
|
|
||||||
splitLine: {
|
|
||||||
show: false
|
|
||||||
},
|
|
||||||
axisTick: {
|
|
||||||
show: true
|
|
||||||
},
|
|
||||||
axisLine: {
|
|
||||||
show: true,
|
|
||||||
lineStyle: {
|
|
||||||
color: '#000'
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
],
|
|
||||||
series: [
|
|
||||||
{
|
|
||||||
name: 'A相',
|
|
||||||
type: 'line',
|
|
||||||
barMaxWidth: 24, //使用的 y 轴的 index,在单个图表实例中存在多个 y轴的时候有用
|
|
||||||
itemStyle: {
|
|
||||||
// normal: {
|
|
||||||
barBorderRadius: [3, 3, 0, 0],
|
|
||||||
color: '#00CC99'
|
|
||||||
// }e
|
|
||||||
},
|
|
||||||
data: yDataList1,
|
|
||||||
smooth: true, // 这里设置平滑曲线
|
|
||||||
symbol: 'none' // 设置为 'none' 去掉折点小圆
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'B相',
|
|
||||||
type: 'line',
|
|
||||||
barMaxWidth: 24,
|
|
||||||
itemStyle: {
|
|
||||||
// normal: {
|
|
||||||
barBorderRadius: [3, 3, 0, 0],
|
|
||||||
|
|
||||||
color: '#FF9900'
|
|
||||||
// }
|
|
||||||
},
|
|
||||||
data: yDataList2,
|
|
||||||
smooth: true, // 这里设置平滑曲线
|
|
||||||
symbol: 'none' // 设置为 'none' 去掉折点小圆
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'C相',
|
|
||||||
type: 'line',
|
|
||||||
barMaxWidth: 24,
|
|
||||||
itemStyle: {
|
|
||||||
// normal: {
|
|
||||||
barBorderRadius: [3, 3, 0, 0]
|
|
||||||
// color: '#FF9900'
|
|
||||||
// }
|
|
||||||
},
|
|
||||||
data: yDataList3,
|
|
||||||
smooth: true, // 这里设置平滑曲线
|
|
||||||
symbol: 'none' // 设置为 'none' 去掉折点小圆
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
barCharts2.value && barCharts2.value.initChart()
|
|
||||||
}
|
|
||||||
if (searchForm.value.index[2]) {
|
|
||||||
echartsData3.value = {
|
|
||||||
options: {
|
|
||||||
// backgroundColor: '#0f375f',
|
|
||||||
title: [
|
|
||||||
{
|
|
||||||
left: '10%',
|
|
||||||
top: 0,
|
|
||||||
text: chartsTitle3.value
|
|
||||||
}
|
|
||||||
],
|
|
||||||
grid: {
|
|
||||||
top: '8%',
|
|
||||||
bottom: '15%', //也可设置left和right设置距离来控制图表的大小
|
|
||||||
left: '3%',
|
|
||||||
right: '5%'
|
|
||||||
},
|
|
||||||
tooltip: {
|
|
||||||
trigger: 'axis',
|
|
||||||
axisPointer: {
|
|
||||||
type: 'cross',
|
|
||||||
label: {
|
|
||||||
show: false
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
legend: {
|
|
||||||
data: ['A相', 'B相', 'C相'],
|
|
||||||
top: '2%',
|
|
||||||
right: '2%'
|
|
||||||
// icon: 'icon'
|
|
||||||
// icon: "circle", //icon 长方形 circle 圆形 arrow箭头型 diamond菱形
|
|
||||||
// itemWidth: 14,
|
|
||||||
// itemHeight: 14,
|
|
||||||
// textStyle: {
|
|
||||||
// inside: true,
|
|
||||||
// color: '#000',
|
|
||||||
// padding: [11, 0, 10, 0],
|
|
||||||
// align: 'left',
|
|
||||||
// verticalAlign: 'center',
|
|
||||||
// fontSize: 14,
|
|
||||||
// rich: {}
|
|
||||||
// }
|
|
||||||
},
|
|
||||||
xAxis: {
|
|
||||||
// name: '时间(ms)',
|
|
||||||
data: xDataList,
|
|
||||||
axisLine: {
|
|
||||||
show: true, //隐藏X轴轴线
|
|
||||||
lineStyle: {
|
|
||||||
color: '#000'
|
|
||||||
}
|
|
||||||
},
|
|
||||||
axisTick: {
|
|
||||||
show: true //隐藏X轴刻度
|
|
||||||
},
|
|
||||||
axisPointer: {
|
|
||||||
type: 'shadow'
|
|
||||||
},
|
|
||||||
axisLabel: {
|
|
||||||
show: true,
|
|
||||||
textStyle: {
|
|
||||||
color: '#000' //X轴文字颜色
|
|
||||||
}
|
|
||||||
},
|
|
||||||
boundaryGap: false
|
|
||||||
},
|
|
||||||
yAxis: [
|
|
||||||
{
|
|
||||||
type: 'value',
|
|
||||||
name: 'kv',
|
|
||||||
splitLine: {
|
|
||||||
show: false
|
|
||||||
},
|
|
||||||
axisTick: {
|
|
||||||
show: true
|
|
||||||
},
|
|
||||||
axisLine: {
|
|
||||||
show: true,
|
|
||||||
lineStyle: {
|
|
||||||
color: '#000'
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
],
|
|
||||||
series: [
|
|
||||||
{
|
|
||||||
name: 'A相',
|
|
||||||
type: 'line',
|
|
||||||
barMaxWidth: 24, //使用的 y 轴的 index,在单个图表实例中存在多个 y轴的时候有用
|
|
||||||
itemStyle: {
|
|
||||||
// normal: {
|
|
||||||
barBorderRadius: [3, 3, 0, 0],
|
|
||||||
color: '#00CC99'
|
|
||||||
// }e
|
|
||||||
},
|
|
||||||
data: yDataList1,
|
|
||||||
smooth: true, // 这里设置平滑曲线
|
|
||||||
symbol: 'none' // 设置为 'none' 去掉折点小圆
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'B相',
|
|
||||||
type: 'line',
|
|
||||||
barMaxWidth: 24,
|
|
||||||
itemStyle: {
|
|
||||||
// normal: {
|
|
||||||
barBorderRadius: [3, 3, 0, 0],
|
|
||||||
|
|
||||||
color: '#FF9900'
|
|
||||||
// }
|
|
||||||
},
|
|
||||||
data: yDataList2,
|
|
||||||
smooth: true, // 这里设置平滑曲线
|
|
||||||
symbol: 'none' // 设置为 'none' 去掉折点小圆
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'C相',
|
|
||||||
type: 'line',
|
|
||||||
barMaxWidth: 24,
|
|
||||||
itemStyle: {
|
|
||||||
// normal: {
|
|
||||||
barBorderRadius: [3, 3, 0, 0]
|
|
||||||
// color: '#FF9900'
|
|
||||||
// }
|
|
||||||
},
|
|
||||||
data: yDataList3,
|
|
||||||
smooth: true, // 这里设置平滑曲线
|
|
||||||
symbol: 'none' // 设置为 'none' 去掉折点小圆
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
barCharts3.value && barCharts3.value.initChart()
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
watch(
|
watch(
|
||||||
() => searchForm.value.index,
|
() => searchForm.value.index,
|
||||||
(val: any, oldval: any) => {
|
(val: any, oldval: any) => {
|
||||||
if (val && val.length != 0) {
|
if (val && val.length != 0) {
|
||||||
init()
|
// init()
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -531,10 +230,7 @@ watch(
|
|||||||
immediate: true
|
immediate: true
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
onMounted(() => {
|
onMounted(() => {})
|
||||||
console.log()
|
|
||||||
// init()
|
|
||||||
})
|
|
||||||
defineExpose({ getHarmonicSpectrumParams })
|
defineExpose({ getHarmonicSpectrumParams })
|
||||||
</script>
|
</script>
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
@@ -564,6 +260,14 @@ defineExpose({ getHarmonicSpectrumParams })
|
|||||||
height: 200px;
|
height: 200px;
|
||||||
margin: 15px 0;
|
margin: 15px 0;
|
||||||
border: 1px solid #eee;
|
border: 1px solid #eee;
|
||||||
|
position: relative;
|
||||||
|
.charts_title {
|
||||||
|
position: absolute;
|
||||||
|
top: 10px;
|
||||||
|
left: 10%;
|
||||||
|
font-size: 18px;
|
||||||
|
font-weight: 800;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user