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(() => {