vue2-client 1.11.4 → 1.11.6-alpha

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.
Files changed (57) hide show
  1. package/.babelrc +3 -0
  2. package/babel.config.js +18 -21
  3. package/jest.config.js +22 -21
  4. package/package.json +5 -4
  5. package/src/base-client/components/common/CitySelect/CitySelect.vue +366 -342
  6. package/src/base-client/components/common/Upload/Upload.vue +322 -322
  7. package/src/base-client/components/common/XDescriptions/XDescriptionsGroup.vue +314 -304
  8. package/src/base-client/components/common/XDescriptions/demo.vue +51 -50
  9. package/src/base-client/components/common/XFormGroup/demo.vue +39 -46
  10. package/src/base-client/components/common/XFormTable/demo.vue +60 -60
  11. package/src/components/STable/index.js +426 -426
  12. package/src/expression/ExpressionRunner.js +26 -0
  13. package/src/expression/TestExpression.js +508 -0
  14. package/src/expression/core/Delegate.js +113 -0
  15. package/src/expression/core/Expression.js +1323 -0
  16. package/src/expression/core/Program.js +933 -0
  17. package/src/expression/core/Token.js +27 -0
  18. package/src/expression/enums/ExpressionType.js +81 -0
  19. package/src/expression/enums/TokenType.js +11 -0
  20. package/src/expression/exception/BreakWayException.js +2 -0
  21. package/src/expression/exception/ContinueWayException.js +2 -0
  22. package/src/expression/exception/ExpressionException.js +28 -0
  23. package/src/expression/exception/ReturnWayException.js +14 -0
  24. package/src/expression/exception/ServiceException.js +22 -0
  25. package/src/expression/instances/JSONArray.js +48 -0
  26. package/src/expression/instances/JSONObject.js +122 -0
  27. package/src/expression/instances/LogicConsole.js +45 -0
  28. package/src/expression/ts/ExpressionRunner.ts +28 -0
  29. package/src/expression/ts/TestExpression.ts +509 -0
  30. package/src/expression/ts/core/Delegate.ts +114 -0
  31. package/src/expression/ts/core/Expression.ts +1309 -0
  32. package/src/expression/ts/core/Program.ts +950 -0
  33. package/src/expression/ts/core/Token.ts +29 -0
  34. package/src/expression/ts/enums/ExpressionType.ts +81 -0
  35. package/src/expression/ts/enums/TokenType.ts +13 -0
  36. package/src/expression/ts/exception/BreakWayException.ts +2 -0
  37. package/src/expression/ts/exception/ContinueWayException.ts +2 -0
  38. package/src/expression/ts/exception/ExpressionException.ts +28 -0
  39. package/src/expression/ts/exception/ReturnWayException.ts +14 -0
  40. package/src/expression/ts/exception/ServiceException.ts +22 -0
  41. package/src/expression/ts/instances/JSONArray.ts +48 -0
  42. package/src/expression/ts/instances/JSONObject.ts +109 -0
  43. package/src/expression/ts/instances/LogicConsole.ts +32 -0
  44. package/src/logic/LogicRunner.js +67 -0
  45. package/src/logic/TestLogic.js +13 -0
  46. package/src/logic/plugins/common/DateTools.js +32 -0
  47. package/src/logic/plugins/index.js +5 -0
  48. package/src/logic/ts/LogicRunner.ts +67 -0
  49. package/src/logic/ts/TestLogic.ts +13 -0
  50. package/src/pages/LogicCallExample/index.vue +30 -0
  51. package/src/router/async/router.map.js +4 -2
  52. package/src/services/user.js +2 -0
  53. package/src/store/mutation-types.js +1 -0
  54. package/src/utils/EncryptUtil.js +23 -0
  55. package/src/utils/indexedDB.js +234 -234
  56. package/src/utils/request.js +382 -362
  57. package/test/request.test.js +17 -0
