Эх сурвалжийг харах

辅助检测研判长传与新增接口更新与新增参数

lkk 5 сар өмнө
parent
commit
9a03ba7448

+ 16 - 0
src/api/ghss/hgxfx.js

@@ -8,6 +8,7 @@ const hgxfxApi = {
     UpdateScx: '/apply/hgxfx/UpdateScx',
     // ShapeUpload:'/file/uploadShpZip',
     ShapeUpload: '/file/upload/geom',
+    ShapeUploadV1: '/upload/geom/v1',
     GetLog: '/apply/hgxfx/GetLog',
     AddHgxfxV1:'/apply/hgxfx/AddHgxfxV1'
 }
@@ -27,6 +28,21 @@ export function ShapeUpload(parameter) {
         }
     })
 }
+/**
+ * 上传SHP文件v1版本
+ * @param parameter
+ * @returns {*}
+ */
+export function ShapeUploadV1(parameter) {
+    return request({
+        method: 'post',
+        url: hgxfxApi.ShapeUploadV1,
+        data: parameter,
+        headers: {
+            'Content-Type': 'application/json;charset=UTF-8'
+        }
+    })
+}
 /**
  * 根据任务编号查询任务
  * @param parameter

+ 16 - 8
src/components/mapView/range-version.vue

@@ -169,7 +169,7 @@
 </template>
 
 <script>
-import { ShapeUpload } from "@/api/ghss/hgxfx.js";
+import { ShapeUpload, ShapeUploadV1 } from "@/api/ghss/hgxfx.js";
 import { ElMessage } from "element-ui";
 import { GetXzqhTree } from "@/api/map";
 import {
@@ -248,6 +248,7 @@ export default {
         xzfw: "",
         xzmj: 0,
         feature: null,
+        yptype:1,
       },
       handlerDraw: null,
       draw: null, //绘制
@@ -261,9 +262,11 @@ export default {
   },
   methods: {
     creatTb() {
+      this.yptype = 2
       this.dialogVisible = false;
       this.multipleSelection.forEach((item, index) => {
         this.model.xzmj += item.jcmj;
+        this.fileDataID += item.id + ",";
         item.type = "图斑上图";
         if (item.geom)
           loadGeoJSON(item.geom, "#55A1E3", { isfly: true }, (data) => {
@@ -274,9 +277,12 @@ export default {
           });
         this.idArr.push(item.jcbh);
       });
+      //去掉最后一个逗号(如果不需要去掉,就不用写)
+      if (this.multipleSelection.length > 0) {
+        this.fileDataID = this.fileDataID.substr(0, this.fileDataID.length - 1);
+      }
     },
     handleSelectionChange(val) {
-      console.log(val, "====");
       this.multipleSelection = val;
     },
     handleClose(done) {
@@ -294,7 +300,6 @@ export default {
       this.updateObj.val0 = val.startTime;
       this.updateObj.val1 = val.endTime;
       this.yearsVal = val.quarter;
-      console.log(this.updateObj.val0, this.updateObj.val1, this.yearsVal);
     },
     getXzqTreeData() {
       GetXzqhTree().then((res) => {
@@ -360,11 +365,14 @@ export default {
         this.fileList = [fileList[fileList.length - 1]]; //这一步,是展示最后一次选择文件
         this.clearAll(false);
       }
+      this.yptype = 1
       const formdata = new FormData();
       formdata.append("file", file.raw);
       formdata.append("fromType", 2);
       formdata.append("fromRoute", this.$route.path);
-      ShapeUpload(formdata).then((res) => {
+      formdata.append("storeStats", 0);
+      formdata.append("followup", "");
+      ShapeUploadV1(formdata).then((res) => {
         if (res.success) {
           this.model.xzmj = (res.data.area * 0.0015).toFixed(2);
           // viewer.entities.removeAll();
@@ -416,12 +424,12 @@ export default {
     //绘制
     drawMap() {
       this.remove(); //删除选择的图斑
+      this.yptype = 1
       if (!window.handlerPolygon) {
         common.initHandler("Polygon");
       }
       common.handlerDrawing("Polygon").then(
         (res) => {
-          // console.log(res.positions, "------");
           //过滤掉高度
           const filteredArr = res.positions.filter((item, index) => {
             if ((index + 1) % 3 !== 0) {
@@ -447,13 +455,11 @@ export default {
           }
 
           var matrix = listToMatrix(filteredArr, 2);
-          // console.log(matrix, "max-----");
 
           matrix.push(matrix[0]);
           const geojsonPolygon = turf.polygon([matrix]);
           // var parse = require("wellknown"); //引入wellknow
           const wktPolygon = parse.stringify(geojsonPolygon);
-          // console.log("WKT Polygon:", wktPolygon);
           if (this.$props.type == "cutfill") {
             this.model.geom = wktPolygon;
             this.$emit("cutfill", this.model.geom);
@@ -468,8 +474,10 @@ export default {
           formdata.append("fromType", 1);
           formdata.append("geom", wktPolygon);
           formdata.append("fromRoute", this.$route.path);
+          formdata.append("storeStats", 0);
+          formdata.append("followup", "");
           // this.addPolygon();
-          ShapeUpload(formdata).then((res) => {
+          ShapeUploadV1(formdata).then((res) => {
             if (res.success) {
               this.fileDataID = res.data.id;
               this.model.xzmj = (res.data.area * 0.0015).toFixed(2);

+ 1 - 0
src/views/farmlandProtection/components/fzjcyp.vue

@@ -165,6 +165,7 @@ export default {
               xzfw: this.$refs.range.fileDataID,
               xmmc: this.ruleForm.xmmc,
               mxlist: this.multipleSelection,
+              yptype:this.$refs.range.yptype,
             };
 
             const loading = this.$loading({