Selaa lähdekoodia

修改scd的bug

“yueshang” 1 vuosi sitten
vanhempi
commit
9ed52b53c7

+ 4 - 2
src/pages/netStructPicture/components/CidTree.vue

@@ -81,6 +81,7 @@ const props = defineProps({
 });
 const emit = defineEmits(["treeBack", "clickCode", "treeBackDefalut"]);
 let tagList = ref(props.iedRelation);
+const loading = ref(true);
 let tagChoose = ref("");
 let treeData = ref([
   {
@@ -230,7 +231,7 @@ const updateNum = (treeNode, data) => {
     if (data && data.hasOwnProperty(node.itemcode)) {
       node.num = parseInt(data[node.itemcode]);
     }
-    if (data && node.itemcode == "scd.ied.Relation") {
+    if (data && node.itemcode == "scd.ied.Relation"&&data["scd.ied.ExtRef"]) {
       node.num = parseInt(data["scd.ied.ExtRef"]);
     }
     // 如果当前节点有子节点,递归处理子节点
@@ -242,6 +243,7 @@ const updateNum = (treeNode, data) => {
         .reduce((total, child) => total + child.num, 0);
     }
   }
+  loading.value = false
 };
 let defaultProps = ref({
   label: "label",
@@ -311,13 +313,13 @@ const reload = () => {
       tagList.value = res.data;
       tagChoose.value = res.data ? Object.keys(res.data)[0] : "";
       clickTage.value = res.data ? Object.values(res.data)[0] : "";
-      console.log(clickTage.value,tagChoose.value)
       emit("treeBack", clickTage.value)
     });
   }
 };
 const clickTage = ref(null);
 const tagClick = (row, num) => {
+  loading.value = true;
   treeData.value.forEach(item=>{
     item.num = 0;
     item.childItemCid = [];

+ 8 - 16
src/pages/netStructPicture/components/Gsix.vue

@@ -98,13 +98,13 @@ watch(
   () => props.clickCodeValue,
   (newValue) => {
     if (newValue) {
+      loading.value = true;
       isDiffdescUpAdd.value = false; //点击侧边栏的时候站控层的这个先置为空
       isDiffdescUpDel.value = false;
       cClickCode.value = newValue;
       CodeImg(newValue); //找到差异项对应的图片进行展示
       clickLineResult(); //重置
       clickLineResultMain(); //重置
-      loading.value = true;
       if (clickRow.value && clickRow.value.id) {
         getData();
       } else if (CodeInfoCid.value) {
@@ -131,7 +131,8 @@ const mapList = ref(null);
 const leftI = ref([]); //新增
 const dataU = ref([]); //修改
 const rightD = ref([]); //删除
-const loading = ref(props.isCid ? false : true);
+// const loading = ref(props.isCid ? false : true);
+const loading = ref(false);
 const dones = () => {
   //重置
   leftI.value = [];
@@ -157,7 +158,7 @@ const getData = async () => {
     comptype: "u",
     itemcode: cClickCode.value,
   });
-  if(!res.data) return;
+  if(!res.data||!res.data.length) return loading.value = false;
   if (res.data && cClickCode.value != "scd.ied") {
     res.data.forEach((item) => {
       let text;
@@ -168,6 +169,7 @@ const getData = async () => {
   }
   mapList.value = res.data;
   nextTick(() => {
+    if(!middleLine.value) return;
     middleLine.value.style.height = 0;
     middleLine.value.style.height = mianItem.value.scrollHeight + "px";
   });
@@ -181,7 +183,6 @@ const getDataCid = () => {
   } else if (cClickCode.value != "scd.ied" && cidsnode && cidsnode.length > 0) {
     //除开装置信息
     mapList.value = cidsnode;
-    console.log("cidsnode----------", cidsnode);
     dones();
     mapList.value.forEach((item) => {
       commonGetData(item);
@@ -195,7 +196,6 @@ const getDataCid = () => {
 const commonGetData = (item) => {
   isDiffdescUpAdd.value = false;
   isDiffdescUpDel.value = false;
-  console.log("item+++++", item);
   switch (item.diff_opt) {
     case "i": //新增
       leftI.value.push(item);
@@ -207,14 +207,6 @@ const commonGetData = (item) => {
       dataU.value.push(item);
       break;
   }
-  console.log(
-    "leftI.value",
-    leftI.value,
-    "rightD.value",
-    rightD.value,
-    "dataU.value",
-    dataU.value
-  );
 };
 //点击新增或删除的图片
 const DelClick = ref({});
@@ -638,6 +630,7 @@ const setLeaderlineMain = () => {
       line = new LeaderLine(mainLeftStartDom, value, lineStyleLeftMain);
       leaderLineMain.value.push(line);
       hiddenLineDialog();
+      loading.value = false;
     }
   }
   if (domListRightMain.value.size > 0) {
@@ -646,9 +639,10 @@ const setLeaderlineMain = () => {
       lines = new LeaderLine(value, mainRightStartDom, lineStyleRightMain);
       leaderLineMain.value.push(lines);
       hiddenLineDialog();
+      loading.value = false;
     }
   }
-  loading.value = false;
+
 };
 //左右两侧点击图片显示的连线
 const setLeaderlines = (types) => {
@@ -812,8 +806,6 @@ const setLeaderlines = (types) => {
               key3.includes("add") &&
               key3 == key2
             ) {
-
-              console.log('lallal', 11111111)
               let line4; //从左往右的线条
               line4 = new LeaderLine(value3, value2, lineStyleAdd);
               leaderLineShow.value.push(line4);

+ 14 - 13
src/pages/netStructPicture/components/ScdNow.vue

@@ -49,7 +49,8 @@
           <img :src="jiantouPng" alt="" class="jiantou" />
           <div id="newCrc">
             <img src="../../../assets/icon/clice_blue.png" alt="" />
-            <span v-if="crcVer">{{ crcVer[0] }}</span>
+            <span v-if="crcVer && crcVer[0]">{{ crcVer[0] }}</span>
+            <span v-else>无</span>
           </div>
         </div>
       </div>
@@ -59,17 +60,17 @@
           <p>IED</p>
         </div>
         <div id="newIed" v-if="iedVer">
-          <p id="addId" @click="lookAdd(iedVer.i.list)">
+          <p id="addId" @click="lookAdd(iedVer.i?iedVer.i.list:[])">
             <img :src="newlyPng" alt="" class="icons" />
-            <span style="color: #134bea">新增({{ iedVer.i.list.length }})</span>
+            <span style="color: #134bea">新增({{ iedVer.i?iedVer.i.list.length:0 }})</span>
           </p>
-          <p id="editId" @click="lookEdit(iedVer.u.list)">
+          <p id="editId" @click="lookEdit(iedVer.u?iedVer.u.list:[])">
             <img :src="modifyPng" alt="" class="icons" />
-            <span style="color: #ffcb11">修改({{ iedVer.u.list.length }})</span>
+            <span style="color: #ffcb11">修改({{ iedVer.u?iedVer.u.list.length:0 }})</span>
           </p>
-          <p id="delId" @click="lookDel(iedVer.d.list)">
+          <p id="delId" @click="lookDel(iedVer.d?iedVer.d.list:[])">
             <img :src="delPng" alt="" class="icons" />
-            <span style="color: #e50505">删除({{ iedVer.d.list.length }})</span>
+            <span style="color: #e50505">删除({{ iedVer.d?iedVer.d.list.length:0 }})</span>
           </p>
         </div>
       </div>
@@ -133,7 +134,6 @@ const emit = defineEmits(["nowBack"]);
 const openBig = ref(false);
 const lineWrite = () => {
   let oldIed = document.getElementById("oldIed");
-  let newIed = document.getElementById("newIed");
   let addId = document.getElementById("addId");
   let editId = document.getElementById("editId");
   let delId = document.getElementById("delId");
@@ -233,7 +233,6 @@ watch(
           iedVer.value[key].list.push(item);
         }
       }
-      console.log('iedVer.valu===', iedVer.value)
       setTimeout(() => {
         lineWrite();
       }, 50);
@@ -252,6 +251,7 @@ const iedRelationData = ref({}); //左侧所有数据
 const scdView = ref(false); //是否是点击Scd文件一致性校核进入的
 const delScdId = ref(""); //点击删除的scd_id
 const lookAddOrDel = async (comData, del) => {
+  if(!comData||!comData.length) return;
   iedRelationData.value = {};
   checkDialogData.value = null;
   scdView.value = true;
@@ -273,28 +273,28 @@ const lookAddOrDel = async (comData, del) => {
   } else if (del == "add") {
     delScdId.value = route.query.id;
   } else if (del == "edit") {
-    recordDelIedVer.value = iedVer.value ? iedVer.value.d.list : null;
+    recordDelIedVer.value = iedVer.value&&iedVer.value.d ? iedVer.value.d.list : null;
   }
   // 对键进行排序===
   // if (del != "edit") {
+    if(!comData[0]) return;
   const iedRes = await scdIedRelation({
     scd_id: delScdId.value,
     ied_name: comData[0].ied_name,
     reset: 1,
   });
-  console.log('iedRelationData.value111111111', iedRelationData.value)
   checkDialogData.value = iedRes.data ? iedRes.data[comData[0].ied_name] : null;
   if (del != "edit") {
     openBig.value = true;
   }
 };
 const lookAdd = async (comData) => {
-  console.log("comData=====", comData);
   lookAddOrDel(comData, "add");
   // lookType.value = 1;
   // emit("nowBack", lookType.value);
 };
 const lookDel = (comData) => {
+  
   lookAddOrDel(comData, "del");
   // lookType.value = 3;
   // emit("nowBack", lookType.value);
@@ -338,8 +338,9 @@ watch(()=>openScl.value,(newValue)=>{
 })
 
 const lookEdit = (comData) => {
-  openScl.value = true;
+  if(!comData||!comData.length) return;
   lookAddOrDel(comData, "edit");
+  openScl.value = true;
   // emit("nowBack", lookType.value);
 };
 //关闭scl修改弹窗

+ 0 - 1
src/pages/netStructPicture/components/dialogIndex.vue

@@ -130,7 +130,6 @@ const checkData = ref(null); //选中的数据
 watch(
   () => props.checkDialogData,
   (newValue) => {
-    console.log("checkDialogData", newValue);
     checkData.value = newValue;
   }
 );

+ 13 - 22
src/pages/netStructPicture/components/inoutControl.vue

@@ -1,6 +1,6 @@
 <!-- 输入输出控制块 -->
 <template>
-  <div>
+  <div v-loading="loading" element-loading-text="加载数据中">
     <!-- 关联图 -->
     <div
       v-if="tabValue == 'photo'"
@@ -126,6 +126,7 @@ import LeaderLine from "../../../../public/leader-line.min.js";
 import AnimEvent from "../../../../public/anim-event.min.js";
 import inoutSendOrRv from "./inoutSendOrRv";
 import inoutDialog from "./inoutDialog.vue";
+import { clickImgEvent } from "@/utils/common.js";
 import {
   //send发送
   iednetworkInfo,
@@ -134,7 +135,6 @@ import {
   scdIedRelation,
   getiedInputs,
 } from "@/api/iedNetwork";
-import jsPlumb from "jsplumb";
 import { useRoute } from "vue-router";
 const route = useRoute();
 const props = defineProps({
@@ -164,7 +164,7 @@ const props = defineProps({
   },
 });
 const svInfo = ref(null);
-
+const loading = ref(true);
 const iedChild = ref(null);
 const circleOpen = ref(false); //数字点击事件
 //得到两边子版块的数据
@@ -197,7 +197,10 @@ const getIedChild = async () => {
               itemKey.ld_inst == key.ld_inst &&
               itemKey.ld_desc == key.ld_desc
             ) {
-              itemKey.childItem.push(key);
+              // 将key对象中的属性进行浅拷贝,避免直接引用和循环引用而避免报错
+              const newKey = Object.assign({}, key);
+              itemKey.childItem= [];
+              itemKey.childItem.push(newKey);
             }
           });
         }
@@ -236,10 +239,10 @@ const getNetworkInfo = async () => {
     }else{
       svInfo.value = svResInfoCtrl.data.GSEControl
     }
-
+    if(!middleElement.value) return;
     if (svInfo.value && svInfo.value.length > 3) {
       middleElement.value.style.marginTop = "20px";
-    } else {
+    } else{
       middleElement.value.style.marginTop = "150px"; // 设置元素的垂直位置
     }
   }
@@ -314,22 +317,8 @@ const processArray = (arr) => {
 };
 //点击图片的时候筛选出数据
 const clickImg = async (dataItem) => {
-  if (!props.isScdView) {
-    Object.values(props.iedRelation).find((item) => {
-      if (item.ied_name == dataItem.ref_ied_name) {
-        listData2.value = item;
-      }
-    });
-  } else {
-    //如果是从scdView进来点到直接调用接口
-    const resRla = await scdIedRelation({
-      scd_id: scdIdValue,
-      ied_name: dataItem.ref_ied_name,
-      reset: 1,
-    });
-    if (!resRla.data) return;
-    listData2.value = resRla.data[dataItem.ref_ied_name];
-  }
+  loading.value =true;
+  listData2.value =await clickImgEvent(props,dataItem,scdIdValue);
 };
 
 //点击后重置数据和线条
@@ -652,6 +641,7 @@ const setLeaderline2 = () => {
   }
   // const allText = document.querySelectorAll(".leader-line");
   // circelSet();
+  loading.value =false;
   hiddenLine2();
 };
 //滚动时重定位线条
@@ -763,6 +753,7 @@ watch(
   () => props.checkData,
   (newValue) => {
     if (newValue) {
+      loading.value =true;
       // if (leaderLines2.value.length > 0) {
       leaderLines2.value = [];
       // }

+ 5 - 1
src/pages/netStructPicture/components/inoutSendOrRv.vue

@@ -316,7 +316,7 @@ const getGooseReList = async () => {
     scd_id: scdIdValue,
     ied_name: props.checkData.ied_name,
   });
-  if(!gooseRes.data) return;
+  if (!gooseRes.data) return;
   if (gooseRes.data.length > 0) {
     gooseRes.data.forEach((item) => {
       item.children = [];
@@ -381,15 +381,19 @@ watch(
     nextTick(() => {
       switch (newValue) {
         case "SVsend":
+          if (!svTableCtrl.value) return;
           myTable.value.setCurrentRow(svTableCtrl.value[0]);
           break;
         case "SVreceive":
+          if (!svReceive.value) return;
           myTable2.value.setCurrentRow(svReceive.value[0]);
           break;
         case "GOOSEsend":
+          if (!gooseReCtrl.value) return;
           myTable3.value.setCurrentRow(gooseCtrl.value[0]);
           break;
         case "GOOSEreceive":
+          if (!svTableCtrl.value) return;
           myTable4.value.setCurrentRow(gooseReCtrl.value[0]);
           break;
         default:

+ 39 - 40
src/pages/netStructPicture/components/relationShip.vue

@@ -1,6 +1,6 @@
 <!-- 装置关联关系 -->
 <template>
-  <div>
+  <div v-loading="loading" element-loading-text="加载数据中">
     <div class="main-cont" ref="myElement" id="treedom">
       <div class="main-left" ref="leftElement">
         <div
@@ -48,10 +48,14 @@
   </div>
 </template>
   <script setup>
-import { onMounted, watch, ref, nextTick, defineEmits,inject } from "vue";
+import { onMounted, watch, ref, nextTick, defineEmits, inject } from "vue";
 import devicePng from "@/assets/image/instruct/device.png";
 import LeaderLine from "../../../../public/leader-line.min.js";
 import AnimEvent from "../../../../public/anim-event.min.js";
+import { useRoute } from "vue-router";
+import { clickImgEvent} from "@/utils/common.js";
+const route = useRoute();
+const loading = ref(true);
 const props = defineProps({
   checkData: {
     type: Object,
@@ -65,6 +69,10 @@ const props = defineProps({
     type: Object,
     default: () => {},
   },
+  isScdView: {
+    type: Boolean,
+    default: false,
+  },
 });
 const middleElement = ref(null);
 const rightElement = ref(null);
@@ -92,7 +100,7 @@ const setdomRight = (el, item) => {
 const processArray = (arr) => {
   // ref_ied_id作为键,obj作为值
   const uniqueObjects = new Map();
-  if(!arr) return;
+  if (!arr) return;
   // 遍历数组
   for (const obj of arr) {
     const { ref_ied_id } = obj;
@@ -109,16 +117,14 @@ const processArray = (arr) => {
   return Array.from(uniqueObjects.values());
 };
 //点击图片的时候筛选出数据
-const clickImg = (dataItem) => {
-  Object.values(props.iedRelation).find((item) => {
-    if (item.ied_name == dataItem.ref_ied_name) {
-      listData.value = item;
-    }
-  });
+const clickImg = async (dataItem) => {
+  loading.value =true;
+  listData.value =await clickImgEvent(props,dataItem,scdIdValue);
 };
 watch(
   () => props.checkData,
   (newValue, oldV) => {
+    loading.value =true;
     listData.value = newValue;
     if (newValue && leaderLines.value.length > 0) {
       // leaderLines.value.forEach((line) => line.remove()); //清除连线
@@ -160,7 +166,7 @@ const clickResetLine = () => {
 // 将设备列表分成两份
 const bothSide = (data) => {
   const formatArr = processArray(data);
-  if(!formatArr) return;
+  if (!formatArr&&formatArr.length) return;
   const arrlenght = formatArr.length;
   const long1 = Math.ceil(arrlenght / 2);
   leftList.value = formatArr.splice(0, long1);
@@ -168,17 +174,7 @@ const bothSide = (data) => {
 };
 
 const setLeaderline = () => {
-  // lineArr.value = [];
   //线条样式
-  const lineStyle0 = {
-    color: "#51637F",
-    size: 2,
-    path: "straight",
-    startPlug: "arrow1",
-    endPlug: "behind",
-    startSocket: "right",
-    endSocket: "left",
-  };
   const lineStyle1 = {
     color: "#51637F",
     size: 2,
@@ -187,6 +183,11 @@ const setLeaderline = () => {
     startSocket: "right",
     endSocket: "left",
   };
+  const lineStyle0 = {
+    ...lineStyle1,
+    startPlug: "arrow1",
+    endPlug: "behind",
+  };
   const lineStyle2 = {
     color: "#134BEA",
     size: 2,
@@ -196,29 +197,18 @@ const setLeaderline = () => {
     startSocket: "right",
     endSocket: "left",
   };
-  const lineStyleRight0 = {
-    color: "#51637F",
-    size: 2,
-    path: "straight",
-    startPlug: "arrow1",
-    endPlug: "behind",
-    startSocket: "left",
-    endSocket: "right",
-  };
   const lineStyleRight1 = {
-    color: "#51637F",
-    size: 2,
-    path: "straight",
-    endPlug: "arrow1",
+    ...lineStyle1,
     startSocket: "left",
     endSocket: "right",
   };
-  const lineStyleRight2 = {
-    color: "#134BEA",
-    size: 2,
-    path: "straight",
+  const lineStyleRight0 = {
+    ...lineStyleRight1,
     startPlug: "arrow1",
-    endPlug: "arrow1",
+    endPlug: "behind",
+  }
+  const lineStyleRight2 = {
+    ...lineStyle2,
     startSocket: "left",
     endSocket: "right",
   };
@@ -281,6 +271,7 @@ const setLeaderline = () => {
     //  保存进数组,方便进行遍历删除
     leaderLines.value.push(line2);
   }
+  loading.value =false
   hiddenLine();
 };
 //设置中间盒子的所在位置
@@ -293,6 +284,7 @@ const middleLinePosition = () => {
       element.value.style.marginTop = `${value}px`;
     };
     if (leftList.value.length > 3 || rightList.value.length > 3) {
+      if(!middleElement.value) return;
       middleElement.value.style.marginTop = `${(heights - 60) / 2}px`; // 设置元素的垂直位置
     } else {
       setElementMarginTop(leftElement, 0);
@@ -307,7 +299,13 @@ const middleLinePosition = () => {
     }
   }, 0);
 };
+let scdIdValue ='';
 onMounted(() => {
+  if (props.delScdId) {
+    scdIdValue = props.delScdId;
+  } else {
+    scdIdValue = route.query.id;
+  }
   nextTick(() => {
     setLine();
     middleLinePosition();
@@ -318,10 +316,11 @@ onMounted(() => {
 });
 //滚动时重定位线条
 const newPositionLine = () => {
+  if(!document.getElementById("treedom")) return;
   document.getElementById("treedom").addEventListener(
     "scroll",
     AnimEvent.add(() => {
-      if(!leaderLines.value) return;
+      if (!leaderLines.value) return;
       leaderLines.value.forEach((line) => {
         hiddenLine();
         line.position();
@@ -333,7 +332,7 @@ const newPositionLine = () => {
   document.getElementById("treedom").addEventListener(
     "resize",
     AnimEvent.add(function () {
-      if(!leaderLines.value) return;
+      if (!leaderLines.value) return;
       leaderLines.value.forEach((line) => {
         hiddenLine();
         line.position();

+ 0 - 2
src/pages/netStructPicture/components/scdDialogIndex.vue

@@ -74,9 +74,7 @@ const cancelClick = () => {
 const iedRelationData = ref([]);
 const checkDialogData = ref(null);
 const iedRelation = async () => {
-  console.log('scdIdValue', scdIdValue)
   const iedRes = await scdIedRelation({ scd_id: scdIdValue });
-  console.log('iedRes111', iedRes)
   iedRelationData.value = iedRes.data;
 };
 onMounted(()=>{

+ 16 - 11
src/pages/netStructPicture/components/scdTree.vue

@@ -175,9 +175,7 @@
 import {
   ref,
   onMounted,
-  toRefs,
   watch,
-  nextTick,
   defineEmits,
   onUnmounted,
 } from "vue";
@@ -189,15 +187,12 @@ import {
   compstatView,
   scdExpTableData,
 } from "@/api/scdCheck/scdCheck2";
-import scd from "@/api/scd";
-import systemRow from "@/api/systemRow";
 import {
   ElMessage,
   ElLoading,
   ElMessageBox,
   ElNotification,
 } from "element-plus";
-import LookScd from "../modalCom/LookScd.vue";
 import dervicePng from "@/assets/image/scdcheck/derive.png";
 import againPng from "@/assets/image/scdcheck/again.png";
 import addPng from "@/assets/image/scdcheck/add.png";
@@ -210,9 +205,6 @@ const route = useRoute();
 const emit = defineEmits(["scdTreeBack", "scdView", "scdJpadList"]);
 let tableList = ref([]);
 let multipleTable = ref();
-let alreadyTriggered = ref(false);
-let scdid = ref([]);
-const loading = ref(false);
 let lookScdArr = ref([]);
 let lookScdModal = ref(false);
 const fileList = ref([]); //上传的文件
@@ -221,9 +213,18 @@ const loadingAddError = ref(false); //文件上传的加载状态
 const chooseFile = ref("");
 const chooseContrast = ref(null);
 const checkNow = (e) => {
+  tipsLoading();
   //scd比对
   results();
 };
+const tipsLoading = () =>{
+  // if(lookScdModal.value){
+  //   return ElMessage({
+  //     type: "warning",
+  //     message: "上一条对比正在进行中!",
+  //   });
+  // }
+}
 const results = () => {
   lookScdModal.value = true;
   contrast.value = false;
@@ -236,6 +237,7 @@ const results = () => {
 const exportModal = ref(false);
 const exportLink = ref("");
 const excelPort = () => {
+  tipsLoading();
   exportLink.value = "";
   if (!chooseContrast.value) {
     return ElMessage({
@@ -266,6 +268,7 @@ const excelPort = () => {
 };
 const contrast = ref(false); //是否是重新对比
 const reloadCheck = async () => {
+  tipsLoading();
   contrast.value = true;
   mesg.value = null;
   //重新比对
@@ -386,14 +389,13 @@ const getMessage = () => {
       isAnalysis.value = false;
       contrast.value = false;
     }
-    console.log(mesg.value, "返回的数据", topic);
   });
 };
 //取消MQTT订阅
 const unsubscribe = () => {
   //如果页面并没有初始化MQTT,无需取消订阅
   if (PublicMqtt.value) {
-    PublicMqtt.unsubscribes();
+    PublicMqtt.value.unsubscribes();
   }
 };
 onUnmounted(() => {
@@ -408,10 +410,14 @@ onUnmounted(() => {
 const cancelClick = () => {
   loadingAddError.value = false;
   loadingAdd.value = false;
+  AnalysisProcess.value = false;
+  unsubscribe()
 };
 //点击输入框中的清除按钮
 const clearFile = () => {
   fileList.value = [];
+  AnalysisProcess.value = false;
+  unsubscribe()
 };
 watch(
   () => chooseFile.value,
@@ -421,7 +427,6 @@ watch(
     }
   }
 );
-const referenceData = ref(null);
 //解析完成开始对比的点击
 const yesAnalysisClick = () => {
   ElMessageBox.confirm(

+ 8 - 29
src/pages/netStructPicture/components/virtualRelation.vue

@@ -1,6 +1,6 @@
 <!-- 虚端子关系 -->
 <template>
-  <div>
+  <div v-loading="loading" element-loading-text="加载数据中">
     <!-- 关联图 -->
     <div class="main-cont" id="treedom3">
       <div class="main-left">
@@ -114,6 +114,7 @@ import {
   scdIedRelation,
 } from "@/api/iedNetwork";
 import { useRoute } from "vue-router";
+import { clickImgEvent } from "@/utils/common.js";
 const route = useRoute();
 const props = defineProps({
   checkData: {
@@ -138,9 +139,9 @@ const props = defineProps({
   },
 });
 const svInfo = ref(null);
+const loading = ref(true);
 //处理两边的数据
 const processBoth = (list, svResInfo, inoutType) => {
-  console.log('svResInfo.data', svResInfo.data)
   if (!list||!svResInfo.data) return;
   list.forEach((item, index) => {
     item.titleItems = [];
@@ -158,7 +159,6 @@ const processBoth = (list, svResInfo, inoutType) => {
       }
     });
   });
-  // console.log('listaaaaaaaaa', list)
 };
 let leaderLines3 = ref([]); //控制线条显示
 const leftList = ref([]);
@@ -206,7 +206,6 @@ const getNetworkInfo3 = async (names) => {
     isDecollate: true,
   };
   //处理两边的数据
-  console.log('leftList.value2222', leftList.value,rightList.value)
   if (svResInfo.data.length > 0) {
     processBoth(leftList.value, svResInfo, "in");
     processBoth(rightList.value, svResInfo, "out");
@@ -228,30 +227,9 @@ const getNetworkInfo3 = async (names) => {
 };
 //点击图片的时候筛选出数据
 const clickImg = async (dataItem) => {
-  if (!props.isScdView) {
-    Object.values(props.iedRelation).find((item) => {
-      if (item.ied_name == dataItem.ref_ied_name) {
-        listData3.value = item;
-      }
-    });
-  } else {
-    console.log('dataItem', dataItem)
-    // listData3.value.ied_name = dataItem.ref_ied_name;
-    // listData3.value.ied_desc = dataItem.ref_ied_desc;
-        //如果是从scdView进来点到直接调用接口
-        const resRla = await scdIedRelation({
-      scd_id: scdIdValue,
-      ied_name: dataItem.ref_ied_name,
-      reset: 1,
-    });
-    if (!resRla.data) return;
-    listData3.value = resRla.data[dataItem.ref_ied_name];
-    getNetworkInfo3(dataItem.ref_ied_name)
-    // const ResInput = await getMiddleinputs({
-    //   ied_name: dataItem.ref_ied_name,
-    //   scd_id: scdIdValue,
-    // });
-  }
+  loading.value =true;
+  listData3.value =await clickImgEvent(props,dataItem,scdIdValue);
+  getNetworkInfo3(dataItem.ref_ied_name)
 };
 
 //点击后重置数据和线条
@@ -319,6 +297,7 @@ const setLeaderline = () => {
       }
     }
   }
+  loading.value =false;
   hiddenLine();
 };
 //滚动时重定位线条
@@ -402,10 +381,10 @@ onMounted(() => {
 watch(
   () => props.checkData,
   (newValue) => {
+    loading.value =true;
     listData3.value = [];
     svInfo.value = [];
     listData3.value = newValue;
-    console.log('newValue======', newValue)
     if (newValue != null) {
       getNetworkInfo3(listData3.value.ied_name);
     }

+ 1 - 1
src/pages/netStructPicture/components/virtualnformation.vue

@@ -325,7 +325,7 @@ middleTitelDesc.value = iedRes.data?iedRes.data[names].desc:''
       }
     }
   });
-
+  if(!props.recordDelIedVer) return;
   // recordDelIedVer  删除的全部数据
   props.recordDelIedVer.forEach((itemdel) => {
     svResInfo.data.forEach((item) => {

+ 0 - 2
src/pages/netStructPicture/index.vue

@@ -270,7 +270,6 @@ const nowUpload = (file, e) => {
               ids: idp,
             })
             .then((res) => {
-              console.log("res", res);
               ElNotification.closeAll();
               if (res.code == 0) {
                 ElMessage({
@@ -317,7 +316,6 @@ const clickCode = (code, e) => {
   clickCodeValue.value = code;
   if (e) {
     clickCodeInfoCid.value = e;
-    console.log("esssssssss", e);
   }
   allCidStart.value = [];
 };

+ 0 - 2
src/pages/netStructPicture/newTitle/SlcCheck.vue

@@ -314,7 +314,6 @@ const reload = () => {
     tableData.value = resultList; //右侧表格数据
     // 左侧树
     treeData.value = buildTree(treeList.data, 0);
-    console.log(" treeData.value", treeData.value);
     loading.close();
   });
 };
@@ -431,7 +430,6 @@ const excelPort = () => {
   exportLink.value = "";
   const nodeName = clickTreeData.value ? clickTreeData.value.datatype : "";
   const nodeId = clickTreeData.value ? clickTreeData.value.id : "";
-  console.log(nodeName, nodeId);
   exportModal.value = true;
   //导出excel
   scdExpTableData({

+ 52 - 0
src/utils/common.js

@@ -0,0 +1,52 @@
+import { scdIedRelation } from "@/api/iedNetwork";
+export async function clickImgEvent(props,dataItem,scdIdValue){
+    let listData = null;
+    if (!props.isScdView) {
+        const foundItem = Object.values(props.iedRelation).find(item => item.ied_name === dataItem.ref_ied_name);
+        if (foundItem) {
+            listData = foundItem;
+        }
+    } else {
+      //如果是从scdView进来点到直接调用接口
+      const resRla = await scdIedRelation({
+        scd_id: scdIdValue,
+        ied_name: dataItem.ref_ied_name,
+        reset: 1,
+      });
+      if (!resRla.data||!resRla.data[dataItem.ref_ied_name]) return;
+      listData = resRla.data[dataItem.ref_ied_name];
+    }
+
+    return listData
+  };
+  export function newPositionLineEvent(elementId, leaderLines){
+    const element = document.getElementById(elementId);
+    if (!element) return;
+  
+    element.addEventListener(
+      "scroll",
+      AnimEvent.add(() => {
+        if (!leaderLines.value) return;
+        leaderLines.value.forEach((line) => {
+          hiddenLine();
+          line.position();
+          line.positionByWindowResize = false;
+        });
+      }),
+      false
+    );
+  
+    element.addEventListener(
+      "resize",
+      AnimEvent.add(function () {
+        if (!leaderLines.value) return;
+        leaderLines.value.forEach((line) => {
+          hiddenLine();
+          line.position();
+          line.positionByWindowResize = true;
+        });
+      }),
+      false
+    );
+  };
+