智慧农业大数据平台
guanqb
2022-08-24 54c402021a8aa0bd4454797c0583b2a1ff254ff4
首页地图地块点击事件
7 files modified
207 ■■■■ changed files
src/api/equipment/equipment.js 2 ●●● patch | view | raw | blame | history
src/api/farm/farmingrecord.js 2 ●●● patch | view | raw | blame | history
src/components/map/index.vue 20 ●●●●● patch | view | raw | blame | history
src/router/page/index.js 2 ●●● patch | view | raw | blame | history
src/views/farm/index.vue 17 ●●●●● patch | view | raw | blame | history
src/views/home/index.vue 135 ●●●●● patch | view | raw | blame | history
src/views/manage/index.vue 29 ●●●●● patch | view | raw | blame | history
src/api/equipment/equipment.js
@@ -46,7 +46,7 @@
    })
}
// 根据农场id获取设备列表 监控和监测在同一个集合
// 根据基地id获取设备列表 监控和监测在同一个集合
export const queryEquipmentList = (params) => {
    return request({
        url: 'http://dev.jxpskj.com:8030/pyh-station/stationAndVideo/queryEquipmentList',
src/api/farm/farmingrecord.js
@@ -12,7 +12,7 @@
    })
}
// 获取农场
// 获取基地
export const getFarmList = (current, size, params) => {
    return request({
        url: '/farm/getFarmList',
src/components/map/index.vue
@@ -244,9 +244,9 @@
            // })
        },
        /**
         * 添加农场点及范围的方法
         * 添加基地点及范围的方法
         * @param {*} positions 位置信息(范围信息)
         * @param {*} item 农场对应的所有信息(接口返回的数据)
         * @param {*} item 基地对应的所有信息(接口返回的数据)
         */
        addPolygon (positions, item) {
            const that = this
@@ -317,11 +317,17 @@
            polygon.setStyle({
                material: global.DC.Namespace.Cesium.Color.fromBytes(
                    129, 255, 84,
                    200
                    400
                )
            })
            polygon.on(global.DC.MouseEventType.CLICK, (e) => {
                polygon.setStyle({
                    material: global.DC.Namespace.Cesium.Color.fromBytes(
                        129, 255, 0,
                        200
                    )
                })
                that.$parent.plotDetailsPopupShow(e.overlay.attrParams)
            })
@@ -400,7 +406,7 @@
        /**
         * 设置中心点
         * @param {*} name 对应站点(农场范围)的中心点 --- 对应的名字
         * @param {*} name 对应站点(基地范围)的中心点 --- 对应的名字
         */
        setCenter (name) {
            let center
@@ -412,7 +418,7 @@
            if (center == '') {
                this.$message({
                    message: '当前农场暂未绘制',
                    message: '当前基地暂未绘制',
                    type: 'warning'
                })
                return
@@ -523,12 +529,12 @@
            }
            return centerLonLat
        },
        // 隐藏农场标记图层
        // 隐藏基地标记图层
        hiddenFarmLayer () {
            farmLogoLayer.show = false
            farmRegionLayer.show = false
        },
        // 显示农场标记图层
        // 显示基地标记图层
        showFarmLayer () {
            farmLogoLayer.show = true
            farmRegionLayer.show = true
src/router/page/index.js
@@ -78,7 +78,7 @@
    {
        path: '/farmDetails',
        meta: {
            title: '农场详情'
            title: '基地详情'
        },
        component: () => import('../../views/farm/index.vue')
    },
src/views/farm/index.vue
@@ -31,7 +31,7 @@
            <div class="tab-btn">
                <div>
                    <div class="item" :class="{on: ncjscz == 'ncjs'}">
                        <div @click="ncjscz = 'ncjs'" class="title">农场介绍</div>
                        <div @click="ncjscz = 'ncjs'" class="title">基地介绍</div>
                        <span></span>
                    </div>
                </div>
@@ -45,12 +45,12 @@
            </div>
            <div v-show="ncjscz == 'ncjs'" class="detail-box">
                <div class="item">
                    <div class="name">农场名称:</div>
                    <div class="name">基地名称:</div>
                    <div class="deserve">{{this.currentDetails.farmName}}</div>
                </div>
                <div class="item">
                    <div class="name">农场地址:</div>
                    <div class="name">基地地址:</div>
                    <div class="deserve">{{this.currentDetails.farmAddress}}</div>
                </div>
@@ -65,7 +65,7 @@
                </div>
                <div class="item">
                    <div class="name">农场简介:</div>
                    <div class="name">基地简介:</div>
                    <div class="deserve">{{this.currentDetails.introduce}}</div>
                </div>
            </div>
@@ -1081,6 +1081,7 @@
        width: 440px;
        height: 640px;
        background: #06344e;
        border-radius: 30px;
        .tab-btn {
            display: flex;
@@ -1318,8 +1319,8 @@
        .border-box {
            position: absolute;
            width: 18px;
            height: 18px;
            width: 70px;
            height: 54px;
            z-index: 0;
        }
@@ -1328,24 +1329,28 @@
            left: -2px;
            border-top: 3px solid #09e2ef;
            border-left: 3px solid #09e2ef;
            border-top-left-radius: 30px;
        }
        .t-r-border {
            top: -2px;
            right: -2px;
            border-top: 3px solid #09e2ef;
            border-right: 3px solid #09e2ef;
            border-top-right-radius: 30px;
        }
        .b-l-border {
            bottom: -2px;
            left: -2px;
            border-bottom: 3px solid #09e2ef;
            border-left: 3px solid #09e2ef;
            border-bottom-left-radius: 30px;
        }
        .b-r-border {
            bottom: -2px;
            right: -2px;
            border-bottom: 3px solid #09e2ef;
            border-right: 3px solid #09e2ef;
            border-bottom-right-radius: 30px;
        }
    }
src/views/home/index.vue
@@ -27,7 +27,7 @@
                    <div class="content-box">
                        <div class="nc-num">
                            <div class="text">
                                农场数量
                                基地数量
                                <span class="num">{{ncnum}}</span>
                            </div>
                            <div class="t-l"></div>
@@ -206,7 +206,7 @@
                >
                    <div class="l">
                        <i class="el-icon-my-nc-menu"></i>
                        <span :class="{'checked': ncListShow}">农场</span>
                        <span :class="{'checked': ncListShow}">基地</span>
                    </div>
                    <i :class="{'el-icon-arrow-down': !ncListShow, 'el-icon-arrow-up': ncListShow}"></i>
@@ -302,7 +302,7 @@
                <li>
                    <input type="checkbox" v-model="showIconNC" />
                    <div class="icon"></div>
                    <div class="title">农场</div>
                    <div class="title">基地</div>
                </li>
                <li>
                    <input type="checkbox" v-model="showIconDK" />
@@ -340,7 +340,7 @@
            </template>
            <template slot="public-box-content">
                <div class="market-title">
                    <el-select v-model="farm.id" placeholder="请选择农场" @change="scFarmChange">
                    <el-select v-model="farm.id" placeholder="请选择基地" @change="scFarmChange">
                        <el-option
                            v-for="item in farmNumArray"
                            :key="item.id"
@@ -409,7 +409,7 @@
                <div class="farm-profiles">
                    <div class="btn-grounp">
                        <div class="details" @click="goPath">
                            进入农场
                            进入基地
                            <i class="el-icon-arrow-right"></i>
                        </div>
                        <div class="scene">
@@ -433,7 +433,7 @@
                            <div class="r">{{this.farmDetails.slogan}}</div>
                        </div>
                        <div class="row">
                            <div class="l">农场介绍</div>
                            <div class="l">基地介绍</div>
                            <div class="r" style="line-height: 32px;">{{this.farmDetails.introduce}}</div>
                        </div>
                        <div class="row">
@@ -702,6 +702,80 @@
                </div>
            </template>
        </public-box>
        <public-nape-box
            v-show="napePlotPopupFlag"
            :closeFlag="'napePlotPopupFlag'"
            :className="'public-nape-plot-details'"
        >
            <template slot="public-box-header">
                <div
                    @click="plotDetailsClick('zypz')"
                    :class="{on: plotDetailsNape == 'zypz'}"
                    class="nav"
                >种养品种</div>
                <div
                    @click="plotDetailsClick('nscz')"
                    :class="{on: plotDetailsNape == 'nscz'}"
                    class="nav"
                >农事操作</div>
                <div
                    @click="plotDetailsClick('base')"
                    :class="{on: plotDetailsNape == 'base'}"
                    class="nav"
                >基础信息</div>
            </template>
            <template slot="public-box-content">
                <div v-show="plotDetailsNape == 'zypz'" class="box zypz-box">
                    <div
                        v-for="(item, index) in plotDetailsPlantList"
                        :key="'plotDetailsPlantList'+index"
                    >
                        <img class="logo" :src="item.url" alt />
                        <div class="titles-box">
                            <div class="title">{{item.strainName}}</div>
                            <div
                                class="time"
                            >{{item.createTime}} {{item.plantingWay == 0 ? '移摘' : item.plantingWay == 1 ? '直播' : '秧苗'}}</div>
                        </div>
                    </div>
                </div>
                <div v-show="plotDetailsNape == 'nscz'" class="box nscz-box">
                    <div
                        v-for="(item, index) in plotDetailsRecordList"
                        :key="'plotDetailsRecordList'+index"
                    >
                        <div class="t-border"></div>
                        <div class="t-item">
                            <div class="type">{{item.typeName}}</div>
                            <div class="manure" v-show="item.type == 0">{{item.agriculturalName}}</div>
                            <div class="date">{{item.time}}</div>
                        </div>
                        <div class="b-item">
                            <div class="variety">{{item.strainName}}</div>
                            <div class="pel">{{item.realName}}</div>
                            <div class="plot">{{item.landName}}</div>
                        </div>
                    </div>
                </div>
                <div v-show="plotDetailsNape == 'base'" class="box base-box">
                    <div class="plot-name">
                        <div class="sub-title">地块名称</div>
                        <div class="current-val">{{currentClickPlot.landName}}</div>
                    </div>
                    <div class="plot-area">
                        <div class="sub-title">地块面积</div>
                        <div
                            class="current-val"
                        >{{currentClickPlot.landArea}} {{currentClickPlot.landUnit}}</div>
                    </div>
                    <div class="plot-type">
                        <div class="sub-title">地块类型</div>
                        <div class="current-val">{{currentClickPlot.landType}}</div>
                    </div>
                </div>
            </template>
        </public-nape-box>
    </div>
</template>
@@ -722,8 +796,7 @@
    getFarmList,
    getLandList,
    getFarmingRecordList,
    getFarmPlantList
} from '@/api/farm/farmingrecord'
// eslint-disable-next-line no-unused-vars
import { selectXCount } from '@/api/land/land'
@@ -768,9 +841,9 @@
            farmOperList: [],
            // 选择的农事类型
            farmOperType: '',
            // 农场地块id
            // 基地地块id
            farmPlotId: '',
            // 全局农场参数
            // 全局基地参数
            farmID: '',
            // 设备
            mTotalObj: {},
@@ -796,6 +869,14 @@
            // 监测列表index
            jcIndex: 0,
            flvPlayer: null,
            // 地块详情弹框默认选中
            plotDetailsNape: 'zypz',
            // 地块详情中的种养品种
            plotDetailsPlantList: [],
            // 地块详情中的农事操作
            plotDetailsRecordList: [],
            currentClickPlot: {},
            napePlotPopupFlag: false,
        }
    },
    created () {
@@ -1298,7 +1379,7 @@
                that.farmingList = res.data.data
            })
        },
        // 农场使用率
        // 基地使用率
        selectXCount () {
            // eslint-disable-next-line no-unused-vars
            var that = this
@@ -1836,6 +1917,38 @@
                this.flvPlayer.play()
            }
        },
        // 地图地块点击
        plotDetailsPopupShow (params) {
            this.plotDetailsNape = 'zypz'
            this.currentClickPlot = params
            this.plotDetailsPlantList = []
            this.plotDetailsRecordList = []
            getFarmPlantList({ landId: params.id }).then(res => {
                this.plotDetailsPlantList = res.data.data
            })
            getFarmingRecordList({ landId: params.id }).then(res => {
                this.plotDetailsRecordList = res.data.data
            })
            this.napePlotPopupFlag = true
        },
        getFarmingRecordList () {
            getFarmingRecordList({ farmId: this.currentDetails.id }).then(res => {
                this.farmRecordList = res.data.data
            })
        },
        getFarmPlantList () {
            getFarmPlantList({ farmId: this.currentDetails.id, status: 1 }).then(res => {
                this.farmPlantList = res.data.data
            })
        },
        // 地块详情弹框中切换
        plotDetailsClick (type) {
            this.plotDetailsNape = type
        },
    }
}
src/views/manage/index.vue
@@ -11,7 +11,7 @@
            <el-select
                v-model="farmValue"
                @change="farmSelectChange"
                placeholder="请选择农场"
                placeholder="请选择基地"
                :popper-append-to-body="false"
            >
                <el-option
