Browse Source

修改线上子系统点位接入级联报错问题

haojianlong 5 years ago
parent
commit
f412f95cc2

+ 2 - 2
package.json

@@ -26,9 +26,9 @@
         "vuex": "^3.1.0",
         "cad-engine": "2.0.250",
         "@saga-web/base": "2.1.8",
-        "@saga-web/draw": "2.1.56",
+        "@saga-web/draw": "2.1.57",
         "@saga-web/graphy": "2.1.28",
-        "@saga-web/cad-engine": "2.0.285"
+        "@saga-web/cad-engine": "2.0.292"
     },
     "devDependencies": {
         "ajv": "^6.9.1",

+ 24 - 8
src/components/config_point/dictionaryCascader.vue

@@ -71,7 +71,8 @@ export default {
         Bd: 'Building',
         Fl: 'Floor',
         VOTn: 'Tenant',
-      }
+      },
+      timer: null
     }
   },
   created() {
@@ -127,7 +128,6 @@ export default {
     },
     //请求信息点
     getDataPoint(type) {
-      let that = this;
       let param = {
         data: {
           Filters: "InputMode='M' or InputMode='L'",
@@ -144,17 +144,31 @@ export default {
             Name: item.InfoPointName
           }
         })
-        this.pushPoints(this.options, tempArr, type);
         this.pointDataSource = {}
         res.Content.map(item => {
           let code = item.InfoPointCode
           this.pointDataSource[code] = item
         })
-        this.$nextTick(() => {
-          this.changeSelect(this.form.dict)
-        })
+        this.timer = setTimeout(() => {
+          if (this.interval()) {
+            this.pushPoints(this.options, tempArr, type);
+            this.changeSelect(this.form.dict);
+            clearTimeout(this.timer);
+            this.timer = null;
+            return
+          }
+          this.timer()
+        }, 100);
       })
     },
+    interval() {
+      for (let i = 0; i < this.options.length; i++) {
+        if (this.options[i].children.length > 0) {
+          return true;
+        }
+      }
+      return false;
+    },
     //根据返回数据拼接options
     pushPoints(options, arr, Code) {
       options.map(option => {
@@ -168,8 +182,10 @@ export default {
       })
     },
     changeSelect(val) {
-      let labels = this.$refs.dictCas.getCheckedNodes()[0].pathLabels
-      this.$emit('change', { val: val, labels: labels })
+      if (this.$refs.dictCas.getCheckedNodes()[0]) {
+        let labels = this.$refs.dictCas.getCheckedNodes()[0].pathLabels
+        this.$emit('change', { val: val, labels: labels })
+      }
     },
     //减少请求次数
     hasChildren(Code) {

+ 17 - 17
src/components/config_point/step3_edit/index.vue

@@ -458,24 +458,24 @@ export default {
           this.$refs.dictionaryCas.setCascaderVal(tempArr)
         })
 
-        this.handleItemChange(dict, () => {
           this.form.DataRuleType = data.DataRuleType
-          this.unitObj = this.infoDict[data.InfomationPointCode]
-          this.InfomationPoint = this.unitObj.infoPointName || '--'
-          if (typeof this.unitObj.dataSource == 'string') {
-            if (this.unitObj.dataSource.length) {
-              this.ValueDescription = this.unitObj.dataSource
-            } else {
-              this.ValueDescription = '无信息点单位及值说明'
-            }
-          } else {
-            let str = ''
-            this.unitObj.dataSource.forEach(ele => {
-              str += ele.code + '.' + ele.name + ' '
-            })
-            this.ValueDescription = str
-          }
-        })
+        // this.handleItemChange(dict, () => {
+          // this.unitObj = this.infoDict[data.InfomationPointCode]
+          // this.InfomationPoint = this.unitObj.infoPointName || '--'
+          // if (typeof this.unitObj.dataSource == 'string') {
+          //   if (this.unitObj.dataSource.length) {
+          //     this.ValueDescription = this.unitObj.dataSource
+          //   } else {
+          //     this.ValueDescription = '无信息点单位及值说明'
+          //   }
+          // } else {
+          //   let str = ''
+          //   this.unitObj.dataSource.forEach(ele => {
+          //     str += ele.code + '.' + ele.name + ' '
+          //   })
+          //   this.ValueDescription = str
+          // }
+        // })
         if (length == 1) {
           let flag = data.DataRuleType
           var dataRules = null

+ 2 - 2
src/views/point/config_point/steps/step3.vue

@@ -162,11 +162,11 @@
                             item.Point.DataRuleType = item.RelationList[0].DataRuleType
                             item.Point.PhysicalRelated = item.RelationList[0].Type
                             //设备-部件-空间
-                            if(item.RelationList[0].EquipmentTypeCode&&item.RelationList[0].EquipmentTypeCode!='null'){
+                            if(item.RelationList[0].TypeCode == 'Eq' || item.RelationList[0].TypeCode == 'Ec' || item.RelationList[0].TypeCode == 'Sp'){
                                 item.Point.PhysicalRelated += '-' + item.RelationList[0].EquipmentType
                             }
                             //系统
-                            if(item.RelationList[0].SystemCode&&item.RelationList[0].SystemCode!='null'){
+                            if(item.RelationList[0].TypeCode == 'Sy'){
                                 item.Point.PhysicalRelated += '-' + item.RelationList[0].Specialty
                                 item.Point.PhysicalRelated += '-' + item.RelationList[0].System
                             }