vue2-client 1.8.233 → 1.8.235
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/package.json +1 -1
- package/src/base-client/components/common/AddressSearchCombobox/AddressSearchCombobox.vue +93 -18
- package/src/base-client/components/common/AddressSearchCombobox/demo.vue +35 -0
- package/src/base-client/components/common/XForm/XFormItem.vue +19 -3
- package/src/config/default/setting.config.js +3 -1
- package/src/pages/Example/index.vue +2 -1
package/package.json
CHANGED
|
@@ -1,8 +1,30 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<div id="addressSearchCombobox">
|
|
3
3
|
<div>
|
|
4
|
-
<a-input
|
|
5
|
-
|
|
4
|
+
<a-input-group
|
|
5
|
+
style="display: flex; width: 100%;"
|
|
6
|
+
compact>
|
|
7
|
+
<a-input
|
|
8
|
+
v-model="addressInput"
|
|
9
|
+
:read-only="readOnly"
|
|
10
|
+
@change="change"
|
|
11
|
+
style="flex: 1; width: auto; min-width: 0;"
|
|
12
|
+
placeholder="请选择地址信息"/>
|
|
13
|
+
<a-button
|
|
14
|
+
v-if="attr?.inputOnAfterName && attr?.inputOnAfterFunc"
|
|
15
|
+
style="flex: 1; width: auto; min-width: 4rem;max-width: 6rem"
|
|
16
|
+
type="primary"
|
|
17
|
+
@click="emitFunc(attr?.inputOnAfterFunc,addressInput)">
|
|
18
|
+
{{ attr?.inputOnAfterName }}
|
|
19
|
+
</a-button>
|
|
20
|
+
<!-- 默认展示该图标 如果配置了按钮插槽展示 primary 央视 -->
|
|
21
|
+
<a-button
|
|
22
|
+
style="width: 2rem; flex-shrink: 0;"
|
|
23
|
+
:type="attr?.inputOnAfterName ? 'primary' :''"
|
|
24
|
+
icon="environment"
|
|
25
|
+
@click="visible=true">
|
|
26
|
+
</a-button>
|
|
27
|
+
</a-input-group>
|
|
6
28
|
</div>
|
|
7
29
|
<a-modal :visible="visible" title="地址选择" @ok="selected" @cancel="visible=false" :zIndex="m_index">
|
|
8
30
|
<div id="addressSearchCombobox_map">
|
|
@@ -17,15 +39,17 @@
|
|
|
17
39
|
@search="fetchFunction"
|
|
18
40
|
@select="onSelect"
|
|
19
41
|
>
|
|
20
|
-
<a-spin v-if="searching" slot="notFoundContent" size="small"
|
|
42
|
+
<a-spin v-if="searching" slot="notFoundContent" size="small"/>
|
|
21
43
|
<template slot="dataSource">
|
|
22
44
|
<a-select-opt-group v-for="group in option" :key="group.title">
|
|
23
45
|
<span
|
|
24
46
|
slot="label">
|
|
25
|
-
<a-icon type="bank"
|
|
47
|
+
<a-icon type="bank"/> {{ group.title }}
|
|
26
48
|
</span>
|
|
27
49
|
<a-select-option v-for="address in group.children" :key="address.label + ' <' + address.value + '>'">
|
|
28
|
-
<p class="addressName"
|
|
50
|
+
<p class="addressName">
|
|
51
|
+
<a-icon type="environment"/>
|
|
52
|
+
<span v-html="highLight(address.label, address.word)"></span></p>
|
|
29
53
|
<p v-if="address.address !== '[]'" class="addressRemark">
|
|
30
54
|
{{ address.address }}
|
|
31
55
|
</p>
|
|
@@ -79,13 +103,27 @@ export default {
|
|
|
79
103
|
map: null,
|
|
80
104
|
m_index: 1002,
|
|
81
105
|
positionPicker: null,
|
|
82
|
-
addressInput: this.searchResult
|
|
106
|
+
addressInput: this.searchResult,
|
|
107
|
+
// 选择地址返回的行政区域
|
|
108
|
+
divisions: {},
|
|
109
|
+
// 生成地址串中省市区街道信息禁止修改
|
|
110
|
+
readOnlyDivisions: false
|
|
83
111
|
}
|
|
84
112
|
},
|
|
85
113
|
computed: {
|
|
86
114
|
...mapState('setting', ['isMobile', 'gaode_key', 'gaode_secret_key'])
|
|
87
115
|
},
|
|
88
116
|
props: {
|
|
117
|
+
attr: {
|
|
118
|
+
type: Object,
|
|
119
|
+
default: () => {
|
|
120
|
+
}
|
|
121
|
+
},
|
|
122
|
+
emitFunc: {
|
|
123
|
+
type: Function,
|
|
124
|
+
default: () => {
|
|
125
|
+
}
|
|
126
|
+
},
|
|
89
127
|
searchResult: {
|
|
90
128
|
type: String,
|
|
91
129
|
default: undefined
|
|
@@ -100,8 +138,19 @@ export default {
|
|
|
100
138
|
// Object 返回格式时 可以自定义key
|
|
101
139
|
resultKeys: {
|
|
102
140
|
type: Object,
|
|
103
|
-
default: () => {
|
|
104
|
-
|
|
141
|
+
default: () => {
|
|
142
|
+
return { address: 'address', coords: 'coords' }
|
|
143
|
+
}
|
|
144
|
+
},
|
|
145
|
+
readOnly: {
|
|
146
|
+
type: Boolean,
|
|
147
|
+
default: false
|
|
148
|
+
},
|
|
149
|
+
// 省市区是否可以修改
|
|
150
|
+
divisionsChange: {
|
|
151
|
+
type: Boolean,
|
|
152
|
+
default: false
|
|
153
|
+
},
|
|
105
154
|
},
|
|
106
155
|
created () {
|
|
107
156
|
},
|
|
@@ -109,6 +158,14 @@ export default {
|
|
|
109
158
|
},
|
|
110
159
|
methods: {
|
|
111
160
|
change (value) {
|
|
161
|
+
if (this.readOnlyDivisions && !this.divisionsChange) {
|
|
162
|
+
// 如果省市区街道信息禁止修改
|
|
163
|
+
if (this.divisions.str && !this.addressInput.startsWith(this.divisions.str)) {
|
|
164
|
+
this.addressInput = this.addressObj.address
|
|
165
|
+
this.$message.info('省市区街道信息请从选择新地址以变更')
|
|
166
|
+
return
|
|
167
|
+
}
|
|
168
|
+
}
|
|
112
169
|
this.$emit('update:searchResult', this.addressInput)
|
|
113
170
|
},
|
|
114
171
|
initMap (aMap) {
|
|
@@ -151,7 +208,7 @@ export default {
|
|
|
151
208
|
this.addressInput = this.addressObj.address
|
|
152
209
|
console.log(' result--- ', result)
|
|
153
210
|
this.visible = false
|
|
154
|
-
this.$emit('onSelect',
|
|
211
|
+
this.$emit('onSelect', Object.assign({}, result, { divisions: this.divisions }))
|
|
155
212
|
// this.$emit('onClick', result || value)
|
|
156
213
|
},
|
|
157
214
|
// 懒加载检索方法
|
|
@@ -230,8 +287,6 @@ export default {
|
|
|
230
287
|
dragEnable: true,
|
|
231
288
|
animateEnable: false
|
|
232
289
|
})
|
|
233
|
-
console.log(aMap)
|
|
234
|
-
console.log(window)
|
|
235
290
|
this.positionPicker = new window.AMapUI.PositionPicker({
|
|
236
291
|
mode: 'dragMap',
|
|
237
292
|
map: this.map
|
|
@@ -239,6 +294,22 @@ export default {
|
|
|
239
294
|
this.positionPicker.on('success', (positionResult) => {
|
|
240
295
|
console.log(positionResult)
|
|
241
296
|
console.log(positionResult.position)
|
|
297
|
+
// 设置 行政区划信息
|
|
298
|
+
if (positionResult?.regeocode?.addressComponent) {
|
|
299
|
+
const { addressComponent } = positionResult?.regeocode
|
|
300
|
+
this.divisions.province = addressComponent.province
|
|
301
|
+
this.divisions.city = addressComponent.city
|
|
302
|
+
this.divisions.district = addressComponent.district
|
|
303
|
+
this.divisions.township = addressComponent.township
|
|
304
|
+
this.divisions.towncode = addressComponent.towncode
|
|
305
|
+
this.divisions.street = addressComponent.street
|
|
306
|
+
this.divisions.str =
|
|
307
|
+
`${addressComponent.province}${addressComponent.city}${addressComponent.district}${addressComponent.township}`
|
|
308
|
+
}
|
|
309
|
+
if (this.divisions.str && positionResult.address.startsWith(this.divisions.str)) {
|
|
310
|
+
// 如果 省市区信息和获取到的地址的前缀一致 那么省市区前缀禁止修改只能修改后面的 通过 onchange事件拦截
|
|
311
|
+
this.readOnlyDivisions = true
|
|
312
|
+
}
|
|
242
313
|
this.addressObj.address = positionResult.address
|
|
243
314
|
this.addressObj.lng_lat = `${positionResult.position.lng},${positionResult.position.lat}`
|
|
244
315
|
})
|
|
@@ -252,18 +323,19 @@ export default {
|
|
|
252
323
|
}
|
|
253
324
|
</script>
|
|
254
325
|
<style>
|
|
255
|
-
.asc_descriptions .ant-descriptions-item-content{
|
|
326
|
+
.asc_descriptions .ant-descriptions-item-content {
|
|
256
327
|
width: 80%;
|
|
257
328
|
}
|
|
258
329
|
</style>
|
|
259
330
|
<style lang="less">
|
|
260
|
-
#addressSearchCombobox_map{
|
|
261
|
-
margin:1% 0;
|
|
262
|
-
width:100%;
|
|
263
|
-
height:400px;
|
|
264
|
-
text-align:center
|
|
331
|
+
#addressSearchCombobox_map {
|
|
332
|
+
margin: 1% 0;
|
|
333
|
+
width: 100%;
|
|
334
|
+
height: 400px;
|
|
335
|
+
text-align: center
|
|
265
336
|
}
|
|
266
|
-
|
|
337
|
+
|
|
338
|
+
#addressSearchCombobox {
|
|
267
339
|
|
|
268
340
|
.certain-category-search-dropdown .ant-select-dropdown-menu-item-group-title {
|
|
269
341
|
color: #666;
|
|
@@ -287,15 +359,18 @@ export default {
|
|
|
287
359
|
.certain-category-search-dropdown .ant-select-dropdown-menu {
|
|
288
360
|
max-height: 300px;
|
|
289
361
|
}
|
|
362
|
+
|
|
290
363
|
.certain-category-search-wrapper .certain-search-item-count {
|
|
291
364
|
position: absolute;
|
|
292
365
|
color: #999;
|
|
293
366
|
right: 16px;
|
|
294
367
|
}
|
|
368
|
+
|
|
295
369
|
.certain-category-search-wrapper .certain-category-search.ant-select-focused,
|
|
296
370
|
.certain-category-icon {
|
|
297
371
|
color: #108ee9;
|
|
298
372
|
}
|
|
373
|
+
|
|
299
374
|
.certain-category-search-wrapper .certain-category-icon {
|
|
300
375
|
color: #6e6e6e;
|
|
301
376
|
transition: all 0.3s cubic-bezier(0.645, 0.045, 0.355, 1);
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
<script>
|
|
2
|
+
|
|
3
|
+
import AddressSearchCombobox from '@/base-client/components/common/AddressSearchCombobox/index'
|
|
4
|
+
|
|
5
|
+
export default {
|
|
6
|
+
name: 'Demo',
|
|
7
|
+
components: { AddressSearchCombobox },
|
|
8
|
+
data () {
|
|
9
|
+
return {
|
|
10
|
+
visible: false,
|
|
11
|
+
searchResult: {}
|
|
12
|
+
}
|
|
13
|
+
},
|
|
14
|
+
methods: {
|
|
15
|
+
addressSearchComboboxSelect (res) {
|
|
16
|
+
console.log('===', res)
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
</script>
|
|
21
|
+
|
|
22
|
+
<template>
|
|
23
|
+
<div>
|
|
24
|
+
<address-search-combobox
|
|
25
|
+
v-model="searchResult"
|
|
26
|
+
:resultKeys="{ address: 'f_address', coords: `f_address_lng_lat` }"
|
|
27
|
+
searchResultType="Object"
|
|
28
|
+
@onSelect="addressSearchComboboxSelect"
|
|
29
|
+
></address-search-combobox>
|
|
30
|
+
</div>
|
|
31
|
+
</template>
|
|
32
|
+
|
|
33
|
+
<style scoped lang="less">
|
|
34
|
+
|
|
35
|
+
</style>
|
|
@@ -380,12 +380,21 @@
|
|
|
380
380
|
<x-form-col
|
|
381
381
|
v-else-if="attr.type === 'addressSearch'"
|
|
382
382
|
:flex="attr.flex">
|
|
383
|
-
<a-form-model-item
|
|
383
|
+
<a-form-model-item
|
|
384
|
+
:ref="attr.model"
|
|
385
|
+
:label="attr.name"
|
|
386
|
+
:prop="attr.prop ? attr.prop : attr.model"
|
|
387
|
+
:labelCol="layout === 'inline' && attr.occupyCol ? labelAndWrapperCol[attr.occupyCol].labelCol:undefined"
|
|
388
|
+
:wrapperCol="layout === 'inline'&& attr.occupyCol ? labelAndWrapperCol[attr.occupyCol].wrapperCol:undefined"
|
|
389
|
+
:style="layout === 'inline'&& attr.occupyCol && attr.occupyCol > 1? {width:`calc(100% - ${attr.occupyCol * 1.533}rem)`}:{}">
|
|
384
390
|
<address-search-combobox
|
|
391
|
+
:emitFunc="emitFunc"
|
|
392
|
+
:attr="attr"
|
|
393
|
+
:read-only="readOnly"
|
|
385
394
|
v-model="searchResult"
|
|
386
395
|
:resultKeys="{ address: attr.model, coords: `${attr.model}_lng_lat` }"
|
|
387
396
|
searchResultType="Object"
|
|
388
|
-
@onSelect="
|
|
397
|
+
@onSelect="addressSearchComboboxSelect"
|
|
389
398
|
></address-search-combobox>
|
|
390
399
|
</a-form-model-item>
|
|
391
400
|
</x-form-col>
|
|
@@ -596,7 +605,7 @@ export default {
|
|
|
596
605
|
xxl: 24
|
|
597
606
|
}
|
|
598
607
|
} else {
|
|
599
|
-
if (
|
|
608
|
+
if (['input', 'addressSearch'] && this.attr.occupyCol) {
|
|
600
609
|
// 如果是 input 看是否配置了 占用列配置
|
|
601
610
|
this.attr.flex = {
|
|
602
611
|
xs: 8 * this.attr.occupyCol,
|
|
@@ -637,6 +646,13 @@ export default {
|
|
|
637
646
|
this.initRadioValue()
|
|
638
647
|
}
|
|
639
648
|
},
|
|
649
|
+
addressSearchComboboxSelect () {
|
|
650
|
+
this.form = Object.assign(this.form, JSON.parse(this.searchResult))
|
|
651
|
+
this.emitFunc('addressSearchComboboxSelect', {
|
|
652
|
+
key: this.attr.model,
|
|
653
|
+
value: this.searchResult
|
|
654
|
+
})
|
|
655
|
+
},
|
|
640
656
|
getDataCallback (res) {
|
|
641
657
|
this.option = res
|
|
642
658
|
if (this.attr.type === 'treeSelect') {
|
|
@@ -49,5 +49,7 @@ module.exports = {
|
|
|
49
49
|
// 自定义组件集合 格式为组件名: 组件路径(不需要带@/)
|
|
50
50
|
customizeComponent: {},
|
|
51
51
|
// 自定义默认头像路径
|
|
52
|
-
defaultAvatarUrl: 'https://gw.alipayobjects.com/zos/rmsportal/jZUIxmJycoymBprLOUbT.png'
|
|
52
|
+
defaultAvatarUrl: 'https://gw.alipayobjects.com/zos/rmsportal/jZUIxmJycoymBprLOUbT.png',
|
|
53
|
+
gaode_key: 'a37ffa0cad038bef7242cdff7084cd36',
|
|
54
|
+
gaode_secret_key: 'da72499e61d9299f447bb5b2af9f9e6c',
|
|
53
55
|
}
|
|
@@ -8,7 +8,8 @@
|
|
|
8
8
|
<script>
|
|
9
9
|
import XReport from '@vue2-client/base-client/components/common/XReport'
|
|
10
10
|
// import Demo from '@vue2-client/base-client/components/common/XFormGroup/demo.vue'
|
|
11
|
-
import Demo from '@vue2-client/base-client/components/common/XDescriptions/demo.vue'
|
|
11
|
+
// import Demo from '@vue2-client/base-client/components/common/XDescriptions/demo.vue'
|
|
12
|
+
import Demo from '@vue2-client/base-client/components/common/AddressSearchCombobox/demo.vue'
|
|
12
13
|
|
|
13
14
|
export default {
|
|
14
15
|
name: 'Example',
|