Pārlūkot izejas kodu

sop编辑和新增修改好了

pm 11 mēneši atpakaļ
vecāks
revīzija
2462553a4d

+ 170 - 112
src/components/separationPoint/index.vue

@@ -1,4 +1,5 @@
 <template>
+
   <div id="container" ref="container"></div>
 </template>
 
@@ -34,27 +35,25 @@ export default {
     'getMapData': {
       handler(newval) {
         if (newval) {
-          this.$nextTick(() => {
+          this.$nextTick(()=>{
             this.initKonva()
           })
 
         }
       }
-    }
+    },
 
   },
   mounted() {
     this.initKonva()
     console.log(this.points, 'points')
-
-    // console.log(
-    //   this.getSelectSopPoints,
-    //   this.getSopEdit,
-    //   this.getSopLook,
-    //   this.getMapData,
-    //   'getSopEdit - getSelectSopPoints'
-    // )
-
+    // console.log(this.getMapData, 'Mapdata')
+    console.log(
+      this.getSelectSopPoints,
+      this.getSopEdit,
+      this.getSopLook,
+      'getSopEdit - getSelectSopPoints'
+    )
   },
   computed: {
     ...mapGetters('sopSelectPoints', [
@@ -134,14 +133,20 @@ export default {
 
       this.layer.draw()
     },
+
+
+
+
     renderGrid(imageSrc) {
-      this.selectedStates = {}; // 用对象来存储选中状态,键为文字内容
-      this.rects = {};
-      this.texts = {};
-      this.redrects = {};
-      this.redtexts = {};
-      this.selectedText = [];
 
+      this.selectedStates = {} // 用对象来存储选中状态,键为文字内容
+      this.rects = {}
+      this.texts = {}
+      this.redrects = {}
+      this.redtexts = {}
+      this.selectedText = []
+
+      // const positions = JSON.parse(this.points.map);
       let positions;
 
       // 判断getMapData是否已为数组
@@ -159,26 +164,28 @@ export default {
         }
       }
 
-      console.log(positions, 'positions');
+
       // 检查 this.getSelectSopPoints 是否有内容
-      const isLocked = this.getSelectSopPoints.length > 0;
+      const isLocked = this.getSelectSopPoints.length > 0
 
       // 添加或移除全局点击事件监听器 this.getSopEdit这是vuex里判断是否可以选择隔离点的操作
-      if (isLocked && this.getSopEdit === true) {
+      if (isLocked && this.getSopEdit == true) {
         this.layer.on('click', (e) => {
-          e.cancelBubble = true; // 阻止事件冒泡
-        });
+          e.cancelBubble = true // 阻止事件冒泡
+          // e.stopPropagation(); // 阻止事件传播
+        })
       } else {
-        this.layer.off('click'); // 移除全局点击事件监听器
+        this.layer.off('click') // 移除全局点击事件监听器
       }
 
       positions.forEach((pos, index) => {
-        const x = pos.col * 50; // 每个单元格宽度为50
-        const y = pos.row * 50; // 每个单元格高度为50
-        const labelText = pos.pointName; // 对应的文字
+        const x = pos.col * 50 // 每个单元格宽度为50
+        const y = pos.row * 50 // 每个单元格高度为50
+        const labelText = pos.pointName // 对应的文字
 
-        const point = new Image();
-        point.src = pos.pointIcon;
+        const point = new Image()
+        point.src = pos.pointIcon
+        // point.src = imageSrc;
         point.onload = () => {
           const knovaImage = new Konva.Image({
             x: x,
@@ -187,78 +194,82 @@ export default {
             width: 50,
             height: 50,
             draggable: false
-          });
-
-          // 添加点击事件,仅当 getSopEdit 为 true 时才允许点击
-          if (this.getSopEdit === true && this.getSopLook === false) {
+          })
+          // 添加点击事件,仅当 getSopEdit 为 true 时才允许点击a
+          if (this.getSopEdit == true && this.getSopLook == false) {
             knovaImage.on('click', () => {
               // 切换选中状态,基于文本内容
-              this.selectedStates[labelText] = !this.selectedStates[labelText];
+              this.selectedStates[labelText] = !this.selectedStates[labelText]
 
               if (this.selectedStates[labelText]) {
                 // 选中状态,显示红色矩形和文字,切换为选中的图片
-                this.rects[labelText].visible(false);
-                this.texts[labelText].visible(false);
-                this.redrects[labelText].visible(true);
-                this.redtexts[labelText].visible(true);
+                this.rects[labelText].visible(false)
+                this.texts[labelText].visible(false)
+                this.redrects[labelText].visible(true)
+                this.redtexts[labelText].visible(true)
 
-                const selectedImage = new Image();
-                selectedImage.src = require('@/assets/images/localSetSelect.jpg');
+                const selectedImage = new Image()
+                selectedImage.src = require('@/assets/images/localSetSelect.jpg')
                 selectedImage.onload = () => {
-                  knovaImage.image(selectedImage); // 更新图像
-                  this.layer.draw(); // 更新图层
-                };
+                  knovaImage.image(selectedImage) // 更新图像
+                  this.layer.draw() // 更新图层
+                }
 
                 // 获取隔离点信息,并将选中的 labelText 推入数组
+
                 this.$nextTick(() => {
                   if (
                     this.$route.query.sopId !== null ||
                     this.$route.query.ticketId !== null
                   ) {
-                    const newItem = {
+                    this.selectedText.push({
                       pointName: pos.pointName,
                       pointId: pos.pointId,
                       pointType: pos.pointTypeName,
                       powerType: pos.powerTypeName,
-                      prePointId: pos.prePointId,
-                    };
-
-                    // 去重处理
-                    if (!this.selectedText.some(item => item.pointId === newItem.pointId)) {
-                      this.selectedText.push(newItem);
-                    }
-
-                    console.log(this.selectedText, 'selectedText');
-                    this.$emit('selection-changed', this.selectedText);
+                      prePointId:pos.prePointId
+                    })
+                    this.$emit('selection-changed', this.selectedText)
+                    // selectIsIsolationPointById(pos.pointId).then((res) => {
+                    //   this.selectedText.push({
+                    //     pointName: res.data.pointName,
+                    //     pointId: res.data.pointId,
+                    //     pointType: res.data.pointType,
+                    //     powerType: res.data.powerType,
+                    //   });
+                    //   console.log(this.selectedText, "$emit");
+                    //   this.$emit("selection-changed", this.selectedText);
+                    // });
                   }
-                });
+                })
               } else {
-                // 取消选中状态,恢复普通矩形和文字
-                this.rects[labelText].visible(true);
-                this.texts[labelText].visible(true);
-                this.redrects[labelText].visible(false);
-                this.redtexts[labelText].visible(false);
-
-                const normalImage = new Image();
-                normalImage.src = imageSrc; // 未选中的默认图片路径
+                // 取消选中状态,恢复普通矩形和文字,切换为未选中的图片
+                this.rects[labelText].visible(true)
+                this.texts[labelText].visible(true)
+                this.redrects[labelText].visible(false)
+                this.redtexts[labelText].visible(false)
+
+                const normalImage = new Image()
+                normalImage.src = pos.pointIcon
+                // normalImage.src = imageSrc; // 未选中的默认图片路径
                 normalImage.onload = () => {
-                  knovaImage.image(normalImage); // 更新图像
-                  this.layer.draw(); // 更新图层
-                };
+                  knovaImage.image(normalImage) // 更新图像
+                  this.layer.draw() // 更新图层
+                }
 
                 // 从选中数组中移除该项
                 this.selectedText = this.selectedText.filter(
                   (item) => item.pointName !== labelText
-                );
+                )
               }
 
               // 确保图层重新渲染
-              this.layer.draw();
-              this.$emit('selection-changed', this.selectedText);
-            });
+              this.layer.draw()
+              this.$emit('selection-changed', this.selectedText)
+            })
           }
 
