Zimo 16 時間 前
コミット
9f80b237c2

+ 20 - 12
src/views/oli-connection/monitoring/detail.vue

@@ -195,19 +195,27 @@ async function loadDimensions() {
         }
       })
 
-    // 合并并分配霓虹色
-    dimensions.value = [...gateway, ...car]
-      // .filter((item) => !disabledDimensions.value.includes(item.identifier))
-      .map((item, index) => {
-        const color = neonColors[index]
+    const rawList = [...gateway, ...car]
 
-        return {
-          ...item,
-          color: color,
-          bgHover: hexToRgba(color, 0.08),
-          bgActive: hexToRgba(color, 0.12)
-        }
-      })
+    const uniqueMap = new Map()
+
+    rawList.forEach((item) => {
+      const uniqueKey = `${item.identifier}|${item.name}`
+
+      // if (!uniqueMap.has(uniqueKey)) {
+      uniqueMap.set(uniqueKey, item)
+      // }
+    })
+
+    dimensions.value = Array.from(uniqueMap.values()).map((item, index) => {
+      const color = neonColors[index % neonColors.length]
+      return {
+        ...item,
+        color: color,
+        bgHover: hexToRgba(color, 0.08),
+        bgActive: hexToRgba(color, 0.12)
+      }
+    })
 
     gatewayDimensions.value = dimensions.value.filter((d) =>
       gateway.some((g) => g.identifier === d.identifier)

+ 20 - 13
src/views/pms/device/monitor/TdDeviceInfo.vue

@@ -98,7 +98,6 @@ async function loadDimensions() {
       .sort((a, b) => b.modelOrder - a.modelOrder)
       .map((item) => {
         const { value, suffix, isText } = formatIotValue(item.value)
-        console.log(`${item.modelName} :>> `, value)
         return {
           identifier: item.identifier,
           name: item.modelName,
@@ -109,19 +108,27 @@ async function loadDimensions() {
         }
       })
 
-    // 合并并分配霓虹色
-    dimensions.value = [...gateway, ...car]
-      // .filter((item) => !disabledDimensions.value.includes(item.identifier))
-      .map((item, index) => {
-        const color = neonColors[index]
+    const rawList = [...gateway, ...car]
 
-        return {
-          ...item,
-          color: color,
-          bgHover: hexToRgba(color, 0.08),
-          bgActive: hexToRgba(color, 0.12)
-        }
-      })
+    const uniqueMap = new Map()
+
+    rawList.forEach((item) => {
+      const uniqueKey = `${item.identifier}|${item.name}`
+
+      // if (!uniqueMap.has(uniqueKey)) {
+      uniqueMap.set(uniqueKey, item)
+      // }
+    })
+
+    dimensions.value = Array.from(uniqueMap.values()).map((item, index) => {
+      const color = neonColors[index % neonColors.length]
+      return {
+        ...item,
+        color: color,
+        bgHover: hexToRgba(color, 0.08),
+        bgActive: hexToRgba(color, 0.12)
+      }
+    })
 
     gatewayDimensions.value = dimensions.value.filter((d) =>
       gateway.some((g) => g.identifier === d.identifier)