智慧农业后台管理页面
tangzy
2022-07-18 ce0d1b5ed54ef4f08ce4d3dad60a9659e5bb57c2
地块
2 files modified
90 ■■■■ changed files
src/api/land/land.js 8 ●●●●● patch | view | raw | blame | history
src/views/land/LandDetail.vue 82 ●●●●● patch | view | raw | blame | history
src/api/land/land.js
@@ -40,11 +40,13 @@
    })
}
export const update = (row) => {
export const update = (params) => {
    return request({
        url: '/api/land/land/submit',
    url: '/api/land/land/updateLandAr',
        method: 'post',
        data: row
    params: {
      ...params,
    }
    })
}
src/views/land/LandDetail.vue
@@ -2,7 +2,7 @@
    <div class="wraaper-box farming-detail-box">
        <div class="dd">
            <div class="da">
                <div class="land-img" @click="mod()">
        <div class="land-img" @click="mod(usePolygons)">
                    <img :src="url" class="landimg" />
                </div>
                <div class="cent">
@@ -15,7 +15,7 @@
                <div class="edit">
                    <el-button @click="btnGrounpShow = !btnGrounpShow" icon="el-icon-menu"></el-button>
                    <div v-show="btnGrounpShow" class="btn-grounp">
          <div v-show="btnGrounpShow" class="btn-grounp" @click="DelLand(delId)">
                        <el-button>删除地块</el-button>
                    </div>
                </div>
@@ -50,7 +50,7 @@
            :before-close="dialogBeforeClose"
        >
            <getMapDataInThere ref="getMapData" id="getMapData" @setMapData="setMapData"></getMapDataInThere>
            <el-button class="save" type="success">保存</el-button>
      <el-button class="save" type="success" @click="upLand()">保存</el-button>
        </el-dialog>
    </div>
</template>
@@ -61,6 +61,7 @@
import farming from "@/views/farm/farmingrecord.vue"
import recovery from "@/views/recovery/recovery.vue"
import getMapDataInThere from "./getMapDataInThere.vue"
import {remove, update} from "@/api/land/land"
export default {
    components: {
@@ -76,7 +77,10 @@
            url: "",
            dica: "",
            deptname: "",
      landUnit: "",
      delId: "",
            landArea: "",
      usePolygons: "",
            dic: "",
            formC: {},
            gradeBoxVisible1: false,
@@ -116,8 +120,10 @@
        this.landArea = this.$route.query.landArea
        this.dica = this.$route.query.dica
        this.deptname = this.$route.query.deptname
    this.delId = this.$route.query.id
    this.landUnit = this.$route.query.landUnit
        // this.form = res.data.data;
        let usePolygons = this.$route.query.landRange
    this.usePolygons = this.$route.query.landRange
            .split("POLYGON((")[1]
            .split("))")[0]
            .split(",")
@@ -127,13 +133,73 @@
                lat: +usePolygons[k].split(" ")[1],
            }
        }
        this.$refs.getMapData.draw(usePolygons)
    },
    methods: {
        mod () {
            this.formC = {}
    mod(usePolygons) {
            this.gradeBoxVisible1 = true
      this.$refs.getMapData.draw(usePolygons)
        },
    setMapData(val) {
      this.LineData = val[0];
      this.PointData = val[1];
    },
    //删除地块
    DelLand(delId) {
      this.$confirm("确定将选择数据删除?", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning"
      })
        .then(() => {
          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();
      } else {
        //如果有值,空间坐标转换
        let pol = this.polygons;
        let polLength = this.polygons.length - 1;
        let usePolygons = "";
        for (let k in pol) {
          usePolygons += pol[k].lng + "," + pol[k].lat;
          if (k != polLength) {
            usePolygons += ";";
          }
        }
        //设置坐标点
        params.userId = this.userInfo.user_id;
        params.landRange = usePolygons;
        params.id = this.delId,
          params.landUnit = this.landUnit
      }
      // update(params).then(() => {
      //   that.$refs.form.resetFields();
      //   that.visible = false;
      //   this.$message({
      //     type: "success",
      //     message: "操作成功!"
      //   });
      //   done();
      // }, error => {
      //   loading();
      //   window.console.log(error);
      // });
    }
    },
    watch: {},
}
@@ -150,6 +216,7 @@
    width: 100%;
    height: 100%;
}
.wraaper-box {
    padding: 0 !important;
    position: absolute;
@@ -203,6 +270,7 @@
    margin-left: 340px;
    width: 175px;
}
.dck {
    width: 151px;
    margin-left: 340px;