vue2-client 1.11.4 → 1.11.6
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/CitySelect/CitySelect.vue +366 -342
- package/src/base-client/components/common/Upload/Upload.vue +322 -322
- package/src/base-client/components/common/XDescriptions/XDescriptionsGroup.vue +61 -51
- package/src/base-client/components/common/XDescriptions/demo.vue +10 -9
- package/src/base-client/components/common/XFormGroup/demo.vue +3 -10
- package/src/base-client/components/common/XFormTable/demo.vue +60 -60
- package/src/components/STable/index.js +426 -426
- package/src/expression/ExpressionRunner.ts +28 -0
- package/src/expression/TestExpression.ts +509 -0
- package/src/expression/core/Delegate.ts +114 -0
- package/src/expression/core/Expression.ts +1295 -0
- package/src/expression/core/Program.ts +950 -0
- package/src/expression/core/Token.ts +29 -0
- package/src/expression/enums/ExpressionType.ts +81 -0
- package/src/expression/enums/TokenType.ts +13 -0
- package/src/expression/exception/BreakWayException.ts +2 -0
- package/src/expression/exception/ContinueWayException.ts +2 -0
- package/src/expression/exception/ExpressionException.ts +28 -0
- package/src/expression/exception/ReturnWayException.ts +14 -0
- package/src/expression/exception/ServiceException.ts +22 -0
- package/src/expression/instances/JSONArray.ts +48 -0
- package/src/expression/instances/JSONObject.ts +109 -0
- package/src/expression/instances/LogicConsole.ts +32 -0
- package/src/router/async/router.map.js +3 -2
- package/src/utils/indexedDB.js +234 -234
|
@@ -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
|
-
:
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
</
|
|
52
|
-
|
|
53
|
-
<
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
//
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
}
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
type: String,
|
|
151
|
-
default:
|
|
152
|
-
},
|
|
153
|
-
//
|
|
154
|
-
|
|
155
|
-
type:
|
|
156
|
-
default:
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
//
|
|
160
|
-
|
|
161
|
-
type:
|
|
162
|
-
default:
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
width: '
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
this.
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
if (this.
|
|
283
|
-
this.
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
this.
|
|
289
|
-
this.model[2]
|
|
290
|
-
this.model[
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
this.tagData.
|
|
300
|
-
this.model[
|
|
301
|
-
this.model[
|
|
302
|
-
|
|
303
|
-
this.model[
|
|
304
|
-
}
|
|
305
|
-
if (this.contexts !==
|
|
306
|
-
this.activeKey = '
|
|
307
|
-
}
|
|
308
|
-
this.getResultText(
|
|
309
|
-
} else if (e === '
|
|
310
|
-
if (this.model[
|
|
311
|
-
this.
|
|
312
|
-
this.model[
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
if (this.model[
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
this
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
this.
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
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>
|