Browse Source

scd文件一致性校核,新的对比新增删除已完成

“yueshang” 1 năm trước cách đây
mục cha
commit
16a32c7550

+ 44 - 21
src/pages/netStructPicture/components/ScdNow.vue

@@ -59,7 +59,7 @@
           <p>IED</p>
         </div>
         <div id="newIed" v-if="iedVer">
-          <p id="addId" @click="lookAdd">
+          <p id="addId" @click="lookAdd(iedVer.i.list)">
             <img :src="newlyPng" alt="" class="icons" />
             <span style="color: #134bea">新增({{ iedVer.i.list.length }})</span>
           </p>
@@ -67,7 +67,7 @@
             <img :src="modifyPng" alt="" class="icons" />
             <span style="color: #ffcb11">修改({{ iedVer.u.list.length }})</span>
           </p>
-          <p id="delId" @click="lookDel">
+          <p id="delId" @click="lookDel(iedVer.d.list)">
             <img :src="delPng" alt="" class="icons" />
             <span style="color: #e50505">删除({{ iedVer.d.list.length }})</span>
           </p>
@@ -84,6 +84,7 @@
       :checkDialogData="checkDialogData"
       :iedRelationData="iedRelationData"
       :scdView="scdView"
+      :delScdId="delScdId"
     ></dialog-index>
     <div id="wrapperscd"></div>
   </div>
@@ -111,7 +112,7 @@ const props = defineProps({
     type: Array,
     default: () => [],
   },
-  clickView: {
+  clickViewData: {
     type: Object,
     default: () => {},
   },
@@ -161,16 +162,17 @@ const lineWrite = () => {
     })
   );
   hiddenLine2();
-  console.log("lineList.value", lineList.value);
 };
 const clickRow = ref(false);
