From e57c42d8338904f0045a72665f2ad43b5012cc53 Mon Sep 17 00:00:00 2001
From: shuishen <1109946754@qq.com>
Date: Fri, 29 Jul 2022 08:58:50 +0800
Subject: [PATCH] map修改
---
src/views/mapPattern/index.vue | 735 +++++++++++++++++++++++++++++---------------------------
1 files changed, 379 insertions(+), 356 deletions(-)
diff --git a/src/views/mapPattern/index.vue b/src/views/mapPattern/index.vue
index ddec951..a33ad27 100644
--- a/src/views/mapPattern/index.vue
+++ b/src/views/mapPattern/index.vue
@@ -1,413 +1,436 @@
<template>
- <div style="width: 1920px;
- height: 1080px;
- background: #FFFFFF;
- border-radius: 0px 0px 0px 0px;
- opacity: 1;">
- <div class="top">
- <div class="logo">
- <img src="../../../public/mg.png" />
- </div>
- <div class="farm-info">
- <div class="farm-name">
- <span>{{ farmInfo.farmName }}</span>
- </div>
- <div class="farm-area">
- <span>地块总面积:</span>
- <span style="font-size: 16px;font-weight: bold;"> {{landAreaInfo.zarea}}亩</span>
-
- <span>在田面积:</span>
- <span style="font-size: 16px;font-weight: bold;"> {{landAreaInfo.sarea}}亩</span>
- </div>
- </div>
- <div class="out" @click="goToBack">
- <img src="../../../public/img/out.png" />
- <span> 退出</span>
- </div>
- </div>
- <div class="down">
- <div class="farm-plant">
- <div class="title"><span>种养品种 · {{ this.page.total }}种</span></div>
- <div class="content">
- <div class="list-item" v-for="item in farmPlantList">
- <div class="item-img">
- <img :src="item.url" />
- <span>{{ item.strainName }}</span>
+ <div style="position: relative; height: 100%;">
+ <plot-map ref="plotMap" style="position: absolute; width: 100%; height: 100%;"></plot-map>
+ <div class="top">
+ <div class="logo">
+ <img src="../../../public/mg.png" />
</div>
- <div class="item-num">{{ item.area }}亩</div>
- </div>
- </div>
- </div>
- <div class="land-info">
- <div class="content">
- <span>有轮廓的地块:</span><span style="font-size: 26px;font-weight: bold;color: #5ABF78;"> {{landIsAreaStatistic[0]}}</span>
-
- <span>无轮廓的地块:</span><span style="font-size: 26px;font-weight: bold;color: #E3B745;"> {{landIsAreaStatistic[1]}}</span>
- </div>
- </div>
- <div class="farm-land">
- <div class="title"><span>地块 · {{ this.pageLand.total }}种</span></div>
- <div class="content">
- <div class="list-item" v-for="item in landList">
- <div class="item-img">
- <img :src="item.url" />
- <span>{{ item.landName }}</span>
+ <div class="farm-info">
+ <div class="farm-name">
+ <span>{{ farmInfo.farmName }}</span>
+ </div>
+ <div class="farm-area">
+ <span>地块总面积:</span>
+ <span style="font-size: 16px;font-weight: bold;"> {{landAreaInfo.zarea}}亩</span>
+
+ <span>在田面积:</span>
+ <span style="font-size: 16px;font-weight: bold;"> {{landAreaInfo.sarea}}亩</span>
+ </div>
</div>
- <div class="item-num">{{ item.landArea }}亩</div>
- </div>
+ <div class="out" @click="goToBack">
+ <img src="../../../public/img/out.png" />
+ <span> 退出</span>
+ </div>
</div>
- </div>
+ <div class="farm-plant">
+ <div class="title">
+ <span>种养品种 · {{ this.page.total }}种</span>
+ </div>
+ <div class="content">
+ <div class="list-item" v-for="(item, index) in farmPlantList" :key="index">
+ <div class="item-img">
+ <img :src="item.url" />
+ <span>{{ item.strainName }}</span>
+ </div>
+ <div class="item-num">{{ item.area }}亩</div>
+ </div>
+ </div>
+ </div>
+ <div class="land-info">
+ <div class="content">
+ <span>有轮廓的地块:</span>
+ <span
+ style="font-size: 26px;font-weight: bold;color: #5ABF78;"
+ > {{landIsAreaStatistic[0]}}</span>
+
+ <span>无轮廓的地块:</span>
+ <span
+ style="font-size: 26px;font-weight: bold;color: #E3B745;"
+ > {{landIsAreaStatistic[1]}}</span>
+ </div>
+ </div>
+ <div class="farm-land">
+ <div class="title">
+ <span>地块 · {{ this.pageLand.total }}种</span>
+ </div>
+ <div class="content">
+ <div class="list-item" v-for="(item, index) in landList" :key="index">
+ <div class="item-img">
+ <img :src="item.url" />
+ <span>{{ item.landName }}</span>
+ </div>
+ <div class="item-num">{{ item.landArea }}亩</div>
+ </div>
+ </div>
+ </div>
</div>
- </div>
</template>
<script>
import { mapGetters } from "vuex"
-import { getList } from "@/api/farmplant/farmplant";
-import { getList as getLandList, selectCount,getLandIsAreaStatistic } from "@/api/land/land";
-import { getDetails } from "@/api/farm/farm";
+import { getList } from "@/api/farmplant/farmplant"
+import { getList as getLandList, selectCount, getLandIsAreaStatistic } from "@/api/land/land"
+import { getDetails } from "@/api/farm/farm"
export default {
- components: {
- },
- data() {
- return {
- page: {
- pageSize: 10,
- currentPage: 1,
- total: 0,
- },
- pageLand: {
- pageSize: 10,
- currentPage: 1,
- total: 0,
- },
- farmPlantList: [],
- landList: [],
- farmInfo: {},
- landAreaInfo:{},
- landIsAreaStatistic:null,
- }
+ components: {
+ },
+ data () {
+ return {
+ page: {
+ pageSize: 10,
+ currentPage: 1,
+ total: 0,
+ },
+ pageLand: {
+ pageSize: 10,
+ currentPage: 1,
+ total: 0,
+ },
+ farmPlantList: [],
+ landList: [],
+ farmInfo: {},
+ landAreaInfo: {},
+ landIsAreaStatistic: null,
+ }
- },
- computed: {
- ...mapGetters(["userInfo"]),
- },
- created() {
- //获取种样品列表
- this.getFarmPlantList(this.page);
- //获取地块列表
- this.getLandList(this.pageLand);
- //获取农场信息
- this.getFarmInfo();
- //获取统计面积信息
- this.getLandCount();
- //获取地块轮廓统计信息
- this.getLandIsAreaStatistic();
- },
- methods: {
- //获取种养品列表
- getFarmPlantList(page, params = {}) {
- params['farmId'] = this.userInfo.farmId;
- this.loading = true;
- getList(
- page.currentPage,
- page.pageSize,
- Object.assign(params)
- ).then((res) => {
- const data = res.data.data;
- this.page.total = data.total;
- this.farmPlantList = data.records;
- this.loading = false;
- this.selectionClear();
- });
},
- //获取地块列表
- getLandList(page, params = {}) {
- params['farmId'] = this.userInfo.farmId;
- params['tenantId'] = this.userInfo.tenant_id;
- this.loading = true;
- getLandList(
- page.currentPage,
- page.pageSize,
- Object.assign(params)
- ).then((res) => {
- const data = res.data.data;
- this.pageLand.total = data.total;
- this.landList = data.records;
- this.loading = false;
- this.selectionClear();
- });
+ computed: {
+ ...mapGetters(["userInfo"]),
},
- //返回上一页
- goToBack() {
- this.$router.go(-1)
+ created () {
+ //获取种样品列表
+ this.getFarmPlantList(this.page)
+ //获取地块列表
+ this.getLandList(this.pageLand)
+ //获取农场信息
+ this.getFarmInfo()
+ //获取统计面积信息
+ this.getLandCount()
+ //获取地块轮廓统计信息
+ this.getLandIsAreaStatistic()
},
- //获取农场信息
- getFarmInfo() {
- var that = this;
- getDetails(this.userInfo.farmId).then(res => {
- that.farmInfo = res.data.data;
- })
- },
- //获取统计面积信息
- getLandCount() {
- selectCount(this.userInfo.farmId).then(res => {
- this.landAreaInfo = res.data.data;
- })
- },
- //获取地块轮廓统计信息
- getLandIsAreaStatistic(){
- getLandIsAreaStatistic(this.userInfo.farmId).then(res=>{
- this.landIsAreaStatistic = res.data.data;
- })
+ methods: {
+ //获取种养品列表
+ getFarmPlantList (page, params = {}) {
+ params['farmId'] = this.userInfo.farmId
+ this.loading = true
+ getList(
+ page.currentPage,
+ page.pageSize,
+ Object.assign(params)
+ ).then((res) => {
+ const data = res.data.data
+ this.page.total = data.total
+ this.farmPlantList = data.records
+ this.loading = false
+ // this.selectionClear()
+ })
+ },
+ //获取地块列表
+ getLandList (page, params = {}) {
+ params['farmId'] = this.userInfo.farmId
+ params['tenantId'] = this.userInfo.tenant_id
+ this.loading = true
+ getLandList(
+ page.currentPage,
+ page.pageSize,
+ Object.assign(params)
+ ).then((res) => {
+ const data = res.data.data
+
+ data.records.forEach(item => {
+ if (item.landRange != '' || item.landRange != null) {
+ item.landRange = item.landRange.replace(/POLYGON\(\(/g, '')
+ item.landRange = item.landRange.replace(/\)\)/g, '')
+
+ const arr = item.landRange.split(',')
+ var brr = []
+ arr.forEach(it => {
+ brr.push(it.split(' '))
+ })
+
+ this.$refs.plotMap.addPlotPolygon(brr, item)
+ }
+ })
+
+ this.pageLand.total = data.total
+ this.landList = data.records
+ this.loading = false
+ // this.selectionClear()
+ })
+ },
+ //返回上一页
+ goToBack () {
+ this.$router.go(-1)
+ },
+ //获取农场信息
+ getFarmInfo () {
+ var that = this
+ getDetails(this.userInfo.farmId).then(res => {
+ that.farmInfo = res.data.data
+ })
+ },
+ //获取统计面积信息
+ getLandCount () {
+ selectCount(this.userInfo.farmId).then(res => {
+ this.landAreaInfo = res.data.data
+ })
+ },
+ //获取地块轮廓统计信息
+ getLandIsAreaStatistic () {
+ getLandIsAreaStatistic(this.userInfo.farmId).then(res => {
+ this.landIsAreaStatistic = res.data.data
+ })
+ }
}
- }
}
</script>
<style lang="scss" scope>
.top {
- width: 100%;
- height: 80px;
- background: #000000;
- border-radius: 0px 0px 0px 0px;
- opacity: 0.5;
-
- .logo {
position: absolute;
- left: 36px;
- top: 12px;
-
- img {
- height: 55px;
- }
- }
-
- .farm-info {
- height: 100%;
+ top: 0;
width: 100%;
+ height: 80px;
+ background: rgba(0, 0, 0, 0.5);
+ z-index: 9;
- .farm-name {
- width: 100%;
- height: 33px;
- font-size: 25px;
- font-weight: bold;
- color: #5ABF78;
- text-align: center;
- padding-top: 13px;
+ .logo {
+ position: absolute;
+ left: 36px;
+ top: 12px;
+
+ img {
+ height: 55px;
+ }
}
- .farm-area {
- width: 100%;
- height: 19px;
- font-size: 14px;
- font-weight: 400;
- color: #FFFFFF;
- text-align: center;
- padding-top: 6px;
- }
- }
+ .farm-info {
+ height: 100%;
+ width: 100%;
- .out {
- width: 136px;
- height: 33px;
- line-height: 33px;
- background: rgba(236, 95, 89, 0.8000);
- border-radius: 4px 4px 4px 4px;
- opacity: 1;
- border: 1px solid #EC5F59;
- position: absolute;
- top: 24px;
- right: 33px;
- text-align: center;
- cursor: pointer;
+ .farm-name {
+ width: 100%;
+ height: 33px;
+ font-size: 25px;
+ font-weight: bold;
+ color: #5abf78;
+ text-align: center;
+ padding-top: 13px;
+ }
- img {
- width: 12px;
- height: 18px;
- position: relative;
- top: 4px;
- }
-
- span {
- font-size: 14px;
- color: #FFFFFF;
- font-weight: 400;
- }
- }
-
-
-}
-
-.down {
- width: 100%;
-
- .farm-plant {
- width: 292px;
- height: 550px;
- position: absolute;
- left: 30px;
- top: 242px;
-
- .title {
- width: 292px;
- height: 50px;
- background: #5ABF78;
- border-radius: 4px 4px 0px 0px;
- opacity: 1;
- line-height: 50px;
- font-size: 17px;
- font-weight: bold;
- color: #FFFFFF;
-
- span {
- margin-left: 20px;
- }
- }
-
- .content {
- width: 292px;
- // height: 500px;
- background: #08551E;
- border-radius: 4px 4px 0px 0px;
- opacity: 0.9;
- padding-bottom: 30px;
-
- .list-item {
- width: 252px;
- margin: auto;
- display: flex;
- height: 64px;
- line-height: 64px;
- border-bottom: 1px solid #cccccc;
- flex-flow: row nowrap;
- justify-content: space-between;
-
- .item-img {
- margin-left: 5px;
- display: flex;
-
- img {
- margin-top: 12px;
- width: 40px;
- height: 40px;
- background: #2389EF;
- border-radius: 84px 84px 84px 84px;
- opacity: 1;
- }
-
- span {
- margin-left: 11px;
+ .farm-area {
+ width: 100%;
+ height: 19px;
font-size: 14px;
font-weight: 400;
- color: #FFFFFF;
- }
+ color: #ffffff;
+ text-align: center;
+ padding-top: 6px;
}
-
- .item-num {
- font-size: 14px;
- font-weight: 400;
- color: #FFFFFF;
- }
-
-
- }
}
+ .out {
+ width: 136px;
+ height: 33px;
+ line-height: 33px;
+ background: rgba(236, 95, 89, 0.8);
+ border-radius: 4px 4px 4px 4px;
+ opacity: 1;
+ border: 1px solid #ec5f59;
+ position: absolute;
+ top: 24px;
+ right: 33px;
+ text-align: center;
+ cursor: pointer;
- }
+ img {
+ width: 12px;
+ height: 18px;
+ position: relative;
+ top: 4px;
+ }
- .land-info{
+ span {
+ font-size: 14px;
+ color: #ffffff;
+ font-weight: 400;
+ }
+ }
+}
+
+.land-info {
width: 100%;
position: absolute;
top: 112px;
- .content{
- margin: auto;
- width: 431px;
- height: 56px;
- background: #000000;
- border-radius: 28px 28px 28px 28px;
- opacity: 0.5;
- display: flex;
- justify-content: center;
- align-items:center;
- font-size: 16px;
- font-weight: 400;
- color: #FFFFFF;
+ .content {
+ margin: auto;
+ width: 431px;
+ height: 56px;
+ background: rgba(0, 0, 0, 0.5);
+ border-radius: 28px 28px 28px 28px;
+ display: flex;
+ justify-content: center;
+ align-items: center;
+ font-size: 16px;
+ font-weight: 400;
+ color: #ffffff;
}
- }
+}
- .farm-land {
+.farm-plant {
+ position: absolute;
+ left: 30px;
+ top: 242px;
+ z-index: 99;
+
width: 292px;
height: 550px;
+
+ .title {
+ width: 292px;
+ height: 50px;
+ background: #5abf78;
+ border-radius: 4px 4px 0px 0px;
+ opacity: 1;
+ line-height: 50px;
+ font-size: 17px;
+ font-weight: bold;
+ color: #ffffff;
+
+ span {
+ margin-left: 20px;
+ }
+ }
+
+ .content {
+ width: 292px;
+ height: calc(100% - 50px);
+ background: rgba(8, 85, 30, 0.9);
+ // height: 500px;
+ border-radius: 4px 4px 0px 0px;
+ opacity: 0.9;
+ padding-bottom: 30px;
+
+ overflow-x: hidden;
+ overflow-y: auto;
+
+ .list-item {
+ width: 252px;
+ margin: auto;
+ display: flex;
+ height: 64px;
+ line-height: 64px;
+ border-bottom: 1px solid #cccccc;
+ flex-flow: row nowrap;
+ justify-content: space-between;
+
+ .item-img {
+ margin-left: 5px;
+ display: flex;
+
+ img {
+ margin-top: 12px;
+ width: 40px;
+ height: 40px;
+ background: #2389ef;
+ border-radius: 84px 84px 84px 84px;
+ opacity: 1;
+ }
+
+ span {
+ margin-left: 11px;
+ font-size: 14px;
+ font-weight: 400;
+ color: #ffffff;
+ }
+ }
+
+ .item-num {
+ font-size: 14px;
+ font-weight: 400;
+ color: #ffffff;
+ }
+ }
+ }
+}
+
+.farm-land {
position: absolute;
right: 30px;
top: 242px;
- .title {
- width: 292px;
- height: 50px;
- background: #5ABF78;
- border-radius: 4px 4px 0px 0px;
- opacity: 1;
- line-height: 50px;
- font-size: 17px;
- font-weight: bold;
- color: #FFFFFF;
+ z-index: 99;
- span {
- margin-left: 20px;
- }
+ width: 292px;
+ height: 550px;
+
+ .title {
+ width: 292px;
+ height: 50px;
+ background: #5abf78;
+ border-radius: 4px 4px 0px 0px;
+ opacity: 1;
+ line-height: 50px;
+ font-size: 17px;
+ font-weight: bold;
+ color: #ffffff;
+
+ span {
+ margin-left: 20px;
+ }
}
.content {
- width: 292px;
- // height: 500px;
- background: #08551E;
- border-radius: 4px 4px 0px 0px;
- opacity: 0.9;
- padding-bottom: 30px;
+ width: 292px;
+ height: calc(100% - 50px);
+ background: rgba(8, 85, 30, 0.9);
+ // height: 500px;
- .list-item {
- width: 252px;
- margin: auto;
- display: flex;
- height: 64px;
- line-height: 64px;
- border-bottom: 1px solid #cccccc;
- flex-flow: row nowrap;
- justify-content: space-between;
+ border-radius: 4px 4px 0px 0px;
+ opacity: 0.9;
+ padding-bottom: 30px;
- .item-img {
- margin-left: 5px;
- display: flex;
+ overflow-x: hidden;
+ overflow-y: auto;
- img {
- margin-top: 12px;
- width: 40px;
- height: 40px;
- background: #2389EF;
- border-radius: 84px 84px 84px 84px;
- opacity: 1;
- }
+ .list-item {
+ width: 252px;
+ margin: auto;
+ display: flex;
+ height: 64px;
+ line-height: 64px;
+ border-bottom: 1px solid #cccccc;
+ flex-flow: row nowrap;
+ justify-content: space-between;
- span {
- margin-left: 11px;
- font-size: 14px;
- font-weight: 400;
- color: #FFFFFF;
- }
+ .item-img {
+ margin-left: 5px;
+ display: flex;
+
+ img {
+ margin-top: 12px;
+ width: 40px;
+ height: 40px;
+ background: #2389ef;
+ border-radius: 84px 84px 84px 84px;
+ opacity: 1;
+ }
+
+ span {
+ margin-left: 11px;
+ font-size: 14px;
+ font-weight: 400;
+ color: #ffffff;
+ }
+ }
+
+ .item-num {
+ font-size: 14px;
+ font-weight: 400;
+ color: #ffffff;
+ }
}
-
- .item-num {
- font-size: 14px;
- font-weight: 400;
- color: #FFFFFF;
- }
-
-
- }
}
- }
}
</style>
--
Gitblit v1.9.3