Procházet zdrojové kódy

1.坐标经纬度转换; 2. 弹窗属性修改; 3. 预设模型测试

Bella před 2 roky
rodič
revize
966a534ea4

+ 37 - 43
src/components/common/BottomForm/UploadingData.vue

@@ -15,12 +15,11 @@
     <div id="uploadingBox">
       <div v-show="dataUpState" style="width: 100%">
         <el-progress
-          :percentage="postDataSize == 0 ? 0 : (postIndex / postDataSize) * 100"
+          :percentage="postIndex == 0 ? 0 : (postIndex / postDataSize) * 100"
           :stroke-width="10"
           :show-text="false"
         ></el-progress>
         <div>当前进度:{{ postIndex + "/" + postDataSize }}</div>
-        <div v-for="(item, index) in postMessageList" :key="index">{{ (index + postIndex) +":"+ item }}</div>
       </div>
       <el-upload
         v-show="!dataUpState"
@@ -69,9 +68,8 @@ export default {
   data() {
     return {
       townMap: new Map(),
-      postMessageList: [],
       dataUpState: false,
-      postIndex: 1609,
+      postIndex: 0,
       postDataSize: 0,
       // 文件目标路径
       filePath: "",
@@ -97,6 +95,7 @@ export default {
   },
   props: [],
   methods: {
+    getMapData() {},
     // 当用户点击svg底座时,切换底部菜单显示隐藏状态。
     changeShowBottomMenusStatus() {
       // 打开弹窗
@@ -132,16 +131,15 @@ export default {
         //   let pdData = that.pd.features;
         //   that.addPreModelData(pdData);
         // });
-        shp("http://127.0.0.1:5500/nzy_performance/zjz/PermFarmland").then(
-          function (geojson) {
-            debugger;
-            window.geojsontu = geojson;
-            that.postDataSize = geojson.features.length;
-            that.dataUpState = true;
-            let pdData = that.pd.features;
-            that.addAllLayerData(pdData);
-          }
-        );
+        this.$Get(
+          "http://127.0.0.1:5500/output/soil/jlh/zjz/PATROL.geojson"
+        ).then((geojson) => {
+          window.geojsontu = geojson;
+          that.postDataSize = geojson.features.length;
+          that.dataUpState = true;
+          let pdData = that.pd.features;
+          that.addAllLayerData(pdData);
+        });
       } else {
         this.$message.error(
           "浦东新区行政区划数据未获取,请尝试刷新页面并重试!"
@@ -227,11 +225,11 @@ export default {
               pdPolygon != "" &&
               turf.intersect(testPolygon, pdPolygon)
             ) {
-              targetProperties.面积 = area;
-              targetProperties.性质 = "基本农田被侵占";
-              targetProperties.图层构成 = "基本农田和2020年森林";
-              targetProperties.镇域名称 = pdData[j].properties.NAME;
-              targetProperties.xzqh = this.townMap.get(
+              targetProperties["面积"] = area;
+              targetProperties["性质"] = "基本农田被侵占";
+              targetProperties["图层构成"] = "基本农田和2020年森林";
+              targetProperties["镇域名称"] = pdData[j].properties.NAME;
+              targetProperties["xzqh"] = this.townMap.get(
                 pdData[j].properties.NAME
               );
               geojsondata.properties = targetProperties;
@@ -244,11 +242,11 @@ export default {
               (turf.intersect(pdPolygon, outerPolygon) ||
                 turf.intersect(pdPolygon, innerPolygon))
             ) {
-              targetProperties.面积 = area;
-              targetProperties.性质 = "基本农田被侵占";
-              targetProperties.图层构成 = "基本农田和2020年森林";
-              targetProperties.镇域名称 = pdData[j].properties.NAME;
-              targetProperties.xzqh = this.townMap.get(
+              targetProperties["面积"] = area;
+              targetProperties["性质"] = "基本农田被侵占";
+              targetProperties["图层构成"] = "基本农田和2020年森林";
+              targetProperties["镇域名称"] = pdData[j].properties.NAME;
+              targetProperties["xzqh"] = this.townMap.get(
                 pdData[j].properties.NAME
               );
               geojsondata.properties = targetProperties;
@@ -257,11 +255,11 @@ export default {
           }
         }
         if (!geojsondata.properties.xzqh) {
-          targetProperties.面积 = area;
-          targetProperties.性质 = "基本农田被侵占";
-          targetProperties.图层构成 = "基本农田和2020年森林";
-          targetProperties.镇域名称 = "浦东新区";
-          targetProperties.xzqh = 5000000;
+          targetProperties["面积"] = area;
+          targetProperties["性质"] = "基本农田被侵占";
+          targetProperties["图层构成"] = "基本农田和2020年森林";
+          targetProperties["镇域名称"] = "浦东新区";
+          targetProperties["xzqh"] = 5000000;
           geojsondata.properties = targetProperties;
         }
         let xzqh = geojsondata.properties.xzqh;
@@ -307,20 +305,22 @@ export default {
       if (geojsondata && this.postIndex < this.postDataSize) {
         delete geojsondata["geometry"]["bbox"];
         // 封装参数
-        let xzqh = geojsondata.properties.xzqh;
+        let townName = geojsondata.properties["镇域名称"];
+        let layerType = geojsondata.properties["土地类型"];
+        let xzqh = this.townMap.get(geojsondata.properties["镇域名称"]);
         geojsondata = JSON.stringify(geojsondata);
         let params = new FormData();
-        params.append("columnId", "510");
-        params.append("modelId", "118");
+        params.append("columnId", "768");
+        params.append("modelId", "120");
         var data = {
           c_boolean: false,
           c_content: geojsondata,
           c_date_time: (new Date().getTime() / 1000).toFixed(0) * 1000,
-          c_editorid: 4,
-          c_editor_name: "gaolu",
+          // c_editorid: 4,
+          // c_editor_name: "",
           c_xzqh: xzqh,
-          content: "测试录入数据",
-          title: "gl-t" + this.postIndex,
+          content: layerType,
+          title: layerType,
         };
         params.append("content", JSON.stringify(data));
         this.$Post(this.urlsCollection.addContent, params).then(
@@ -329,16 +329,10 @@ export default {
               this.postIndex += 1;
               this.addAllLayerData(pdData);
             } else {
-              this.postIndex += 1;
-              this.addData(pdData);
-              this.postMessageList.push(error);
               this.$message.error(res.message);
             }
           },
-          error => {
-            this.postIndex += 1;
-            this.addData(pdData);
-            this.postMessageList.push(error);
+          (error) => {
             this.$message.error(error);
           }
         );

+ 11 - 9
src/components/map/MapHolder.vue

@@ -716,21 +716,23 @@ export default {
       let coordinates = "";
       // 当前数据坐标系为WGS84
       let targetGeometry = JSON.parse(geometry).geometry;
+      // 预设模型与所有图层层级不同
+
       if (targetGeometry.type === "Polygon") {
         let coord = targetGeometry.coordinates[0];
-        coordinates = coord.map((v) => {
-          return [v[1], v[0]];
-        });
+        coordinates = publicFun.latLngsToReverse(coord);
+        // coordinates = coord.map((v) => {
+        //   return [v[1], v[0]];
+        // });
       }
 
-      if (targetGeometry.type === "MultiPolygon ") {
+      if (targetGeometry.type === "MultiPolygon") {
+        debugger;
         let coord = targetGeometry.coordinates[0][0];
-        coordinates = coord.map((v) => {
-          return v.map((e) => {
-            return [e[1], e[0]];
-          });
-        });
+        coordinates = publicFun.latLngsToReverse(coord);
       }
+
+      console.log(coordinates, "222");
       // x,y转换
       let polygon = L.polygon(coordinates, {
         color: color,

+ 2 - 2
src/components/popup/CaseAuditPopup.vue

@@ -78,8 +78,8 @@ export default {
       tableObj: {
         镇域名称: "--",
         面积: "--",
-        土地类型: "--",
-        图斑编号: "--",
+        图层构成: "--",
+        性质: "--",
       },
       selectVal: "疑点",
       selectOptions: [

+ 17 - 0
src/utils/publicFunction.js

@@ -189,6 +189,22 @@ let group = (arr, field) => {
   return map;
 };
 
+/**
+ * 多维数组转置
+ */
+let latLngsToReverse = (latlngsAry) => {
+  // 深拷贝
+  var tempLatlngsAry = JSON.parse(JSON.stringify(latlngsAry));
+  if (typeof tempLatlngsAry[0] === "number") {
+    return tempLatlngsAry.reverse();
+  } else {
+    for (var i = 0, l = tempLatlngsAry.length; i < l; i++) {
+      tempLatlngsAry[i] = latLngsToReverse(tempLatlngsAry[i]);
+    }
+  }
+  return tempLatlngsAry;
+};
+
 export default {
   buildGuid,
   compare,
@@ -198,4 +214,5 @@ export default {
   generateGeoJSON,
   standardGeojson,
   convertTree,
+  latLngsToReverse,
 };

+ 2 - 4
src/views/ComprehensiveAnalysis.vue

@@ -682,9 +682,7 @@ export default {
         );
       }
     },
-    getMapData(){
-      
-    },
+    getMapData() {},
     /**
      * 获取图层信息 -- 所有模型和预设模型
      * @columnId
@@ -693,7 +691,7 @@ export default {
      * @sourceType 土地资源/林地资源/生态资源/水资源/全部
      */
     displaySingleLayer(columnId, id, mainType, sourceType) {
-      // if (id !== "永久基本农田_50") {
+      debugger;
       let uniqueId = id;
       this.layerIdMap.set(uniqueId, uniqueId);
       // 图例