vue2-client 1.8.241 → 1.8.243

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.241",
3
+ "version": "1.8.243",
4
4
  "private": false,
5
5
  "scripts": {
6
6
  "serve": "SET NODE_OPTIONS=--openssl-legacy-provider && vue-cli-service serve --no-eslint",
@@ -170,7 +170,9 @@ export default {
170
170
  return
171
171
  }
172
172
  }
173
- this.$emit('update:searchResult', this.addressInput)
173
+ debounce(() => {
174
+ this.selected(null, this.addressInput)
175
+ }, 200)()
174
176
  },
175
177
  initMap (aMap) {
176
178
  this.map = new (aMap).Map('addressSearchCombobox_map', { // 设置地图容器id
@@ -198,23 +200,24 @@ export default {
198
200
  this.addressObj.lng_lat = _arr[1]
199
201
  this.map.setCenter(this.addressObj.lng_lat.split(','))
200
202
  },
201
- selected () {
203
+ selected (_value, _addstr) {
202
204
  let result
203
205
  if (this.searchResultType !== 'Default') {
204
206
  if (this.searchResultType === 'Array') {
205
- result = [this.addressObj.address, this.addressObj.lng_lat]
207
+ result = [_addstr || this.addressObj.address, this.addressObj.lng_lat]
206
208
  } else {
207
209
  result = {}
208
- result[this.resultKeys.address] = this.addressObj.address
210
+ result[this.resultKeys.address] = _addstr || this.addressObj.address
209
211
  result[this.resultKeys.coords] = this.addressObj.lng_lat
210
212
  }
211
213
  }
212
- this.addressInput = this.addressObj.address
213
- console.log(' result--- ', result)
214
214
  this.visible = false
215
215
  this.$emit('onSelect', JSON.stringify(result))
216
- this.$emit('onDivisionsChange', Object.assign({}, result, { divisions: this.divisions, vm: this }))
217
- // this.$emit('onClick', result || value)
216
+ // 如果传递了地址 是为了更新上级 不做省市区检验处理
217
+ if (!_addstr) {
218
+ this.addressInput = this.addressObj.address
219
+ this.$emit('onDivisionsChange', Object.assign({}, result, { divisions: this.divisions, vm: this }))
220
+ }
218
221
  },
219
222
  // 懒加载检索方法
220
223
  fetchFunction (value) {
@@ -283,51 +286,53 @@ export default {
283
286
  watch: {
284
287
  'visible' (val) {
285
288
  if (val) {
286
- GetGDMap(this.gaode_secret_key, this.gaode_key).then(aMap => {
287
- this.initMap(aMap)
288
- this.mapAutocomplete = new (aMap).AutoComplete({
289
- // city 限定城市,默认全国
290
- city: '全国',
291
- dragEnable: true,
292
- animateEnable: false
293
- })
294
- this.positionPicker = new window.AMapUI.PositionPicker({
295
- mode: 'dragMap',
296
- map: this.map
297
- })
298
- this.positionPicker.on('success', (positionResult) => {
299
- console.log(positionResult)
300
- console.log(positionResult.position)
301
- // 设置 行政区划信息
302
- if (positionResult?.regeocode?.addressComponent) {
303
- const { addressComponent } = positionResult?.regeocode
304
- this.divisions.province = addressComponent.province
305
- this.divisions.city = addressComponent.city
306
- this.divisions.district = addressComponent.district
307
- this.divisions.township = addressComponent.township
308
- this.divisions.towncode = addressComponent.towncode
309
- this.divisions.street = addressComponent.street
310
- // 试着获取小区
311
- if (positionResult?.regeocode?.aois && positionResult?.regeocode?.aois.length) {
312
- // 取第一个当做小区
313
- this.divisions.area = positionResult?.regeocode?.aois[0]?.name
314
- } else if (positionResult?.regeocode?.pois && positionResult?.regeocode?.pois.length) {
315
- // 取第一个当做小区
316
- this.divisions.area = positionResult?.regeocode?.pois[0]?.name
289
+ this.$nextTick(() => {
290
+ GetGDMap(this.gaode_secret_key, this.gaode_key).then(aMap => {
291
+ this.initMap(aMap)
292
+ this.mapAutocomplete = new (aMap).AutoComplete({
293
+ // city 限定城市,默认全国
294
+ city: '全国',
295
+ dragEnable: true,
296
+ animateEnable: false
297
+ })
298
+ this.positionPicker = new window.AMapUI.PositionPicker({
299
+ mode: 'dragMap',
300
+ map: this.map
301
+ })
302
+ this.positionPicker.on('success', (positionResult) => {
303
+ console.log(positionResult)
304
+ console.log(positionResult.position)
305
+ // 设置 行政区划信息
306
+ if (positionResult?.regeocode?.addressComponent) {
307
+ const { addressComponent } = positionResult?.regeocode
308
+ this.divisions.province = addressComponent.province
309
+ this.divisions.city = addressComponent.city
310
+ this.divisions.district = addressComponent.district
311
+ this.divisions.township = addressComponent.township
312
+ this.divisions.towncode = addressComponent.towncode
313
+ this.divisions.street = addressComponent.street
314
+ // 试着获取小区
315
+ if (positionResult?.regeocode?.aois && positionResult?.regeocode?.aois.length) {
316
+ // 取第一个当做小区
317
+ this.divisions.area = positionResult?.regeocode?.aois[0]?.name
318
+ } else if (positionResult?.regeocode?.pois && positionResult?.regeocode?.pois.length) {
319
+ // 取第一个当做小区
320
+ this.divisions.area = positionResult?.regeocode?.pois[0]?.name
321
+ }
322
+ this.divisions.str =
323
+ `${addressComponent.province}${addressComponent.city}${addressComponent.district}${addressComponent.township}`
317
324
  }
318
- this.divisions.str =
319
- `${addressComponent.province}${addressComponent.city}${addressComponent.district}${addressComponent.township}`
320
- }
321
- if (this.divisions.str && positionResult.address.startsWith(this.divisions.str)) {
322
- // 如果 省市区信息和获取到的地址的前缀一致 那么省市区前缀禁止修改只能修改后面的 通过 onchange事件拦截
323
- this.readOnlyDivisions = true
324
- }
325
- this.addressObj.address = positionResult.address
326
- this.addressObj.lng_lat = `${positionResult.position.lng},${positionResult.position.lat}`
327
- })
328
- this.positionPicker.on('fail', function (positionResult) {
325
+ if (this.divisions.str && positionResult.address.startsWith(this.divisions.str)) {
326
+ // 如果 省市区信息和获取到的地址的前缀一致 那么省市区前缀禁止修改只能修改后面的 通过 onchange事件拦截
327
+ this.readOnlyDivisions = true
328
+ }
329
+ this.addressObj.address = positionResult.address
330
+ this.addressObj.lng_lat = `${positionResult.position.lng},${positionResult.position.lat}`
331
+ })
332
+ this.positionPicker.on('fail', function (positionResult) {
333
+ })
334
+ this.positionPicker.start()
329
335
  })
330
- this.positionPicker.start()
331
336
  })
332
337
  }
333
338
  }
@@ -117,7 +117,9 @@ export default {
117
117
  this.setValue(this.value, res)
118
118
  }
119
119
  } else {
120
- runLogic('getOperatingAreas', {}, 'af-revenue').then(res => {
120
+ runLogic('getOperatingAreas', {
121
+ orgId: this.currUser.orgid
122
+ }, 'af-revenue').then(res => {
121
123
  this.tagData.divisionsForTree = handleTree(res, 'code', 'parentcode')
122
124
  if (this.value) {
123
125
  this.setValue(this.value, res)