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 @@