人生啊人生 преди 3 месеца
родител
ревизия
0da76c2841

+ 1 - 1
user_web/src/components/CarSimulation/CarThreeWorldEvent/CarThreeWorldEventMain.vue

@@ -2658,7 +2658,7 @@ const getRndArrayDemoEvent = () => {
     });
 
     console.log(
-        " 【管道问题点】 const getRndArrayDemoEvent = () => {",
+        " 【管道问题点】 const getRndArrayDemoEvent = () => { ===> ",
         array,
         pipelineProblemsJson
     );

+ 1 - 0
user_web/src/components/QvSimulation/QvThreeWorldEvent/js/QvEvent.js

@@ -272,6 +272,7 @@ export class QvEvent {
 
         // 默认将所有的问题管道先移动到看不到的地方
         QvPipeEvent.find().pipelineProblemsJsonMoveEvent();
+        QvPipeEvent.find().rndList();
 
         // WindowEvent.find().WindowTxtViewOpenEvent(
         //     "安装探头时,先清洁支架安装位,确保无杂质。将探头对准预设孔位,使用专用螺丝固定,适当控制 扭矩力度,连接数据线并做防弯折处理,保证连接稳固。" + "\n"

+ 227 - 1
user_web/src/components/QvSimulation/QvThreeWorldEvent/js/QvPipeEvent.js

@@ -216,14 +216,240 @@ export class QvPipeEvent {
      * 随机个顺序进行测试
      */
     rndList = function() {
+        
+        /**
+         * 获取当前学生任务ID缺陷列表
+         * 因为目前还没对接接口,所以这里就先写死
+         * 后面根据传来的接口,来更新这里的逻辑
+         */
+        let studentTaskIdList = [
+            {
+                "id": "1790937579119353857",
+                "createdTime": "2024-05-16T02:49:27.000+00:00",
+                "updatedTime": "2024-05-16T02:49:27.000+00:00",
+                "studentTaskId": "1790937579115159554",
+                "pipDefectId": "1767007344905887746",
+                "pipIndex": 4,
+                "pipDefect": {
+                    "id": "1767007344905887746",
+                    "createdTime": "2024-03-11T01:59:15.000+00:00",
+                    "updatedTime": "2024-03-11T01:59:15.000+00:00",
+                    "courseId": "1767000074935541761",
+                    "name": "管道问题点-密封圈脱落段",
+                    "type": 1,
+                    "configJson": "管道问题点-密封圈脱落段",
+                    "imageUrls": [
+                        "https://www.3dyzt.com/edu-train/oss/files/course/cover/1223213023611719680.png",
+                        "https://www.3dyzt.com/edu-train/oss/files/course/cover/1223213023611719680.png"
+                    ]
+                }
+            },
+            {
+                "id": "1790937579119353858",
+                "createdTime": "2024-05-16T02:49:27.000+00:00",
+                "updatedTime": "2024-05-16T02:49:27.000+00:00",
+                "studentTaskId": "1790937579115159554",
+                "pipDefectId": "1767007301306097666",
+                "pipIndex": 9,
+                "pipDefect": {
+                    "id": "1767007301306097666",
+                    "createdTime": "2024-03-11T01:59:04.000+00:00",
+                    "updatedTime": "2024-03-11T01:59:04.000+00:00",
+                    "courseId": "1767000074935541761",
+                    "name": "管道问题点-漏水段",
+                    "type": 1,
+                    "configJson": "管道问题点-漏水段",
+                    "imageUrls": [
+                        "https://www.3dyzt.com/edu-train/oss/files/course/cover/1223213055660396544.png",
+                        "https://www.3dyzt.com/edu-train/oss/files/course/cover/1223213055660396544.png"
+                    ]
+                }
+            },
+            {
+                "id": "1790937579123548162",
+                "createdTime": "2024-05-16T02:49:27.000+00:00",
+                "updatedTime": "2024-05-16T02:49:27.000+00:00",
+                "studentTaskId": "1790937579115159554",
+                "pipDefectId": "1767007183332909057",
+                "pipIndex": 7,
+                "pipDefect": {
+                    "id": "1767007183332909057",
+                    "createdTime": "2024-03-11T01:58:36.000+00:00",
+                    "updatedTime": "2024-03-11T01:58:36.000+00:00",
+                    "courseId": "1767000074935541761",
+                    "name": "管道问题点-浮渣段",
+                    "type": 1,
+                    "configJson": "管道问题点-浮渣段",
+                    "imageUrls": [
+                        "https://www.3dyzt.com/edu-train/oss/files/course/cover/1223213178243125248.png",
+                        "https://www.3dyzt.com/edu-train/oss/files/course/cover/1223213178243125248.png"
+                    ]
+                }
+            },
+            {
+                "id": "1790937579127742465",
+                "createdTime": "2024-05-16T02:49:27.000+00:00",
+                "updatedTime": "2024-05-16T02:49:27.000+00:00",
+                "studentTaskId": "1790937579115159554",
+                "pipDefectId": "1767007144044863489",
+                "pipIndex": 13,
+                "pipDefect": {
+                    "id": "1767007144044863489",
+                    "createdTime": "2024-03-11T01:58:27.000+00:00",
+                    "updatedTime": "2024-03-11T01:58:27.000+00:00",
+                    "courseId": "1767000074935541761",
+                    "name": "管道问题点-错位段",
+                    "type": 1,
+                    "configJson": "管道问题点-错位段",
+                    "imageUrls": [
+                        "https://www.3dyzt.com/edu-train/oss/files/course/cover/1223213205489324032.png",
+                        "https://www.3dyzt.com/edu-train/oss/files/course/cover/1223213205489324032.png"
+                    ]
+                }
+            },
+            {
+                "id": "1790937579127742466",
+                "createdTime": "2024-05-16T02:49:27.000+00:00",
+                "updatedTime": "2024-05-16T02:49:27.000+00:00",
+                "studentTaskId": "1790937579115159554",
+                "pipDefectId": "1767006886866919425",
+                "pipIndex": 12,
+                "pipDefect": {
+                    "id": "1767006886866919425",
+                    "createdTime": "2024-03-11T01:57:25.000+00:00",
+                    "updatedTime": "2024-03-11T01:57:25.000+00:00",
+                    "courseId": "1767000074935541761",
+                    "name": "管道问题点-残墙段",
+                    "type": 1,
+                    "configJson": "管道问题点-残墙段",
+                    "imageUrls": [
+                        "https://www.3dyzt.com/edu-train/oss/files/course/cover/1223213237227622400.png",
+                        "https://www.3dyzt.com/edu-train/oss/files/course/cover/1223213237227622400.png"
+                    ]
+                }
+            }
+        ];
+
+        let getPipelineIssuesArray = this.getPipelineIssuesArray(studentTaskIdList);
+
+        console.log(
+            "getPipelineIssuesArray ===>", getPipelineIssuesArray
+        );
+        
+    }
+    
+    /**
+     * 根据传来的问题管段,跟标准管段
+     * 进行排序出一个顺序,来展示管段
+     * studentTaskIdList        问题管段数组
+     * 
+     * 得到最后排序要展示到三维的管段数组
+     */
+    getPipelineIssuesArray = function(studentTaskIdList) {
+        
+        // ############################## 现在根据对应的问题管段,跟标准管段,开始进行排序 ##############################
+        let array = [];
+
+        // 记录当前新增的【 管道问题点-标准管段 】数量
+        let addStandardSum = 1;
+
+        /**
+         * 临时记录已经出现过的管段
+         * 如果已经重复,则不添加
+         */
+        let addOldNameJson = {};
+
+        // 固定有个最开始封闭的管道
+        array.push({
+            "name" : "管道问题点-端头1"
+        });
+
+        // ########## 现在修改为根据后端返回的数组下标的点位,进行排序,不在进行随机生成标准管段
+
+        // 优先记录对应数组下标的管段json
+        let addIndexJson = {};
+
+        if (
+            studentTaskIdList != null
+            && studentTaskIdList != undefined
+            && typeof studentTaskIdList == 'object'
+        ) {
 
-        let list = [];
+            for (var i = 0; i < studentTaskIdList.length; i++) {
+
+                let thisStudentTaskIdList = studentTaskIdList[i];
+                let pipIndex = thisStudentTaskIdList.pipIndex;
+                let name = thisStudentTaskIdList?.pipDefect?.name;
+                // console.log(
+                //     "thisStudentTaskIdList",
+                //     thisStudentTaskIdList
+                // );
+                
+                let addJson = {
+                    "name" : name
+                }
+                
+                if (addJson["name"] == null || addJson["name"] == undefined || addJson["name"] == '') {
+                    addJson["name"] = '管道问题点-标准管段' + addStandardSum;
+                    addStandardSum += 1;
+                }
+                
+                if (
+                    addOldNameJson[addJson["name"]] == null && addOldNameJson[addJson["name"]] == undefined
+                ) {
+                    addOldNameJson[addJson["name"]] = addJson["name"];
+                    addIndexJson[pipIndex] = addJson;
+                }
+                
+            }
+
+        }
+
+        // console.log(
+        //     "addIndexJson ===>", addIndexJson
+        // );
+
+        // 总共是15个管段,15个管段内,根据 addIndexJson 数组下标,替换问题管段
+        for (var i = 1; i <= 15; i++) {
+
+            // 如果存在问题管段数据
+            if (addIndexJson[i] != null && addIndexJson[i] != undefined) {
+
+                array.push(addIndexJson[i]);
+
+            } else {
+
+                var addJson = {
+                    "name" : '管道问题点-标准管段' + addStandardSum,
+                };
+
+                // 增加为标准管段
+                array.push(addJson);
+                addStandardSum += 1;
+
+            }
+
+        }
+        
+        // 固定有个最尾巴封闭的管道
+        array.push({
+            "name" : "管道问题点-端头2"
+        });
+        
+        console.log(
+            "【管道问题点】 getPipelineIssuesArray ===> ",
+            array
+        );
         
+        return array;
+
     }
 
 
 
 
+
+
     
     
 }