Ver código fonte

Merge branch 'master' of http://114.244.114.158:8802/siwei/real3d-portalsite

lkk 7 meses atrás
pai
commit
022e192c89

+ 17 - 0
src/utils/MapHelper/help.js

@@ -59,6 +59,23 @@ export function loadGeoJSON(geom, yanse, adata, fun) {
         offset: new Cesium.HeadingPitchRange(0, -45),
       });
     fun(data)
+    if (!geojson.type.includes("Polygon")) {
+      data.entities.values.forEach((entity, ei) => {
+        if (entity.billboard) {
+          entity.billboard = new Cesium.BillboardGraphics({
+            image: "@/.././static/images/flypng/hos_point.png",
+            height: 40,
+            width: 40,
+            scale: 1.0,
+            pixelOffset: new Cesium.Cartesian2(0, -16),
+          });
+          // entity.point = {
+          //   pixelsize: 20,
+          //   color: Cesium.Color.fromCssColorString(colors),
+          // };
+        }
+      });
+    }
 
   });
   // let polygon = Cesium.GeoJsonDataSource.load(geojson, {

+ 78 - 52
src/views/LandConsolidation/components/fxjg.vue

@@ -14,7 +14,7 @@
       </div>
       <div>
         预检分析面积:
-        <span class="text">{{ compute(scjgObj.fxmj) }}亩</span>
+        <span class="text">{{ compute(scjgObj.xzmj) }}亩</span>
         <span class="export" @click="download">导出报告</span>
       </div>
     </div>
@@ -55,6 +55,7 @@ import scjgContent from "../../complianceAnalysis/components/scjgContent.vue";
 import { getyjjg } from "@/api/stxf/tdzz.js";
 import { jslist } from "./config.js";
 import parse from "wellknown";
