529 lines
16 KiB
Vue
529 lines
16 KiB
Vue
<template>
|
||
<div class="center-map">
|
||
<div class="china-map-box">
|
||
<div class="tab-list">
|
||
<div v-for="(item,i) in list" :class="[currentIndex==i?'active':'']" class="tab" @click="changeTab(i)">
|
||
{{ item.name }}
|
||
</div>
|
||
</div>
|
||
<div v-show="currentIndex==list.length-1" class="route-navigation">
|
||
<a-form
|
||
:model="formState"
|
||
layout="inline"
|
||
>
|
||
<a-form-item class="form-item-self" label="起点"
|
||
>
|
||
<a-input v-model:value="formState.user">
|
||
</a-input>
|
||
</a-form-item>
|
||
<a-form-item class="form-item-self" label="终点">
|
||
<a-input v-model:value="formState.password">
|
||
</a-input>
|
||
</a-form-item>
|
||
<a-form-item>
|
||
<a-button class="reset-btn">清空</a-button>
|
||
<a-button class="search-btn">路线规划</a-button>
|
||
</a-form-item>
|
||
</a-form>
|
||
<div class="line-container">
|
||
<div class="has-data">
|
||
<div class="line-title">
|
||
全程2小时37分钟(172.15公里)
|
||
</div>
|
||
<div class="line-content">
|
||
<div class="start">起点</div>
|
||
<div class="line-body">
|
||
<div class="line"></div>
|
||
<div class="line-desc">
|
||
<p>向东行驶124米左转</p>
|
||
<p>向西北行驶92米左转</p>
|
||
<p>向西南行驶45米右转</p>
|
||
<p>向西北行驶50米右转</p>
|
||
<p>沿燕庆街向东北行驶157米左转</p>
|
||
<p>向西北行驶47米左转</p>
|
||
<p>向西行驶97米右转进入主路</p>
|
||
<p>沿新华东路向西行驶1.1千米右转进入主路</p>
|
||
<p>沿友爱街向北行驶5.9千米右转</p>
|
||
<p>沿417乡道向东北行驶49米右转</p>
|
||
<p>沿417乡道向东行驶1.1千米左转</p>
|
||
<p>沿417乡道向北行驶8.3千米左转</p>
|
||
<p>向西北行驶47米左转</p>
|
||
<p>向西行驶97米右转进入主路</p>
|
||
<p>沿新华东路向西行驶1.1千米右转进入主路</p>
|
||
<p>沿友爱街向北行驶5.9千米右转</p>
|
||
<p>沿417乡道向东北行驶49米右转</p>
|
||
<p>沿417乡道向东行驶1.1千米左转</p>
|
||
<p>沿417乡道向北行驶8.3千米左转</p>
|
||
<p>向西北行驶4.9千米到达目的地</p>
|
||
</div>
|
||
</div>
|
||
<div class="end">终点</div>
|
||
</div>
|
||
</div>
|
||
<div v-show="false" class="empty-data">
|
||
暂无数据
|
||
</div>
|
||
</div>
|
||
</div>
|
||
<div class="china-map-container"></div>
|
||
|
||
<div class="map-legend">
|
||
<div v-for="(item,i) in legendList" :key="i" class="legend-item">
|
||
<div><img :src="item.img" alt="" class="legend-img"> {{ item.text }}</div>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
<div class="center-footer">
|
||
<div class="count-item">
|
||
<div class="num">1054</div>
|
||
<div class="text">累计受理</div>
|
||
</div>
|
||
<div class="count-item">
|
||
<div class="num">1054</div>
|
||
<div class="text">累计处置</div>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</template>
|
||
<script lang="ts" setup>
|
||
import {onMounted, ref} from 'vue'
|
||
import * as echarts from 'echarts';
|
||
import mapJson from '/@/components/chinaMap/json/c'
|
||
|
||
// import bgImg from '/@/assets/images/china-textur.png'
|
||
const bgImg = new URL('/@/assets/images/china-textur.jpg', import.meta.url).href
|
||
const mapIcon1 = new URL('/@/assets/img/mapIcon1.png', import.meta.url).href
|
||
const mapIcon2 = new URL('/@/assets/img/mapIcon2.png', import.meta.url).href
|
||
const mapIcon3 = new URL('/@/assets/img/mapIcon3.png', import.meta.url).href
|
||
const mapIcon4 = new URL('/@/assets/img/mapIcon4.png', import.meta.url).href
|
||
const mapIcon5 = new URL('/@/assets/img/mapIcon5.png', import.meta.url).href
|
||
const mapIcon6 = new URL('/@/assets/img/mapIcon6.png', import.meta.url).href
|
||
|
||
const legend1 = new URL('/@/assets/img/legend1.png', import.meta.url).href
|
||
const legend2 = new URL('/@/assets/img/legend2.png', import.meta.url).href
|
||
const legend3 = new URL('/@/assets/img/legend3.png', import.meta.url).href
|
||
const legend4 = new URL('/@/assets/img/legend4.png', import.meta.url).href
|
||
const legend5 = new URL('/@/assets/img/legend5.png', import.meta.url).href
|
||
const legend6 = new URL('/@/assets/img/legend6.png', import.meta.url).href
|
||
const mapIcons = [mapIcon1, mapIcon2, mapIcon3, mapIcon4, mapIcon5, mapIcon6]
|
||
const legendList = [{img: legend1, text: '油田医院'}, {img: legend2, text: '医疗点'}, {
|
||
img: legend3,
|
||
text: '救护车'
|
||
}, {img: legend4, text: '合作医院'}, {img: legend5, text: '地方医院'}, {img: legend6, text: '直升机'}]
|
||
const formState = ref({
|
||
user: '',
|
||
password: "",
|
||
});
|
||
const list = ref([
|
||
{
|
||
name: '所有资源',
|
||
isChecked: true
|
||
},
|
||
{
|
||
name: '油田医院',
|
||
isChecked: false
|
||
},
|
||
{
|
||
name: '医疗点',
|
||
isChecked: false
|
||
},
|
||
{
|
||
name: '救护车',
|
||
isChecked: false
|
||
},
|
||
{
|
||
name: '合作医院',
|
||
isChecked: false
|
||
},
|
||
{
|
||
name: '地方医院',
|
||
isChecked: false
|
||
},
|
||
{
|
||
name: '直升机',
|
||
isChecked: false
|
||
},
|
||
{
|
||
name: '急救路线',
|
||
isChecked: false
|
||
}
|
||
])
|
||
const currentIndex = ref(0);
|
||
const icons = ref([{
|
||
type: "scatter",
|
||
zlevel: 100,
|
||
coordinateSystem: "geo",
|
||
//自定义图片的 位置(lng, lat)
|
||
data: [{name: '西安', value: ['108.88', '34.40'], id: 'xian'}],
|
||
//自定义图片的 大小
|
||
symbolSize: [25, 63],
|
||
//自定义图片的 路径
|
||
// symbol: 'image://http://192.168.1.7:9200/src/assets/img/tree.png', // 图片 URL
|
||
// symbol: 'image://https://img2.baidu.com/it/u=1568770988,2090980470&fm=253&fmt=auto&app=138&f=JPEG?w=500&h=567', // 图片 URL
|
||
symbol: 'image://' + mapIcon1, // 图片 URL
|
||
},
|
||
{
|
||
type: "scatter",
|
||
zlevel: 100,
|
||
coordinateSystem: "geo",
|
||
//自定义图片的 位置(lng, lat)
|
||
data: [{name: '太原', value: [112.55, 37.98], id: 'taiyuan'}],
|
||
//自定义图片的 大小
|
||
symbolSize: [25, 63],
|
||
symbol: 'image://' + mapIcon2, // 图片 URL
|
||
}])
|
||
|
||
function changeTab(i) {
|
||
let x = Math.random() + 3 - Math.random() - i;
|
||
let y = Math.random() - 2 + Math.random() + i
|
||
const o = {
|
||
type: "scatter",
|
||
zlevel: 100,
|
||
coordinateSystem: "geo",
|
||
//自定义图片的 位置(lng, lat)
|
||
data: [{name: '太原', value: [112.55 + Math.random() + x, 37.98 + Math.random() + y], id: 'taiyuan'}],
|
||
//自定义图片的 大小
|
||
symbolSize: [25, 63],
|
||
symbol: 'image://' + mapIcons[Math.floor(Math.random() * 6)], // 图片 URL
|
||
}
|
||
icons.value = []
|
||
icons.value.push(o)
|
||
currentIndex.value = i
|
||
list.value = list.value.map(item => {
|
||
item.isChecked = false
|
||
return item
|
||
})
|
||
let myChart = echarts.init(document.querySelector('.china-map-container'));
|
||
initMap(myChart)
|
||
|
||
}
|
||
|
||
onMounted(() => {
|
||
console.log('reload')
|
||
let myChart = echarts.init(document.querySelector('.china-map-container'));
|
||
echarts.registerMap('china', mapJson);
|
||
initMap(myChart);
|
||
})
|
||
|
||
function initMap(myChart) {
|
||
let option = {
|
||
tooltip: {
|
||
show: false,
|
||
formatter: "{b0}: {c0}"
|
||
},
|
||
geo: [
|
||
{
|
||
map: 'china',
|
||
zlevel: 3,
|
||
aspectScale: .8, //长宽比
|
||
zoom: 1.1,
|
||
roam: false,
|
||
top: '60',
|
||
left: 'center',
|
||
itemStyle: {
|
||
areaColor: "#173a58",
|
||
shadowColor: "#173a58",
|
||
shadowOffsetX: 0,
|
||
shadowOffsetY: 5,
|
||
borderWidth: 6,//外部边框
|
||
borderColor: "#6ccffe",
|
||
}
|
||
},
|
||
{
|
||
map: 'china',
|
||
zlevel: 2,
|
||
aspectScale: .8, //长宽比
|
||
zoom: 1.1,
|
||
roam: false,
|
||
top: '60',
|
||
left: 'center',
|
||
itemStyle: {
|
||
areaColor: "#1e2c38",
|
||
shadowColor: "#1e2c38",
|
||
shadowOffsetX: 0,
|
||
shadowOffsetY: 10,
|
||
borderWidth: 6,//外部边框
|
||
borderColor: "#384d61",
|
||
}
|
||
},
|
||
],
|
||
series: [
|
||
{
|
||
map: 'china',// 这个是上面注册时的名字哦,registerMap('这个名字保持一致')
|
||
name: '中国地图',
|
||
type: 'map',
|
||
zlevel: 9,
|
||
zoom: 1.1,
|
||
aspectScale: .8, //长宽比
|
||
hoverAnimation: false,
|
||
silent: false,
|
||
top: '60',
|
||
left: 'center',
|
||
label: {
|
||
show: true,
|
||
padding: [0, 10],
|
||
height: 31,
|
||
lineHeight: 31,
|
||
textStyle: {
|
||
color: "#fff",
|
||
fontSize: 13,
|
||
marginLeft: 5
|
||
},
|
||
},
|
||
itemStyle: {
|
||
// 给地图添加背景图片
|
||
areaColor: {
|
||
type: 'pattern',
|
||
image: bgImg,
|
||
repeat: 'no-repeat'
|
||
},
|
||
borderColor: "#359de5",
|
||
borderWidth: 2,//内部边框
|
||
},
|
||
},
|
||
...icons.value
|
||
],
|
||
};
|
||
// myChart.value.clear()
|
||
myChart.setOption(option);
|
||
myChart.on('click', function (res) {
|
||
if ('scatter' === res.componentSubType) {
|
||
alert(`点击了 ${res.name} 图标`);
|
||
}
|
||
if ('map' === res.componentSubType) {
|
||
alert(`点击了 ${res.name} 地图`);
|
||
}
|
||
});
|
||
window.addEventListener('resize', () => {
|
||
myChart.resize()
|
||
})
|
||
}
|
||
</script>
|
||
<style lang="less" scoped>
|
||
.center-map {
|
||
flex: 1;
|
||
color: #fff;
|
||
display: flex;
|
||
flex-direction: column;
|
||
align-content: space-between;
|
||
|
||
.china-map-box {
|
||
flex: 1;
|
||
display: flex;
|
||
flex-direction: column;
|
||
position: relative;
|
||
}
|
||
|
||
.tab-list {
|
||
display: flex;
|
||
flex-wrap: wrap;
|
||
justify-content: space-between;
|
||
|
||
.tab {
|
||
width: calc(100% / 8);
|
||
height: 43px;
|
||
display: flex;
|
||
justify-content: center;
|
||
align-items: center;
|
||
color: #29F1FA;
|
||
background: url("/@/assets/img/tab-default.png") no-repeat;
|
||
background-size: 100%;
|
||
cursor: pointer;
|
||
transition: all 0.3s;
|
||
//background-position: -5px -10px;
|
||
&.active {
|
||
color: #fff;
|
||
background: url("/@/assets/img/tab-active.png") no-repeat;
|
||
background-size: 100%;
|
||
}
|
||
}
|
||
}
|
||
|
||
.route-navigation {
|
||
margin: 12px 0;
|
||
width: 100%;
|
||
height: 46px;
|
||
display: flex;
|
||
align-items: center;
|
||
justify-content: center;
|
||
background: #002E64;
|
||
border-radius: 6px;
|
||
position: absolute;
|
||
top: 40px;
|
||
z-index: 999;
|
||
transition: all 0.3s;
|
||
|
||
:deep(.form-item-self) {
|
||
label {
|
||
color: #29F1FA;
|
||
}
|
||
|
||
.ant-input {
|
||
width: 280px;
|
||
color: #d6d9e0;
|
||
background: #2A4164;
|
||
border-radius: 2px 2px 2px 2px;
|
||
border: 1px solid #1B7EF2;
|
||
}
|
||
}
|
||
|
||
.reset-btn {
|
||
width: 64px;
|
||
height: 32px;
|
||
border-radius: 5px;
|
||
color: #45A2FF;
|
||
background: #002E64;
|
||
border: 1px solid #45A2FF;
|
||
}
|
||
|
||
.search-btn {
|
||
margin-left: 10px;
|
||
width: 88px;
|
||
height: 32px;
|
||
color: #EFEFEF;
|
||
background: #45A2FF;
|
||
border-radius: 5px;
|
||
border-color: #45A2FF;
|
||
}
|
||
|
||
.line-container {
|
||
position: absolute;
|
||
right: 0;
|
||
top: 54px;
|
||
width: 288px;
|
||
padding: 9px 18px;
|
||
min-height: 200px;
|
||
max-height: 473px;
|
||
overflow: auto;
|
||
background: #2A4164;
|
||
border-radius: 2px;
|
||
border: 1px solid #1B7EF2;
|
||
|
||
.line-title {
|
||
margin-bottom: 9px;
|
||
font-size: 14px;
|
||
font-weight: 700;
|
||
color: rgba(255, 255, 255, 0.8);
|
||
}
|
||
|
||
.line-content {
|
||
font-size: 12px;
|
||
|
||
.start {
|
||
display: flex;
|
||
align-items: center;
|
||
|
||
&::before {
|
||
content: '起';
|
||
color: #fff;
|
||
width: 20px;
|
||
height: 20px;
|
||
margin-right: 7px;
|
||
display: flex;
|
||
align-items: center;
|
||
justify-content: center;
|
||
border-radius: 50%;
|
||
background: #1478F5;
|
||
}
|
||
}
|
||
|
||
.end {
|
||
display: flex;
|
||
align-items: center;
|
||
|
||
&::before {
|
||
content: '终';
|
||
color: #fff;
|
||
width: 20px;
|
||
height: 20px;
|
||
margin-right: 7px;
|
||
display: flex;
|
||
align-items: center;
|
||
justify-content: center;
|
||
border-radius: 50%;
|
||
background: #1478F5;
|
||
}
|
||
}
|
||
|
||
.line-body {
|
||
display: flex;
|
||
//max-height: 370px;
|
||
}
|
||
|
||
.line {
|
||
width: 1px;
|
||
//max-height: 370px;
|
||
background-color: #1478f5;
|
||
margin: 5px 19px 5px 8px;
|
||
}
|
||
|
||
.line-sesc {
|
||
flex: 1;
|
||
}
|
||
}
|
||
|
||
}
|
||
|
||
}
|
||
|
||
.china-map-container {
|
||
flex: 1;
|
||
margin: 10px;
|
||
//border: 1px solid red;
|
||
}
|
||
|
||
.map-legend {
|
||
position: absolute;
|
||
bottom: 20px;
|
||
left: 0;
|
||
width: 200px;
|
||
//border: 1px solid red;
|
||
display: flex;
|
||
flex-wrap: wrap;
|
||
|
||
.legend-item {
|
||
width: 50%;
|
||
font-size: 12px;
|
||
font-weight: 400;
|
||
line-height: 30px;
|
||
|
||
.legend-img {
|
||
width: 20px;
|
||
}
|
||
}
|
||
}
|
||
|
||
.center-footer {
|
||
display: flex;
|
||
justify-content: center;
|
||
margin-bottom: 10px;
|
||
gap: 20px;
|
||
|
||
.count-item {
|
||
width: 340px;
|
||
height: 80px;
|
||
display: flex;
|
||
color: #FFFFFF;
|
||
flex-direction: column;
|
||
align-items: center;
|
||
justify-content: center;
|
||
background: #00071B;
|
||
box-shadow: inset 0 0 40px 0 #1B7EF2;
|
||
border-radius: 4px;
|
||
|
||
.num {
|
||
font-size: 24px;
|
||
font-weight: 700;
|
||
}
|
||
|
||
.text {
|
||
font-size: 16px;
|
||
font-weight: 400;
|
||
}
|
||
}
|
||
}
|
||
}
|
||
</style>
|
||
|
||
|