-          this.layer.add(knovaImage);
+          this.layer.add(knovaImage)
 
           // 普通矩形
           const rect = new Konva.Rect({
@@ -270,9 +281,9 @@ export default {
             stroke: 'red',
             strokeWidth: 2,
             fill: 'white'
-          });
-          this.layer.add(rect);
-          this.rects[labelText] = rect; // 用文字作为键存储
+          })
+          this.layer.add(rect)
+          this.rects[labelText] = rect // 用文字作为键存储
 
           // 普通文字
           const text = new Konva.Text({
@@ -282,9 +293,9 @@ export default {
             text: labelText,
             fontFamily: 'Calibri',
             fill: 'red'
-          });
-          this.layer.add(text);
-          this.texts[labelText] = text; // 用文字作为键存储
+          })
+          this.layer.add(text)
+          this.texts[labelText] = text // 用文字作为键存储
 
           // 红色矩形(初始隐藏)
           const redrect = new Konva.Rect({
@@ -297,9 +308,9 @@ export default {
             strokeWidth: 2,
             fill: 'red',
             visible: false
-          });
-          this.layer.add(redrect);
-          this.redrects[labelText] = redrect; // 用文字作为键存储
+          })
+          this.layer.add(redrect)
+          this.redrects[labelText] = redrect // 用文字作为键存储
 
           // 红色文字(初始隐藏)
           const redtext = new Konva.Text({
@@ -310,58 +321,105 @@ export default {
             fontFamily: 'Calibri',
             fill: 'white',
             visible: false
-          });
-          this.layer.add(redtext);
-          this.redtexts[labelText] = redtext; // 用文字作为键存储
+          })
+          this.layer.add(redtext)
+          this.redtexts[labelText] = redtext // 用文字作为键存储
 
           // 检查 this.getSelectSopPoints 是否包含当前点的 pointId
           if (pos.state) {
-            console.log('选中的隔离点渲染',pos)
             // 设置为选中状态
-            this.selectedStates[labelText] = true;
-            this.rects[labelText].visible(false);
-            this.texts[labelText].visible(false);
-            this.redrects[labelText].visible(true);
-            this.redtexts[labelText].visible(true);
+            this.selectedStates[labelText] = true
+            this.rects[labelText].visible(false)
+            this.texts[labelText].visible(false)
+            this.redrects[labelText].visible(true)
+            this.redtexts[labelText].visible(true)
 
             // 切换图片为选中状态的图片
-            const selectedImage = new Image();
-            selectedImage.src = require('@/assets/images/localSetSelect.jpg'); // 选中的图片路径
+            const selectedImage = new Image()
+            selectedImage.src = require('@/assets/images/localSetSelect.jpg') // 选中的图片路径
             selectedImage.onload = () => {
-              knovaImage.image(selectedImage); // 更新图像
-              this.layer.draw(); // 更新图层
-            };
+              knovaImage.image(selectedImage) // 更新图像
+              this.layer.draw() // 更新图层
+            }
 
             // 将选中的 labelText 推入数组
