Browse Source

cid修改

“yueshang” 1 year ago
parent
commit
a5cb83a18b

+ 21 - 10
src/pages/netStructPicture/components/CidTree.vue

@@ -228,16 +228,16 @@ const updateNum = (treeNode, data) => {
     if (data && data.hasOwnProperty(node.itemcode)) {
       node.num = parseInt(data[node.itemcode]);
     }
-    if(data &&node.itemcode == 'scd.ied.Relation'){
-      node.num =parseInt(data['scd.ied.ExtRef'])
+    if (data && node.itemcode == "scd.ied.Relation") {
+      node.num = parseInt(data["scd.ied.ExtRef"]);
     }
     // 如果当前节点有子节点,递归处理子节点
     if (node.children) {
       updateNum(node.children, data);
       // 计算父级节点的num是子节点num的和
       node.num = node.children
-    .filter(child => child.itemcode !== 'scd.ied.Relation')
-    .reduce((total, child) => total + child.num, 0);
+        .filter((child) => child.itemcode !== "scd.ied.Relation")
+        .reduce((total, child) => total + child.num, 0);
     }
   }
 };
@@ -254,7 +254,7 @@ watch(
   }
 );
 watch(
-  () => props.iedRelation,
+  () => props.iedRelation, //点击SCD文件一致性校核,点击查看,点击修改进如的装置列表
   (newValue) => {
     if (newValue) {
       tagList.value = newValue;
@@ -264,8 +264,14 @@ watch(
 );
 const reload = () => {
   if (!props.OpensclTrue) {
+    //网络结构体点击CID一致性校核打开获取的装置列表
     cid.getAll({ scd_id: route.query.id, ied_name: "" }).then((res) => {
       tagList.value = res.data;
+      tagChoose.value = res.data ? Object.keys(res.data)[0] : "";
+      clickTage.value = res.data ? Object.values(res.data)[0] : "";
+      console.log('tagList.value', tagList.value)
+      codeStatic();
+      console.log("tageList.value", tagList.value);
     });
   }
 };
@@ -324,13 +330,18 @@ const handleNodeClick = (e) => {
   emit("clickCode", e.itemcode);
 };
 onMounted(() => {
-  tagChoose.value = props.iedRelation ? Object.keys(props.iedRelation)[0] : "";
-  clickTage.value = props.iedRelation
-    ? Object.values(props.iedRelation)[0]
-    : "";
+  if (!props.OpensclTrue) {
+    tagChoose.value = props.iedRelation
+      ? Object.keys(props.iedRelation)[0]
+      : "";
+    clickTage.value = props.iedRelation
+      ? Object.values(props.iedRelation)[0]
+      : "";
+    codeStatic();
+  }
   emit("treeBackDefalut", clickTage.value);
   reload();
-  codeStatic();
+
 });
 </script>
 

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

@@ -1082,7 +1082,7 @@ onMounted(() => {
           v-for="(value, key) in CommunicationS1"
           :key="key"
           class="middle-frame"
-          :class="{ 'del-middle-frame': value.add||value.del}"
+          :class="{ 'del-middle-frame': value.del,'add-middle-frame': value.add}"
         >
           <!-- 是修改的,!value.add 是修改加新增的  !value.del是修改加删除的  -->
           <div

+ 56 - 28
src/pages/netStructPicture/index.vue

@@ -32,7 +32,9 @@
       <div class="disappear" v-if="activeNav == 0">
         <!-- 左侧树形数据 -->
         <div style="width: 15%">
-          <CidTree :nowScdId="nowScdId" @treeBack="treeBack"></CidTree>
+          <CidTree 
+          @treeBack="treeBack" 
+          ></CidTree>
         </div>
         <!-- 右侧展示图 -->
         <div
@@ -158,7 +160,7 @@ import CrcCheck from "./newTitle/CrcCheck";
 import SlcCheck from "./newTitle/SlcCheck.vue";
 import { useRoute } from "vue-router";
 import cid from "@/api/cid/cid";
-import { ElMessage } from "element-plus";
+import { ElMessage, ElMessageBox, ElNotification } from "element-plus";
 import systemRow from "@/api/systemRow";
 import scdCheck from "@/api/scdCheck/scdCheck";
 import virtualRelation from "./components/virtualRelation.vue"; //虚端
@@ -215,13 +217,11 @@ const handleClick = (val) => {
   clickNavCode.value = "";
 };
 //点击树返回的信息,
-const clickAttachment = ref(null); //拿到file-type上传文件
 const treeBack = (data, val) => {
   console.log("data", val.file_type);
   backName.value = data; //返回的点击行的信息
   arrName.value = data;
   backId.value = val.id;
-  clickAttachment.value = val;
 };
 const closeX = () => {
   activeName.value = "first";
@@ -230,32 +230,60 @@ const closeX = () => {
 const nowUpload = (file, e) => {
   upFile.value = file.file;
   upName.value = file.file.name;
-  const clickAtt = clickAttachment.value ? clickAttachment.value.file_type : "";
-  cid
-    .fileUpload({
-      station_id: nowStation.value - 0,
-      file: upFile.value,
-      attachment_type: clickAtt,
-      ied_name: backName.value.ied_name,
-    })
-    .then((res) => {
-      if (res.code == 0) {
-        let idp = `${route.query.name},${res.data.fileid}`;
+  ElMessageBox.confirm(
+    "该操作耗时较长,校验开始后将清除原有校验结果且无法中止,确定开始吗?",
+    "Warning",
+    {
+      confirmButtonText: "确定",
+      cancelButtonText: "取消",
+      type: "warning",
+    }
+  ).then(async () => {
+    ElNotification({
+      title: "信息",
+      message: "正在进行CID的一致性比对...请稍候",
+      duration: 0,
+    });
+    cid
+      .fileUpload({
+        station_id: nowStation.value - 0,
+        file: upFile.value,
+        attachment_type: "cid",
+        ied_name: backName.value.ied_name,
+      })
+      .then((res) => {
+        if (res.code == 0) {
+          let idp = `${"CG1102"},${res.data.fileid}`;
+          scdCheck
+            .scdStart({
+              type: "CID",
+              station_id: route.query.stationId,
+              source_scd_id: route.query.id,
+              station_id: nowStation.value - 0,
+              ids: idp,
+            })
+            .then((res) => {
+              ElNotification.closeAll();
+              ElMessage({
+                type: "success",
+                message: "对比成功!",
+              });
+            })
+            .catch((err) => {
+              ElMessage({
+                type: "error",
+                message: err.msg,
+              });
+            });
+        }
+      })
+      .catch((err) => {
         ElMessage({
-          type: "success",
-          message: "上传成功!",
+          type: "error",
+          message: err.msg,
         });
-        scdCheck
-          .scdStart({
-            type: "CID",
-            station_id: route.query.stationId,
-            source_scd_id: route.query.id,
-            station_id: nowStation.value - 0,
-            ids: idp,
-          })
-          .then((res) => {});
-      }
-    });
+      });
+  });
 };
 
 const handleRemove = (file, e) => {};