浏览代码

检查结果接口数据

maxiaoxiao 11 月之前
父节点
当前提交
4f5e11a53c
共有 2 个文件被更改,包括 32 次插入25 次删除
  1. 1 1
      src/views/complianceAnalysis/components/lsjl.vue
  2. 31 24
      src/views/complianceAnalysis/components/scjg.vue

+ 1 - 1
src/views/complianceAnalysis/components/lsjl.vue

@@ -74,7 +74,7 @@
 </template>
 
 <script>
-import { GetPage, GetFxjg, Delect } from "@/api/ghss/hgxfx.js";
+import { GetPage, Delect } from "@/api/ghss/hgxfx.js";
 import { Message, MessageBox } from "element-ui";
 import { rest } from "lodash";
 import { GetXzResList } from "../../../api/ghss/ghxz.js";

+ 31 - 24
src/views/complianceAnalysis/components/scjg.vue

@@ -10,7 +10,7 @@
       </div>
       <div>
         分析面积:
-        <span class="text">{{ scjgObj.xzmj }}平方千米</span>
+        <span class="text">{{ compute(scjgObj.fxmj) }}亩</span>
       </div>
     </div>
 
@@ -32,6 +32,7 @@
         v-show="eitem.isshow"
         class="echart"
         :class="`echart${i}`"
+        unit="亩"
         @echartClick="(name, iseyes) => echartClick(name, iseyes, i)"
         :ref="`echartRef`"
       ></pie>
@@ -46,6 +47,7 @@
 <script>
 import pie from "@/components/echartsTemplate/pie.vue";
 import { GetFxjg } from "@/api/ghss/hgxfx.js";
+import parse from "wellknown";
 import hgxfx from "../../../../static/data/ghss/data.js";
 let colors = [
   "#62ADED",
@@ -80,28 +82,33 @@ export default {
   },
   mounted() {},
   methods: {
+    compute(mj) {
+      return mj ? (mj * 0.0015).toFixed(2) : 0;
+    },
     initData() {
       this.echarts = [];
+      this.$emit("updateParent", "loading", true);
       GetFxjg({ bsm: this.$props.scjgObj.bsm }).then((res) => {
         if (res.success) {
           res.data.forEach((e, ei) => {
             let c = e.dataList || e.child;
             c.map((ci) => {
-              ci.name = ci.mc_name || ci.scxbsm;
-              ci.value = ci.mj;
-              // ci.id = ci.scxbsm;
+              ci.name = ci.yslx_name || ci.scxname;
+              ci.value = this.compute(ci.mj);
+              ci.id = ci.yslx || ci.scxbsm;
+              ci.geom = ci.geom || (ci.data ? ci.data.geom : "");
               // ci.label = ci.mc_name;
             });
             this.echarts.push({
               id: e.scxbsm,
-              label: e.scxbsm,
+              label: e.scxname,
               children: c,
               iseyes: false,
               isshow: false,
             });
             this.setEchart(c, ei);
-            console.log(c, "this.echars");
           });
+          this.$emit("updateParent", "loading", false);
         }
       });
     },
@@ -117,17 +124,19 @@ export default {
       // }
       // emit("eyesChaneg");
     },
-    changeDataSources({ label, id, iseyes }, color) {
+    changeDataSources({ geom, id, iseyes }, color) {
       if (this.dataSources[id]) {
         this.dataSources[id].show = iseyes;
-      } else this.addPolygon(label, id, color);
+      } else if (geom) {
+        this.addPolygon(geom, id, color);
+      }
     },
     echartClick(name, iseyes, index) {
       if (this.echarts[index].iseyes) {
-        let click = this.echarts[index].children.filter((c) => c.label == name);
+        let click = this.echarts[index].children.filter((c) => c.name == name);
         if (click.length > 0)
           this.changeDataSources({
-            label: click[0].label,
+            geom: click[0].geom,
             id: click[0].id,
             iseyes,
           });
@@ -140,7 +149,8 @@ export default {
       });
     },
     // 加载GeoJSON数据
-    addPolygon(label, id, colors) {
+    addPolygon(geom, id, colors) {
+      let geojson = parse(geom);
       let _this = this;
       // viewer.entities.removeAll();
       let scolor = colors
@@ -150,15 +160,12 @@ export default {
         ? Cesium.Color.fromCssColorString(colors)
         : Cesium.Color.WHITE;
 
-      let polygon = Cesium.GeoJsonDataSource.load(
-        `/static/data/ghss/${this.fileid}/${id + label}.geojson`,
-        {
-          clampToGround: true,
-          stroke: scolor,
-          fill: fcolor.withAlpha(0.3), //注意:颜色必须大写,即不能为blue
-          strokeWidth: 3,
-        }
-      );
+      let polygon = Cesium.GeoJsonDataSource.load(geojson, {
+        clampToGround: true,
+        stroke: scolor,
+        fill: fcolor.withAlpha(0.3), //注意:颜色必须大写,即不能为blue
+        strokeWidth: 3,
+      });
       polygon.then(function (dataSource) {
         // dataSource.id = id;
         // 将数据源添加到Cesium Viewer
@@ -195,9 +202,9 @@ export default {
   //     }
   //   );
   watch: {
-    scjgObj(newValue) {
-      this.initData();
-    },
+    // scjgObj(newValue) {
+    //   this.initData();
+    // },
   },
 };
 </script>
@@ -269,7 +276,7 @@ export default {
     .echart0,
     .echart2 {
       width: 380px;
-      height: 370px;
+      height: 300px;
     }
   }
 }