+import { loadGeoJSON } from "@/utils/MapHelper/help.js";
 let dataSourceList = {};
 let colors = [
   "#62ADED",
@@ -103,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", true);
+      this.addPolygon(this.$props.scjgObj.geom, "all", "#ff0000", "#ffffff");
       getyjjg(this.$props.scjgObj.bsm).then((res) => {
         if (res.code == 200) {
           let jdData = {
@@ -116,14 +117,29 @@ 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) => {
+          res.data.XZGD.map((ci, i) => {
             ci.id = "XZGD" + i;
           });
           res.data.SQSX.map((ci, i) => {
@@ -131,7 +147,7 @@ export default {
             ci.value = ci.sumvalue;
             ci.id = "SQSX" + i;
           });
-          res.data.GHDK.map((ci) => {
+          res.data.GHDK.map((ci, i) => {
             ci.name = ci.groupvalue;
             ci.value = ci.sumvalue;
             ci.id = "GHDK" + i;
@@ -156,7 +172,7 @@ export default {
       if (dataSourceList[id]) {
         dataSourceList[id].show = this.isshowAll;
       } else {
-        this.addPolygon(this.$props.scjgObj.geom, "all", "#ff0000", true);
+        this.addPolygon(this.$props.scjgObj.geom, "all", "#ff0000", "#ffffff");
       }
     },
     eyesChaneg(i) {
@@ -167,8 +183,11 @@ export default {
       let iseyes = this.echarts[i].iseyes;
       if (this.echarts[i].dataList)
         this.echarts[i].dataList.forEach((child, ci) => {
-          console.log(child, "child");
-          this.changeDataSources({ ...child, iseyes }, colors[ci]);
+          if (this.echarts[i].scxstyle == 2) {
+            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);
       // }
@@ -202,15 +221,15 @@ export default {
         }
       });
     },
-    changeDataSources({ geomvalue, id, iseyes, iszoom }, color) {
-      console.log(geomvalue, id, iseyes, iszoom, color);
+    changeDataSources({ geomvalue, id, iseyes, iszoom }, color, fcolor) {
+      console.log(id, iseyes, iszoom, color, fcolor);
       if (iszoom) {
         this.zoomTo(id, geomvalue);
       } else if (dataSourceList[id]) {
         dataSourceList[id].show = iseyes;
         this.tempdataSourcesId = null;
       } else if (geomvalue) {
-        this.addPolygon(geomvalue, id, color);
+        this.addPolygon(geomvalue, id, color, fcolor);
       }
     },
     zoomTo(id, geom) {
@@ -222,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";
@@ -233,50 +252,57 @@ export default {
       });
     },
     // 加载GeoJSON数据
-    addPolygon(geom, id, colors, fillreset) {
-      let geojson = parse(geom);
-      console.log("---", geojson.type);
+    addPolygon(geom, id, colors, fillcolor) {
       let _this = this;
-      // viewer.entities.removeAll();
-      let scolor = colors
-        ? Cesium.Color.fromCssColorString(colors)
-        : Cesium.Color.RED;
-      let fcolor =
-        colors && !fillreset
-          ? Cesium.Color.fromCssColorString(colors)
-          : Cesium.Color.WHITE;
+      let fill = fillcolor || colors || "#ffffff";
 
-      let polygon = Cesium.GeoJsonDataSource.load(geojson, {
-        clampToGround: true,
-        stroke: scolor,
-        fill: fcolor.withAlpha(0.3), //注意:颜色必须大写,即不能为blue
-        strokeWidth: 5,
-      });
-      polygon.then(function (dataSource) {
-        // dataSource.id = id;
-        // 将数据源添加到Cesium Viewer
-        viewer.dataSources.add(dataSource);
-        viewer.zoomTo(dataSource);
-        dataSourceList[id] = dataSource;
+      loadGeoJSON(geom, colors || "#ff0000", { isfly: true, fill }, (data) => {
+        data.name = "MultiLevelQuery_echart";
+        dataSourceList[id] = data;
         if (id == "all") _this.isshowAll = true;
-        if (!geojson.type.includes("Polygon")) {
-          dataSource.entities.values.forEach((entity, ei) => {
-            if (entity.billboard) {
-              entity.billboard = new Cesium.BillboardGraphics({
-                image: "@/.././static/images/flypng/hos_point.png",
-                height: 40,
-                width: 40,
-                scale: 1.0,
-                pixelOffset: new Cesium.Cartesian2(0, -16),
-              });
-              // entity.point = {
-              //   pixelsize: 20,
-              //   color: Cesium.Color.fromCssColorString(colors),
-              // };
-            }
-          });
-        }
       });
+      // let geojson = parse(geom);
+      // console.log("---", geojson.type);
+      // // viewer.entities.removeAll();
+      // let scolor = colors
+      //   ? Cesium.Color.fromCssColorString(colors)
+      //   : Cesium.Color.RED;
+      // let fcolor =
+      //   colors && !fillreset
+      //     ? Cesium.Color.fromCssColorString(colors)
+      //     : Cesium.Color.WHITE;
+
+      // let polygon = Cesium.GeoJsonDataSource.load(geojson, {
+      //   clampToGround: true,
+      //   stroke: scolor,
+      //   fill: fcolor.withAlpha(0.3), //注意:颜色必须大写,即不能为blue
+      //   strokeWidth: 5,
+      // });
+      // polygon.then(function (dataSource) {
+      //   // dataSource.id = id;
+      //   // 将数据源添加到Cesium Viewer
+      //   viewer.dataSources.add(dataSource);
+      //   viewer.zoomTo(dataSource);
+      //   dataSourceList[id] = dataSource;
+      //   if (id == "all") _this.isshowAll = true;
+      //   if (!geojson.type.includes("Polygon")) {
+      //     dataSource.entities.values.forEach((entity, ei) => {
+      //       if (entity.billboard) {
+      //         entity.billboard = new Cesium.BillboardGraphics({
+      //           image: "@/.././static/images/flypng/hos_point.png",
+      //           height: 40,
+      //           width: 40,
+      //           scale: 1.0,
+      //           pixelOffset: new Cesium.Cartesian2(0, -16),
+      //         });
+      //         // entity.point = {
+      //         //   pixelsize: 20,
+      //         //   color: Cesium.Color.fromCssColorString(colors),
+      //         // };
+      //       }
+      //     });
+      //   }
+      // });
     },
 
     download() {

+ 1 - 1
src/views/LandConsolidation/components/xzgd.vue

@@ -103,7 +103,7 @@ export default {
       this.region = region;
       this.xmdata = xmdata;
       this.params = { zzxmid: xmdata.id, bsm: this.region };
-      this.getData();
+      this.gdchange();
     },
     getData() {
       this.$emit("updateParent", "loading", true);

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

@@ -206,6 +206,7 @@ export default {
       if (val == 1) this.$refs.list.regionChange(this.xzqh);
 
       if (val == 2) this.$refs.xzgd.regionChange(this.xzqh, xmdata);
+      this.$refs.detailModal.closeInster();
     },
     goxzgd(xmdata) {
       this.onClick(2, xmdata);

+ 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);
     },
   },
 };