maxiaoxiao 9 месяцев назад
Родитель
Сommit
07ca2bdafb

+ 7 - 0
src/api/ghss/gdbh.js

@@ -50,6 +50,13 @@ export function DeleteGdbh(bsm) {
         method: 'get',
         params
     })
+}
+export function getgeoms(params) {
+    return request({
+        url: '/apply/gdbh/QueryGdbhJg/geom',
+        method: 'get',
+        params
+    })
 }
   export function getOneDetail(params) {
     return request({

+ 1 - 1
src/components/TerrainAnalysis/TerrainCutFillAnalysis/TerrainCutFillAnalysisNew.vue

@@ -140,7 +140,7 @@ export default {
 
         this.loading = false;
         let pitch = Cesium.Math.toRadians(-45.0);
-        let params = { sw: 0, fill_a: 0.8 };
+        let params = { sw: 0.001, fill_a: 0.8 };
         loadGeoJSON(res.data.bottomGeom, "#1E90A8", params, (data) => {
           viewer.dataSources.add(data);
           viewer.flyTo(data, {

+ 39 - 11
src/utils/MapHelper/help.js

@@ -30,18 +30,46 @@ export function listToMatrix(list, elementsPerSubArray) {
 // 加载GeoJSON数据
 export function loadGeoJSON(geom, yanse, adata, fun) {
   let geojson = typeof geom === 'string' ? parse(geom) : geom;
-  const dataSource = new Cesium.GeoJsonDataSource();
-  dataSource
-    .load(geojson, {
-      clampToGround: true,
-      stroke: Cesium.Color.fromCssColorString(yanse),
-      fill: Cesium.Color.fromCssColorString(yanse).withAlpha(adata.fill_a || 0.4), //Cesium.Color.fromCssColorString("rgba(10, 95, 152, 0.4)"), //注意:颜色必须大写,即不能为blue
-      strokeWidth: adata ? adata.sw : 2,
-    })
-    .then((data) => {
-      fun(data)
+  let polygon = Cesium.GeoJsonDataSource.load(geojson, {
+    clampToGround: true,
+    stroke: yanse
+      ? Cesium.Color.fromCssColorString(yanse)
+      : Cesium.Color.RED.withAlpha(0),
+    fill: Cesium.Color.fromCssColorString(yanse).withAlpha(adata.fill_a || 0.4), //Cesium.Color.fromCssColorString("rgba(10, 95, 152, 0.4)"), //注意:颜色必须大写,即不能为blue
+    strokeWidth: adata.sw || 2,
+  })
+  polygon.then((data) => {
+    viewer.dataSources.add(data);
+    if (adata.isfly)
+      viewer.flyTo(data, {
+        offset: new Cesium.HeadingPitchRange(0, -45),
+      });
+    fun(data)
 
-    });
+  });
+  // let polygon = Cesium.GeoJsonDataSource.load(geojson, {
+  //   clampToGround: true,
+  //   stroke: yanse
+  //     ? Cesium.Color.fromCssColorString(yanse)
+  //     : Cesium.Color.RED.withAlpha(0),
+  //   fill: yanse
+  //     ? Cesium.Color.fromCssColorString(yanse).withAlpha(0.3)
+  //     : Cesium.Color.WHITE.withAlpha(0),
+  //   strokeWidth: isfly ? 5 : 2,
+  // });
+  // polygon.then(function (dataSource) {
+  //   viewer.dataSources.add(dataSource);
+  //   layerSources[id] = dataSource;
+  //   if (isfly)
+  //     viewer.flyTo(dataSource, {
+  //       offset: new Cesium.HeadingPitchRange(0, -45),
+  //     });
+  //   if (resdata) {
+  //     dataSource.entities.values.forEach((entity) => {
+  //       entity.properties = resdata;
+  //     });
+  //   }
+  // });
 }
 /**
     * 下载图片

+ 26 - 9
src/views/farmlandProtection/components/fxjg.vue

@@ -15,12 +15,15 @@
           <div class="divImg">
             <img :src="imgs.zd1" style="height: 2.5rem; width: 2.5rem" />
           </div>
-          <div class="divText">
+          <div class="divText" @click="resultDeatils({}, '')">
             <span style="color: #fff">图斑数(个)</span>
             <!-- <span color="#2d8cf0" v-if="xmxx">{{ xmxx.sumNumber }}</span> -->
-            <span color="#2d8cf0" v-if="resultData && resultData.xmxx"
-              >{{ resultData.xmxx.sumNumber || 0 }}个</span
-            >
+            <span
+              style="color: #2d8cf0; font-weight: bold; cursor: pointer"
+              v-if="resultData && resultData.xmxx"
+              >{{ resultData.xmxx.sumNumber || 0 }}个
+              <i style="pointer-events: all" class="el-icon-view'"></i
+            ></span>
           </div>
         </div>
         <div class="divCol">
@@ -30,7 +33,7 @@
           <div class="divText">
             <span style="color: #fff">图斑面积(㎡)</span>
             <span color="#2d8cf0" v-if="resultData && resultData.xmxx"
-              >{{ resultData.xmxx.sumMj || 0 }}平方米</span
+              >{{ resultData.xmxx.xzmj || 0 }}平方米</span
             >
           </div>
         </div>
@@ -40,11 +43,11 @@
           <div class="site_Icon"></div>
           <span>现状情况</span>
         </div>
-        <el-button size="mini" @click="zdyModel">图表切换</el-button>
+        <!-- <el-button size="mini" @click="zdyModel">图表切换</el-button> -->
       </div>
       <div>
         <pie
-          class="echart"
+          :class="`echart${litem.dataList.length <= 6 ? '' : '_vertical'}`"
           unit="平方米"
           @echartClick="(name) => echartClick(name, item.value)"
           :ref="`echartRef`"
@@ -112,6 +115,19 @@ export default {
 
   methods: {
     download() {},
+    draw_vector() {
+      // store.setViewerFlagb(false);
+      // store.setToolBarShow(false);
+      // store.setXzqh_flag(false);
+      // store.setCockpit_vector({
+      //   title: "山水工程项目",
+      //   word: "项目名称",
+      //   mapType: "jsc_stxf_ssxf_layer",
+      //   tableData: store.state.cockpit_stxf.ssgc.list,
+      //   tablejscType: `jsc_stxf_ywlx_ssxfmx`,
+      //   columns: ['项目名称', '治理面积(公顷)','投资金额(万元)', '区县编码', '区县编码名称', '治理时间', '治理进度',  '备注'],
+      // });
+    },
     resultDeatils(val, mxbsm) {
       let obj = {
         bsm: this.fxjgObj.bsm,
@@ -125,7 +141,7 @@ export default {
       QueryGdbhJg({ bsm: this.fxjgObj.bsm }).then((res) => {
         let data = [];
         if (res.statuscode == 200) {
-          console.log(res,':resresres')
+          console.log(res, ":resresres");
           if (res.data.sandiao.mx_data.length) {
             res.data.sandiao.mx_data.forEach((el) => {
               data.push({
@@ -135,7 +151,8 @@ export default {
               });
             });
           }
-          this.$refs.echartRef.setOptions({ data, type: "horizontal" }, 1);
+          let type = data.length <= 6 ? "horizontal" : "vertical";
+          this.$refs.echartRef.setOptions({ data, type }, 1);
           this.resultData = res.data;
           // this.drawWktPloygon(res.data.xmxx.geom, "#ff0000", "all"); //res.data.bsm
           this.loadGeoJSON(parse(res.data.xmxx.geom), "#ff0000", "all");

+ 53 - 8
src/views/farmlandProtection/components/interDetails.vue

@@ -28,7 +28,7 @@
             <el-table-column
               show-overflow-tooltip="true"
               prop="siweiarea"
-              label="图斑面积"
+              label="图斑面积(㎡)"
             >
             </el-table-column>
             <el-table-column width="100" label="操作">
@@ -141,8 +141,9 @@
 
 <script>
 import { name } from "file-loader";
-import { getYZ, getOneDetail } from "../../../api/ghss/gdbh.js";
-
+import { getYZ, getgeoms, getOneDetail } from "../../../api/ghss/gdbh.js";
+import { loadGeoJSON } from "@/utils/MapHelper/help.js";
+let layerSources = {};
 export default {
   props: {
     interObj: {
@@ -157,6 +158,7 @@ export default {
       isShallow: false,
       jbxxData: null,
       yzjgData: [],
+      tempdataLayerId: null,
     };
   },
   mounted() {
@@ -166,11 +168,20 @@ export default {
     //关闭套合结果详情
     closeInster() {
       this.$emit("updateParent", "showInter", false);
-      this.isShallow = false
+      this.isShallow = false;
+      viewer.entities.removeAll();
+      viewer.dataSources.removeAll();
+    },
+    flyTo(item) {
+      let id = "h_" + item.id;
+      this.tempdataLayerId = id;
+      loadGeoJSON(item.geom, "#ff0000", { isfly: true }, (data) => {
+        console.log("--sx;,ksc");
+        layerSources[id] = data;
+      });
     },
-    flyTo(val) {},
     handleView(val) {
-      this.isShallow = true
+      this.isShallow = true;
       getOneDetail({
         bsm: this.interObj.bsm,
         id: val.id,
@@ -189,14 +200,42 @@ export default {
       this.isShallow = true;
     },
     init() {
+      if (!this.interObj.mxbsm) {
+        this.getAll();
+      } else {
+        this.getYZ();
+      }
+    },
+    getYZ() {
       getYZ(this.interObj).then((res) => {
         if (res.statuscode == 200) {
           this.tableData = res.data;
+          this.active_tableData(this.tableData);
+        } else {
+          this.$message.error(res.message);
+        }
+      });
+    },
+    getAll() {
+      getgeoms(this.interObj).then((res) => {
+        if (res.statuscode == 200) {
+          this.tableData = res.data.dataListMap;
+          console.log(this.tableData, "---xo-sx");
+          this.active_tableData(res.data.dataListMap);
         } else {
           this.$message.error(res.message);
         }
       });
     },
+    active_tableData(newVal) {
+      newVal.forEach((res, index) => {
+        res.type = "图斑上图";
+        if (res.geom)
+          loadGeoJSON(res.geom, "#55A1E3", { isfly: false }, (data) => {
+            layerSources[res.id] = data;
+          });
+      });
+    },
   },
   mounted() {},
   watch: {
@@ -210,6 +249,12 @@ export default {
       deep: true,
       immediate: true,
     },
+    tempdataLayerId(newVal, oldVal) {
+      if (oldVal && layerSources[oldVal]) {
+        viewer.dataSources.remove(layerSources[oldVal]);
+        layerSources[oldVal] = null;
+      }
+    },
   },
 };
 </script>
@@ -266,7 +311,7 @@ export default {
     color: aqua;
   }
 }
-/deep/ .el-carousel--horizontal{
+/deep/ .el-carousel--horizontal {
   margin-top: 15px;
 }
 /deep/ .el-carousel__item h3 {
@@ -350,7 +395,7 @@ export default {
     }
   }
 }
-.sm-function-module-query{
+.sm-function-module-query {
   max-height: 800px !important;
   top: 28px !important;
 }