+const clickRowData = ref({});//对比列表点击的数据
 watch(
-  () => props.clickView,
+  () => props.clickViewData,
   (newValue) => {
+    iedVer.value = {};
     if (newValue) {
+      clickRowData.value = newValue;
       clickRow.value = true;
       detailData.value = null;
-      iedVer.value = {};
       lineList.value.forEach((item) => item.remove());
       lineList.value = [];
     }
@@ -183,7 +185,8 @@ const iedVer = ref({});
 watch(
   () => props.scdipadMini,
   (newValue) => {
-    if (newValue && clickRow) {
+    if (newValue && clickRow.value) {
+      iedVer.value = {};
       detailData.value = newValue;
       // SCD版本数据
       const scdv = detailData.value.filter(
@@ -224,30 +227,53 @@ const done = (emits) => {
   openBig.value = emits;
   checkDialogData.value = null;
   scdView.value = false;
+  delScdId.value = ''
 };
 const iedRelationData = ref({}); //左侧所有数据
 const scdView = ref(false); //是否是点击Scd文件一致性校核进入的
-const lookAdd = async () => {
-  console.log('window.ApiServer', window.ApiServer)
-  iedRelationData.value = {}
+const delScdId = ref('');//点击删除的scd_id
+const lookAddOrDel =async (comData,del) => {
+  iedRelationData.value = {};
+  checkDialogData.value =null;
   scdView.value = true;
-  for (let k = 0; k < iedVer.value.i.list.length; k++) {
-    let item = iedVer.value.i.list[k];
+  const iedDetail = {};
+  for (let k = 0; k < comData.length; k++) {
+    let item = comData[k];
     const key = item.ied_name;
-    iedRelationData.value[key] = item;
+    iedDetail[key] = item;
+  }
+  // 获取对象的所有键,并存入数组
+  let keys = Object.keys(iedDetail);
+  // 对键进行排序===
+  keys.sort();
+  for (let key of keys) {
+    iedRelationData.value[key] = iedDetail[key];
   }
-  console.log("iedRelationData.value", iedRelationData.value);
+  if(del=='del'&&clickRowData.value.target_id){
+    delScdId.value= clickRowData.value.target_id
+  }else{
+    delScdId.value=route.query.id
+  }
+   // 对键进行排序===
   const iedRes = await scdIedRelation({
-    scd_id: route.query.id,
-    ied_name: "CE2201",
+    scd_id: delScdId.value,
+    ied_name: comData[0].ied_name,
     reset: 1,
   });
-  checkDialogData.value = iedRes.data["CE2201"];
+  checkDialogData.value = iedRes.data[comData[0].ied_name];
   openBig.value = true;
 
+}
+const lookAdd = async (comData) => {
+  lookAddOrDel(comData)
   // lookType.value = 1;
   // emit("nowBack", lookType.value);
 };
+const lookDel = (comData) => {
+  lookAddOrDel(comData,'del')
+  // lookType.value = 3;
+  // emit("nowBack", lookType.value);
+};
 const hiddenLine2 = () => {
   const elmWrapper = document.getElementById("wrapperscd");
   // 移动 line
@@ -281,10 +307,7 @@ const lookEdit = () => {
   lookType.value = 2;
   emit("nowBack", lookType.value);
 };
-const lookDel = () => {
-  lookType.value = 3;
-  emit("nowBack", lookType.value);
-};
+
 onMounted(() => {});
 onBeforeUnmount(() => {
   // lineList.value.forEach((item) => item.remove());

+ 12 - 1
src/pages/netStructPicture/components/basicInfo.vue

@@ -335,6 +335,8 @@ import {
 import LeaderLine from "../../../../public/leader-line.min.js";
 import AnimEvent from "../../../../public/anim-event.min.js";
 import { CloseBold } from "@element-plus/icons-vue";
+import { useRoute } from "vue-router";
+const route = useRoute();
 const props = defineProps({
   checkData: {
     type: Object,
@@ -344,8 +346,11 @@ const props = defineProps({
     type: Boolean,
     default: false,
   },
+  delScdId:{
+    type:String,
+    default: '',
+  }
 });
-const scdIdValue = inject("scdId");
 const navList = ref(null); //最头部的数据
 const mainTitle = ref(null); //每个方框的标题
 const moBottom = ref(null); //底部方框所展示的MAC-Address等desc
@@ -589,7 +594,13 @@ const getNode = async () => {
   });
   attrsData.value = attrRes.data;
 };
+let scdIdValue = '';
 onMounted(() => {
+  if (props.delScdId) {
+    scdIdValue = props.delScdId;
+  } else {
+    scdIdValue = route.query.id;
+  }
   getNav();
   getMainTitle();
   getNode();

+ 38 - 6
src/pages/netStructPicture/components/dialogIndex.vue

@@ -36,7 +36,8 @@
             :class="{ 'left-item-active': activeLeft == index }"
           >
             <span class="ied-name">{{ item.ied_name }}</span
-            ><span class="desc">{{ item.desc }}</span>
+            ><span class="desc" v-if="!isScdView">{{ item.desc }}</span>
+            <span class="desc" v-else>{{ item.ied_desc }}</span>
           </p>
         </el-scrollbar>
       </div>
@@ -83,6 +84,7 @@
             :iedRelation="iedRelation"
             @result="result"
             :isPhoto="isPhoto"
+            :delScdId="delScdId"
           ></component>
         </div>
       </div>
@@ -98,6 +100,7 @@ import {
   nextTick,
   shallowRef,
   defineEmits,
+  provide,
 } from "vue";
 import devicePng from "@/assets/image/instruct/device.png";
 import { Search } from "@element-plus/icons-vue";
@@ -108,6 +111,8 @@ import basicInfo from "./basicInfo.vue";
 import fixedEntry from "./fixedEntry.vue";
 import infoTable from "./infoTable.vue";
 import soureFile from "./soureFile.vue";
+import { scdIedRelation } from "@/api/iedNetwork";
+import { useRoute } from "vue-router";
 const props = defineProps({
   openBig: {
     type: Boolean,
@@ -125,8 +130,13 @@ const props = defineProps({
     type: Boolean,
     default: false,
   },
+  delScdId:{
+    type:String,
+    default: '',
+  }
 });
 const isOpen = ref(props.openBig);
+const route = useRoute();
 const inoutNav = ref([
   { name: "关联图", code: "photo" },
   { name: "SV发送", code: "SVsend" },
@@ -134,12 +144,19 @@ const inoutNav = ref([
   { name: "GOOSE发送", code: "GOOSEsend" },
   { name: "GOOSE接收", code: "GOOSEreceive" },
 ]);
+const isScdView = ref(false);
 watch(
   () => props.scdView,
   (newValue) => {
-    
+    isScdView.value = newValue;
   }
 );
+const delScdIds = ref('');
+watch(()=>props.delScdId,(newValue)=>{
+  if(newValue){
+    delScdIds.value= newValue
+  }
+})
 watch(
   () => props.openBig,
   (newValue) => {
@@ -150,7 +167,6 @@ const iedRelation = ref(null);
 watch(
   () => props.iedRelationData,
   (newValue) => {
-    console.log("iedRelation.value111111111", newValue);
     iedRelation.value = newValue;
   }
 );
@@ -158,6 +174,7 @@ const checkData = ref(null); //选中的数据
 watch(
   () => props.checkDialogData,
   (newValue) => {
+    console.log("checkDialogData", newValue);
     checkData.value = newValue;
   }
 );
@@ -198,6 +215,7 @@ const cancelClick = () => {
   isOpen.value = false;
   activeLeft.value = null;
   checkData.value = null;
+  isScdView.value = false;
   emit("done", false);
 };
 const activeNav = ref(0);
@@ -206,16 +224,30 @@ const inoutName = ref("");
 const clickNav = (navIndex, name) => {
   //点击导航栏事件
   inoutName.value = name;
-  console.log("name", name);
   activeNavName.value = name;
   activeNav.value = navIndex;
 };
 const activeLeft = ref(null);
-const clickLeft = (item, navIndex) => {
+const clickLeft = async (item, navIndex) => {
   //点击侧边栏事件
   checkData.value = null;
   activeLeft.value = navIndex;
-  checkData.value = item;
+  if (!isScdView.value) {
+    checkData.value = item;
+  } else {
+    let id='';
+    if(delScdIds.value){
+      id=delScdIds.value
+    }else{
+      id=route.query.id
+    }
+    const iedRes = await scdIedRelation({
+      scd_id:id,
+      ied_name: item.ied_name,
+      reset: 1,
+    });
+    checkData.value = iedRes.data[item.ied_name];
+  }
 };
 onMounted(() => {
   // const height = ref(0);

+ 12 - 1
src/pages/netStructPicture/components/fixedEntry.vue

@@ -47,6 +47,8 @@ import { onMounted, watch, ref, nextTick, defineEmits, inject } from "vue";
 import {
   getDingzhis
 } from "@/api/iedNetwork";
+import { useRoute } from "vue-router";
+const route = useRoute();
 const props = defineProps({
   checkData: {
     type: Object,
@@ -55,9 +57,12 @@ const props = defineProps({
   isPhoto: {
     type: String,
     default: "",
+  },
+  delScdId:{
+    type:String,
+    default: '',
   }
 });
-const scdIdValue = inject("scdId");
 const dingzhiData = ref(null);
 const dingzhiDataChild = ref(null);
 const myTable5 = ref(null);
@@ -87,7 +92,13 @@ watch(
     }
   }
 );
+let scdIdValue = '';
 onMounted(() => {
+  if (props.delScdId) {
+    scdIdValue = props.delScdId;
+  } else {
+    scdIdValue = route.query.id;
+  }
   getDingzhisList()
 });
 </script>

+ 12 - 1
src/pages/netStructPicture/components/infoTable.vue

@@ -55,6 +55,8 @@
 <script setup>
 import { onMounted, watch, ref, nextTick, defineEmits, inject } from "vue";
 import { getPointtable } from "@/api/iedNetwork";
+import { useRoute } from "vue-router";
+const route = useRoute();
 const props = defineProps({
   checkData: {
     type: Object,
@@ -64,8 +66,11 @@ const props = defineProps({
     type: String,
     default: "",
   },
+  delScdId:{
+    type:String,
+    default: '',
+  }
 });
-const scdIdValue = inject("scdId");
 const dingzhiData = ref(null);
 const dingzhiDataChild = ref(null);
 const myTable5 = ref(null);
@@ -95,7 +100,13 @@ watch(
     }
   }
 );
+let scdIdValue = '';
 onMounted(() => {
+  if (props.delScdId) {
+    scdIdValue = props.delScdId;
+  } else {
+    scdIdValue = route.query.id;
+  }
   getDingzhisList();
 });
 </script>

+ 39 - 25
src/pages/netStructPicture/components/inoutControl.vue

@@ -134,6 +134,8 @@ import {
   getiedInputs,
 } from "@/api/iedNetwork";
 import jsPlumb from "jsplumb";
+import { useRoute } from "vue-router";
+const route = useRoute();
 const props = defineProps({
   checkData: {
     type: Object,
@@ -151,9 +153,13 @@ const props = defineProps({
     type: Object,
     default: () => {},
   },
+  delScdId:{
+    type:String,
+    default: '',
+  }
 });
 const svInfo = ref(null);
-const scdIdValue = inject("scdId");
+
 const iedChild = ref(null);
 const circleOpen = ref(false); //数字点击事件
 //得到两边子版块的数据
@@ -163,33 +169,35 @@ const getIedChild = async () => {
     ied_name: props.checkData.ied_name,
     forcerefresh: 0,
   });
-  //左右侧内部侧数据组装
-  listData2.value.list.forEach((item, index) => {
-    item.titleItems = [];
-    childRes.data.forEach((key) => {
-      if (key.target_ied_name === item.ref_ied_name) {
-        if (
-          item.titleItems.length < 1 ||
-          !item.titleItems.some(
-            (titleKey) =>
-              titleKey.ld_inst === key.ld_inst &&
-              titleKey.ld_desc === key.ld_desc
-          )
-        ) {
-          key.childItem = [];
-          item.titleItems.push(key);
-        }
-        item.titleItems.forEach((itemKey) => {
+  if (childRes.data) {
+    //左右侧内部侧数据组装
+    listData2.value.list.forEach((item, index) => {
+      item.titleItems = [];
+      childRes.data.forEach((key) => {
+        if (key.target_ied_name === item.ref_ied_name) {
           if (
-            itemKey.ld_inst == key.ld_inst &&
-            itemKey.ld_desc == key.ld_desc
+            item.titleItems.length < 1 ||
+            !item.titleItems.some(
+              (titleKey) =>
+                titleKey.ld_inst === key.ld_inst &&
+                titleKey.ld_desc === key.ld_desc
+            )
           ) {
-            itemKey.childItem.push(key);
+            key.childItem = [];
+            item.titleItems.push(key);
           }
-        });
-      }
+          item.titleItems.forEach((itemKey) => {
+            if (
+              itemKey.ld_inst == key.ld_inst &&
+              itemKey.ld_desc == key.ld_desc
+            ) {
+              itemKey.childItem.push(key);
+            }
+          });
+        }
+      });
     });
-  });
+  }
   iedChild.value = childRes.data;
 };
 
@@ -677,7 +685,13 @@ const removeLine2 = () => {
     });
   }
 };
+let scdIdValue = '';
 onMounted(() => {
+  if (props.delScdId) {
+    scdIdValue = props.delScdId;
+  } else {
+    scdIdValue = route.query.id;
+  }
   //不加条件切换下方tab时会出现bug
   if (props.checkData != null && props.isPhoto == "photo") {
     getIedChild();
@@ -719,7 +733,7 @@ watch(
   (newValue) => {
     if (newValue) {
       // if (leaderLines2.value.length > 0) {
-        leaderLines2.value = [];
+      leaderLines2.value = [];
       // }
       //清除数字圆圈
       let child = document.querySelectorAll(".circel-name");

+ 3 - 2
src/pages/netStructPicture/components/relationShip.vue

@@ -48,7 +48,7 @@
   </div>
 </template>
   <script setup>
-import { onMounted, watch, ref, nextTick, defineEmits } 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";
@@ -64,8 +64,9 @@ const props = defineProps({
   iedRelation: {
     type: Object,
     default: () => {},
-  }
+  },
 });
+const delScdId = inject('delScdId')
 const middleElement = ref(null);
 const rightElement = ref(null);
 const leftElement = ref(null);

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

@@ -19,7 +19,7 @@
         v-if="lookType == 0"
         @nowBack="nowBack"
         :arrNew="arrNew"
-        :clickView="clickView"
+        :clickViewData="clickViewData"
         :scdipadMini="scdipadMini"
       ></ScdNow>
     </div>

+ 4 - 1
src/pages/netStructPicture/components/scdTree.vue

@@ -275,8 +275,11 @@ const uploadFile = async (e) => {
   }
 };
   //查看scd对比
+  let data = {};
 const searchScdCheck = async (row) => {
-  emit('scdView',row)
+  data = {}
+  data = row;
+  emit('scdView',data)
   const loading = ElLoading.service({
     lock: true,
     text: "正在查询数据",

+ 12 - 2
src/pages/netStructPicture/components/soureFile.vue

@@ -11,16 +11,20 @@
 <script setup>
 import { onMounted, watch, ref, inject } from "vue";
 import { getSourcexml } from "@/api/iedNetwork";
+import { useRoute } from "vue-router";
+const route = useRoute();
 const props = defineProps({
   checkData: {
     type: Object,
     default: () => {},
   },
+  delScdId:{
+    type:String,
+    default: '',
+  }
 });
 const loading = ref(true);
-const scdIdValue = inject("scdId");
 const text = ref("");
-
 const setPrefix = function (prefixIndex) {
   let result = "";
   let span = "    "; //缩进长度
@@ -117,7 +121,13 @@ watch(
     }
   }
 );
+let scdIdValue = '';
 onMounted(() => {
+  if (props.delScdId) {
+    scdIdValue = props.delScdId;
+  } else {
+    scdIdValue = route.query.id;
+  }
   getHtml();
 });
 </script>

+ 12 - 2
src/pages/netStructPicture/components/virtualRelation.vue

@@ -112,6 +112,8 @@ import {
   getMiddleinputs,
 } from "@/api/iedNetwork";
 import jsPlumb from "jsplumb";
+import { useRoute } from "vue-router";
+const route = useRoute();
 const props = defineProps({
   checkData: {
     type: Object,
@@ -128,11 +130,13 @@ const props = defineProps({
   iedRelation: {
     type: Object,
     default: () => {},
+  },
+  delScdId:{
+    type:String,
+    default: '',
   }
 });
 const svInfo = ref(null);
-const scdIdValue = inject("scdId");
-
 //处理两边的数据
 const processBoth = (list, svResInfo, inoutType) => {
   list.forEach((item, index) => {
@@ -355,7 +359,13 @@ const removeLine3 = () => {
     });
   }
 };
+let scdIdValue = '';
 onMounted(() => {
+  if (props.delScdId) {
+    scdIdValue = props.delScdId;
+  } else {
+    scdIdValue = route.query.id;
+  }
   if (props.checkData != null) {
     getNetworkInfo3();
   }