maxiaoxiao 7 mesiacov pred
rodič
commit
0b47cc4943

+ 23 - 15
src/views/LandConsolidation/components/fxjg.vue

@@ -104,7 +104,7 @@ export default {
       console.log("----", this.$props.scjgObj);
       this.echarts = [];
       this.$emit("updateParent", "loading", true);
-      this.addPolygon(this.$props.scjgObj.geom, "all", "#ff0000","#ffffff");
+      this.addPolygon(this.$props.scjgObj.geom, "all", "#ff0000", "#ffffff");
       getyjjg(this.$props.scjgObj.bsm).then((res) => {
         if (res.code == 200) {
           let jdData = {
@@ -117,12 +117,27 @@ export default {
             region: "",
             result: [[], [], []],
           };
-          res.data["3D"].map((ci) => {
+          res.data["3D"].map((ci, i) => {
             jdData.x_data.push(ci.key);
             jdData.result[0].push(ci.zzq_area);
             jdData.result[1].push(ci.zzh_area);
             jdData.result[2].push(ci.ce_area);
             // zzh_geom
+            ci.name = ci.key;
+            ci.geoms = [
+              {
+                id: `zzq_${i}`,
+                geomvalue: ci.zzq_geom || "",
+                sc: colors[i],
+                fc: "#186bb8",
+              },
+              {
+                id: `zzh_${i}`,
+                geomvalue: ci.zzh_geom || "",
+                sc: colors[i],
+                fc: "#4ee1ac",
+              },
+            ];
           });
           res.data.XZGD.map((ci, i) => {
             ci.id = "XZGD" + i;
@@ -157,7 +172,7 @@ export default {
       if (dataSourceList[id]) {
         dataSourceList[id].show = this.isshowAll;
       } else {
-        this.addPolygon(this.$props.scjgObj.geom, "all", "#ff0000","#ffffff");
+        this.addPolygon(this.$props.scjgObj.geom, "all", "#ff0000", "#ffffff");
       }
     },
     eyesChaneg(i) {
@@ -169,16 +184,9 @@ export default {
       if (this.echarts[i].dataList)
         this.echarts[i].dataList.forEach((child, ci) => {
           if (this.echarts[i].scxstyle == 2) {
-            this.changeDataSources(
-              { id: `zzq_${ci}`, iseyes, geomvalue: child.zzq_geom },
-              colors[ci],
-              "#186bb8"
-            );
-            this.changeDataSources(
-              { id: `zzh_${ci}`, iseyes, geomvalue: child.zzh_geom },
-              colors[ci],
-              "#4ee1ac"
-            );
+            let gi = child.geoms;
+            this.changeDataSources({ ...gi[0], iseyes }, colors[ci], gi[0].fc);
+            this.changeDataSources({ ...gi[1], iseyes }, colors[ci], gi[1].fc);
           } else this.changeDataSources({ ...child, iseyes }, colors[ci]);
         });
       // this.lForEach(this.echarts[i].lchildren, "sources", iseyes);
@@ -214,7 +222,7 @@ export default {
       });
     },
     changeDataSources({ geomvalue, id, iseyes, iszoom }, color, fcolor) {
-      console.log(geomvalue, id, iseyes, iszoom, color);
+      console.log(id, iseyes, iszoom, color, fcolor);
       if (iszoom) {
         this.zoomTo(id, geomvalue);
       } else if (dataSourceList[id]) {
@@ -233,7 +241,7 @@ export default {
     },
     setEchart(data, id, childid) {
       this.$nextTick(() => {
-        console.log(id, this.$refs[`contentRef${id}`], "---");
+        // console.log(id, this.$refs[`contentRef${id}`], "---");
         let type = null;
         if (!data.legend_data)
           type = data.length <= 6 ? "horizontal" : "vertical";

+ 7 - 0
src/views/cockpit/common/ThreeStackedBarAndLine.vue

@@ -183,6 +183,13 @@ export default {
     }   
 });
             this.chart.setOption(option);
+    //         this.chart.on("legendselectchanged", function (params) {
+    //     let iseyes = params.selected[params.name];
+    //     _this.$emit("echartClick", params.name, { iseyes });
+    //   });
+      this.chart.on("click", function (params) {
+        _this.$emit("echartClick", params.name, { color: params.color,sIndex:params.seriesIndex });
+      });
 
         },
         setOptions(obj) {

+ 12 - 4
src/views/complianceAnalysis/components/scjgContent.vue

@@ -31,6 +31,7 @@
       v-else-if="litem.scxstyle == 2"
       class="echart"
       ref="echartRef"
+      @echartClick="echartClick"
     ></barAndLine>
     <div v-else-if="litem.scxstyle == 3" class="xzgdcontent">
       <div class="item">
@@ -76,12 +77,19 @@ export default {
         else this.$refs.echartRef.setOptions(data);
       });
     },
-    echartClick(name, { iseyes }) {
+    echartClick(name, { iseyes, sIndex }) {
       console.log("name: ", name);
       let iszoom = iseyes == undefined; //红色高亮,不受眼睛控制
       if (this.piseyes || iszoom) {
         let click = this.litem.dataList.filter((c) => c.name == name);
-        if (click.length > 0) this.mapview({ ...click[0], iseyes, iszoom });
+        if (click.length > 0) {
+          if (click[0].geoms && sIndex != undefined) {
+            let gi = click[0].geoms[sIndex];
+            this.mapview({ ...gi, iseyes, iszoom }, undefined, gi.fc);
+          } else {
+            this.mapview({ ...click[0], iseyes, iszoom });
+          }
+        }
       }
     },
     mapviewClick(ldata) {
@@ -89,8 +97,8 @@ export default {
       // this.$set(ldata, "iseyes", !ldata.iseyes);
       this.mapview({ ...ldata, iszoom: true });
     },
-    mapview(data) {
-      this.$emit("mapview", data);
+    mapview(data, color, fcolor) {
+      this.$emit("mapview", data, color, fcolor);
     },
   },
 };