From 5bc6506e55196f8af6f9290e4d7a465d0cb2c0b3 Mon Sep 17 00:00:00 2001
From: zmj <1493694146@qq.com>
Date: Sun, 24 Dec 2023 21:56:23 +0800
Subject: [PATCH] =?UTF-8?q?=E8=AE=BE=E5=A4=87=E5=91=8A=E8=AD=A6=E4=BF=AE?=
=?UTF-8?q?=E6=94=B9?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
src/api.js | 4 +-
src/components/areaList.vue | 2 +
src/components/areaMap.vue | 117 ++++++++++++++++++++-----
src/components/detail/centerBottom.vue | 15 ++--
src/components/detail/leftCenter.vue | 21 ++---
src/components/detail/leftTop.vue | 18 ++--
src/components/detail/rightBottom.vue | 9 +-
src/components/detail/rightTop.vue | 12 ++-
src/components/farmerMap.vue | 95 ++++++++++++++------
src/components/index/centerBottom.vue | 7 +-
src/components/index/leftTop.vue | 1 -
src/components/warnDetail.vue | 9 +-
src/components/warnPop.vue | 15 ++--
src/store/index.js | 10 ++-
src/view/detail.vue | 59 ++++++++++---
src/view/home.vue | 16 +++-
16 files changed, 290 insertions(+), 120 deletions(-)
diff --git a/src/api.js b/src/api.js
index 14ce336..5ee308c 100644
--- a/src/api.js
+++ b/src/api.js
@@ -5,7 +5,9 @@ import axios from "axios";
// 创建axios 实例
const instacne = axios.create({
- baseURL: "http://ceshi-suyuan.lihaink.cn/",
+ // baseURL: "http://ceshi-suyuan.lihaink.cn/",
+ baseURL: "https://suyuan.lihaink.cn/",
+
timeout: 30000,
});
diff --git a/src/components/areaList.vue b/src/components/areaList.vue
index 10cbf01..c5fc531 100644
--- a/src/components/areaList.vue
+++ b/src/components/areaList.vue
@@ -42,6 +42,8 @@ const choseTownFn = (item) => {
axios.get(`https://crmeb-test.shop.lihaink.cn/api/city/get_street?area_code=${510521}`)
.then(function (response) {
+
+ userInfoStore.changeareaCodeList(response.data.data)
response.data.data.forEach(item => {
areaList.push(item)
})
diff --git a/src/components/areaMap.vue b/src/components/areaMap.vue
index cfe3a08..0100a24 100644
--- a/src/components/areaMap.vue
+++ b/src/components/areaMap.vue
@@ -42,6 +42,8 @@ import * as echarts from 'echarts';
import geoJson from "/static/jsonData/luxian_geo.js"
import { useRouter } from "vue-router"
import { areaObj } from "@/store/index.js"
+import { landListApi } from "@/api.js"
+
const areaStore = areaObj()
const showArea = (ref(true))
@@ -86,9 +88,24 @@ const pointerFn = () => {
})
return list
}
-
+const pointerFn2 = (lists) => {
+ let list = []
+ lists.forEach((item, index) => {
+ list.push({
+ coord: item.value,
+ value: item.name,
+ animation: true,
+ symbol: index == geoJson.center.length - 1 ? ('image://' + lx) : ('image://' + icon),// 自定义图片路径
+ symbolSize: [100, 30], // 图片大小
+ symbolOffset: ['50%', '-50%'],
+ data: lists,
+
+ },)
+ })
+ return list
+}
const initAreaMap = () => {
- showArea.value=true
+ showArea.value = true
var mapName = 'lz';
const myChart = document.getElementById("chart2")
let option = {
@@ -298,7 +315,12 @@ const initAreaMap = () => {
const bg = echarts.init(myChart)
bg.setOption(option);
bg.on('click', function (params) {
- areaStore.changeAddress('',params.name||params.value)
+ areaStore.areaCodeList.forEach(item => {
+ if (item.name == (params.name||params.value)) {
+ areaStore.changeUserInfoFn(510521, item.code)
+ }
+ })
+ areaStore.changeAddress('', params.name || params.value)
initTownMap(params.name || params.value)
@@ -306,13 +328,45 @@ const initAreaMap = () => {
}
-const initTownMap = (name) => {
+const initTownMap = async (name) => {
showArea.value = false
+ let center = []
+ let pointerList = []
+ let res = await landListApi({
+ ...areaStore.userInfo
+ })
+
+ console.log(res.data,4545)
+
+ res.data.list.forEach(item => {
+
+ center.push([item.longitude, item.latitude])
+ pointerList.push({
+ value: [item.longitude, item.latitude],
+ name: item.title,
+ id: item.id
+ })
+ })
+ console.log(center,'center')
+ // let center2 = [[105.33113, 29.121584], [105.329675, 29.122785], [105.329046, 29.123046], [105.328221, 29.123388], [105.266415, 29.138461], [105.266196, 29.167795]]
+ let pointerList2 = []
+ center.forEach((item, index) => {
+ pointerList2.push({
+ value: item,
+ name: "土地" + index,
+ id: 18
+ })
+ })
const townJson = deepCopy(geoJson)
+
+
+
townJson.features = townJson.features.filter((item) => {
return item.properties.name == name
})
+
+
var mapName = 'town';
const myChart = document.getElementById("chart3")
let option = {
@@ -492,27 +546,27 @@ const initTownMap = (name) => {
// return val[2] / 10;
},
markPoint: {
- // data: pointerFn()
+ data: pointerFn2(pointerList2)
},
- // data: (() => {
- // let data = {
- // 资产数: geoJson.center
+ data: (() => {
+ let data = {
+ 资产数: center
- // }
- // let finalData = []
- // Object.keys(data).map((i, index) => {
- // let child = data[i].map((row, index) => ({
- // value: row,
- // itemStyle: {
- // color: index == geoJson.center.length - 1 ? '#FEB821' : '#F0733A',
- // },
- // }))
+ }
+ let finalData = []
+ Object.keys(data).map((i, index) => {
+ let child = data[i].map((row, index) => ({
+ value: row,
+ itemStyle: {
+ color: index == geoJson.center.length - 1 ? '#FEB821' : '#F0733A',
+ },
+ }))
- // finalData = [...finalData, ...child]
- // })
- // return finalData
- // })(),
+ finalData = [...finalData, ...child]
+ })
+ return finalData
+ })(),
},
],
};
@@ -521,6 +575,22 @@ const initTownMap = (name) => {
const bg = echarts.init(myChart)
bg.setOption(option);
bg.on('click', function (params) {
+ let longInfo = params.data.coord
+ areaStore.areaCodeList.forEach(item => {
+ if (item.name == name) {
+ areaStore.changeUserInfoFn(510521, item.code)
+ }
+ })
+ params.data.data.forEach(item => {
+
+ if (item.value[0] == longInfo[0] && item.value[1] == longInfo[1]) {
+ router.push(`/detail?landId=${item.id}&town=${name}&parmas=${JSON.stringify(areaStore.userInfo) }`)
+ }
+
+ })
+
+ // console.log(params.data.coord)
+ // console.log(params.data.data)
});
}
@@ -529,13 +599,12 @@ watch(
() => areaStore.address,
(value, oldValue) => {
- if(value.city){
+ if (value.city) {
initAreaMap()
}
- else if(value.area){
+ else if (value.area) {
showArea.value = false
initTownMap(value.area)
- console.log(showArea.value)
}
diff --git a/src/components/detail/centerBottom.vue b/src/components/detail/centerBottom.vue
index 94e24da..3c25643 100644
--- a/src/components/detail/centerBottom.vue
+++ b/src/components/detail/centerBottom.vue
@@ -18,6 +18,10 @@
import { monitorInfoApi } from "@/api.js"
import {ref,reactive} from "vue"
+const props = defineProps({
+ data:Object,
+})
+
const statusFn=(min,max,item )=>{
if(item.value>=min&&item.value<=max ) item.flag=true
@@ -27,9 +31,7 @@ else item.flag=false
monitorInfoApi(
{
- areaCode: 510521,
- streetCode: 510521100,
- land_id: 18
+ ...props.data
}
).then(res => {
@@ -54,13 +56,6 @@ statusFn(monitorThreshold.ambient_air_pressure_min,monitorThreshold.ambient_air_
-
-console.log(environmentData)
-console.log(monitorThreshold)
-
-
-
-
})
const environmentData = reactive({
diff --git a/src/components/detail/leftCenter.vue b/src/components/detail/leftCenter.vue
index 8c70952..acbe802 100644
--- a/src/components/detail/leftCenter.vue
+++ b/src/components/detail/leftCenter.vue
@@ -5,8 +5,12 @@