-            const newItem = {
+            this.selectedText.push({
               pointName: pos.pointName,
               pointId: pos.pointId,
               pointType: pos.pointTypeName,
               powerType: pos.powerTypeName,
-              prePointId: pos.prePointId,
-            };
-
-            // 去重处理
-            if (!this.selectedText.some(item => item.pointId === newItem.pointId)) {
-              this.selectedText.push(newItem);
-            }
+              prePointId:pos.prePointId
+            })
           } else {
             // 设置为未选中状态
-            this.selectedStates[labelText] = false;
-            this.rects[labelText].visible(true);
-            this.texts[labelText].visible(true);
-            this.redrects[labelText].visible(false);
-            this.redtexts[labelText].visible(false);
+            this.selectedStates[labelText] = false
+            this.rects[labelText].visible(true)
+            this.texts[labelText].visible(true)
+            this.redrects[labelText].visible(false)
+            this.redtexts[labelText].visible(false)
           }
 
           // 触发父组件的 selection-changed 事件
-          this.$emit('selection-changed', this.selectedText);
-          this.layer.draw();
-        }
-      });
-    },
-
+          this.$emit('selection-changed', this.selectedText)
+
+          // if (this.getSelectSopPoints.includes(pos.pointId.toString())) {
+          //   // 设置为选中状态
+          //   this.selectedStates[labelText] = true;
+          //   this.rects[labelText].visible(false);
+          //   this.texts[labelText].visible(false);
+          //   this.redrects[labelText].visible(true);
+          //   this.redtexts[labelText].visible(true);
+          //
+          //   // 切换图片为选中状态的图片
+          //   const selectedImage = new Image();
+          //   selectedImage.src = require("@/assets/images/localSetSelect.jpg"); // 选中的图片路径
+          //   selectedImage.onload = () => {
+          //     knovaImage.image(selectedImage); // 更新图像
+          //     this.layer.draw(); // 更新图层
+          //   };
+          //   // 将选中的 labelText 推入数组
+          //   this.$nextTick(() => {
+          //     getIsIsolationPointPage({ current: 1, size: 100 })
+          //       .then((res) => {
+          //         const allPoints = res.data.records; // 假设返回的数据结构是 { records: [点数据] }
+          //
+          //         // 根据 pos.pointId 查找对应的 pointType 和 powerType
+          //         const pointInfo = allPoints.find(
+          //           (point) => point.pointId == pos.pointId
+          //         );
+          //
+          //         if (pointInfo) {
+          //           this.selectedText.push({
+          //             pointName: labelText,
+          //             pointId: pos.pointId,
+          //             pointType: pointInfo.pointType,
+          //             powerType: pointInfo.powerType,
+          //           });
+          //         } else {
+          //           // 如果没有找到对应的点信息,可以处理这种情况
+          //           console.warn(`未找到 pointId 为 ${pos.pointId} 的点信息`);
+          //           this.selectedText.push({
+          //             pointName: labelText,
+          //             pointId: pos.pointId,
+          //             pointType: "",
+          //             powerType: "",
+          //           });
+          //         }
+          //         // console.log(this.selectedText,'默认拿到的points')
+          //         // 触发父组件的 selection-changed 事件
+          //         this.$emit("selection-changed", this.selectedText);
+          //       })
+          //       .catch((error) => {
+          //         console.error("获取隔离点信息失败", error);
+          //       });
+          //   });
+          // }
+
+          this.layer.draw()
 
