Browse Source

fix: 优化告警统计-处理状态中饼图的颜色

yanglzh 7 months ago
parent
commit
55362a9aca
2 changed files with 6 additions and 1 deletions
  1. 2 1
      src/components/chart/options.ts
  2. 4 0
      src/views/iot/alarm/dashboard/index.vue

+ 2 - 1
src/components/chart/options.ts

@@ -51,6 +51,7 @@ export function getPieOption({ data = [] as any[],
   center = ['50%', '55%'],
   legend = { bottom: '5%', left: 'center', top: '0' } as any,
   total = 0,
+  color = [] as string[],
   centerText = '告警总数'
 }) {
   return {
@@ -65,7 +66,7 @@ export function getPieOption({ data = [] as any[],
       itemWidth: getPx(20), itemHeight: 14,
       ...legend
     },
-    color: colors,
+    color: color.length ? color : colors,
     series: [
       {
         name: '',

+ 4 - 0
src/views/iot/alarm/dashboard/index.vue

@@ -218,6 +218,10 @@ const getAlarmStatusData = () => {
 						top: 'center',
 						left: '55%',
 					},
+					// 					'未处理': '#ed5565', // 红色
+					// '已处理': '#23c6c8', // 蓝绿色
+					// '已忽略': '#ffce37'  // 黄色
+					color: ['#23c6c8', '#ed5565', '#ffce37'],
 					centerText: '总计',
 					data: resData.map((item: any) => {
 						const name = statusMap[item.status as keyof typeof statusMap]