Browse Source

feat: 支持动态传入文本

vera_min 2 months ago
parent
commit
c83d2ad6f1
2 changed files with 4 additions and 3 deletions
  1. 3 3
      src/utils/dataUiOptions.ts
  2. 1 0
      src/views/iot/iotmanager/dashboard.vue

+ 3 - 3
src/utils/dataUiOptions.ts

@@ -262,7 +262,7 @@ export function getLine2Data({ xAxis = [] as any[], datas = [] as number[][], le
       },
       "userOptions": {
         "show": false
-      }
+      },
     },
     "line": {
       "radius": 3,
@@ -297,7 +297,7 @@ export function getLine2Data({ xAxis = [] as any[], datas = [] as number[][], le
   return { config, dataset }
 }
 
-export function getPieData({ datas = [] as number[][], legend = [] as string[], types = [] as number[], width = 500, height = 1300, responsive = false }) {
+export function getPieData({ datas = [] as number[][], legend = [] as string[], types = [] as number[], width = 500, height = 1300, responsive = false, totalText = "总计" }) {
 
   const colorList = ['#4285F4', '#2ecc71', '#FBBB04', '#e67e22', '#FF0000'].reverse()
 
@@ -344,7 +344,7 @@ export function getPieData({ datas = [] as number[][], legend = [] as string[],
             "hollow": {
               "total": {
                 "fontSize": 18,
-                "text": "总计",
+                "text": totalText,
                 "value": {
                   "fontSize": 18,
                 }

+ 1 - 0
src/views/iot/iotmanager/dashboard.vue

@@ -296,6 +296,7 @@ function getDeviceAlarmLevelCount() {
 					legend: list.map((item: any) => alarmTypeMap[item.Title]),
 					types: list.map((item: any) => item.Title),
 					datas: list.map((item: any) => [item.Value]),
+					totalText: t('message.dashboard.total')
 				})
 				pieConfig.value = pieData.config
 				pieDataset.value = pieData.dataset