From 2b9fa490d4db4ef8dbc5100ee29b1df7c44a361d Mon Sep 17 00:00:00 2001 From: lai <371757574@qq.com> Date: Tue, 29 Oct 2024 18:52:51 +0800 Subject: [PATCH] =?UTF-8?q?=E7=A7=9F=E6=88=B7=E9=A6=96=E9=A1=B5=E6=B7=BB?= =?UTF-8?q?=E5=8A=A0=E5=8C=BA=E5=88=86=E5=A4=9A=E4=B8=AAUPF=E6=83=85?= =?UTF-8?q?=E5=86=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/index/tenantIndex.vue | 11 +--- src/views/index/tenantUPF.vue | 100 ++++++++++++++++++++------------ 2 files changed, 66 insertions(+), 45 deletions(-) diff --git a/src/views/index/tenantIndex.vue b/src/views/index/tenantIndex.vue index 8ff093d3..553d5643 100644 --- a/src/views/index/tenantIndex.vue +++ b/src/views/index/tenantIndex.vue @@ -14,15 +14,8 @@ onMounted(() => {});
-
- - -
+ + diff --git a/src/views/index/tenantUPF.vue b/src/views/index/tenantUPF.vue index 96f7d94d..33937c28 100644 --- a/src/views/index/tenantUPF.vue +++ b/src/views/index/tenantUPF.vue @@ -49,6 +49,15 @@ const upfFlow = ref(undefined); /**图实例对象 */ const upfFlowChart = ref(null); +// 使用Map去重 +const uniqueItems = new Map(); + +//UPF下拉框 +const dropdownOptions: any = ref([]); + +//UPF下拉框选中值 +const selectRmUid = ref(''); + function fnDesign(container: HTMLElement | undefined, option: EChartsOption) { if (!container) { return; @@ -71,6 +80,7 @@ function fnDesign(container: HTMLElement | undefined, option: EChartsOption) { //渲染速率图 function handleRanderChart() { + console.log(upfFlowData.value); const { lineXTime, lineYUp, lineYDown } = upfFlowData.value; var yAxisSeries: any = [ { @@ -206,6 +216,13 @@ function fnGetInitData() { const nowDate: Date = new Date(); const tenMinutesAgo = new Date(nowDate.getTime() - 5 * 60 * 1000); + upfFlowData.value = { + lineXTime: [], + lineYUp: [], + lineYDown: [], + cap: 0, + }; + listKPIData({ neType: 'UPF', neId: '', @@ -219,19 +236,32 @@ function fnGetInitData() { }) .then(res => { if (res.code === RESULT_CODE_SUCCESS && Array.isArray(res.data)) { - if (res.data.length > 0) { - reSendUPF(res.data[0].rmUID); - } + //先分类再分析每条数据 for (const item of res.data) { - upfFlowParse(item); + if (item.neName && item.rmUID) { + uniqueItems.set(item.neName, item.rmUID); + } + } + // 将 Map 转换为数组 + dropdownOptions.value = Array.from(uniqueItems, ([label, value]) => ({ + label, + value, + })); + + //填写初始值 + if (dropdownOptions.value.length > 0) { + if (!selectRmUid.value) { + selectRmUid.value = dropdownOptions.value[0].value; + } + reSendUPF(selectRmUid.value); + } + + for (const item of res.data) { + if (item.rmUID === selectRmUid.value) { + console.log(item); + upfFlowParse(item); + } } - } else if (res.code === 0) { - upfFlowData.value = { - lineXTime: [], - lineYUp: [], - lineYDown: [], - cap: 0, - }; } }) .finally(() => { @@ -264,27 +294,6 @@ watch( onMounted(() => { fnGetInitData(); - // setInterval(() => { - // upfFlowData.value.lineXTime.push(parseDateToStr(new Date())); - // const upN3 = parseSizeFromKbs(+145452, 5); - // upfFlowData.value.lineYUp.push(upN3[0]); - // const downN6 = parseSizeFromKbs(+232343, 5); - // upfFlowData.value.lineYDown.push(downN6[0]); - - // upfFlowChart.value.setOption({ - // xAxis: { - // data: upfFlowData.value.lineXTime, - // }, - // series: [ - // { - // data: upfFlowData.value.lineYUp, - // }, - // { - // data: upfFlowData.value.lineYDown, - // }, - // ], - // }); - // }, 5000); }); onUnmounted(() => { @@ -296,10 +305,29 @@ onUnmounted(() => {