n20-common-lib 2.8.11 → 2.8.13

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": "n20-common-lib",
3
- "version": "2.8.11",
3
+ "version": "2.8.13",
4
4
  "private": false,
5
5
  "scripts": {
6
6
  "serve": "vue-cli-service serve",
@@ -9,6 +9,7 @@
9
9
  "lint": "vue-cli-service lint",
10
10
  "build:Jenkins_1": "vue-cli-service build --serverConfig ./server-config-jenkins.jsonc",
11
11
  "build:css": "node build_css",
12
+ "build:dev": "vue-cli-service build",
12
13
  "build:doc": "node versionInfo.js && vue-cli-service build --testTheme",
13
14
  "build:gzip": "vue-cli-service build --gzip",
14
15
  "build:js": "vue-cli-service build --formats umd-min --target lib src/index.js --name index --dest lib --analy",
@@ -13,8 +13,6 @@
13
13
 
14
14
  <script>
15
15
  import axios from '../../utils/axios'
16
- import list2tree from '../../utils/list2tree'
17
-
18
16
  window._china_area_tree_ = undefined
19
17
 
20
18
  export default {
@@ -32,10 +30,15 @@ export default {
32
30
  type: Boolean,
33
31
  default: true
34
32
  },
33
+
35
34
  isUrban: {
36
35
  type: Boolean,
37
36
  default: false
38
37
  },
38
+ isStreet: {
39
+ type: Boolean,
40
+ default: false
41
+ },
39
42
  labelSort: {
40
43
  type: Boolean,
41
44
  default: false
@@ -60,7 +63,8 @@ export default {
60
63
  value: 'regionNo',
61
64
  label: 'regionName',
62
65
  children: 'children',
63
- expandTrigger: 'hover'
66
+ expandTrigger: 'hover',
67
+ checkStrictly: this.isUrban ? false : true
64
68
  }
65
69
  return Object.assign(_prop, this.props)
66
70
  },
@@ -69,46 +73,40 @@ export default {
69
73
  },
70
74
  urbanKey() {
71
75
  return this.countryId === 'CHN' ? '_china_urban_tree_' : `_${this.countryId}_urban_tree_`
76
+ },
77
+ streetKey() {
78
+ return this.countryId === 'CHN' ? '_china_street_tree_' : `_${this.countryId}_street_tree_`
72
79
  }
73
80
  },
74
81
  mounted() {
75
82
  if (!window[this.areaKey]) {
76
83
  this.getAreaTree()
77
84
  } else {
78
- this.areaTree = this.isUrban ? window[this.urbanKey] : window[this.areaKey]
85
+ this.areaTree = this.isUrban
86
+ ? window[this.urbanKey]
87
+ : this.isStreet
88
+ ? window[this.streetKey]
89
+ : window[this.areaKey]
79
90
  }
80
91
  },
81
92
  methods: {
82
93
  getAreaTree() {
83
94
  axios
84
- .get('/bems/1.0/area', { countryId: this.countryId, isEnable: '1' }, { loading: false, noMsg: true })
95
+ .get(
96
+ `/bems/1.0/area?t=${Math.random()}`,
97
+ { countryId: this.countryId, isEnable: '1', resultType: 2, queryLeave4: this.isStreet },
98
+ { loading: false, noMsg: true }
99
+ )
85
100
  .then(({ data }) => {
86
- let dataAr = JSON.parse(JSON.stringify(data))
87
- let dataUb = JSON.parse(JSON.stringify(data))
88
-
89
- let areaTree = list2tree(
90
- dataAr,
91
- 'regionNo',
92
- 'fatherNo',
93
- 'children',
94
- this.labelSort ? 'regionName' : 'regionNo'
95
- )
96
- let noAreaTree = areaTree.filter((a) => a.regionLevel !== '1')
97
- if (noAreaTree.length > 0) {
98
- console.warn('这些区域找不到父级节点:', noAreaTree)
99
- }
100
- window[this.areaKey] = areaTree.filter((a) => a.regionLevel === '1')
101
+ window[this.urbanKey] = isUrbanFn(JSON.parse(JSON.stringify(data)))
102
+ window[this.streetKey] = treeFn(JSON.parse(JSON.stringify(data)))
103
+ window[this.areaKey] = treeFn(JSON.parse(JSON.stringify(data)))
101
104
 
102
- let urbanTree = list2tree(
103
- dataUb.filter((d) => d.regionLevel !== '3'),
104
- 'regionNo',
105
- 'fatherNo',
106
- 'children',
107
- this.labelSort ? 'regionName' : 'regionNo'
108
- )
109
-
110
- window[this.urbanKey] = urbanTree.filter((a) => a.regionLevel === '1')
111
- this.areaTree = this.isUrban ? window[this.urbanKey] : window[this.areaKey]
105
+ this.areaTree = this.isUrban
106
+ ? window[this.urbanKey]
107
+ : this.isStreet
108
+ ? window[this.streetKey]
109
+ : window[this.areaKey]
112
110
  })
113
111
  },
114
112
  updateArea() {
@@ -116,4 +114,30 @@ export default {
116
114
  }
117
115
  }
118
116
  }
117
+
118
+ const treeFn = (data) => {
119
+ return data?.map((res) => {
120
+ if (!['3', '4', '5'].includes(res.regionLevel)) {
121
+ res.disabled = true
122
+ }
123
+
124
+ if (!res.children?.length) {
125
+ res.children = null
126
+ } else {
127
+ res.children = treeFn(res.children)
128
+ }
129
+ return res
130
+ })
131
+ }
132
+
133
+ const isUrbanFn = (data) => {
134
+ return data?.map((res) => {
135
+ if (res.regionLevel === '2') {
136
+ res.children = null
137
+ } else {
138
+ res.children = isUrbanFn(res.children)
139
+ }
140
+ return res
141
+ })
142
+ }
119
143
  </script>
@@ -41,7 +41,7 @@
41
41
  class="input-w"
42
42
  :placeholder="formItem.placeholder || formItem.label"
43
43
  :clearable="formItem.clearable === false ? false : true"
44
- :maxlength="formItem.maxlength||'100'"
44
+ :maxlength="formItem.maxlength||inputMaxLength"
45
45
  v-bind="formItem"
46
46
  @change="value => $emit('valueChange', value, key)"
47
47
  />
@@ -335,6 +335,10 @@ export default {
335
335
  }
336
336
  },
337
337
  props: {
338
+ inputMaxLength:{
339
+ type:String,
340
+ default:'100'
341
+ },
338
342
  value: {
339
343
  type: Object
340
344
  },
Binary file
Binary file
Binary file
Binary file