shaun-sheep 5 jaren geleden
bovenliggende
commit
cf4837cf9c
1 gewijzigde bestanden met toevoegingen van 54 en 46 verwijderingen
  1. 54 46
      src/views/relation/data/index.vue

+ 54 - 46
src/views/relation/data/index.vue

@@ -81,57 +81,63 @@
     computed: {
       ...mapGetters('layout', ['projectId']),
     },
-    watch: {},
-    created() {
-      //  统计数量
-      let count = {
-        projectId: this.projectId
+    watch: {
+      projectId() {
+        this.init();
       }
-      dictCount(count, res => {
-        this.allCount = res.Count
-      })
-      //需要转换数量
-      dictSwitchCount(count, res => {
-        this.replenishCount = res.Count
-        if (res.Count === 0) {
-          this.isDisabled = true
-          return
-        }
-        let _this = this
-        if (localStorage.getItem('CountNumber')) {
-          // if (localStorage.getItem('CountNumber') == res.Count) {
-          //   _this.isDisabled = true
-          // } else {
-          //   _this.isDisabled = false
-          // }
-          _this.isDisabled = localStorage.getItem('CountNumber') == res.Count ? true : false
-        } else { //不存在
-          localStorage.setItem('CountNumber', res.Count)
-
+    },
+    created() {
+      this.init()
+    },
+    methods: {
+      init() {
+        //  统计数量
+        let count = {
+          projectId: this.projectId
         }
+        dictCount(count, res => {
+          this.allCount = res.Count
+        })
+        //需要转换数量
+        dictSwitchCount(count, res => {
+          this.replenishCount = res.Count
+          if (res.Count === 0) {
+            this.isDisabled = true
+            return
+          }
+          let _this = this
+          if (localStorage.getItem('CountNumber')) {
+            // if (localStorage.getItem('CountNumber') == res.Count) {
+            //   _this.isDisabled = true
+            // } else {
+            //   _this.isDisabled = false
+            // }
+            _this.isDisabled = localStorage.getItem('CountNumber') == res.Count ? true : false
+          } else { //不存在
+            localStorage.setItem('CountNumber', res.Count)
 
+          }
 
-      })
-      //数据中心-物理世界数据转换
-      dictDataCenter(count, res => {
-        this.dataCenter = res.Content
-      })
-      // 物理世界-数据中心数据转换
-      dictDataPlatFrom(count, res => {
-        this.dataPlatForm = res.Content
-      })
-      //条件查询数量
-      let filterCount = {
-        projectId: this.projectId,
-        "Filters": "type!=1;dcCategory isnull"
-      }
-      dictCount(filterCount, res => {
-        this.filterCount = res.Count
-      })
 
+        })
+        //数据中心-物理世界数据转换
+        dictDataCenter(count, res => {
+          this.dataCenter = res.Content
+        })
+        // 物理世界-数据中心数据转换
+        dictDataPlatFrom(count, res => {
+          this.dataPlatForm = res.Content
+        })
+        //条件查询数量
+        let filterCount = {
+          projectId: this.projectId,
+          "Filters": "type!=1;dcCategory isnull"
+        }
+        dictCount(filterCount, res => {
+          this.filterCount = res.Count
+        })
 
-    },
-    methods: {
+      },
       dataTable() {
         this.$router.push({
           path: "datatable",
@@ -141,6 +147,7 @@
           // }
         })
       },
+
       margeData(arr) {
         if (arr.length) {
           let arrList = arr.map(item => {
@@ -166,7 +173,8 @@
         createEquip(param, res => {
         })
       }
-    }
+    },
+
   }
 </script>