fix: 主页告警状态饼图颜色分布颜色绘制不一致

This commit is contained in:
TsMask
2024-01-31 20:07:37 +08:00
parent 61b0f56e36
commit 7b9f0781f4

View File

@@ -30,12 +30,11 @@ echarts.use([
LabelLayout, LabelLayout,
]); ]);
/**字典数据 */ /**网元状态字典数据 */
/**用户性别字典 */
let indexColor = ref<DictType[]>([ let indexColor = ref<DictType[]>([
{ label: 'normal', value: 'normal', elTagType: '', elTagClass: '#91cc75' }, { label: 'Normal', value: 'normal', elTagType: '', elTagClass: '#91cc75' },
{ {
label: 'abnormal', label: 'Abnormal',
value: 'abnormal', value: 'abnormal',
elTagType: '', elTagType: '',
elTagClass: '#ee6666', elTagClass: '#ee6666',
@@ -200,10 +199,7 @@ function fnGetList(one: boolean) {
orient: 'vertical', orient: 'vertical',
left: 'left', left: 'left',
}, },
color: [ color: indexColor.value.map(item => item.elTagClass),
'' + indexColor.value[0]['elTagClass'],
'' + indexColor.value[1]['elTagClass'],
],
series: [ series: [
{ {
name: t('views.index.realNeStatus'), name: t('views.index.realNeStatus'),
@@ -303,15 +299,17 @@ function fnLocale() {
} }
onMounted(() => { onMounted(() => {
getDict('index_status').then(res => { getDict('index_status')
if (res.length > 0) { .then(res => {
indexColor.value = res; if (res.length > 0) {
} indexColor.value = res;
}); }
//console.log(indexColor) })
fnLocale(); .finally(() => {
fnGetList(true); fnLocale();
timer = setInterval(() => fnGetList(false), 10000); // 每隔10秒执行一次 fnGetList(true);
timer = setInterval(() => fnGetList(false), 10000); // 每隔10秒执行一次
});
}); });
// 在组件卸载之前清除定时器 // 在组件卸载之前清除定时器
@@ -405,7 +403,6 @@ onBeforeUnmount(() => {
nfInfo.obj nfInfo.obj
}}</a-descriptions-item> }}</a-descriptions-item>
<template v-if="nfInfo.obj === 'OMC'"> <template v-if="nfInfo.obj === 'OMC'">
<a-descriptions-item :label="t('views.index.versionNum')">{{ <a-descriptions-item :label="t('views.index.versionNum')">{{
nfInfo.version nfInfo.version
}}</a-descriptions-item> }}</a-descriptions-item>