Преглед изворни кода

1. fix bug : 设备设施Cannot read property '0' of undefined
2. 取消 查询楼层图失败时的提示: 图不存在

yunxing пре 4 година
родитељ
комит
ebc643a1c5
1 измењених фајлова са 10 додато и 4 уклоњено
  1. 10 4
      src/components/floorMap/index.vue

+ 10 - 4
src/components/floorMap/index.vue

@@ -126,19 +126,25 @@ export default {
             this.readGroup(this.floorid).then(data => {
                 this.loading = false
                 if (data.Result == 'failure') {
-                    this.$message({
+                    // 取消 失败时的提示: 图不存在
+                    /* this.$message({
                         message: data.Message,
                         type: 'warning'
-                    })
+                    }) */
                     this.$store.commit('SETISMESSAGE', false)
                     //    一会回来存这个
                 } else {
                     this.$store.commit('SETISMESSAGE', true)
                 }
-                if (data.Data.length > 0) {
+                // FIXME:   Cannot read property '0' of undefined
+                // 无返回Data处理
+                if (!(data.Data && data.Data.length) ) {
+                    return false
                     //console.log(data.data.Data[0].ID)
-                    this.$cookie.set('graphId', data.Data[0].ID, 3)
+                    // this.$cookie.set('graphId', data.Data[0].ID, 3)
                 }
+                // 放到后边 $cookie graphId
+                this.$cookie.set('graphId', data.Data[0].ID, 3)
                 this.topologyParser = new STopologyParser(null)
                 this.topologyParser.parseData(data.Data[0].Elements)
                 // 多边形