智慧农业绘制地图
guoshilong
2022-08-30 4677779d3ea99789e59f7a00e769401852943909
画地时按钮放大,地图模式显示当前农场名
3 files modified
53 ■■■■ changed files
src/api/index.js 10 ●●●●● patch | view | raw | blame | history
src/components/leafletDraw.vue 24 ●●●● patch | view | raw | blame | history
src/views/clickmap.vue 19 ●●●● patch | view | raw | blame | history
src/api/index.js
@@ -41,4 +41,14 @@
            size,
        }
    })
}
export const getFarmDetail = (params) =>{
    return request({
        url: '/farm/details',
        method: 'get',
        params: {
            ...params,
        }
    })
}
src/components/leafletDraw.vue
@@ -306,28 +306,40 @@
    font-size: 16px;
    .draw {
        width: 144px;
        height: 44px;
        // width: 144px;
        // height: 44px;
        line-height: 44px;
        background: #5abf78;
        color: #fff;
        border: none;
        border-radius: 22px;
        width: 216px;
        height: 66px;
        font-size: 30px;
    }
    .repeal {
        width: 100px;
        height: 44px;
        // width: 100px;
        // height: 44px;
        border-radius: 22px;
        border: none;
        width: 150px;
        height: 66px;
        font-size: 30px;
    }
    .save {
        margin-left: 10px;
        width: 100px;
        height: 44px;
        // width: 100px;
        // height: 44px;
        border-radius: 22px;
        border: none;
        width: 150px;
        height: 66px;
        font-size: 30px;
    }
}
src/views/clickmap.vue
@@ -162,7 +162,7 @@
<script>
import wx from 'weixin-js-sdk'
import clickMap from '@/components/clickMap.vue'
import { getLandIsAreaStatistic, getList, getLandList } from "@/api/index"
import { getLandIsAreaStatistic, getList, getLandList,getFarmDetail } from "@/api/index"
export default {
    name: 'clickmap',
    components: {
@@ -170,7 +170,7 @@
    },
    data () {
        return {
            title: "今天",
            title: "农场",
            zydksb: 'zy',
            choosepz: -1,
            choosedk: -1,
@@ -190,6 +190,7 @@
            landList: [],
            farmPlantList: [],
            landDetails: {},
            farmDetail:{},
            isShowLandDetails: false,
            isShowFooter: true,
            farmId: null,
@@ -198,13 +199,14 @@
    },
    created () {
        this.farmId = this.getQueryString('farmId')
        // 获取有无轮廓地块数量
        this.getLandIsAreaStatistic()
        // 获取农产品列表
        this.getFarmPlantList(this.page)
        //获取地块列表
        this.getLandList(this.pageLand)
        //获取农场信息
        this.getFarmDetail()
    },
    methods: {
        // 获取url信息
@@ -338,6 +340,17 @@
            this.$refs.ClickMap.closePlotDetails()
        },
        //获取农场信息
        getFarmDetail(){
            var params = {
                id:this.farmId
            }
            getFarmDetail(params).then((res)=>{
                this.farmDetail = res.data.data
                this.title = this.farmDetail.farmName
            })
        },
        /**
         * 根据经纬度范围计算中心点位置