@@ -652,7 +652,7 @@
            farmOperList: [],
            // 选择的农事类型
            farmOperType: "",
            // 农场地块id
            // 基地地块id
            farmPlotId: "",
            // 地块下拉
            plotNumArray: [],
@@ -664,7 +664,7 @@
            stockrecordAll: [],
            // 农产品监管记录弹窗
            ncpAll: [],
            // 农场下拉
            // 基地下拉
            farmSelect: [],
            // 所选值
            farmValue: 1,
@@ -674,15 +674,15 @@
        }
    },
    created () {
        // 农场下拉列表
        // 基地下拉列表
        this.farmSelectQuery()
        // 默认查询第一个农场数据
        // 默认查询第一个基地数据
        this.AllDataUpdate()
    },
    mounted () { },
    methods: {
        // 农场下拉选中事件
        // 基地下拉选中事件
        farmSelectChange (e) {
            this.AllDataUpdate()
        },
@@ -717,7 +717,7 @@
            // 溯源次数统计
            this.getSweepRecordStatistics()
        },
        // 农场下拉列表
        // 基地下拉列表
        farmSelectQuery () {
            var params = {}
            params.current = "1"
@@ -1099,7 +1099,7 @@
            for (var i = 0; i < 5; i++) {
                sum += Number(data[i])
                echartData.push({
                    name: dj[i],
                    name: dj[i] + '(' + data[i] + '公斤)',
                    value: data[i],
                })
            }
@@ -1111,7 +1111,10 @@
                    top: "5%",
                    padding: [50, 100, 0, 0],
                    orient: "vertical",
                    left: "right",
                    left: "left",
                    textStyle: {
                        color: "rgba(255,255,255,0.6)",
                    },
                },
                series: [
                    {
@@ -1313,7 +1316,7 @@
            }
            option && myChart.setOption(option)
        },
        // 农场使用率
        // 基地使用率
        selectXCount () {
            // eslint-disable-next-line no-unused-vars
            var that = this
@@ -1450,7 +1453,7 @@
        // 溯源次数统计
        getSweepRecordStatistics () {
            var params = {}
            // 农场id
            // 基地id
            params.farmId = this.farmValue
            getSweepRecordStatistics(Object.assign(params)).then((res) => {
                this.sweepList = res.data.data
@@ -1459,7 +1462,7 @@
        // 溯源趋势统计
        getSweepRecordStatisticsByDayOrMonthOrYear (year) {
            var params = {}
            // 农场id
            // 基地id
            params.farmId = this.farmValue
            params.time = year
            getSweepRecordStatisticsByDayOrMonthOrYear(Object.assign(params)).then(
@@ -1504,7 +1507,7 @@
        // 地块下拉
        getLandList () {
            var params = {}
            // 农场id
            // 基地id
            params.farmId = this.farmValue
            getLandList(Object.assign(params)).then((res) => {
                this.plotNumArray = res.data.data