haiwei-ui 1.0.3 → 1.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +10 -0
- package/package.json +1 -1
- package/packages/components/box/index.vue +116 -125
- package/packages/components/box-col/index.vue +30 -33
- package/packages/components/box-row/index.vue +17 -17
- package/packages/components/box-small/index.vue +38 -38
- package/packages/components/button/index.vue +29 -42
- package/packages/components/button-copy/index.vue +46 -62
- package/packages/components/button-delete/index.vue +64 -77
- package/packages/components/button-delete-batch/index.vue +82 -95
- package/packages/components/button-has/index.vue +29 -42
- package/packages/components/checkbox-group/index.vue +85 -85
- package/packages/components/color-picker/index.vue +41 -50
- package/packages/components/container/index.vue +8 -8
- package/packages/components/date-range-picker/index.vue +92 -103
- package/packages/components/details/index.vue +72 -79
- package/packages/components/dialog/index.vue +281 -294
- package/packages/components/drag-sort/index.vue +36 -36
- package/packages/components/drag-sort-dialog/index.vue +58 -58
- package/packages/components/drawer/index.vue +157 -166
- package/packages/components/enums/sex/index.vue +1 -1
- package/packages/components/flex/index.vue +33 -33
- package/packages/components/form/index.vue +123 -138
- package/packages/components/form-dialog/index.vue +184 -217
- package/packages/components/form-page/index.vue +134 -151
- package/packages/components/icon/index.vue +6 -6
- package/packages/components/icon-picker/index.vue +30 -30
- package/packages/components/icon-picker/panel.vue +58 -58
- package/packages/components/label/index.vue +22 -30
- package/packages/components/list/components/export/index.vue +101 -99
- package/packages/components/list/components/footer/index.vue +42 -51
- package/packages/components/list/components/header/index.vue +34 -34
- package/packages/components/list/components/querybar/index.vue +144 -144
- package/packages/components/list/components/select-column/index.vue +30 -30
- package/packages/components/list/components/table/index.vue +169 -188
- package/packages/components/list/index.vue +337 -391
- package/packages/components/list-agile/index.vue +145 -145
- package/packages/components/list-dialog/index.vue +70 -84
- package/packages/components/listbox/index.vue +48 -48
- package/packages/components/login-default/index.vue +107 -107
- package/packages/components/login-neon/index.vue +104 -104
- package/packages/components/map/index.vue +229 -229
- package/packages/components/map-coord-picking/index.vue +220 -219
- package/packages/components/map-search/index.vue +75 -72
- package/packages/components/scrollbar/index.vue +11 -11
- package/packages/components/select-whether/index.vue +30 -30
- package/packages/components/split/index.vue +141 -141
- package/packages/components/split/trigger.vue +15 -15
- package/packages/components/tabnav/index.vue +125 -89
- package/packages/components/tabs/index.vue +31 -31
- package/packages/components/toolbar/components/fullscreen/index.vue +10 -10
- package/packages/components/toolbar/components/logout/index.vue +13 -13
- package/packages/components/toolbar/components/skin-toggle/form.vue +59 -59
- package/packages/components/toolbar/components/skin-toggle/index.vue +12 -12
- package/packages/components/toolbar/components/userInfo/index.vue +18 -18
- package/packages/components/toolbar/index.vue +12 -12
- package/packages/components/tree-select/mixins.vue +261 -270
- package/packages/components/txt/index.vue +17 -17
- package/packages/components/update-password/index.vue +45 -57
- package/packages/layout.vue +18 -18
- package/packages/mixins/components/checkbox.vue +71 -82
- package/packages/mixins/components/radio.vue +69 -69
- package/packages/page/403/index.vue +32 -28
- package/packages/page/404/index.vue +32 -28
- package/packages/page/default/index.vue +17 -13
- package/packages/page/iframe/index.vue +6 -6
- package/packages/page/login/index.vue +9 -9
- package/packages/page/userInfo/index.vue +5 -5
- package/packages/router/index.js +1 -9
- package/packages/skins/pretty/components/header/components/breadcrumb/index.vue +29 -29
- package/packages/skins/pretty/components/header/components/theme/index.vue +22 -21
- package/packages/skins/pretty/components/header/index.vue +12 -12
- package/packages/skins/pretty/components/main/index.vue +27 -27
- package/packages/skins/pretty/components/menus/index.vue +28 -28
- package/packages/skins/pretty/components/menus/item.vue +23 -23
- package/packages/skins/pretty/components/sidebar/index.vue +7 -7
- package/packages/skins/pretty/index.vue +6 -6
- package/packages/skins/pretty/styles/themes/blue-light/_index.scss +2 -2
- package/packages/skins/pretty/styles/themes/default/_index.scss +1 -1
- package/packages/skins/pretty/styles/themes/green/_index.scss +2 -2
- package/packages/skins/pretty/styles/themes/green-light/_index.scss +2 -2
- package/packages/styles/_mixins.scss +24 -25
- package/packages/styles/animation/_index.scss +22 -23
- package/packages/styles/animation/breadcrumb.scss +6 -6
- package/packages/styles/animation/fade.scss +11 -11
- package/packages/styles/animation/move.scss +98 -98
- package/packages/styles/components/box-small/_index.scss +58 -58
- package/packages/styles/components/button/_index.scss +7 -7
- package/packages/styles/components/container/_index.scss +26 -26
- package/packages/styles/components/date-range-picker/_index.scss +4 -4
- package/packages/styles/components/details/_index.scss +66 -67
- package/packages/styles/components/details-dialog/_index.scss +13 -13
- package/packages/styles/components/drag-sort/_index.scss +20 -20
- package/packages/styles/components/drag-sort-dialog/_index.scss +7 -7
- package/packages/styles/components/flex/_index.scss +56 -56
- package/packages/styles/components/form-dialog/_index.scss +11 -11
- package/packages/styles/components/icon/_index.scss +6 -6
- package/packages/styles/components/label/_index.scss +245 -245
- package/packages/styles/components/listbox/_index.scss +47 -47
- package/packages/styles/components/split/_index.scss +102 -102
- package/packages/styles/components/toolbar/_index.scss +98 -98
- package/packages/styles/components/txt/_index.scss +13 -13
- package/packages/styles/components/upload-dialog/_index.scss +44 -44
- package/packages/styles/components/upload-multiple/_index.scss +19 -19
- package/packages/styles/components/upload-single/_index.scss +16 -16
- package/packages/utils/resize-event.js +3 -3
- package/packages/vuter/attributes.json +30 -40
- package/packages/vuter/tags.json +11 -27
- package/public/lib/font/iconfont.js +47 -1
|
@@ -6,8 +6,9 @@
|
|
|
6
6
|
|
|
7
7
|
<nm-dialog v-bind="dialog" :visible.sync="visible" @opened="onOpened">
|
|
8
8
|
<template v-slot:title>
|
|
9
|
-
{{ dialog.title }} (
|
|
10
|
-
>
|
|
9
|
+
{{ dialog.title }} (
|
|
10
|
+
<span class="nm-size-14 nm-text-danger">当前坐标 : {{ label_ }}</span>
|
|
11
|
+
)
|
|
11
12
|
</template>
|
|
12
13
|
<div class="nm-map-coord-picking-box" v-loading="loading">
|
|
13
14
|
<nm-split v-model="split">
|
|
@@ -33,244 +34,244 @@
|
|
|
33
34
|
</div>
|
|
34
35
|
</template>
|
|
35
36
|
<script>
|
|
36
|
-
export default {
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
return {
|
|
40
|
-
split: 0.8,
|
|
41
|
-
/**是否显示 */
|
|
42
|
-
visible: false,
|
|
43
|
-
/**地图实例 */
|
|
44
|
-
map: null,
|
|
45
|
-
/**中心点 */
|
|
46
|
-
center: null,
|
|
47
|
-
/**标注对象 */
|
|
48
|
-
marker: null,
|
|
49
|
-
/**选择的的坐标点 */
|
|
50
|
-
selection: null,
|
|
51
|
-
loading: true,
|
|
52
|
-
oldValue: this.value,
|
|
53
|
-
/**显示的坐标 */
|
|
54
|
-
label: '',
|
|
55
|
-
/**是否手动输入 */
|
|
56
|
-
isManualInput: false,
|
|
57
|
-
/**打开对话框时是否需要重置标注 */
|
|
58
|
-
resetMarkerOnOpen: false
|
|
59
|
-
}
|
|
60
|
-
},
|
|
61
|
-
props: {
|
|
62
|
-
value: Object,
|
|
63
|
-
/**标题 */
|
|
64
|
-
title: {
|
|
65
|
-
type: String,
|
|
66
|
-
default: '坐标拾取'
|
|
67
|
-
},
|
|
68
|
-
/**图标 */
|
|
69
|
-
icon: {
|
|
70
|
-
type: String,
|
|
71
|
-
default: 'coordinate'
|
|
72
|
-
},
|
|
73
|
-
/**是否显示全屏按钮 */
|
|
74
|
-
fullscreen: {
|
|
75
|
-
type: Boolean,
|
|
76
|
-
default: true
|
|
77
|
-
},
|
|
78
|
-
width: {
|
|
79
|
-
type: String,
|
|
80
|
-
default: '70%'
|
|
81
|
-
},
|
|
82
|
-
height: {
|
|
83
|
-
type: String,
|
|
84
|
-
default: '80%'
|
|
85
|
-
},
|
|
86
|
-
placeholder: {
|
|
87
|
-
type: String,
|
|
88
|
-
default: '请输入或选择坐标,如:116.404,39.915'
|
|
89
|
-
},
|
|
90
|
-
/**禁用 */
|
|
91
|
-
disabled: Boolean,
|
|
92
|
-
/**允许手动输入 */
|
|
93
|
-
allowInput: Boolean,
|
|
94
|
-
/**查询延时,默认700ms */
|
|
95
|
-
delay: {
|
|
96
|
-
type: Number,
|
|
97
|
-
default: 700
|
|
98
|
-
},
|
|
99
|
-
/**保留小数位精度 */
|
|
100
|
-
precision: {
|
|
101
|
-
type: Number,
|
|
102
|
-
default: 3
|
|
103
|
-
},
|
|
104
|
-
/**查询时每页数量,默认15 */
|
|
105
|
-
searchPageCapacity: {
|
|
106
|
-
type: Number,
|
|
107
|
-
default: 15
|
|
108
|
-
},
|
|
109
|
-
/**启用滚轮放大缩小,默认启用 */
|
|
110
|
-
scrollWheelZoom: {
|
|
111
|
-
type: Boolean,
|
|
112
|
-
default: true
|
|
113
|
-
},
|
|
114
|
-
/**缩放 */
|
|
115
|
-
zoom: Number
|
|
116
|
-
},
|
|
117
|
-
computed: {
|
|
118
|
-
dialog() {
|
|
37
|
+
export default {
|
|
38
|
+
name: 'MapCoordPicking',
|
|
39
|
+
data() {
|
|
119
40
|
return {
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
41
|
+
split: 0.8,
|
|
42
|
+
/**是否显示 */
|
|
43
|
+
visible: false,
|
|
44
|
+
/**地图实例 */
|
|
45
|
+
map: null,
|
|
46
|
+
/**中心点 */
|
|
47
|
+
center: null,
|
|
48
|
+
/**标注对象 */
|
|
49
|
+
marker: null,
|
|
50
|
+
/**选择的的坐标点 */
|
|
51
|
+
selection: null,
|
|
52
|
+
loading: true,
|
|
53
|
+
oldValue: this.value,
|
|
54
|
+
/**显示的坐标 */
|
|
55
|
+
label: '',
|
|
56
|
+
/**是否手动输入 */
|
|
57
|
+
isManualInput: false,
|
|
58
|
+
/**打开对话框时是否需要重置标注 */
|
|
59
|
+
resetMarkerOnOpen: false
|
|
127
60
|
}
|
|
128
61
|
},
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
62
|
+
props: {
|
|
63
|
+
value: Object,
|
|
64
|
+
/**标题 */
|
|
65
|
+
title: {
|
|
66
|
+
type: String,
|
|
67
|
+
default: '坐标拾取'
|
|
68
|
+
},
|
|
69
|
+
/**图标 */
|
|
70
|
+
icon: {
|
|
71
|
+
type: String,
|
|
72
|
+
default: 'coordinate'
|
|
73
|
+
},
|
|
74
|
+
/**是否显示全屏按钮 */
|
|
75
|
+
fullscreen: {
|
|
76
|
+
type: Boolean,
|
|
77
|
+
default: true
|
|
78
|
+
},
|
|
79
|
+
width: {
|
|
80
|
+
type: String,
|
|
81
|
+
default: '70%'
|
|
82
|
+
},
|
|
83
|
+
height: {
|
|
84
|
+
type: String,
|
|
85
|
+
default: '80%'
|
|
86
|
+
},
|
|
87
|
+
placeholder: {
|
|
88
|
+
type: String,
|
|
89
|
+
default: '请输入或选择坐标,如:116.404,39.915'
|
|
90
|
+
},
|
|
91
|
+
/**禁用 */
|
|
92
|
+
disabled: Boolean,
|
|
93
|
+
/**允许手动输入 */
|
|
94
|
+
allowInput: Boolean,
|
|
95
|
+
/**查询延时,默认700ms */
|
|
96
|
+
delay: {
|
|
97
|
+
type: Number,
|
|
98
|
+
default: 700
|
|
99
|
+
},
|
|
100
|
+
/**保留小数位精度 */
|
|
101
|
+
precision: {
|
|
102
|
+
type: Number,
|
|
103
|
+
default: 3
|
|
104
|
+
},
|
|
105
|
+
/**查询时每页数量,默认15 */
|
|
106
|
+
searchPageCapacity: {
|
|
107
|
+
type: Number,
|
|
108
|
+
default: 15
|
|
109
|
+
},
|
|
110
|
+
/**启用滚轮放大缩小,默认启用 */
|
|
111
|
+
scrollWheelZoom: {
|
|
112
|
+
type: Boolean,
|
|
113
|
+
default: true
|
|
114
|
+
},
|
|
115
|
+
/**缩放 */
|
|
116
|
+
zoom: Number
|
|
144
117
|
},
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
this.visible = false
|
|
163
|
-
},
|
|
164
|
-
/**重置中心坐标 */
|
|
165
|
-
setCenter(point) {
|
|
166
|
-
this.center = point ? Object.assign({}, point) : null
|
|
167
|
-
},
|
|
168
|
-
/**设置选择的坐标点 */
|
|
169
|
-
setSelection(point) {
|
|
170
|
-
if (point) {
|
|
171
|
-
this.selection = {
|
|
172
|
-
lng: parseFloat(point.lng).toFixed(this.precision),
|
|
173
|
-
lat: parseFloat(point.lat).toFixed(this.precision)
|
|
118
|
+
computed: {
|
|
119
|
+
dialog() {
|
|
120
|
+
return {
|
|
121
|
+
title: this.title,
|
|
122
|
+
icon: this.icon,
|
|
123
|
+
fullscreen: this.fullscreen,
|
|
124
|
+
noScrollbar: true,
|
|
125
|
+
width: this.width,
|
|
126
|
+
height: this.height,
|
|
127
|
+
draggable: true
|
|
128
|
+
}
|
|
129
|
+
},
|
|
130
|
+
label_() {
|
|
131
|
+
if (this.selection) {
|
|
132
|
+
return `${this.selection.lng},${this.selection.lat}`
|
|
133
|
+
} else {
|
|
134
|
+
return ''
|
|
174
135
|
}
|
|
175
|
-
} else {
|
|
176
|
-
this.selection = null
|
|
177
|
-
}
|
|
178
|
-
},
|
|
179
|
-
setLabel() {
|
|
180
|
-
if (this.selection) {
|
|
181
|
-
this.label = `${this.selection.lng},${this.selection.lat}`
|
|
182
|
-
} else {
|
|
183
|
-
this.label = ''
|
|
184
136
|
}
|
|
185
137
|
},
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
138
|
+
methods: {
|
|
139
|
+
/**警告提示 */
|
|
140
|
+
_warning(msg) {
|
|
141
|
+
this.$message({
|
|
142
|
+
message: msg,
|
|
143
|
+
type: 'warning'
|
|
144
|
+
})
|
|
145
|
+
},
|
|
146
|
+
/**重置 */
|
|
147
|
+
reset() {
|
|
148
|
+
if (this.map) {
|
|
149
|
+
this.setSelection(this.oldValue)
|
|
150
|
+
this.setCenter(this.oldValue)
|
|
151
|
+
this.createMarker()
|
|
152
|
+
this.$refs.search.reset()
|
|
192
153
|
}
|
|
154
|
+
this.setSelection(this.oldValue)
|
|
155
|
+
this.save()
|
|
156
|
+
},
|
|
157
|
+
show() {
|
|
158
|
+
if (!this.disabled) this.visible = !this.visible
|
|
159
|
+
},
|
|
160
|
+
save() {
|
|
161
|
+
this.setLabel()
|
|
162
|
+
this.$emit('input', this.selection ? Object.assign({}, this.selection) : null)
|
|
163
|
+
this.visible = false
|
|
164
|
+
},
|
|
165
|
+
/**重置中心坐标 */
|
|
166
|
+
setCenter(point) {
|
|
167
|
+
this.center = point ? Object.assign({}, point) : null
|
|
168
|
+
},
|
|
169
|
+
/**设置选择的坐标点 */
|
|
170
|
+
setSelection(point) {
|
|
171
|
+
if (point) {
|
|
172
|
+
this.selection = {
|
|
173
|
+
lng: parseFloat(point.lng).toFixed(this.precision),
|
|
174
|
+
lat: parseFloat(point.lat).toFixed(this.precision)
|
|
175
|
+
}
|
|
176
|
+
} else {
|
|
177
|
+
this.selection = null
|
|
178
|
+
}
|
|
179
|
+
},
|
|
180
|
+
setLabel() {
|
|
193
181
|
if (this.selection) {
|
|
194
|
-
this.
|
|
195
|
-
|
|
182
|
+
this.label = `${this.selection.lng},${this.selection.lat}`
|
|
183
|
+
} else {
|
|
184
|
+
this.label = ''
|
|
196
185
|
}
|
|
197
|
-
}
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
186
|
+
},
|
|
187
|
+
//创建标注
|
|
188
|
+
createMarker() {
|
|
189
|
+
if (typeof BMap !== 'undefined') {
|
|
190
|
+
//先删除,再创建
|
|
191
|
+
if (this.marker) {
|
|
192
|
+
this.map.removeOverlay(this.marker)
|
|
193
|
+
}
|
|
194
|
+
if (this.selection) {
|
|
195
|
+
this.marker = new BMap.Marker(this.selection)
|
|
196
|
+
this.map.addOverlay(this.marker)
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
},
|
|
200
|
+
onMapInit(map) {
|
|
201
|
+
this.map = map
|
|
202
|
+
//初始化搜索
|
|
203
|
+
this.$refs.search.init(map)
|
|
204
|
+
//关闭loading
|
|
205
|
+
this.loading = false
|
|
205
206
|
|
|
206
|
-
|
|
207
|
-
|
|
207
|
+
//设置标注
|
|
208
|
+
this.createMarker()
|
|
208
209
|
|
|
209
|
-
const _this = this
|
|
210
|
-
//注册点击事件
|
|
211
|
-
this.map.addEventListener('click', function(e) {
|
|
212
|
-
_this.setSelection(e.point)
|
|
213
|
-
_this.createMarker()
|
|
214
|
-
})
|
|
215
|
-
},
|
|
216
|
-
onSelect(point) {
|
|
217
|
-
this.setSelection(point)
|
|
218
|
-
this.setCenter(point)
|
|
219
|
-
this.createMarker()
|
|
220
|
-
},
|
|
221
|
-
onOpened() {
|
|
222
|
-
if (this.resetMarkerOnOpen && this.map) {
|
|
223
210
|
const _this = this
|
|
224
|
-
|
|
211
|
+
//注册点击事件
|
|
212
|
+
this.map.addEventListener('click', function(e) {
|
|
213
|
+
_this.setSelection(e.point)
|
|
225
214
|
_this.createMarker()
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
215
|
+
})
|
|
216
|
+
},
|
|
217
|
+
onSelect(point) {
|
|
218
|
+
this.setSelection(point)
|
|
219
|
+
this.setCenter(point)
|
|
220
|
+
this.createMarker()
|
|
221
|
+
},
|
|
222
|
+
onOpened() {
|
|
223
|
+
if (this.resetMarkerOnOpen && this.map) {
|
|
224
|
+
const _this = this
|
|
225
|
+
setTimeout(() => {
|
|
226
|
+
_this.createMarker()
|
|
227
|
+
_this.setCenter(this.value)
|
|
228
|
+
}, 200)
|
|
229
|
+
this.resetMarkerOnOpen = false
|
|
230
|
+
}
|
|
231
|
+
},
|
|
232
|
+
onLabelChange(val) {
|
|
233
|
+
let point = null
|
|
234
|
+
this.refreshMarkerOnOpen = true
|
|
234
235
|
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
236
|
+
if (val.indexOf(',') < 0 || val.endsWith(',') || val.startsWith(',')) {
|
|
237
|
+
this.label = ''
|
|
238
|
+
this._warning('坐标无效')
|
|
239
|
+
return
|
|
240
|
+
}
|
|
240
241
|
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
242
|
+
const arr = val.split(',')
|
|
243
|
+
point = {
|
|
244
|
+
lng: arr[0],
|
|
245
|
+
lat: arr[1]
|
|
246
|
+
}
|
|
247
|
+
this.isManualInput = true
|
|
247
248
|
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
249
|
+
this.$emit('input', point)
|
|
250
|
+
}
|
|
251
|
+
},
|
|
252
|
+
watch: {
|
|
253
|
+
value: {
|
|
254
|
+
immediate: true,
|
|
255
|
+
handler(val) {
|
|
256
|
+
this.setSelection(val)
|
|
256
257
|
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
258
|
+
//如果是手动输入,需要重新设置中心坐标,并且再打开时需要重置标注,反之,需要设置label
|
|
259
|
+
if (this.isManualInput) {
|
|
260
|
+
this.resetMarkerOnOpen = true
|
|
261
|
+
if (!this.map) {
|
|
262
|
+
this.setCenter(val)
|
|
263
|
+
}
|
|
264
|
+
} else {
|
|
265
|
+
this.setLabel()
|
|
262
266
|
}
|
|
263
|
-
} else {
|
|
264
|
-
this.setLabel()
|
|
265
267
|
}
|
|
266
268
|
}
|
|
267
|
-
}
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
269
|
+
},
|
|
270
|
+
created() {
|
|
271
|
+
//首次创建设置中心坐标
|
|
272
|
+
if (!this.center) {
|
|
273
|
+
this.setCenter(this.value)
|
|
274
|
+
}
|
|
273
275
|
}
|
|
274
276
|
}
|
|
275
|
-
}
|
|
276
277
|
</script>
|
|
@@ -5,7 +5,10 @@
|
|
|
5
5
|
<el-scrollbar>
|
|
6
6
|
<ul v-if="data.length > 0" class="nm-map-search-list-box">
|
|
7
7
|
<li v-for="(item, i) in data" :key="i" :class="['nm-map-search-list-item', active === i ? 'active' : '']" @click="onSelect(item, i)">
|
|
8
|
-
<div class="title"
|
|
8
|
+
<div class="title">
|
|
9
|
+
<i class="el-icon-location-information" />
|
|
10
|
+
{{ item.title }}
|
|
11
|
+
</div>
|
|
9
12
|
<div class="address">{{ item.address }}</div>
|
|
10
13
|
<div class="point">{{ item.point.lng.toFixed(precision) }},{{ item.point.lat.toFixed(precision) }}</div>
|
|
11
14
|
</li>
|
|
@@ -16,83 +19,83 @@
|
|
|
16
19
|
</section>
|
|
17
20
|
</template>
|
|
18
21
|
<script>
|
|
19
|
-
export default {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
},
|
|
37
|
-
props: {
|
|
38
|
-
/**查询延时,默认800ms */
|
|
39
|
-
delay: {
|
|
40
|
-
type: Number,
|
|
41
|
-
default: 700
|
|
42
|
-
},
|
|
43
|
-
/**保留小数位精度 */
|
|
44
|
-
precision: {
|
|
45
|
-
type: Number,
|
|
46
|
-
default: 4
|
|
22
|
+
export default {
|
|
23
|
+
name: 'MapSearch',
|
|
24
|
+
data() {
|
|
25
|
+
return {
|
|
26
|
+
/**关键字 */
|
|
27
|
+
keyword: '',
|
|
28
|
+
/**搜索实例 */
|
|
29
|
+
local: null,
|
|
30
|
+
/**定时器 */
|
|
31
|
+
timer: null,
|
|
32
|
+
/**数据 */
|
|
33
|
+
data: [],
|
|
34
|
+
/**显示加载动画 */
|
|
35
|
+
loading: false,
|
|
36
|
+
/**已选择的 */
|
|
37
|
+
active: ''
|
|
38
|
+
}
|
|
47
39
|
},
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
40
|
+
props: {
|
|
41
|
+
/**查询延时,默认800ms */
|
|
42
|
+
delay: {
|
|
43
|
+
type: Number,
|
|
44
|
+
default: 700
|
|
45
|
+
},
|
|
46
|
+
/**保留小数位精度 */
|
|
47
|
+
precision: {
|
|
48
|
+
type: Number,
|
|
49
|
+
default: 4
|
|
50
|
+
},
|
|
51
|
+
/**查询时每页数量,默认15 */
|
|
52
|
+
searchPageCapacity: {
|
|
53
|
+
type: Number,
|
|
54
|
+
default: 15
|
|
55
|
+
}
|
|
57
56
|
},
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
57
|
+
methods: {
|
|
58
|
+
init(map) {
|
|
59
|
+
this.local = new BMap.LocalSearch(map, { searchPageCapacity: this.searchPageCapacity, onSearchComplete: this.onSearchComplete })
|
|
60
|
+
},
|
|
61
|
+
search() {
|
|
62
|
+
//删除定时器
|
|
63
|
+
clearTimeout(this.timer)
|
|
61
64
|
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
65
|
+
this.timer = setTimeout(() => {
|
|
66
|
+
this.data = []
|
|
67
|
+
if (this.keyword) {
|
|
68
|
+
this.loading = true
|
|
69
|
+
this.local.search(this.keyword)
|
|
70
|
+
}
|
|
71
|
+
}, this.delay)
|
|
72
|
+
},
|
|
73
|
+
onSearchComplete(results) {
|
|
74
|
+
this.loading = false
|
|
75
|
+
if (this.local.getStatus() == BMAP_STATUS_SUCCESS) {
|
|
76
|
+
this.data = results.Sq.map(m => {
|
|
77
|
+
return { title: m.title, address: m.address, point: m.point }
|
|
78
|
+
})
|
|
79
|
+
} else {
|
|
80
|
+
this.$message.error('查询失败~')
|
|
67
81
|
}
|
|
68
|
-
}, this.delay)
|
|
69
|
-
},
|
|
70
|
-
onSearchComplete(results) {
|
|
71
|
-
this.loading = false
|
|
72
|
-
if (this.local.getStatus() == BMAP_STATUS_SUCCESS) {
|
|
73
|
-
this.data = results.Sq.map(m => {
|
|
74
|
-
return { title: m.title, address: m.address, point: m.point }
|
|
75
|
-
})
|
|
76
|
-
} else {
|
|
77
|
-
this.$message.error('查询失败~')
|
|
78
|
-
}
|
|
79
82
|
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
83
|
+
this.$emit('search', this.data)
|
|
84
|
+
},
|
|
85
|
+
onSelect(item, i) {
|
|
86
|
+
this.active = i
|
|
87
|
+
this.$emit('select', item.point, item)
|
|
88
|
+
},
|
|
89
|
+
reset() {
|
|
90
|
+
this.active = ''
|
|
91
|
+
this.keyword = ''
|
|
92
|
+
this.data = []
|
|
93
|
+
}
|
|
85
94
|
},
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
}
|
|
91
|
-
},
|
|
92
|
-
watch: {
|
|
93
|
-
keyword() {
|
|
94
|
-
this.search()
|
|
95
|
+
watch: {
|
|
96
|
+
keyword() {
|
|
97
|
+
this.search()
|
|
98
|
+
}
|
|
95
99
|
}
|
|
96
100
|
}
|
|
97
|
-
}
|
|
98
101
|
</script>
|
|
@@ -4,17 +4,17 @@
|
|
|
4
4
|
</el-scrollbar>
|
|
5
5
|
</template>
|
|
6
6
|
<script>
|
|
7
|
-
export default {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
7
|
+
export default {
|
|
8
|
+
name: 'Scrollbar',
|
|
9
|
+
props: {
|
|
10
|
+
/** 是否显示水平滚动条 */
|
|
11
|
+
horizontal: Boolean
|
|
12
|
+
},
|
|
13
|
+
methods: {
|
|
14
|
+
// 重绘滚动条
|
|
15
|
+
update() {
|
|
16
|
+
this.$refs.bar.update()
|
|
17
|
+
}
|
|
17
18
|
}
|
|
18
19
|
}
|
|
19
|
-
}
|
|
20
20
|
</script>
|