@@ -1,342 +1,366 @@
1
- <template>
2
- <div>
3
- <a-cascader
4
- v-if="type === 'cascader'"
5
- :options="tagData.divisionsForTree"
6
- :placeholder="placeholder"
7
- style="width: 100%;"
8
- :size="size"
9
- />
10
- <a-select
11
- ref="select"
12
- :size="size"
13
- v-model="valueView"
14
- style="width: 100%;"
15
- :dropdownMatchSelectWidth="false"
16
- :dropdownStyle="dropdownStyle"
17
- :placeholder="placeholder"
18
- @blur="selectBlurHandle"
19
- allow-clear
20
- :getPopupContainer=" triggerNode => { return triggerNode.parentNode } "
21
- :style="inputStyle">
22
- <div slot="dropdownRender" @mousedown.prevent>
23
- <a-tabs v-model="activeKey" :size="size">
24
- <a-tab-pane
25
- :tab="view.key"
26
- v-for="(view,index) in viewArr"
27
- :key="view.key"
28
- v-if="contexts > index"
29
- :disabled="tagData[view.value].length === 0">
30
-
31
- <a-checkable-tag
32
- :style="tagStyle"
33
- v-for="item of tagData[view.value]"
34
- :key="item.code"
35
- @change="tagClick(view.key,item)">
36
- <a-tooltip
37
- placement="top"
38
- :mouseEnterDelay="0.5"
39
- :title="item.name"
40
- :getPopupContainer=" triggerNode => { return triggerNode.parentElement } "
41
- >
42
- {{ item?.name?.length > 8 ? `${item.name.slice(0, 8)}...` : item.name }}
43
- </a-tooltip>
44
- </a-checkable-tag>
45
- <a-empty v-if="tagData[view.value].length === 0" :img="Empty.PRESENTED_IMAGE_SIMPLE"></a-empty>
46
- </a-tab-pane>
47
- </a-tabs>
48
- </div>
49
- </a-select>
50
- </div>
51
- </template>
52
-
53
- <script>
54
- import { mapState } from 'vuex'
55
- import { runLogic } from '@vue2-client/services/api/common'
56
- import { handleTree } from '@vue2-client/utils/util'
57
- import { Empty } from 'ant-design-vue'
58
-
59
- const viewArr = [
60
- {
61
- key: '省/直辖市',
62
- value: 'divisionsForTree',
63
- }, {
64
- key: '',
65
- value: 'cityData',
66
- }, {
67
- key: '区',
68
- value: 'areaData',
69
- }, {
70
- key: '街道',
71
- value: 'streetData',
72
- }, {
73
- key: '小区',
74
- value: 'communityData',
75
- }
76
- ]
77
- export default {
78
- name: 'CitySelect',
79
- data () {
80
- return {
81
- Empty,
82
- open: false,
83
- tagData: {
84
- divisionsForTree: [],
85
- //
86
- cityData: [],
87
- //
88
- areaData: [],
89
- // 街道
90
- streetData: [],
91
- // 小区
92
- communityData: [],
93
- },
94
- // model: {
95
- // provinceModel: { name: '', code: '' },
96
- // cityModel: { name: '', code: '' },
97
- // areaModel: { name: '', code: '' },
98
- // streetModel: { name: '', code: '' }
99
- // },
100
- model: [
101
- { name: '', code: '' },
102
- { name: '', code: '' },
103
- { name: '', code: '' },
104
- { name: '', code: '' },
105
- { name: '', code: '' }
106
- ],
107
- // 控制标签
108
- activeKey: '省/直辖市',
109
- // 遍历以渲染页面
110
- viewArr,
111
- // 框内显示值 valueView
112
- valueView: undefined
113
- }
114
- },
115
- async mounted () {
116
- runLogic('getOperatingAreas', {
117
- orgId: this.currUser.orgid
118
- }, 'af-revenue').then(res => {
119
- this.tagData.divisionsForTree = handleTree(res, 'code', 'parentcode')
120
- if (this.value) {
121
- this.setValue(this.value, res)
122
- }
123
- })
124
- },
125
- model: {
126
- prop: 'value',
127
- event: 'onChange'
128
- },
129
- computed: {
130
- ...mapState('account', { currUser: 'user' })
131
- },
132
- props: {
133
- // 页面渲染内容 默认 省市区街道 四个 所以是4 5 是到小区
134
- contexts: {
135
- type: Number,
136
- default: 4
137
- },
138
- placeholder: {
139
- type: String,
140
- default: '请选择省市区'
141
- },
142
- // small lage 输入框大小
143
- size: {
144
- type: String,
145
- default: undefined
146
- },
147
- // 类型 simple / undefined
148
- // simple 就是用的 cascader 不穿就是用的 自己封装的
149
- type: {
150
- type: String,
151
- default: undefined
152
- },
153
- // 框的样式
154
- inputStyle: {
155
- type: Object,
156
- default: () => {
157
- }
158
- },
159
- // 下拉框的样式
160
- dropdownStyle: {
161
- type: Object,
162
- default: () => {
163
- return {
164
- width: '35rem',
165
- padding: '1%'
166
- }
167
- }
168
- },
169
- // 标签的样式
170
- tagStyle: {
171
- type: Object,
172
- default: () => {
173
- return {
174
- fontSize: '0.88rem',
175
- width: '23%',
176
- textAlign: 'left',
177
- margin: '0.5%',
178
- cursor: 'pointer'
179
- }
180
- }
181
- },
182
- // 用于v-model 绑定
183
- value: {
184
- type: String,
185
- default: undefined
186
- },
187
- // 用于仅用于展示
188
- defaultValue: {
189
- type: String,
190
- default: undefined
191
- },
192
- // 用于v-model 绑定 code :最后一级的code address: 所有级拼接的地址
193
- valueType: {
194
- type: String,
195
- default: 'code'
196
- }
197
- },
198
- watch: {
199
- value () {
200
- if (!this.value && this.valueView) {
201
- /// 兼容外层重置方法
202
- this.model = [
203
- { name: '', code: '' },
204
- { name: '', code: '' },
205
- { name: '', code: '' },
206
- { name: '', code: '' },
207
- { name: '', code: '' }
208
- ]
209
- this.getResultText(this.contexts)
210
- }
211
- }
212
- },
213
- methods: {
214
- setValue (code, tree) {
215
- const findNode = (code, tree) => {
216
- for (let i = 0; i < tree.length; i++) {
217
- if (tree[i].code === code) {
218
- return tree[i]
219
- } else if (tree[i].children && tree[i].children.length > 0) {
220
- const node = findNode(code, tree[i].children)
221
- if (node) {
222
- return node
223
- }
224
- }
225
- }
226
- }
227
-
228
- const findParent = (code, tree, parent = null) => {
229
- for (let i = 0; i < tree.length; i++) {
230
- if (tree[i].code === code) {
231
- return parent
232
- } else if (tree[i].children && tree[i].children.length > 0) {
233
- const node = findParent(code, tree[i].children, tree[i])
234
- if (node) {
235
- return node
236
- }
237
- }
238
- }
239
- }
240
-
241
- const node = findNode(code, tree)
242
- if (node) {
243
- this.model[this.contexts - 1].name = node.name
244
- this.model[this.contexts - 1].code = node.code
245
- let parent = findParent(code, tree)
246
- for (let i = this.contexts - 2; i >= 0; i--) {
247
- this.model[i].name = parent ? parent.name : null
248
- this.model[i].code = parent ? parent.code : null
249
- if (i < this.contexts - 1 && parent) {
250
- parent = findParent(parent.code, tree)
251
- }
252
- }
253
- this.getResultText(this.contexts)
254
- }
255
- },
256
- tagClick (e, item) {
257
- if (e === '省/直辖市') {
258
- // 如果是同一个标签
259
- if (this.model[0].name !== item.name) {
260
- this.tagData.cityData = item.children
261
- this.tagData.areaData = []
262
- this.tagData.streetData = []
263
- this.model[0].name = item.name
264
- this.model[0].code = item.code
265
- this.model[1] = { name: '', code: '' }
266
- this.model[2] = { name: '', code: '' }
267
- this.model[3] = { name: '', code: '' }
268
- }
269
- if (this.contexts !== 1) {
270
- this.activeKey = '市'
271
- }
272
- this.getResultText(1)
273
- } else if (e === '市') {
274
- if (this.model[1].name !== item.name) {
275
- this.tagData.areaData = item.children
276
- this.tagData.streetData = []
277
- this.model[1].name = item.name
278
- this.model[1].code = item.code
279
- this.model[2] = { name: '', code: '' }
280
- this.model[3] = { name: '', code: '' }
281
- }
282
- if (this.contexts !== 2) {
283
- this.activeKey = '区'
284
- }
285
- this.getResultText(2)
286
- } else if (e === '区') {
287
- if (this.model[2].name !== item.name) {
288
- this.tagData.streetData = item.children || []
289
- this.model[2].name = item.name
290
- this.model[2].code = item.code
291
- this.model[3] = { name: '', code: '' }
292
- }
293
- if (this.contexts !== 3) {
294
- this.activeKey = '街道'
295
- }
296
- this.getResultText(3)
297
- } else if (e === '街道') {
298
- if (this.model[3].name !== item.name) {
299
- this.tagData.communityData = item.children || []
300
- this.model[3].name = item.name
301
- this.model[3].code = item.code
302
-
303
- this.model[4] = { name: '', code: '' }
304
- }
305
- if (this.contexts !== 4) {
306
- this.activeKey = '小区'
307
- }
308
- this.getResultText(4)
309
- } else if (e === '小区') {
310
- if (this.model[4].name !== item.name) {
311
- this.model[4].name = item.name
312
- this.model[4].code = item.code
313
- }
314
- this.getResultText(5)
315
- }
316
- },
317
- getResultText (tag) {
318
- const address = []
319
- let code = ''
320
- for (let i = 0; i < this.contexts; i++) {
321
- if (this.model[i].name && this.model[i].name !== '') {
322
- address.push(this.model[i].name)
323
- }
324
- code = this.model[i].code ?? ''
325
- }
326
- this.valueView = address.length === 0 ? undefined : address.join('')
327
- if (tag === this.contexts) {
328
- this.$refs.select.blur()
329
- // this.$emit('onChange', this.valueType === 'address' ? address.join('') : code)
330
- this.$emit('onChange', code)
331
- }
332
- },
333
- // 失去焦点回调
334
- selectBlurHandle () {
335
- console.log(this.model[this.contexts - 1])
336
- if (!this.model[this.contexts - 1].code || this.model[this.contexts - 1].code === '') {
337
- this.valueView = undefined
338
- }
339
- }
340
- }
341
- }
342
- </script>
1
+ <template>
2
+ <div>
3
+ <a-cascader
4
+ v-if="type === 'cascader'"
5
+ :options="tagData.divisionsForTree"
6
+ :placeholder="placeholder"
7
+ style="width: 100%;"
8
+ :size="size"
9
+ />
10
+ <a-select
11
+ ref="select"
12
+ :size="size"
13
+ v-model="valueView"
14
+ style="width: 100%;"
15
+ :dropdownMatchSelectWidth="false"
16
+ :dropdownStyle="dropdownStyle"
17
+ :placeholder="placeholder"
18
+ @blur="selectBlurHandle"
19
+ allow-clear
20
+ :getPopupContainer=" triggerNode => { return triggerNode.parentNode } "
21
+ :open="selectOpen"
22
+ @focus="handleFocus"
23
+ @mousedown.prevent
24
+ :style="inputStyle">
25
+ <div slot="dropdownRender">
26
+ <a-tabs v-model="activeKey" :size="size">
27
+ <a-tab-pane
28
+ :tab="view.key"
29
+ v-for="(view,index) in viewArr"
30
+ :key="view.key"
31
+ v-if="contexts > index"
32
+ :disabled="tagData[view.value].length === 0">
33
+ <a-input
34
+ v-model="searchKeyword[index]"
35
+ placeholder="搜索"
36
+ style="margin-bottom: 10px; width: 100%;"
37
+ />
38
+ <a-checkable-tag
39
+ :style="tagStyle"
40
+ v-for="item of filteredTags(view.value, index)"
41
+ :key="item.code"
42
+ @change="tagClick(view.key, item)"
43
+ >
44
+ <a-tooltip
45
+ placement="top"
46
+ :mouseEnterDelay="0.5"
47
+ :title="item.name"
48
+ :getPopupContainer=" triggerNode => { return triggerNode.parentElement } "
49
+ >
50
+ {{ item?.name?.length > 8 ? `${item.name.slice(0, 8)}...` : item.name }}
51
+ </a-tooltip>
52
+ </a-checkable-tag>
53
+ <a-empty v-if="tagData[view.value].length === 0" :img="Empty.PRESENTED_IMAGE_SIMPLE"></a-empty>
54
+ </a-tab-pane>
55
+ </a-tabs>
56
+ </div>
57
+ </a-select>
58
+ </div>
59
+ </template>
60
+
61
+ <script>
62
+ import { mapState } from 'vuex'
63
+ import { runLogic } from '@vue2-client/services/api/common'
64
+ import { handleTree } from '@vue2-client/utils/util'
65
+ import { Empty } from 'ant-design-vue'
66
+
67
+ const viewArr = [
68
+ {
69
+ key: '省/直辖市',
70
+ value: 'divisionsForTree',
71
+ }, {
72
+ key: '市',
73
+ value: 'cityData',
74
+ }, {
75
+ key: '区',
76
+ value: 'areaData',
77
+ }, {
78
+ key: '街道',
79
+ value: 'streetData',
80
+ }, {
81
+ key: '小区',
82
+ value: 'communityData',
83
+ }
84
+ ]
85
+ export default {
86
+ name: 'CitySelect',
87
+ data () {
88
+ return {
89
+ Empty,
90
+ open: false,
91
+ tagData: {
92
+ divisionsForTree: [],
93
+ // 市
94
+ cityData: [],
95
+ //
96
+ areaData: [],
97
+ // 街道
98
+ streetData: [],
99
+ // 小区
100
+ communityData: [],
101
+ },
102
+ // model: {
103
+ // provinceModel: { name: '', code: '' },
104
+ // cityModel: { name: '', code: '' },
105
+ // areaModel: { name: '', code: '' },
106
+ // streetModel: { name: '', code: '' }
107
+ // },
108
+ model: [
109
+ { name: '', code: '' },
110
+ { name: '', code: '' },
111
+ { name: '', code: '' },
112
+ { name: '', code: '' },
113
+ { name: '', code: '' }
114
+ ],
115
+ // 控制标签
116
+ activeKey: '省/直辖市',
117
+ // 遍历以渲染页面
118
+ viewArr,
119
+ // 框内显示值 valueView
120
+ valueView: undefined,
121
+ // 搜索关键字
122
+ searchKeyword: ['', '', '', '', ''],
123
+ selectOpen: false,
124
+ }
125
+ },
126
+ async mounted () {
127
+ runLogic('getOperatingAreas', {
128
+ orgId: this.currUser.orgid
129
+ }, 'af-revenue').then(res => {
130
+ this.tagData.divisionsForTree = handleTree(res, 'code', 'parentcode')
131
+ if (this.value) {
132
+ this.setValue(this.value, res)
133
+ }
134
+ })
135
+ },
136
+ model: {
137
+ prop: 'value',
138
+ event: 'onChange'
139
+ },
140
+ computed: {
141
+ ...mapState('account', { currUser: 'user' })
142
+ },
143
+ props: {
144
+ // 页面渲染内容 默认 省市区街道 四个 所以是4 5 是到小区
145
+ contexts: {
146
+ type: Number,
147
+ default: 4
148
+ },
149
+ placeholder: {
150
+ type: String,
151
+ default: '请选择省市区'
152
+ },
153
+ // small lage 输入框大小
154
+ size: {
155
+ type: String,
156
+ default: undefined
157
+ },
158
+ // 类型 simple / undefined
159
+ // simple 就是用的 cascader 不穿就是用的 自己封装的
160
+ type: {
161
+ type: String,
162
+ default: undefined
163
+ },
164
+ // 框的样式
165
+ inputStyle: {
166
+ type: Object,
167
+ default: () => {
168
+ }
169
+ },
170
+ // 下拉框的样式
171
+ dropdownStyle: {
172
+ type: Object,
173
+ default: () => {
174
+ return {
175
+ width: '35rem',
176
+ padding: '1%'
177
+ }
178
+ }
179
+ },
180
+ // 标签的样式
181
+ tagStyle: {
182
+ type: Object,
183
+ default: () => {
184
+ return {
185
+ fontSize: '0.88rem',
186
+ width: '23%',
187
+ textAlign: 'left',
188
+ margin: '0.5%',
189
+ cursor: 'pointer'
190
+ }
191
+ }
192
+ },
193
+ // 用于v-model 绑定
194
+ value: {
195
+ type: String,
196
+ default: undefined
197
+ },
198
+ // 用于仅用于展示
199
+ defaultValue: {
200
+ type: String,
201
+ default: undefined
202
+ },
203
+ // 用于v-model 绑定 code :最后一级的code address: 所有级拼接的地址
204
+ valueType: {
205
+ type: String,
206
+ default: 'code'
207
+ }
208
+ },
209
+ watch: {
210
+ value () {
211
+ if (!this.value && this.valueView) {
212
+ /// 兼容外层重置方法
213
+ this.model = [
214
+ { name: '', code: '' },
215
+ { name: '', code: '' },
216
+ { name: '', code: '' },
217
+ { name: '', code: '' },
218
+ { name: '', code: '' }
219
+ ]
220
+ this.getResultText(this.contexts)
221
+ }
222
+ }
223
+ },
224
+ methods: {
225
+ handleFocus () {
226
+ this.selectOpen = true
227
+ },
228
+ // 根据搜索关键字过滤标签
229
+ filteredTags (key, index) {
230
+ if (!this.searchKeyword[index]) {
231
+ return this.tagData[key] || []
232
+ }
233
+ return (this.tagData[key] || []).filter(item =>
234
+ item.name.toLowerCase().includes(this.searchKeyword[index].toLowerCase())
235
+ )
236
+ },
237
+ setValue (code, tree) {
238
+ const findNode = (code, tree) => {
239
+ for (let i = 0; i < tree.length; i++) {
240
+ if (tree[i].code === code) {
241
+ return tree[i]
242
+ } else if (tree[i].children && tree[i].children.length > 0) {
243
+ const node = findNode(code, tree[i].children)
244
+ if (node) {
245
+ return node
246
+ }
247
+ }
248
+ }
249
+ }
250
+
251
+ const findParent = (code, tree, parent = null) => {
252
+ for (let i = 0; i < tree.length; i++) {
253
+ if (tree[i].code === code) {
254
+ return parent
255
+ } else if (tree[i].children && tree[i].children.length > 0) {
256
+ const node = findParent(code, tree[i].children, tree[i])
257
+ if (node) {
258
+ return node
259
+ }
260
+ }
261
+ }
262
+ }
263
+
264
+ const node = findNode(code, tree)
265
+ if (node) {
266
+ this.model[this.contexts - 1].name = node.name
267
+ this.model[this.contexts - 1].code = node.code
268
+ let parent = findParent(code, tree)
269
+ for (let i = this.contexts - 2; i >= 0; i--) {
270
+ this.model[i].name = parent ? parent.name : null
271
+ this.model[i].code = parent ? parent.code : null
272
+ if (i < this.contexts - 1 && parent) {
273
+ parent = findParent(parent.code, tree)
274
+ }
275
+ }
276
+ this.getResultText(this.contexts)
277
+ }
278
+ },
279
+ tagClick (e, item) {
280
+ if (e === '省/直辖市') {
281
+ // 如果是同一个标签
282
+ if (this.model[0].name !== item.name) {
283
+ this.tagData.cityData = item.children
284
+ this.tagData.areaData = []
285
+ this.tagData.streetData = []
286
+ this.model[0].name = item.name
287
+ this.model[0].code = item.code
288
+ this.model[1] = { name: '', code: '' }
289
+ this.model[2] = { name: '', code: '' }
290
+ this.model[3] = { name: '', code: '' }
291
+ }
292
+ if (this.contexts !== 1) {
293
+ this.activeKey = '市'
294
+ }
295
+ this.getResultText(1)
296
+ } else if (e === '市') {
297
+ if (this.model[1].name !== item.name) {
298
+ this.tagData.areaData = item.children
299
+ this.tagData.streetData = []
300
+ this.model[1].name = item.name
301
+ this.model[1].code = item.code
302
+ this.model[2] = { name: '', code: '' }
303
+ this.model[3] = { name: '', code: '' }
304
+ }
305
+ if (this.contexts !== 2) {
306
+ this.activeKey = ''
307
+ }
308
+ this.getResultText(2)
309
+ } else if (e === '') {
310
+ if (this.model[2].name !== item.name) {
311
+ this.tagData.streetData = item.children || []
312
+ this.model[2].name = item.name
313
+ this.model[2].code = item.code
314
+ this.model[3] = { name: '', code: '' }
315
+ }
316
+ if (this.contexts !== 3) {
317
+ this.activeKey = '街道'
318
+ }
319
+ this.getResultText(3)
320
+ } else if (e === '街道') {
321
+ if (this.model[3].name !== item.name) {
322
+ this.tagData.communityData = item.children || []
323
+ this.model[3].name = item.name
324
+ this.model[3].code = item.code
325
+
326
+ this.model[4] = { name: '', code: '' }
327
+ }
328
+ if (this.contexts !== 4) {
329
+ this.activeKey = '小区'
330
+ }
331
+ this.getResultText(4)
332
+ } else if (e === '小区') {
333
+ if (this.model[4].name !== item.name) {
334
+ this.model[4].name = item.name
335
+ this.model[4].code = item.code
336
+ }
337
+ this.getResultText(5)
338
+ this.selectOpen = false
339
+ }
340
+ },
341
+ getResultText (tag) {
342
+ const address = []
343
+ let code = ''
344
+ for (let i = 0; i < this.contexts; i++) {
345
+ if (this.model[i].name && this.model[i].name !== '') {
346
+ address.push(this.model[i].name)
347
+ }
348
+ code = this.model[i].code ?? ''
349
+ }
350
+ this.valueView = address.length === 0 ? undefined : address.join('')
351
+ if (tag === this.contexts) {
352
+ this.$refs.select.blur()
353
+ // this.$emit('onChange', this.valueType === 'address' ? address.join('') : code)
354
+ this.$emit('onChange', code)
355
+ }
356
+ },
357
+ // 失去焦点回调
358
+ selectBlurHandle () {
359
+ console.log(this.model[this.contexts - 1])
360
+ if (!this.model[this.contexts - 1].code || this.model[this.contexts - 1].code === '') {
361
+ this.valueView = undefined
362
+ }
363
+ }
364
+ }
365
+ }
366
+ </script>