+        }
+      })
+    }
 
     //     methods结束
   }

+ 4 - 1
src/components/separationPoint/workshop.vue

@@ -324,7 +324,10 @@ export default {
     handleNodeClick(data) {
       console.log(data, '单节点点击')
       this.treeSelectMap = data
-      this.setMapData(data.map)
+      if (this.$route.query.sopId === 'null' || this.$route.query.ticketId === 'null') {
+        this.setMapData(data.map);
+        console.log('设置了地图数据');
+      }
       // 传递车间地图
       this.imgsrc = data.mapImg
       this.workareaName = data.label

+ 170 - 68
src/views/mes/sop/sopm/NewSop.vue

@@ -12,7 +12,6 @@
         ></SopLeft>
       </keep-alive>
       <!-- 隔离点 style="position: relative;z-index:0"-->
-
       <IsolationLeftVue
         v-show="this.activeName == 'second'"
         :points="points"
@@ -541,6 +540,7 @@ export default {
       listCoLockerOption: null,//共锁人下拉数据
       OutSideUserTableData: [],//添加外部人员多个表格
       nextUserId: 0//新增外部人员表格序号自定义
+
     }
   },
   mounted() {
@@ -602,19 +602,31 @@ export default {
         selectIsSopById(sopId).then((response) => {
           console.log(response, '详细内容')
           this.form = response.data
-          console.log(response.data.ticketUserDTOList,'response.data.ticketUserDTOList')
+          console.log(response.data.ticketUserDTOList, 'response.data.ticketUserDTOList')
           if (response.data.ticketUserDTOList.length > 0) {
-            this.openStaffing = true;
+            this.openStaffing = true
           }
 
           const value = response.data.ticketUserDTOList //找到上锁人  这里一定要先筛选locker再去给表格筛选 否则表格筛选之后直接不会有上锁人数据了
             .filter(item => item.userType == '0')
-            .map(item => item.userName);
-          this.form.locker=value[0],//map返回的是数字 所以这样写
-          console.log(value,response.data.ticketUserDTOList,'form.locker')
-          this.form.ticketUserDTOList=response.data.ticketUserDTOList.filter((item)=>{return item.userType=='1'}) ;//过滤上锁人
-          this.tableData = response.data.pointDetailVOList
-          console.log(this.tableData, '编辑拿到的隔离点数据')
+            .map(item => item.userName)
+          this.form.locker = value[0],//map返回的是数字 所以这样写
+            console.log(value, response.data.ticketUserDTOList, 'form.locker')
+          this.form.ticketUserDTOList = response.data.ticketUserDTOList.filter((item) => {
+            return item.userType == '1'
+          })//过滤上锁人
+
+          // this.tableData = response.data.pointDetailVOList.map((item)=>{
+          //   return {
+          //     pointName: item.pointName, // 显示的名称
+          //     pointId: item.pointId, // 对应的值
+          //     pointType: item.pointTypeName,
+          //     powerType: item.powerTypeName,
+          //     prePointId: item.prePointId
+          //   }
+          // })
+          // console.log(this.tableData, '编辑拿到的隔离点数据')
+
           this.sopProps = [response.data]
 
           this.title = '修改隔离点信息'
@@ -643,35 +655,11 @@ export default {
       if (!Array.isArray(this.form.spoint)) {
         this.form.spoint = []
       }
-      console.log(this.form.spoint, 'spoint')
-
       // 如果没有选中点,逆向传递为空时,使用当前表格数据中的点
       if (this.form.spoint.length === 0 && Array.isArray(this.tableData)) {
         this.form.spoint = this.tableData.map((point) => point.pointId)
       }
 
-      const selectedpointIds = this.form.spoint.join(',')
-      const UserList=[...this.form.ticketUserDTOList,...this.newticketUserDTOList]
-      const pointsList=this.form.pointDetailVOList.map((item)=>{
-        return {
-          pointId:item.pointId,
-          prePointId:item.prePointId
-        }
-      })
-      console.log(this.form.pointsList)
-      const data = {
-        pointIds: selectedpointIds,
-        sopContent: this.form.sopContent,
-        sopCode: this.form.sopCode,
-        sopName: this.form.sopName,
-        sopType: this.form.sopType,
-        workareaId: this.emitworklineId,
-        ticketUserDTOList: UserList,
-        pointsList: pointsList
-        // workshopId: this.emitWorkShop.value
-      }
-      console.log(data, '新增sop参数')
-
       // 编辑模式
       if (this.$route.query.sopId !== 'null') {
         console.log(this.$route.query.sopId, 'sopIdaaa')
@@ -681,9 +669,28 @@ export default {
           this.$message.error('隔离点id不可为空!') // 使用消息提示
           return
         }
-
+        const selectedpointIds = this.form.spoint.join(',')
+        const UserList = [...this.form.ticketUserDTOList, ...this.newticketUserDTOList]
+        const pointsList = this.form.pointDetailVOList.map((item) => {
+          return {
+            pointId: item.pointId,
+            prePointId: item.prePointId
+          }
+        })
+        console.log(this.form.pointsList)
+        const data = {
+          pointIds: selectedpointIds,
+          sopContent: this.form.sopContent,
+          sopCode: this.form.sopCode,
+          sopName: this.form.sopName,
+          sopType: this.form.sopType,
+          workareaId: this.emitworklineId,
+          ticketUserDTOList: UserList,
+          pointsList: pointsList
+          // workshopId: this.emitWorkShop.value
+        }
         data.sopId = this.form.sopId
-console.log(data,'编辑的参数')
+        console.log(data, '编辑的参数')
         updateIsSop(data).then((res) => {
           console.log(res, '修改接口')
           if (res.code == 200) {
@@ -693,6 +700,26 @@ console.log(data,'编辑的参数')
         })
       } else {
         // 新增模式
+        const selectedpointIds = this.form.spoint.join(',')
+        const UserList = [...this.form.ticketUserDTOList, ...this.newticketUserDTOList]
+        const pointsList = this.tableData.map((item) => {
+          return {
+            pointId: item.pointId,
+            prePointId: item.prePointId
+          }
+        })
+        console.log(this.form.pointsList)
+        const data = {
+          pointIds: selectedpointIds,
+          sopContent: this.form.sopContent,
+          sopCode: this.form.sopCode,
+          sopName: this.form.sopName,
+          sopType: this.form.sopType,
+          workareaId: this.emitworklineId,
+          ticketUserDTOList: UserList,
+          pointsList: pointsList
+          // workshopId: this.emitWorkShop.value
+        }
         console.log(data, '新增参数')
         addinsertIsSop(data).then((res) => {
           console.log(res, '新增接口')
@@ -771,26 +798,33 @@ console.log(data,'编辑的参数')
 
     // 子组件选中的隔离点逆传递拿到的数据
     handleSelectPoint(points) {
-      // console.log(points, '父组件接收逆向传递选中的隔离点')
-      this.tableData = points //子组件传递过来的选中节点
+      console.log(points, '父组件接收逆向传递选中的隔离点');
+
+      // 1. 去除重复的点,使用 Set 确保每个 pointId 唯一
+      const uniquePoints = Array.from(
+        new Set(points.map(point => point.pointId))
+      ).map(id => points.find(point => point.pointId === id));
+
+      console.log(uniquePoints, '去重后的选中节点');
+
+      this.tableData = uniquePoints; // 子组件传递过来的选中节点(去重后)
+
       // 使用 Set 来存储传递过来的点值
-      const newValues = new Set(points.map((point) => point.pointId))
+      const newValues = new Set(uniquePoints.map((point) => point.pointId));
 
-      // 1. 删除取消选中的点
+      // 2. 删除取消选中的点
       const removedPoints = this.tableData
         .filter((item) => !newValues.has(item.pointId))
-        .map((item) => item.pointId) // 记录被删除的点
+        .map((item) => item.pointId); // 记录被删除的点
 
       this.tableData = this.tableData.filter((item) =>
         newValues.has(item.pointId)
-      )
-      // console.log(this.tableData,'handleSelectPoint函数里的tableData')
-      // 2. 确保新增点不会重复
-      const existingValues = new Set(
-        this.tableData.map((item) => item.pointId)
-      )
+      );
+
+      // 3. 确保新增点不会重复
+      const existingValues = new Set(this.tableData.map((item) => item.pointId));
 
-      points.forEach((point) => {
+      uniquePoints.forEach((point) => {
         // 如果当前传递的点不在已有的点集中,则添加
         if (!existingValues.has(point.pointId)) {
           this.tableData.push({
@@ -799,47 +833,115 @@ console.log(data,'编辑的参数')
             pointType: point.pointType,
             powerType: point.powerType,
             prePointId: null
-          })
-          // console.log(this.tableData,'handleSelectPoint函数里的tableData2')
+          });
+
           this.prePointIdOptions.push({
             pointName: point.pointName, // 显示的名称
             pointId: point.pointId // 对应的值
-          })
-          this.initprePointIdOptions = [...this.prePointIdOptions]
-          console.log(this.prePointIdOptions, '前置节点设置下拉')
-          existingValues.add(point.pointId)
+          });
+          this.initprePointIdOptions = [...this.prePointIdOptions];
+          console.log(this.prePointIdOptions, '前置节点设置下拉');
+          existingValues.add(point.pointId);
         }
-      })
+      });
 
-      // 3. 处理被删除的点,如果这些点作为父节点绑定,则将对应的 prePointId 设置为 null
+      // 4. 处理被删除的点,如果这些点作为父节点绑定,则将对应的 prePointId 设置为 null
       this.tableData.forEach((item) => {
         if (removedPoints.includes(item.prePointId)) {
-          item.prePointId = null
+          item.prePointId = null;
         }
-      })
-      // console.log(this.tableData,'handleSelectPoint函数里的tableData3')
-      // 4. 从下拉选项中移除被删除的点
+      });
+
+      // 5. 从下拉选项中移除被删除的点
       this.prePointIdOptions = this.prePointIdOptions.filter(
         (option) => !removedPoints.includes(option.pointId)
-      )
-      this.initprePointIdOptions = [...this.prePointIdOptions]
+      );
+      this.initprePointIdOptions = [...this.prePointIdOptions];
 
-      // 5. 确保下拉选项中仍然保留所有未被删除的点
-      const allPoints = points.map((point) => ({
+      // 6. 确保下拉选项中仍然保留所有未被删除的点
+      const allPoints = uniquePoints.map((point) => ({
         pointName: point.pointName,
         pointId: point.pointId
-      }))
+      }));
 
       this.prePointIdOptions = allPoints.filter(
         (option) => !removedPoints.includes(option.pointId)
-      )
-      this.initprePointIdOptions = [...this.prePointIdOptions]
+      );
+      this.initprePointIdOptions = [...this.prePointIdOptions];
 
       // 更新 form.spoint 为最新选中的隔离点数组
-      this.form.spoint = points.map((point) => point.pointId)
-
+      this.form.spoint = uniquePoints.map((point) => point.pointId);
     },
 
+    // handleSelectPoint(points) {
+    //   console.log(points, '父组件接收逆向传递选中的隔离点')
+    //   this.tableData = points; //子组件传递过来的选中节点
+    //   // 使用 Set 来存储传递过来的点值
+    //   const newValues = new Set(points.map((point) => point.pointId))
+    //
+    //   // 1. 删除取消选中的点
+    //   const removedPoints = this.tableData
+    //     .filter((item) => !newValues.has(item.pointId))
+    //     .map((item) => item.pointId) // 记录被删除的点
+    //
+    //   this.tableData = this.tableData.filter((item) =>
+    //     newValues.has(item.pointId)
+    //   )
+    //   // 2. 确保新增点不会重复
+    //   const existingValues = new Set(
+    //     this.tableData.map((item) => item.pointId)
+    //   )
+    //
+    //   points.forEach((point) => {
+    //     // 如果当前传递的点不在已有的点集中,则添加
+    //     if (!existingValues.has(point.pointId)) {
+    //       this.tableData.push({
+    //         pointName: point.pointName, // 显示的名称
+    //         pointId: point.pointId, // 对应的值
+    //         pointType: point.pointType,
+    //         powerType: point.powerType,
+    //         prePointId: null
+    //       })
+    //
+    //       this.prePointIdOptions.push({
+    //         pointName: point.pointName, // 显示的名称
+    //         pointId: point.pointId // 对应的值
+    //       })
+    //       this.initprePointIdOptions = [...this.prePointIdOptions]
+    //       console.log(this.prePointIdOptions, '前置节点设置下拉')
+    //       existingValues.add(point.pointId)
+    //     }
+    //   })
+    //
+    //   // 3. 处理被删除的点,如果这些点作为父节点绑定,则将对应的 prePointId 设置为 null
+    //   this.tableData.forEach((item) => {
+    //     if (removedPoints.includes(item.prePointId)) {
+    //       item.prePointId = null
+    //     }
+    //   })
+    //
+    //   // 4. 从下拉选项中移除被删除的点
+    //   this.prePointIdOptions = this.prePointIdOptions.filter(
+    //     (option) => !removedPoints.includes(option.pointId)
+    //   )
+    //   this.initprePointIdOptions = [...this.prePointIdOptions]
+    //
+    //   // 5. 确保下拉选项中仍然保留所有未被删除的点
+    //   const allPoints = points.map((point) => ({
+    //     pointName: point.pointName,
+    //     pointId: point.pointId
+    //   }))
+    //
+    //   this.prePointIdOptions = allPoints.filter(
+    //     (option) => !removedPoints.includes(option.pointId)
+    //   )
+    //   this.initprePointIdOptions = [...this.prePointIdOptions]
+    //
+    //   // 更新 form.spoint 为最新选中的隔离点数组
+    //   this.form.spoint = points.map((point) => point.pointId)
+    //
+    // },
+
     // 车间逆向传递拿到的隔离点数据产线
     handleProductLineSelected(selectedOption) {
       // console.log(selectedOption, "父组件接收到的 selectedOption");