From 382085c514e5119865a292a3a2389174b65e2fba Mon Sep 17 00:00:00 2001 From: zhujiyan <17812234322@163.com> Date: Mon, 21 Oct 2024 10:08:05 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AE=9E=E6=97=B6=E6=95=B0=E6=8D=AE-=E6=95=B0?= =?UTF-8?q?=E6=8D=AE=E6=9B=B4=E6=96=B0=E9=97=AA=E5=8A=A8=E9=97=AE=E9=A2=98?= =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/echarts/MyEchart.vue | 20 +++++----- .../govern/device/control/tabs/realtime.vue | 39 ++++++++++++------- 2 files changed, 33 insertions(+), 26 deletions(-) diff --git a/src/components/echarts/MyEchart.vue b/src/components/echarts/MyEchart.vue index b2bdf98..26048e1 100644 --- a/src/components/echarts/MyEchart.vue +++ b/src/components/echarts/MyEchart.vue @@ -20,7 +20,7 @@ const config = useConfig() color[0] = config.layout.elementUiPrimary[0] const chartRef = ref() -const props = defineProps(['options','isInterVal']) +const props = defineProps(['options', 'isInterVal', 'pieInterVal']) let chart: echarts.ECharts | any = null const resizeHandler = () => { // 不在视野中的时候不进行resize @@ -33,8 +33,8 @@ const resizeHandler = () => { }) } const initChart = () => { - if(!props.isInterVal){ - chart?.dispose() + if (!props.isInterVal && !props.pieInterVal) { + chart?.dispose() } // chart?.dispose() chart = echarts.init(chartRef.value as HTMLDivElement) @@ -111,6 +111,7 @@ const initChart = () => { handlerBar(options) // 处理柱状图 chart.setOption(options) + setTimeout(() => { chart.resize() }, 0) @@ -146,7 +147,7 @@ const handlerYAxis = () => { nameTextStyle: { color: '#000' }, - splitNumber:5, + splitNumber: 5, minInterval: 1, axisLine: { show: true, @@ -158,7 +159,7 @@ const handlerYAxis = () => { color: '#000', fontSize: 14, formatter: function (value) { - return value.toFixed(0); // 格式化显示为一位小数 + return value.toFixed(0) // 格式化显示为一位小数 } }, splitLine: { @@ -168,8 +169,7 @@ const handlerYAxis = () => { type: 'dashed', opacity: 0.5 } - }, - + } } // props.options?.xAxis 是数组还是对象 if (Array.isArray(props.options?.yAxis)) { @@ -199,11 +199,9 @@ const handlerXAxis = () => { // textStyle: { fontFamily: 'dinproRegular', color: '#000', - fontSize: '12', + fontSize: '12' // } - } - } // props.options?.xAxis 是数组还是对象 if (Array.isArray(props.options?.xAxis)) { @@ -244,7 +242,7 @@ onBeforeUnmount(() => { watch( () => props.options, (newVal, oldVal) => { - initChart() + initChart() } ) diff --git a/src/views/govern/device/control/tabs/realtime.vue b/src/views/govern/device/control/tabs/realtime.vue index 2aa291e..116177f 100644 --- a/src/views/govern/device/control/tabs/realtime.vue +++ b/src/views/govern/device/control/tabs/realtime.vue @@ -4,20 +4,32 @@
电压有效值(kV)
-
-
-
+
+ +
+
+ +
+
+ +
基波电压/电流幅值(相位)
-
+
电流有效值(A)
-
-
-
+
+ +
+
+ +
+
+ +
@@ -178,7 +190,9 @@ const initRadioCharts = () => { tooltip: { formatter: '{a}
{c} {b}' }, - legend: [], + legend: { + show: false + }, series: [ // 外圈电压 内圈电流 { @@ -456,6 +470,7 @@ const init = () => { //数值位置 detail: { fontSize: 12, + valueAnimation: true, formatter: '{value}', offsetCenter: ['0%', '25%'] }, @@ -490,7 +505,6 @@ const columnsData: any = ref([]) const getColumns = () => { getRealTimeTableList().then(res => { columnsData.value = res.data - console.log(dataList.value, '+++++++++++++++++++++++++446') getTableData(dataList.value) }) } @@ -498,12 +512,10 @@ const getColumns = () => { const columnsDataTop: any = ref([]) const columnsDataBot: any = ref([]) const getTableData = (list: any) => { - console.log(list, '+++++++++++') loading.value = true tableData.value = list columnsDataTop.value = [] columnsDataBot.value = [] - console.log('🚀 ~ columnsData.value.map ~ columnsData.value:', columnsData.value) columnsData.value.map((item: any, index: any) => { item.map((vv: any) => { @@ -526,14 +538,11 @@ const vRadioList: any = ref([]) const realData = ref({}) const realList = ref([]) -console.log(realData.value, '++++++++++++++++++++++757') const setRealData = (val: any) => { - console.log(val, '实时数据') realData.value = val realList.value = [val] initRadioCharts() //新的 - console.log(realData.value, '--99--88--77') echartsDataV1.value.options.series[0].data = [ { name: 'A相', @@ -630,7 +639,7 @@ onMounted(() => { height: 80%; position: absolute; top: 20%; - bottom:10px; + bottom: 10px; } }