vue2-client 1.8.234 → 1.8.236

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vue2-client",
3
- "version": "1.8.234",
3
+ "version": "1.8.236",
4
4
  "private": false,
5
5
  "scripts": {
6
6
  "serve": "SET NODE_OPTIONS=--openssl-legacy-provider && vue-cli-service serve --no-eslint",
@@ -7,19 +7,20 @@
7
7
  <a-input
8
8
  v-model="addressInput"
9
9
  :read-only="readOnly"
10
+ @change="change"
10
11
  style="flex: 1; width: auto; min-width: 0;"
11
12
  placeholder="请选择地址信息"/>
12
13
  <a-button
13
- v-if="attr.inputOnAfterName && attr.inputOnAfterFunc"
14
+ v-if="attr?.inputOnAfterName && attr?.inputOnAfterFunc"
14
15
  style="flex: 1; width: auto; min-width: 4rem;max-width: 6rem"
15
16
  type="primary"
16
- @click="emitFunc(attr.inputOnAfterFunc,addressInput)">
17
- {{ attr.inputOnAfterName }}
17
+ @click="emitFunc(attr?.inputOnAfterFunc,addressInput)">
18
+ {{ attr?.inputOnAfterName }}
18
19
  </a-button>
19
20
  <!-- 默认展示该图标 如果配置了按钮插槽展示 primary 央视 -->
20
21
  <a-button
21
22
  style="width: 2rem; flex-shrink: 0;"
22
- :type="attr.inputOnAfterName ? 'primary' :''"
23
+ :type="attr?.inputOnAfterName ? 'primary' :''"
23
24
  icon="environment"
24
25
  @click="visible=true">
25
26
  </a-button>
@@ -102,7 +103,11 @@ export default {
102
103
  map: null,
103
104
  m_index: 1002,
104
105
  positionPicker: null,
105
- addressInput: this.searchResult
106
+ addressInput: this.searchResult,
107
+ // 选择地址返回的行政区域
108
+ divisions: {},
109
+ // 生成地址串中省市区街道信息禁止修改
110
+ readOnlyDivisions: false
106
111
  }
107
112
  },
108
113
  computed: {
@@ -141,6 +146,11 @@ export default {
141
146
  type: Boolean,
142
147
  default: false
143
148
  },
149
+ // 省市区是否可以修改
150
+ divisionsChange: {
151
+ type: Boolean,
152
+ default: false
153
+ },
144
154
  },
145
155
  created () {
146
156
  },
@@ -148,6 +158,14 @@ export default {
148
158
  },
149
159
  methods: {
150
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
+ }
151
169
  this.$emit('update:searchResult', this.addressInput)
152
170
  },
153
171
  initMap (aMap) {
@@ -190,7 +208,7 @@ export default {
190
208
  this.addressInput = this.addressObj.address
191
209
  console.log(' result--- ', result)
192
210
  this.visible = false
193
- this.$emit('onSelect', JSON.stringify(result))
211
+ this.$emit('onSelect', Object.assign({}, result, { divisions: this.divisions }))
194
212
  // this.$emit('onClick', result || value)
195
213
  },
196
214
  // 懒加载检索方法
@@ -276,6 +294,22 @@ export default {
276
294
  this.positionPicker.on('success', (positionResult) => {
277
295
  console.log(positionResult)
278
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
+ }
279
313
  this.addressObj.address = positionResult.address
280
314
  this.addressObj.lng_lat = `${positionResult.position.lng},${positionResult.position.lat}`
281
315
  })
@@ -0,0 +1,35 @@
1
+ <script>
2
+
3
+ import AddressSearchCombobox from '@vue2-client/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>
@@ -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',
package/vue.config.js CHANGED
@@ -99,7 +99,6 @@ module.exports = {
99
99
  extensions: ['.js', '.vue', '.json'],
100
100
  alias: {
101
101
  '@vue2-client': path.resolve('src'),
102
- '@': path.resolve('src')
103
102
  }
104
103
  }
105
104
  config.entry.app = ['core-js/stable', 'regenerator-runtime/runtime', 'whatwg-fetch', './src/main.js']