Bladeren bron

修改系统集成级联框问题

haojianlong 4 jaren geleden
bovenliggende
commit
80f3ea1943
2 gewijzigde bestanden met toevoegingen van 41 en 22 verwijderingen
  1. 16 7
      src/components/config_point/step3_edit/index.vue
  2. 25 15
      src/views/point/config_point/steps/step3.vue

+ 16 - 7
src/components/config_point/step3_edit/index.vue

@@ -369,8 +369,6 @@ export default {
             // updateParams.data.Content[0].EquipmentMark = other.EquipmentMark
             break
           case '需拆分处理':
-            console.log('---------------')
-            console.log(t.other)
             let SplitPoints = t.other.devArr.length ? t.other.devArr : undefined
             let DataRuleContent4 = undefined
             var enum5 = null
@@ -392,7 +390,6 @@ export default {
               }
               ele.DataRuleContent = JSON.stringify([cutStr, enum5])
             })
-            console.log(SplitPoints)
             eachData.SplitPoints = SplitPoints;
             // otherParams = {
             // SplitPoints: SplitPoints
@@ -503,8 +500,6 @@ export default {
       let length = val.RelationList.length
       let eqMark = this.editData.Point.EquipmentMark
       this.form.EquipmentMark = eqMark;
-      console.log('-------------')
-      console.log(val)
       if (length) {
         var data = val.RelationList[0]
         let dict = [data.SpecialtyCode, data.SystemCode, data.EquipmentTypeCode]
@@ -514,19 +509,29 @@ export default {
           let eachData = [];
           if (t.TypeCode == 'Eq' || t.TypeCode == 'Ec' || t.TypeCode == 'Sp') {
             eachData = [t.TypeCode, t.EquipmentTypeCode, t.InfomationPointCode]
+            if (this.pointToRelationID[`${t.TypeCode}-${t.EquipmentTypeCode}-${t.InfomationPointCode}`]) {
+              return undefined
+            }
             this.pointToRelationID[`${t.TypeCode}-${t.EquipmentTypeCode}-${t.InfomationPointCode}`] = t.Id
           } else if (t.TypeCode == 'Sy') {
             eachData = [t.TypeCode, t.SpecialtyCode, t.SystemCode, t.InfomationPointCode]
+            if (this.pointToRelationID[`${t.TypeCode}-${t.SpecialtyCode}-${t.SystemCode}-${t.InfomationPointCode}`]) {
+              return undefined
+            }
             this.pointToRelationID[`${t.TypeCode}-${t.SpecialtyCode}-${t.SystemCode}-${t.InfomationPointCode}`] = t.Id
           } else {
             eachData = [t.TypeCode, t.InfomationPointCode]
+            if (this.pointToRelationID[`${t.TypeCode}-${t.InfomationPointCode}`]) {
+              return undefined
+            }
             this.pointToRelationID[`${t.TypeCode}-${t.InfomationPointCode}`] = t.Id
           }
           return eachData;
-        })
+        }).filter(item => item)
         this.$nextTick(() => {
           this.$refs.dictionaryCas.setCascaderVal(tempArr);
         })
+        let typeTempList = []
         this.typeList = val.RelationList.map(t => {
           if (t.TypeCode == 'Eq' || t.TypeCode == 'Ec' || t.TypeCode == 'Sp') {
             t.name = `${t.Type}-${t.EquipmentType}-${t.InfomationPoint}`
@@ -535,8 +540,12 @@ export default {
           } else {
             t.name = `${t.Type}-${t.InfomationPoint}`
           }
+          if (typeTempList.indexOf(t.name) > -1) {
+            return undefined
+          }
+          typeTempList.push(t.name)
           return t;
-        });
+        }).filter(item => item);
         this.form.DataRuleType = data.DataRuleType
         // this.handleItemChange(dict, () => {
         // this.unitObj = this.infoDict[data.InfomationPointCode]

+ 25 - 15
src/views/point/config_point/steps/step3.vue

@@ -161,23 +161,33 @@
                         if (item.RelationList.length) {
                             item.Point.DataRuleType = item.RelationList[0].DataRuleType
                             item.Point.PhysicalRelated = '';
-                            item.RelationList.forEach(t => {
-                                if (item.Point.PhysicalRelated) {
-                                    item.Point.PhysicalRelated += '/' + t.Type;
-                                } else {
-                                    item.Point.PhysicalRelated = t.Type;
-                                }
-                                //设备-部件-空间
+                            let tempArr =  item.RelationList.map(t => {
                                 if(t.TypeCode == 'Eq' || t.TypeCode == 'Ec' || t.TypeCode == 'Sp'){
-                                    item.Point.PhysicalRelated += '-' + t.EquipmentType
-                                }
-                                //系统
-                                if(t.TypeCode == 'Sy'){
-                                    item.Point.PhysicalRelated += '-' + t.Specialty
-                                    item.Point.PhysicalRelated += '-' + t.System
+                                    //设备-部件-空间
+                                    let str = `${t.Type}-${t.EquipmentType}-${t.InfomationPoint}`
+                                    if(item.Point.PhysicalRelated.indexOf(str)>-1){
+                                        return undefined
+                                    }
+                                    item.Point.PhysicalRelated += str
+                                    return str;
+                                } else if(t.TypeCode == 'Sy'){
+                                    //系统
+                                    let str = `${t.Type}-${t.Specialty}-${t.System}-${t.InfomationPoint}`
+                                    if(item.Point.PhysicalRelated.indexOf(str)>-1){
+                                        return undefined
+                                    }
+                                    item.Point.PhysicalRelated += str
+                                    return str
+                                } else {
+                                    let str = `${t.Type}-${t.InfomationPoint}`
+                                    if(item.Point.PhysicalRelated.indexOf(str)>-1){
+                                        return undefined
+                                    }
+                                    item.Point.PhysicalRelated += str
+                                    return str
                                 }
-                                item.Point.PhysicalRelated += '-' + t.InfomationPoint
-                            })
+                            }).filter(data => data)
+                            item.Point.PhysicalRelated = tempArr.join('/');
                         }
                         return item
                     })