Ver código fonte

右侧资金投入、资源环境项目、历年频发问题固定显示全区数据,不跟随镇切换

DESKTOP-6LTVLN7\Liumouren 2 anos atrás
pai
commit
98cddfbbef

+ 58 - 54
src/components/layout/MenuCard.vue

@@ -408,6 +408,7 @@ export default {
    * type: 类型【card:卡片;chart:echart组件;imageMenu:图片菜单;legend:图例】(必填)
    * title: 标题(必填)
    *
+   * ifChange: 是否跟随街镇刷新数据(非必填)
    * getUrl: DMS数据请求路径
    * columnId:DMS数据请求columnId
    * pageSize:DMS数据请求个数
@@ -626,65 +627,68 @@ export default {
     // 切换街镇时
     changeHomeSpecialTown() {
       try {
-        this.dataInitLoading = true;
-        // 如果静态文件中的数据存在,直接返回
-        if (
-          this.resData[this.$store.state.homeSpecialTown] &&
-          this.menuCardData.topSolt &&
-          this.menuCardData.topSolt.commonData
-        ) {
-          // 普通街道
-          if (this.resData[this.$store.state.homeSpecialTown].categoryData) {
-            this.menuCardData.topSolt.commonData[0].categoryData = this.resData[this.$store.state.homeSpecialTown].categoryData;
-            this.menuCardData.topSolt.commonData[0].valueData = this.resData[this.$store.state.homeSpecialTown].valueData;
-            this.menuCardData.topSolt.commonData[0].value =
-              this.resData[this.$store.state.homeSpecialTown].valueData[
-                this.resData[this.$store.state.homeSpecialTown].valueData.length - 1
-              ];
-          } else {
-            // 全部
-            let _index = 0;
-            for (let keys in this.resData[this.$store.state.homeSpecialTown]) {
-              let _commonData = {
-                title: keys,
-                unit: this.menuCardData.topSolt.commonData[_index].unit,
-                categoryData: this.resData[this.$store.state.homeSpecialTown][keys].categoryData,
-                valueData: this.resData[this.$store.state.homeSpecialTown][keys].valueData,
-                value:
-                  this.resData[this.$store.state.homeSpecialTown][keys].valueData[
-                    this.resData[this.$store.state.homeSpecialTown][keys].valueData.length - 1
-                  ]
-              };
-              if (this.menuCardData.topSolt.commonData[_index].type) {
-                _commonData.type = this.menuCardData.topSolt.commonData[_index].type;
+        if (this.menuData.ifChange === undefined || this.menuData.ifChange !== false || this.$store.state.homeSpecialTown === "全部") {
+          this.dataInitLoading = true;
+          // 如果静态文件中的数据存在,直接返回
+          if (
+            this.resData[this.$store.state.homeSpecialTown] &&
+            this.menuCardData.topSolt &&
+            this.menuCardData.topSolt.commonData
+          ) {
+            // 普通街道
+            if (this.resData[this.$store.state.homeSpecialTown].categoryData) {
+              this.menuCardData.topSolt.commonData[0].categoryData =
+                this.resData[this.$store.state.homeSpecialTown].categoryData;
+              this.menuCardData.topSolt.commonData[0].valueData = this.resData[this.$store.state.homeSpecialTown].valueData;
+              this.menuCardData.topSolt.commonData[0].value =
+                this.resData[this.$store.state.homeSpecialTown].valueData[
+                  this.resData[this.$store.state.homeSpecialTown].valueData.length - 1
+                ];
+            } else {
+              // 全部
+              let _index = 0;
+              for (let keys in this.resData[this.$store.state.homeSpecialTown]) {
+                let _commonData = {
+                  title: keys,
+                  unit: this.menuCardData.topSolt.commonData[_index].unit,
+                  categoryData: this.resData[this.$store.state.homeSpecialTown][keys].categoryData,
+                  valueData: this.resData[this.$store.state.homeSpecialTown][keys].valueData,
+                  value:
+                    this.resData[this.$store.state.homeSpecialTown][keys].valueData[
+                      this.resData[this.$store.state.homeSpecialTown][keys].valueData.length - 1
+                    ]
+                };
+                if (this.menuCardData.topSolt.commonData[_index].type) {
+                  _commonData.type = this.menuCardData.topSolt.commonData[_index].type;
+                }
+                this.menuCardData.topSolt.commonData[_index] = _commonData;
+                _index++;
               }
-              this.menuCardData.topSolt.commonData[_index] = _commonData;
-              _index++;
-            }
 
-            if (this.menuCardData.title === "土地资源") {
-              console.log("切换街道:end", this.menuCardData.topSolt.commonData);
+              if (this.menuCardData.title === "土地资源") {
+                console.log("切换街道:end", this.menuCardData.topSolt.commonData);
+              }
             }
+          } else if (this.menuCardData && this.menuCardData.commonName && this.menuCardData.commonName === "TOP") {
+            this.topData(this.$store.state.homeSpecialTown);
+          } else if (this.menuCardData && this.menuCardData.commonName && this.menuCardData.commonName === "SUM") {
+            this.sumData(this.$store.state.homeSpecialTown);
+          } else if (this.menuCardData && this.menuCardData.commonName && this.menuCardData.commonName === "ALLLIST") {
+            this.allListData(this.$store.state.homeSpecialTown);
+          } else if (this.menuCardData && this.menuCardData.topSolt && this.menuCardData.topSolt.commonData) {
+            let _menuCardData = Object.assign({}, this.menuCardData);
+            _menuCardData.topSolt.commonData.forEach((item, index) => {
+              _menuCardData.topSolt.commonData[index].categoryData = [];
+              _menuCardData.topSolt.commonData[index].valueData = [];
+              _menuCardData.topSolt.commonData[index].valueData = undefined;
+              _menuCardData.topSolt.commonData[index].value = undefined;
+            });
+            this.menuCardData = _menuCardData;
           }
-        } else if (this.menuCardData && this.menuCardData.commonName && this.menuCardData.commonName === "TOP") {
-          this.topData(this.$store.state.homeSpecialTown);
-        } else if (this.menuCardData && this.menuCardData.commonName && this.menuCardData.commonName === "SUM") {
-          this.sumData(this.$store.state.homeSpecialTown);
-        } else if (this.menuCardData && this.menuCardData.commonName && this.menuCardData.commonName === "ALLLIST") {
-          this.allListData(this.$store.state.homeSpecialTown);
-        } else if (this.menuCardData && this.menuCardData.topSolt && this.menuCardData.topSolt.commonData) {
-          let _menuCardData = Object.assign({}, this.menuCardData);
-          _menuCardData.topSolt.commonData.forEach((item, index) => {
-            _menuCardData.topSolt.commonData[index].categoryData = [];
-            _menuCardData.topSolt.commonData[index].valueData = [];
-            _menuCardData.topSolt.commonData[index].valueData = undefined;
-            _menuCardData.topSolt.commonData[index].value = undefined;
-          });
-          this.menuCardData = _menuCardData;
+          setTimeout(() => {
+            this.dataInitLoading = false;
+          }, 500);
         }
-        setTimeout(() => {
-          this.dataInitLoading = false;
-        }, 500);
       } catch (e) {
         console.log("MenuCard组件changeHomeSpecialTown出现异常", e);
 

+ 1 - 0
src/components/map/Legend.vue

@@ -4,6 +4,7 @@
       :menuData="{
         type: 'legend',
         title: '图例',
+        ifChange: false,
         boxWidth: legendData.boxWidth,
         boxHeight: legendData.boxHeight,
         menuIndex: legendData.menuIndex,

+ 5 - 1
src/config/common.js

@@ -992,6 +992,7 @@ export const menuOnLine = {
   ],
   main: [
     {
+      ifChange: false,
       type: "chart",
       title: "浦东新区自然资源分布",
       boxWidth: "360",
@@ -1005,6 +1006,7 @@ export const menuOnLine = {
   right: [
     [
       {
+        ifChange: false,
         type: "card",
         title: "资金投入情况",
         titleWidth: 64,
@@ -1033,6 +1035,7 @@ export const menuOnLine = {
         },
       },
       {
+        ifChange: false,
         type: "card",
         title: "资源环境项目",
         titleWidth: 64,
@@ -1083,6 +1086,7 @@ export const menuOnLine = {
         },
       },
       {
+        ifChange: false,
         type: "card",
         title: "历年频发问题TOP10",
         titleWidth: 81,
@@ -1402,7 +1406,7 @@ export const menuOnLine = {
         position: "right",
         minDomWidth: 1200,
         commonName: "TOP",
-        setBarWidth:35,
+        setBarWidth: 35,
         // getUrl: "/dms/content/selectGroupByCountOrderBy",
         // columnId: 1133,
         // pageSize: 10,