From 7b9f0781f4a4519fd8f793a3a81826db2e8f24a7 Mon Sep 17 00:00:00 2001 From: TsMask <340112800@qq.com> Date: Wed, 31 Jan 2024 20:07:37 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=B8=BB=E9=A1=B5=E5=91=8A=E8=AD=A6?= =?UTF-8?q?=E7=8A=B6=E6=80=81=E9=A5=BC=E5=9B=BE=E9=A2=9C=E8=89=B2=E5=88=86?= =?UTF-8?q?=E5=B8=83=E9=A2=9C=E8=89=B2=E7=BB=98=E5=88=B6=E4=B8=8D=E4=B8=80?= =?UTF-8?q?=E8=87=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/index.vue | 33 +++++++++++++++------------------ 1 file changed, 15 insertions(+), 18 deletions(-) diff --git a/src/views/index.vue b/src/views/index.vue index 27564db8..f0b7a5fc 100644 --- a/src/views/index.vue +++ b/src/views/index.vue @@ -30,12 +30,11 @@ echarts.use([ LabelLayout, ]); -/**字典数据 */ -/**用户性别字典 */ +/**网元状态字典数据 */ let indexColor = ref([ - { label: 'normal', value: 'normal', elTagType: '', elTagClass: '#91cc75' }, + { label: 'Normal', value: 'normal', elTagType: '', elTagClass: '#91cc75' }, { - label: 'abnormal', + label: 'Abnormal', value: 'abnormal', elTagType: '', elTagClass: '#ee6666', @@ -200,10 +199,7 @@ function fnGetList(one: boolean) { orient: 'vertical', left: 'left', }, - color: [ - '' + indexColor.value[0]['elTagClass'], - '' + indexColor.value[1]['elTagClass'], - ], + color: indexColor.value.map(item => item.elTagClass), series: [ { name: t('views.index.realNeStatus'), @@ -303,15 +299,17 @@ function fnLocale() { } onMounted(() => { - getDict('index_status').then(res => { - if (res.length > 0) { - indexColor.value = res; - } - }); - //console.log(indexColor) - fnLocale(); - fnGetList(true); - timer = setInterval(() => fnGetList(false), 10000); // 每隔10秒执行一次 + getDict('index_status') + .then(res => { + if (res.length > 0) { + indexColor.value = res; + } + }) + .finally(() => { + fnLocale(); + fnGetList(true); + timer = setInterval(() => fnGetList(false), 10000); // 每隔10秒执行一次 + }); }); // 在组件卸载之前清除定时器 @@ -405,7 +403,6 @@ onBeforeUnmount(() => { nfInfo.obj }}