删除多余代码

This commit is contained in:
lai
2024-02-04 15:38:40 +08:00
parent e192f51d64
commit d2b07bb4b5

View File

@@ -17,8 +17,7 @@ import { BarChart, PieChart } from 'echarts/charts';
import { CanvasRenderer } from 'echarts/renderers';
import { LabelLayout } from 'echarts/features';
import useI18n from '@/hooks/useI18n';
import useDictStore from '@/store/modules/dict';
const { getDict } = useDictStore();
const { t } = useI18n();
echarts.use([
@@ -48,14 +47,6 @@ const alarmTypeBar = ref<HTMLElement | undefined>(undefined);
/**图实例对象 */
const alarmTypeBarChart = ref<any>(null);
/**告警类型颜色 */
let dict: {
/**原始严重程度 */
activeAlarmSeverity: DictType[];
} = reactive({
activeAlarmSeverity: [],
});
// 将现有数据补全为期望的格式
function completeData(existingData: any, expectedData: any) {
const result = expectedData.map((item: any) => {
@@ -166,7 +157,7 @@ function initPicture() {
},
// 饼图设置
// color: ['#FFAE57', '#FF7853', '#EA5151', '#CC3F57', '#9A2555'],
// color: ['#FFAE57', '#FFA500', '#FFAE57', '#1E90FF', '#1E90FF'], //红橙黄蓝绿 为告警级别配色 以严重性依次往下!
color: ['#f5222d', '#ffc069', '#fadb14', '#722ed1', '#1677ff'], //红橙黄蓝 为告警级别配色 以严重性依次往下!
series: [
//饼图:
@@ -187,17 +178,6 @@ function initPicture() {
shadowBlur: 10,
shadowOffsetX: 0,
shadowColor: 'rgba(0, 0, 0, 0.5)',
color: function (colors: any) {
const realName = colors.name.split(':')[0];
var colorList: any = {
[t('views.index.Event')]: '#1677ff',
[t('views.index.Warning')]: '#722ed1',
[t('views.index.Minor')]: '#fadb14',
[t('views.index.Major')]: '#ffc069',
[t('views.index.Critical')]: '#f5222d',
};
return colorList[realName];
},
},
},
//柱状
@@ -277,15 +257,7 @@ function fnDesign(container: HTMLElement | undefined, option: any) {
}
onMounted(() => {
getDict('active_alarm_severity')
.then(res => {
if (res.length > 0) {
dict.activeAlarmSeverity = res;
}
})
.finally(() => {
initPicture();
});
initPicture();
});
</script>