From 6256295c815e4258df70824d89e1e8fa7b8c0d46 Mon Sep 17 00:00:00 2001
From: JINGYJ <1458671527@qq.com>
Date: Tue, 15 Apr 2025 09:33:10 +0800
Subject: [PATCH] =?UTF-8?q?feat:=20=E7=82=B9=E4=BA=91=E6=95=B0=E6=8D=AE?=
 =?UTF-8?q?=E4=BF=AE=E6=94=B9?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 src/views/dashboard/AppearanceMonitor.vue     | 25 ++++----
 src/views/dashboard/components/PointModal.vue | 58 ++++++++++---------
 2 files changed, 46 insertions(+), 37 deletions(-)

diff --git a/src/views/dashboard/AppearanceMonitor.vue b/src/views/dashboard/AppearanceMonitor.vue
index 752493d..0a0a8c0 100644
--- a/src/views/dashboard/AppearanceMonitor.vue
+++ b/src/views/dashboard/AppearanceMonitor.vue
@@ -103,6 +103,11 @@ const activeIndex = ref(-1);
 const swiperRef = ref(null);
 const isPointOpen = ref<Boolean>(false); //点云弹窗
 const columns = [
+  {
+    label: "站点",
+    property: "is_reviewed",
+    width: 60,
+  },
   {
     label: "车号",
     property: "train_number",
@@ -133,16 +138,16 @@ const columns = [
     property: "level",
     width: 60,
   },
-  {
-    label: "复核",
-    property: "is_reviewed",
-    formatter: ({ is_reviewed }) => {
-      return is_reviewed === true
-        ? "是"
-        : "否";
-    },
-    width: 60,
-  },
+  // {
+  //   label: "复核",
+  //   property: "is_reviewed",
+  //   formatter: ({ is_reviewed }) => {
+  //     return is_reviewed === true
+  //       ? "是"
+  //       : "否";
+  //   },
+  //   width: 60,
+  // },
   {
     label: "时间",
     property: "created_at",
diff --git a/src/views/dashboard/components/PointModal.vue b/src/views/dashboard/components/PointModal.vue
index 092dc0a..b77ceff 100644
--- a/src/views/dashboard/components/PointModal.vue
+++ b/src/views/dashboard/components/PointModal.vue
@@ -120,7 +120,7 @@ const onDialogOpened = () => {
                 // 加载完成,设置加载状态为 false
                 loading.value = false;
                 // 调整点云的位置到原点
-                pointCloud.position.set(0, 300, 0);
+                pointCloud.position.set(0, 100, 0);
 
                 // 获取点云的几何体
                 const geometry = pointCloud.geometry;
@@ -131,39 +131,43 @@ const onDialogOpened = () => {
                 const numPoints = positions.length / 3;
 
                 // 定义起始颜色和结束颜色
-                const startColor = new THREE.Color(0x00ff00); // 绿色
-                const midColor = new THREE.Color(0xffff00);   // 黄色
+                const startColor = new THREE.Color(0x0000ff); // 蓝色
+                const midColor1 = new THREE.Color(0x00ff00);  // 绿色
+                const midColor2 = new THREE.Color(0xffff00);  // 黄色
                 const endColor = new THREE.Color(0xff0000);   // 红色
 
                 // 计算点云在 z 轴上的最小值和最大值
                 let minZ = Infinity;
-                    let maxZ = -Infinity;
-                    for (let i = 0; i < numPoints; i++) {
-                        const z = positions[i * 3 + 2];
-                        if (z < minZ) minZ = z;
-                        if (z > maxZ) maxZ = z;
-                    }
+                let maxZ = -Infinity;
+                for (let i = 0; i < numPoints; i++) {
+                    const z = positions[i * 3 + 2];
+                    if (z < minZ) minZ = z;
+                    if (z > maxZ) maxZ = z;
+                }
 
-                    for (let i = 0; i < numPoints; i++) {
-                        const z = positions[i * 3 + 2];
-                        // 计算颜色渐变因子
-                        const factor = (z - minZ) / (maxZ - minZ);
-
-                        let color;
-                        if (factor < 0.5) {
-                            // 从绿到黄的渐变
-                            const subFactor = factor * 2;
-                            color = startColor.clone().lerp(midColor, subFactor);
-                        } else {
-                            // 从黄到红的渐变
-                            const subFactor = (factor - 0.5) * 2;
-                            color = midColor.clone().lerp(endColor, subFactor);
-                        }
-
-                        // 将颜色添加到颜色数组中
-                        colors.push(color.r, color.g, color.b);
+                for (let i = 0; i < numPoints; i++) {
+                    const z = positions[i * 3 + 2];
+                    // 计算颜色渐变因子
+                    const factor = (z - minZ) / (maxZ - minZ);
+
+                    let color;
+                    if (factor < 0.33) {
+                        // 从蓝到绿的渐变
+                        const subFactor = factor / 0.33;
+                        color = startColor.clone().lerp(midColor1, subFactor);
+                    } else if (factor < 0.66) {
+                        // 从绿到黄的渐变
+                        const subFactor = (factor - 0.33) / 0.33;
+                        color = midColor1.clone().lerp(midColor2, subFactor);
+                    } else {
+                        // 从黄到红的渐变
+                        const subFactor = (factor - 0.66) / 0.34;
+                        color = midColor2.clone().lerp(endColor, subFactor);
                     }
 
+                    // 将颜色添加到颜色数组中
+                    colors.push(color.r, color.g, color.b);
+                }
                 // 创建颜色属性
                 const colorAttribute = new THREE.Float32BufferAttribute(colors, 3);
                 geometry.setAttribute('color', colorAttribute);