show-waybill-maps.vue
3.31 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
<!-- 地图弹层 -->
<template>
<div class="add-form maps-details-box">
<el-dialog
:title="titleInfo.text"
:visible.sync="dialogFormVisible"
>
<div class="content">
<baidu-map
class="mapsClass"
:center="center"
:zoom="zoom"
:scroll-wheel-zoom="scrollWheelZoom"
@ready="handler"
>
<!-- <bm-polyline
:path="[{ lng: formBase.startLng, lat: formBase.startLat },{ lng: formBase.endLng, lat: formBase.endLat }]"
stroke-color="blue"
:stroke-opacity="0.5"
:stroke-weight="2"
></bm-polyline> -->
<bm-driving
:panel="false"
:start="startArea"
:end="endArea"
:auto-viewport="true"
location="中国"
></bm-driving>
<!-- <bm-transit :panel="false" :start="startArea" :end="endArea" :auto-viewport="true" location="中国"></bm-transit> -->
</baidu-map>
</div>
</el-dialog>
</div>
</template>
<script>
export default {
props: {
titleInfo: {
type: Object,
required: true
},
formBase: {
type: Object,
required: true
}
},
data() {
return {
scrollWheelZoom: true,
zoom: 6,
center: {
lng: 116.404,
lat: 39.915
},
dialogFormVisible: false,
startArea: '',
endArea: ''
}
},
computed: {},
created() {},
// 挂载结束
mounted: function() {},
// 组件更新
updated: function() {},
methods: {
handler: function({ BMap, map }) {
const _this = this
_this.startArea = ''
_this.endArea = ''
// map.enableScrollWheelZoom(true)
_this.BMap = BMap
_this.map = map
const startPoint = new BMap.Point(_this.formBase.startLng, _this.formBase.startLat)
const endPoint = new BMap.Point(_this.formBase.endLng, _this.formBase.endLat)
var gc = new BMap.Geocoder()
gc.getLocation(startPoint, function(rs) {
_this.startArea = rs.address
})
gc.getLocation(endPoint, function(rs) {
_this.endArea = rs.address
})
},
update(e) {
this.points = e.target.cornerPoints
},
// 弹层显示
dialogFormV() {
this.dialogFormVisible = true
},
// 弹层隐藏
dialogFormH() {
this.dialogFormVisible = false
}
}
}
</script>
<style lang="scss" scoped>
/*定义滚动条轨道 内阴影+圆角*/
/deep/ .el-dialog__wrapper {
padding-bottom: 5px;
margin-bottom: 5px;
&::-webkit-scrollbar {
height: 10px;
width: 4px;
}
/*定义滑块 内阴影+圆角*/
&::-webkit-scrollbar-thumb {
border-radius: 10px;
//border: 3px solid rgba(0, 0, 0, 0);
background-color:rgba(144,147,153,.3);
}
&::-webkit-scrollbar-track-piece{
margin-right: 3px;
margin-left: 3px;
}
}
.mapsClass {
width: 100%;
height: 700px;
text-align: center;
}
.el-form--label-left .el-form-item__label {
// text-align: right;
}
.el-form-item--medium {
// margin-bottom: 22px;
}
.el-dialog__footer {
// text-align: center;
}
/deep/ .el-dialog {
width: 1200px;
}
.maps-details-box{
/deep/ .el-dialog__header{
.el-dialog__title{
font-size: 18px;
font-weight: 400;
color: #20232a;
}
}
/deep/ .el-dialog__body{
padding: 32px;
}
}
</style>