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 }}