ソースを参照

fix: 修复左侧树节点切换时的数据加载问题

- 移除Tab切换时不必要的表格重载和图表加载,避免请求报错
- 修复handleNodeClick中引用未定义tab变量的问题,改为使用this.activeTab
- 设置collectionList表格initLoad为false,配合节点选择手动加载
yusheng 5 ヶ月 前
親
コミット
b58d547857

+ 2 - 2
src/views/centralizedMeterReading/collectionList.vue

@@ -145,6 +145,7 @@
                 :cache-key="cacheKeyUrl"
                 autoAmendPage
                 height="calc(100vh - 300px)"
+                :initLoad="false"
                 show-summary
                 :summary-method="getSummaries"
               >
@@ -375,7 +376,6 @@
         this.categoryLevelId = '';
         this.areaId = '';
         this.substanceId = '';
-        this.$refs.table.reload({ page: 1 });
       },
       // 处理第一个节点(由 LeftSidebar 组件加载完成后触发)
       handleFirstNode(data) {
@@ -422,7 +422,7 @@
         this.categoryLevelId = '';
         this.substanceId = '';
         this.areaId = '';
-        if (tab === 'org') {
+        if (this.activeTab === 'org') {
           if (data.nodeType === 'instance') {
             this.substanceId = data.id;
           } else {

+ 2 - 2
src/views/centralizedMeterReading/list.vue

@@ -394,7 +394,7 @@
         this.categoryLevelId = '';
         this.areaId = '';
         this.substanceId = '';
-        this.$refs.table.reload({ page: 1 });
+        // this.$refs.table.reload({ page: 1 });
       },
 
       // 处理第一个节点(由 LeftSidebar 组件加载完成后触发)
@@ -414,7 +414,7 @@
         this.categoryLevelId = '';
         this.substanceId = '';
         this.areaId = '';
-        if (tab === 'org') {
+        if (this.activeTab === 'org') {
           if (data.nodeType === 'instance') {
             this.substanceId = data.id;
           } else {

+ 0 - 1
src/views/energyConsumptionStatistics/index.vue

@@ -282,7 +282,6 @@
         this.areaId = '';
         this.substanceId = '';
         // Tab切换时重置条件,由用户手动选择节点或使用默认
-        this.$refs.table.reload({ page: 1 });
       },
 
       // 处理第一个节点(由 LeftSidebar 组件加载完成后触发)

+ 2 - 4
src/views/energySavingTrend/index.vue

@@ -405,7 +405,6 @@
         this.categoryLevelId = '';
         this.areaId = '';
         this.substanceId = '';
-        this.loadChartData();
       },
       // 处理第一个节点(由 LeftSidebar 组件加载完成后触发)
       handleFirstNode(data) {
@@ -489,7 +488,7 @@
         });
       },
 
-            // 树节点点击
+      // 树节点点击
       handleNodeClick(data) {
         this.categoryLevelId = '';
         this.substanceId = '';
@@ -504,8 +503,7 @@
           this.areaId = data.id;
         }
         this.loadChartData();
-      },
-
+      }
     }
   };
 </script>