Browse Source

三维报建--分析-指标分析,楼层排序问题,BF为顶楼,F开头降序排列,F1一下B开头升序排列展示

lkk 3 months ago
parent
commit
c589a6b30e

+ 31 - 2
src/views/ConstructionApplication3D/ZBFXAnalysisinfo/detailedInfo.vue

@@ -168,13 +168,42 @@ export default {
   },
   computed: {},
   mounted() {
-    
     this.init();
   },
   methods: {
     init() {
-      
       this.tableData = this.info.infoData;
+      this.tableData.builds.forEach((item, i) => {
+        // 1. 分离不同类型的楼层
+        const rfFloor = item.floors.find((floor) => floor.layer === "RF");
+        const fFloors = item.floors.filter((floor) =>
+          floor.layer.startsWith("F")
+        );
+        const bFloors = item.floors.filter((floor) =>
+          floor.layer.startsWith("B")
+        );
+
+        // 2. 对 F 楼层按数字降序排序(F13 → F12 → ... → F1)
+        const sortedFFloors = fFloors.sort((a, b) => {
+          const aNum = parseInt(a.layer.substring(1));
+          const bNum = parseInt(b.layer.substring(1));
+          return bNum - aNum; // 降序
+        });
+
+        // 3. 对 B 楼层按数字升序排序(B1 → B2)
+        const sortedBFloors = bFloors.sort((a, b) => {
+          const aNum = parseInt(a.layer.substring(1));
+          const bNum = parseInt(b.layer.substring(1));
+          return aNum - bNum; // 升序
+        });
+
+        // 4. 合并所有楼层(RF + F + B)
+        const sortedFloors = [];
+        if (rfFloor) sortedFloors.push(rfFloor); // 添加 RF
+        sortedFloors.push(...sortedFFloors); // 添加 F13 → F1
+        sortedFloors.push(...sortedBFloors); // 添加 B1 → B2
+        item.floors = sortedFloors;
+      });
       this.ParkData = this.info.ParkData;
     },
   },