智慧农业后台管理页面
shuishen
2022-07-18 0ddaebe0030d7fa7545f20ce894861856a35bf4c
解数据
2 files modified
52 ■■■■■ changed files
src/views/land/LandDetail.vue 36 ●●●●● patch | view | raw | blame | history
src/views/land/getMapDataInThere.vue 16 ●●●● patch | view | raw | blame | history
src/views/land/LandDetail.vue
@@ -127,12 +127,6 @@
      .split("POLYGON((")[1]
      .split("))")[0]
      .split(",")
    for (let k in usePolygons) {
      usePolygons[k] = {
        lng: +usePolygons[k].split(" ")[0],
        lat: +usePolygons[k].split(" ")[1],
      }
    }
  },
  methods: {
    mod(usePolygons) {
@@ -140,8 +134,8 @@
      this.$refs.getMapData.draw(usePolygons)
    },
    setMapData(val) {
      this.LineData = val[0];
      this.PointData = val[1];
            this.LineData = val[0]
            this.PointData = val[1]
    },
    //删除地块
    DelLand(delId) {
@@ -151,39 +145,39 @@
        type: "warning"
      })
        .then(() => {
          return remove(delId);
                    return remove(delId)
        })
        .then(() => {
          this.$message({
            type: "success",
            message: "操作成功!"
          });
                    })
          this.$router.push({
            path: `/land/cs`,
          });
        });
                    })
                })
    },
    //修改地块
    upLand() {
      var params = {}
      if (this.polygons.length == 0) {
        //没有面的数据
        this.$refs.getMapData.isCheck = true;
        loading();
                this.$refs.getMapData.isCheck = true
                loading()
      } else {
        //如果有值,空间坐标转换
        let pol = this.polygons;
        let polLength = this.polygons.length - 1;
        let usePolygons = "";
                let pol = this.polygons
                let polLength = this.polygons.length - 1
                let usePolygons = ""
        for (let k in pol) {
          usePolygons += pol[k].lng + "," + pol[k].lat;
                    usePolygons += pol[k].lng + "," + pol[k].lat
          if (k != polLength) {
            usePolygons += ";";
                        usePolygons += ";"
          }
        }
        //设置坐标点
        params.userId = this.userInfo.user_id;
        params.landRange = usePolygons;
                params.userId = this.userInfo.user_id
                params.landRange = usePolygons
        params.id = this.delId,
          params.landUnit = this.landUnit
      }
src/views/land/getMapDataInThere.vue
@@ -63,8 +63,20 @@
    },
    methods: {
        draw (usePolygons) {
            this.$store.commit("setpolygon", usePolygons) //用vuex传最终数据
            this.doThat(usePolygons)
            let arr = []
            usePolygons.forEach(item => {
                arr.push({
                    lng: item.split(' ')[0],
                    lat: item.split(' ')[1]
                })
            })
            console.log(arr, 23)
            this.$store.commit("setpolygon", arr) //用vuex传最终数据
            this.doThat(arr)
        },
        doThat (val) {
            this.checkDom("getMapDataRefs", (dom) => {