Explorar o código

修复风电场站头部场站选项bug

baiyanting hai 1 ano
pai
achega
62b2fb73ae

+ 8 - 6
src/views/stateMonitor/factoryMonitor/components/headerButton.vue

@@ -91,7 +91,7 @@ export default {
       OrganizationList: [
         {
           label: "清洁能源",
-          value: "0",
+          value: "KGDL_FGS",
         },
       ],
       PowerStation: [],
@@ -119,12 +119,15 @@ export default {
     };
   },
   created() {
-    //获取区域公司
-    this.getOrganizationList();
     this.localWpinfo = JSON.parse(localStorage.getItem("wpInfo"))
       ? JSON.parse(localStorage.getItem("wpInfo"))
       : {};
     this.localCompanyid = localStorage.getItem("companyId");
+    //获取区域公司
+    this.$nextTick(() => {
+      this.getOrganizationList();
+    });
+
     // console.log(localWpid);
   },
   methods: {
@@ -139,6 +142,7 @@ export default {
           ? this.localCompanyid
           : this.OrganizationList[0].value;
         if (!this.localCompanyid) {
+          this.localCompanyid = this.OrganizationList[0].value;
           localStorage.setItem("companyId", this.OrganizationList[0].value);
         }
         this.getStationList();
@@ -174,9 +178,7 @@ export default {
         }
         if (index == -1) {
           this.localWpinfo = {};
-          this.localCompanyid = "";
           localStorage.removeItem("wpInfo");
-          localStorage.removeItem("companyId");
         }
         this.pageTotal = data.data.length;
         this.pageData = this.queryByPage();
@@ -279,7 +281,7 @@ export default {
         );
       }
       this.localWpinfo = { wpid: val, wpname: this.stationName };
-      localStorage.setItem("wpId", JSON.stringify(this.localWpinfo));
+      localStorage.setItem("wpInfo", JSON.stringify(this.localWpinfo));
     },
     // 实现分页的方法
     queryByPage() {