lcw
This commit is contained in:
@ -1,6 +1,6 @@
|
||||
<template>
|
||||
<div class="homeBox">
|
||||
<GdMap></GdMap>
|
||||
<GdMap :minZoom="6.6" :maxZoom="6.6"></GdMap>
|
||||
<!-- 头部 -->
|
||||
|
||||
<Head></Head>
|
||||
@ -25,7 +25,7 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- <Warning></Warning> -->
|
||||
<!-- <Warning></Warning> -->
|
||||
|
||||
<!-- 右边 内容-->
|
||||
<div class="home-aside asideR">
|
||||
@ -42,11 +42,9 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="asideB" >
|
||||
<img src="@/assets/images/bi/gzy.png" @click="getsxtGetList"/>
|
||||
</div>
|
||||
</div>
|
||||
<Entrance v-if="showEntrance" :JczData="JczData" />
|
||||
|
||||
<PopupWindows />
|
||||
</template>
|
||||
|
||||
@ -63,52 +61,163 @@ import { jczgetJczList, sxtGetList } from "@/api/mosty-jcz";
|
||||
import { ysSxtGetList } from '@/api/yszx.js'
|
||||
import emitter from "@/utils/eventBus.js";
|
||||
import PopupWindows from "@/components/popupWindows/index.vue";
|
||||
import { bm, arrowhead, centralPoint } from '@/components/GdMap/xzqh.js'
|
||||
import { ref, onMounted, reactive } from "vue";
|
||||
import { getItem } from "@/utils/storage";
|
||||
|
||||
import { ref, onMounted } from "vue";
|
||||
//获取所有检查站
|
||||
const getjczgetJczList = () => {
|
||||
jczgetJczList({}).then((res) => {
|
||||
const point = res.filter((item) => item.jd && item.wd);
|
||||
const gajcz = res.filter(item => item.zqlx == '1' && item.jd && item.wd)
|
||||
const jcz = res.filter(item => item.zqlx == '2' && item.jd && item.wd)
|
||||
const icon = require("@/assets/images/z.png");
|
||||
emitter.emit("addPointArea", { coords: point, icon, flag: "jczMap_hm" });
|
||||
const iconjcz = require("@/assets/point/sp.png");
|
||||
emitter.emit("addPointArea", { coords: gajcz, icon, flag: "jczMap_hm" });
|
||||
emitter.emit("addPointArea", { coords: jcz, icon: iconjcz, flag: "jczMap_hm" });
|
||||
});
|
||||
};
|
||||
const makerCenter = () => {
|
||||
const dw = require("@/assets/point/dingwei.png")
|
||||
const coords = centralPoint.map(item => {
|
||||
return { jd: item.point[0], wd: item.point[1], jzMc: item.name }
|
||||
})
|
||||
emitter.emit("addPointArea", { coords, icon: dw, flag: "hm", size: '14px', showTitle: true, offset: [0, -25] });
|
||||
}
|
||||
getjczgetJczList();
|
||||
const JczData = ref();
|
||||
const showEntrance = ref(false);
|
||||
onMounted(() => {
|
||||
getDepId()
|
||||
makerCenter()
|
||||
emitter.on("showJcz", (res) => {
|
||||
if (res) {
|
||||
const promes = {
|
||||
jczid: res.id,
|
||||
}
|
||||
// const promes = {
|
||||
// jczid: res.id,
|
||||
// }
|
||||
showEntrance.value = true;
|
||||
JczData.value = res;
|
||||
emitter.emit("deletePointArea", "jczMap_Gzy");
|
||||
sxtGetList(promes).then(resData => {
|
||||
emitter.emit("addPointArea", {
|
||||
coords: resData,
|
||||
icon: require("@/assets/point/sp.png"),
|
||||
flag: "jczMap_Gzy"
|
||||
});
|
||||
})
|
||||
// emitter.emit("deletePointArea", "jczMap_Gzy");
|
||||
// sxtGetList(promes).then(resData => {
|
||||
// emitter.emit("addPointArea", {
|
||||
// coords: resData,
|
||||
// icon: require("@/assets/point/sp.png"),
|
||||
// flag: "jczMap_Gzy"
|
||||
// });
|
||||
// })
|
||||
} else {
|
||||
showEntrance.value = false;
|
||||
}
|
||||
});
|
||||
});
|
||||
const getsxtGetList = () => {
|
||||
ysSxtGetList().then(res => {
|
||||
emitter.emit("deletePointArea", "jczMap_Gzy");
|
||||
emitter.emit("addPoint", {
|
||||
coords: res,
|
||||
icon: require("@/assets/point/sp.png"),
|
||||
flag: "jczMap_Gzy"
|
||||
});
|
||||
})
|
||||
|
||||
const keyIndex = ref()
|
||||
const changeXzqh = (val, trg) => {
|
||||
setTimeout(() => {
|
||||
// 先移除已有的边界
|
||||
// 如果传入的是多个区域数据(二维数组)
|
||||
const features = val.map((area, index) => ({
|
||||
geometry: {
|
||||
type: "Polygon",
|
||||
coordinates: [area] // 确保格式正确
|
||||
},
|
||||
properties: {
|
||||
},
|
||||
type: "Feature"
|
||||
}))
|
||||
// 循环为每个区域创建单独的多边形,这样可以设置不同的样式
|
||||
features.forEach((feature, index) => {
|
||||
emitter.emit('setBoundarys', {
|
||||
data: {
|
||||
type: "FeatureCollection",
|
||||
features: [feature]
|
||||
},
|
||||
color: '#cf1010',
|
||||
fillColor: 'rgba(255, 255, 255, 0)',
|
||||
borderColor: index == keyIndex.value ? '#ff00ff' : 'red'
|
||||
})
|
||||
})
|
||||
getMapData()
|
||||
}, 3000)
|
||||
}
|
||||
const showDiclog = ref(true)
|
||||
getsxtGetList()
|
||||
|
||||
const getDepId = () => {
|
||||
const deptId = getItem('deptId')
|
||||
const deptLevel = deptId[0].deptLevel ? deptId[0].deptLevel : null
|
||||
const deptCode = deptId[0].deptCode ? deptId[0].deptCode : null
|
||||
// if (deptLevel.startsWith('2')) {
|
||||
const keyData = []
|
||||
for (const key in bm) {
|
||||
keyData.push(key)
|
||||
}
|
||||
|
||||
const data = Object.values(bm).map(item => item);
|
||||
|
||||
// } else {
|
||||
switch (deptCode) {
|
||||
case '54040200000'://巴宜区
|
||||
keyIndex.value = keyData.indexOf('542621')
|
||||
// changeXzqh(bm[542621])
|
||||
break;
|
||||
case '54042400000'://波密县
|
||||
keyIndex.value = keyData.indexOf('542625')
|
||||
// changeXzqh(bm[542625])
|
||||
break;
|
||||
case '54042500000'://察隅县
|
||||
keyIndex.value = keyData.indexOf('542626')
|
||||
// changeXzqh(bm[542626])
|
||||
break;
|
||||
case '54042100000'://工布江达县
|
||||
keyIndex.value = keyData.indexOf('542622')
|
||||
// changeXzqh(bm[542622])
|
||||
break;
|
||||
case '54042600000'://朗县
|
||||
keyIndex.value = keyData.indexOf('542627')
|
||||
// changeXzqh(bm[542627])
|
||||
break;
|
||||
case '54042200000'://米林县
|
||||
keyIndex.value = keyData.indexOf('542623')
|
||||
// changeXzqh(bm[542623])
|
||||
break;
|
||||
case '54042300000'://墨脱县
|
||||
keyIndex.value = keyData.indexOf('542624')
|
||||
// changeXzqh(bm[542624])
|
||||
break;
|
||||
default:
|
||||
const data = Object.values(bm).map(item => item);
|
||||
changeXzqh(data, true)
|
||||
break;
|
||||
}
|
||||
changeXzqh(data, true)
|
||||
|
||||
// }
|
||||
}
|
||||
// 箭头
|
||||
const getMapData = () => {
|
||||
let jtData = []
|
||||
for (const key in arrowhead) {
|
||||
jtData.push({
|
||||
position: [arrowhead[key].zb],
|
||||
text: arrowhead[key].name,
|
||||
pyl: arrowhead[key].pyl,
|
||||
})
|
||||
}
|
||||
// 修复后的多边形绘制代码
|
||||
for (let i = 0; i < jtData.length; i++) {
|
||||
console.log("正在绘制第", i, "个多边形");
|
||||
emitter.emit("echoPlane", {
|
||||
flag: `polygon${i}`,
|
||||
type: "polygon",
|
||||
coords: [jtData[i]], // 保持使用第一个数据点进行测试
|
||||
fontSize: "20px",
|
||||
fontColor: '#000',
|
||||
isclear: false, // 暂时设为false,避免清除之前的绘制
|
||||
id: i,
|
||||
pyl: jtData[i].pyl
|
||||
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
@ -165,9 +274,18 @@ getsxtGetList()
|
||||
background-size: 100% 100%;
|
||||
}
|
||||
}
|
||||
.asideB{
|
||||
position: absolute;bottom: 50px;z-index:11;left: 50%;transform: translateX(-50%);height: 100px;width: 50%;padding: 0 30px;
|
||||
}
|
||||
|
||||
.asideB {
|
||||
position: absolute;
|
||||
bottom: 50px;
|
||||
z-index: 11;
|
||||
left: 50%;
|
||||
transform: translateX(-50%);
|
||||
height: 100px;
|
||||
width: 50%;
|
||||
padding: 0 30px;
|
||||
}
|
||||
|
||||
// 公用
|
||||
.common-title {
|
||||
padding: 0 54px;
|
||||
@ -185,4 +303,6 @@ getsxtGetList()
|
||||
box-sizing: border-box;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
</style>
|
||||
|
||||
Reference in New Issue
Block a user