Browse Source

Merge branch 'master' of http://94.191.59.107:3000/houwenfeng/scd_tools_ui into liling

# Conflicts:
#	src/pages/components/drawModal/LineDouble.vue
#	src/pages/netStructPicture/components/inoutControl.vue
liling 1 year ago
parent
commit
e0b647d244

+ 56 - 56
src/pages/components/drawModal/LineDouble.vue

@@ -55,7 +55,12 @@
                 </span>
             </template>
         </el-dialog>
-        <SureCancel v-if="sureModal" :showCaptionText="fcdaRelationDlgTitle" :sureModal="sureModal" :reload="reload" :checkObj="checkObj" @cancelBack="cancelBack"></SureCancel>
+        <SureCancel v-if="sureModal" :showCaptionText="fcdaRelationDlgTitle" :sureModal="sureModal" :reload="reload"
+            :checkObj="checkObj" @cancelBack="cancelBack">
+        </SureCancel>
+        <!-- <SureCancel v-if="sureModal" :sureModal="sureModal" :reload="reload" :checkObj="checkObj"
+            @cancelBack="cancelBack">
+        </SureCancel> -->
     </div>
 </template>
 
@@ -115,7 +120,7 @@ export default {
         let leftIndex = ref(-1)//左侧选择的输出下标
         let leftFcda = ref("")//左侧的fcdaid
         let together = ref("")//绑定的id
-        let oldCheckList=ref([])//存储最后一次操作后,已选中的目标装置端子列表数据。用于与checklist对比,已判断当前是取消关联还是建立关联
+        let oldCheckList = ref([])//存储最后一次操作后,已选中的目标装置端子列表数据。用于与checklist对比,已判断当前是取消关联还是建立关联
         let checkList = ref([])//当前已选中的目标装置端子列表数据
         let loading = ref(false)
         let arrNew = ref([])//新的存储fdcdids
@@ -142,21 +147,21 @@ export default {
         })
         // 初始化函数
         async function reload() {
-            checkList.value=[]
-            oldCheckList.value=[]
+            checkList.value = []
+            oldCheckList.value = []
             pastLoading.value = true
             dialogVisible.value = props.ldModal
             modelIds.value = props.modelId
             starts.value = props.startTarget
             ends.value = props.endTarget
-            if(props.startText==null || props.startText==''){
+            if (props.startText == null || props.startText == '') {
                 startTxt.value = starts.value.ied_type
-            }else{
+            } else {
                 startTxt.value = props.startText
             }
-            if(props.endText==null || props.endText==''){
+            if (props.endText == null || props.endText == '') {
                 endTxt.value = ends.value.ied_type
-            }else{
+            } else {
                 endTxt.value = props.endText
             }
             numStatus.value = props.numCase
@@ -172,7 +177,7 @@ export default {
                 //liling:避免提示空错误提示,res.data为空不代表接口有错误,所以先判断接口code值
                 pastLoading.value = false
                 if (res.code == 0) {
-                    if (res.data == null || res.data=="") {
+                    if (res.data == null || res.data == "") {
                         curList.value = [];
                         return;
                     }                    
@@ -205,24 +210,25 @@ export default {
                 //if ( res.data) {
                 //liling:避免提示空错误提示,res.data为空不代表接口有错误,所以先判断接口code值
                 if (res.code == 0) {
-                    if (res.data == null || res.data=="") {
+                    if (res.data == null || res.data == "") {
                         outList.value = [];
                         return;
-                    }                    
-                    //对结果进行重排排序:将已关联到输出装置的端子排在前面
-                    let tmpList = [];
-                    res.data.forEach((item, index) => {
-                        if (item.from_ied_type == starts.value.ied_type) {
-                            tmpList.unshift(item)
-                        } else {
-                            //未关联的端子按原结果顺序排列
-                            tmpList.push(item)
-                        }
-                    })                    
-                    outList.value = tmpList;
-                    setIndex()
-                    // 将 setTimeout 移动到 then 方法中
-                    setTimeout(() => {
+                    }
+                }
+                //对结果进行重排排序:将已关联到输出装置的端子排在前面
+                let tmpList = [];
+                res.data.forEach((item, index) => {
+                    if (item.from_ied_type == starts.value.ied_type) {
+                        tmpList.unshift(item)
+                    } else {
+                        //未关联的端子按原结果顺序排列
+                        tmpList.push(item)
+                    }
+                })                 
+                outList.value = tmpList;
+                setIndex()
+                // 将 setTimeout 移动到 then 方法中
+                setTimeout(() => {
                         res.data.forEach((item, index) => {
                             if(item.from_fcda_id=='' || item.from_fcda_id=='0'){
                                 return
@@ -254,14 +260,8 @@ export default {
                                 }
                             })
                         });
-                    }, 100);
-                } else {
-                    ElMessage({
-                        message: res.msg,
-                        type: "error"
-                    });
-                }
-            });
+                }, 100);                
+            })
             curList.value.sort((obj1, obj2) => {
                 if (outList.value[0] == null) return 1;
                 const nameB = outList.value[0].fcda_name;
@@ -311,7 +311,7 @@ export default {
                 leftFcda.value = row.id
                 fcdaIds.value = row.to_fcda_id
                 leftIndex.value = num
-            } else {      
+            } else {
                 if (curList.value.length > 0) {
                     curList.value.map(item => {
                         if (item.to_fcda_id != '0' && item.to_fcda_id != '') {
@@ -342,11 +342,11 @@ export default {
             let hintTxt = '不允许的操作'
             if(addItem.length>0){
                 //判断是否选择源端子以及是否未关联任何其他端子,否则不允许关联                
-                if(leftFcda.value==''){
+                if (leftFcda.value == '') {
                     hintTxt = "请选择关联的源(左侧)端子!"
-                    no=true                    
+                    no = true
                 }
-                if(fcdaIds.value!='' && fcdaIds.value!='0'){
+                if (fcdaIds.value != '' && fcdaIds.value != '0') {
                     //源端子已有关联
                     hintTxt = "选择源(左侧)端子已有关联,请先取消关联或选择其它端子!"
                     no=true
@@ -373,15 +373,15 @@ export default {
             }else{
                 return
             }
-            if(no){
-                    ElMessage({
-                        type: "info",
-                        message: hintTxt
-                    })
-                    //恢复未选状态
-                    let ind = checkList.value.indexOf(addItem[0])
-                    checkList.value.splice(ind,1)
-                    return
+            if (no) {
+                ElMessage({
+                    type: "info",
+                    message: hintTxt
+                })
+                //恢复未选状态
+                let ind = checkList.value.indexOf(addItem[0])
+                checkList.value.splice(ind, 1)
+                return
             }
             //用户操作确认框
             sureModal.value = true
@@ -410,20 +410,20 @@ export default {
             }
         };
         //取消端子关联确认框返回事件处理
-        function cancelBack(data){
+        function cancelBack(data) {
             // 本事件处理选择框
             sureModal.value = false
             const subItem = oldCheckList.value.filter(item => !checkList.value.includes(item)); //是否取消选择,取差集
             const addItem = checkList.value.filter(item => !oldCheckList.value.includes(item)); //是否新选择的,取差集
-            if(!data.ok){
-                if(subItem.length>0){
+            if (!data.ok) {
+                if (subItem.length > 0) {
                     //恢复选中状态
                     checkList.value.push(subItem[0])
                 }
-                if(addItem.length>0){
+                if (addItem.length > 0) {
                     //恢复未选状态
                     let ind = checkList.value.indexOf(addItem[0])
-                    checkList.value.splice(ind,1)
+                    checkList.value.splice(ind, 1)
                 }
                 return
             }
@@ -440,7 +440,7 @@ export default {
                             type: "success",
                             message: "操作成功!"
                         })
-                        reload()                        
+                        reload()
                         removeLine3()
                         emit("lineBack", dialogVisible.value)
                     } else {
@@ -449,7 +449,7 @@ export default {
                             message: res.msg
                         })
                     }
-                }).catch(res=>{
+                }).catch(res => {
                     ElMessage({
                         type: "error",
                         message: '服务器发生异常'
@@ -480,7 +480,7 @@ export default {
                             message: res.msg
                         })
                     }
-                }).catch(res=>{
+                }).catch(res => {
                     ElMessage({
                         type: "error",
                         message: '服务器发生异常'
@@ -492,7 +492,7 @@ export default {
             await reload()
         })
         onBeforeUnmount(() => {
-            for(let key in leaderLineList.value){
+            for (let key in leaderLineList.value) {
                 leaderLineList.value[key].remove();
             }
             //leaderLineList.value.forEach(line => line.remove());//离开当前组件时清除连线
@@ -538,7 +538,7 @@ export default {
             fcdaRelationDlgTitle,
         }
     },
-    components:{
+    components: {
         SureCancel,//确认取消关系组件
     }
 }

+ 5 - 1
src/pages/components/drawModal/SureCancel.vue

@@ -76,4 +76,8 @@ export default {
 }
 </script>
 
-<style lang="scss" scoped></style>
+<style  scoped>
+.box{
+    white-space: normal;
+}
+</style>

+ 24 - 19
src/pages/netStructPicture/components/inoutControl.vue

@@ -48,7 +48,10 @@
             class="midlestyle"
             v-for="(item, index) in svInfo"
             :key="index"
-            :class="{ 'smv-color': item.attr_name == 'smvcb0','smv-color':item.isred }"
+            :class="{
+              'smv-color': item.attr_name == 'smvcb0',
+              'smv-color': item.isred,
+            }"
             :ref="(el) => setdomMiddle2(el, item)"
           >
             <div>{{ `${item.ldinst}/${item.attr_name}` }}</div>
@@ -174,7 +177,7 @@ const getIedChild = async () => {
     ied_name: props.checkData.ied_name,
     forcerefresh: 0,
   });
-  if(!listData2.value.list||!childRes.data) return;
+  if (!listData2.value.list || !childRes.data) return;
   if (childRes.data) {
     //左右侧内部侧数据组装
     listData2.value.list.forEach((item, index) => {
@@ -199,7 +202,7 @@ const getIedChild = async () => {
             ) {
               // 将key对象中的属性进行浅拷贝,避免直接引用和循环引用而避免报错
               const newKey = Object.assign({}, key);
-              itemKey.childItem= [];
+              itemKey.childItem = [];
               itemKey.childItem.push(newKey);
             }
           });
@@ -218,9 +221,9 @@ const getNetworkInfo = async () => {
   });
   const svResInfoCtrl = await iedSVSendCtrlblock({
     scd_id: scdIdValue,
-    ied_name: listData2.value.ied_name
+    ied_name: listData2.value.ied_name,
   });
-  if(!svResInfoCtrl.data ||!svResInfo.data) return;
+  if (!svResInfoCtrl.data || !svResInfo.data) return;
   if (svResInfoCtrl.data && svResInfoCtrl.data.GSEControl) {
     //处理数据得到APPID
     svResInfo.data.forEach((item) => {
@@ -230,19 +233,21 @@ const getNetworkInfo = async () => {
         }
       });
     });
-    if(svResInfoCtrl.data.SampledValueControl){
-      svResInfoCtrl.data.SampledValueControl.forEach(item=>item.isred = true)
+    if (svResInfoCtrl.data.SampledValueControl) {
+      svResInfoCtrl.data.SampledValueControl.forEach(
+        (item) => (item.isred = true)
+      );
       svInfo.value = [
-      ...svResInfoCtrl.data.SampledValueControl,
-      ...svResInfoCtrl.data.GSEControl,
-    ];
-    }else{
-      svInfo.value = svResInfoCtrl.data.GSEControl
+        ...svResInfoCtrl.data.SampledValueControl,
+        ...svResInfoCtrl.data.GSEControl,
+      ];
+    } else {
+      svInfo.value = svResInfoCtrl.data.GSEControl;
     }
-    if(!middleElement.value) return;
+    if (!middleElement.value) return;
     if (svInfo.value && svInfo.value.length > 3) {
       middleElement.value.style.marginTop = "20px";
-    } else{
+    } else {
       middleElement.value.style.marginTop = "150px"; // 设置元素的垂直位置
     }
   }
@@ -300,7 +305,7 @@ const processArray = (arr) => {
   const uniqueObjects = new Map();
   if (!arr) return;
   // 遍历数组
-  if(!arr) return;
+  if (!arr) return;
   for (const obj of arr) {
     const { ref_ied_id } = obj;
     // 如果当前对象的 ref_ied_id 属性已经存在于 uniqueObjects 中
@@ -317,8 +322,8 @@ const processArray = (arr) => {
 };
 //点击图片的时候筛选出数据
 const clickImg = async (dataItem) => {
-  loading.value =true;
-  listData2.value =await clickImgEvent(props,dataItem,scdIdValue);
+  loading.value = true;
+  listData2.value = await clickImgEvent(props, dataItem, scdIdValue);
 };
 
 //点击后重置数据和线条
@@ -335,7 +340,7 @@ const clickResetLine2 = () => {
 // 将设备列表分成两份
 const bothSide = (data) => {
   const formatArr = processArray(data);
-  if(!formatArr) return;
+  if (!formatArr) return;
   const arrlenght = formatArr.length;
   const long1 = Math.ceil(arrlenght / 2);
   leftList.value = formatArr.splice(0, long1);
@@ -732,7 +737,7 @@ watch(
   () => props.checkData,
   (newValue) => {
     if (newValue) {
-      loading.value =true;
+      loading.value = true;
       // if (leaderLines2.value.length > 0) {
       leaderLines2.value = [];
       // }

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

@@ -120,6 +120,7 @@ const processArray = (arr) => {
 const clickImg = async (dataItem) => {
   loading.value =true;
   listData.value =await clickImgEvent(props,dataItem,scdIdValue);
+  if(!listData.value||!listData.value.length) return  loading.value = false;
 };
 watch(
   () => props.checkData,