vue2-client 1.8.176 → 1.8.179
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.
|
|
3
|
+
"version": "1.8.179",
|
|
4
4
|
"private": false,
|
|
5
5
|
"scripts": {
|
|
6
6
|
"serve": "SET NODE_OPTIONS=--openssl-legacy-provider && vue-cli-service serve --no-eslint",
|
|
@@ -38,6 +38,7 @@
|
|
|
38
38
|
"jspdf": "^2.5.1",
|
|
39
39
|
"lodash.clonedeep": "^4.5.0",
|
|
40
40
|
"lodash.get": "^4.4.2",
|
|
41
|
+
"lodash.debounce": "^4",
|
|
41
42
|
"mockjs": "^1.1.0",
|
|
42
43
|
"nprogress": "^0.2.0",
|
|
43
44
|
"qs": "^6.11.2",
|
|
@@ -67,6 +67,9 @@ const viewArr = [
|
|
|
67
67
|
}, {
|
|
68
68
|
key: '街道',
|
|
69
69
|
value: 'streetData',
|
|
70
|
+
}, {
|
|
71
|
+
key: '小区',
|
|
72
|
+
value: 'communityData',
|
|
70
73
|
}
|
|
71
74
|
]
|
|
72
75
|
export default {
|
|
@@ -82,6 +85,8 @@ export default {
|
|
|
82
85
|
areaData: [],
|
|
83
86
|
// 街道
|
|
84
87
|
streetData: [],
|
|
88
|
+
// 小区
|
|
89
|
+
communityData: [],
|
|
85
90
|
},
|
|
86
91
|
// model: {
|
|
87
92
|
// provinceModel: { name: '', code: '' },
|
|
@@ -93,6 +98,7 @@ export default {
|
|
|
93
98
|
{ name: '', code: '' },
|
|
94
99
|
{ name: '', code: '' },
|
|
95
100
|
{ name: '', code: '' },
|
|
101
|
+
{ name: '', code: '' },
|
|
96
102
|
{ name: '', code: '' }
|
|
97
103
|
],
|
|
98
104
|
// 控制标签
|
|
@@ -111,7 +117,7 @@ export default {
|
|
|
111
117
|
this.setValue(this.value, res)
|
|
112
118
|
}
|
|
113
119
|
} else {
|
|
114
|
-
runLogic('getOperatingAreas', 'af-revenue').then(res => {
|
|
120
|
+
runLogic('getOperatingAreas', {}, 'af-revenue').then(res => {
|
|
115
121
|
this.tagData.divisionsForTree = handleTree(res, 'code', 'parentcode')
|
|
116
122
|
if (this.value) {
|
|
117
123
|
this.setValue(this.value, res)
|
|
@@ -128,7 +134,7 @@ export default {
|
|
|
128
134
|
...mapState('account', { currUser: 'user' })
|
|
129
135
|
},
|
|
130
136
|
props: {
|
|
131
|
-
// 页面渲染内容 默认 省市区街道 四个 所以是4
|
|
137
|
+
// 页面渲染内容 默认 省市区街道 四个 所以是4 5 是到小区
|
|
132
138
|
contexts: {
|
|
133
139
|
type: Number,
|
|
134
140
|
default: 4
|
|
@@ -201,6 +207,7 @@ export default {
|
|
|
201
207
|
{ name: '', code: '' },
|
|
202
208
|
{ name: '', code: '' },
|
|
203
209
|
{ name: '', code: '' },
|
|
210
|
+
{ name: '', code: '' },
|
|
204
211
|
{ name: '', code: '' }
|
|
205
212
|
]
|
|
206
213
|
this.getResultText(this.contexts)
|
|
@@ -293,10 +300,22 @@ export default {
|
|
|
293
300
|
this.getResultText(3)
|
|
294
301
|
} else if (e === '街道') {
|
|
295
302
|
if (this.model[3].name !== item.name) {
|
|
303
|
+
this.tagData.communityData = item.children
|
|
296
304
|
this.model[3].name = item.name
|
|
297
305
|
this.model[3].code = item.code
|
|
306
|
+
|
|
307
|
+
this.model[4] = { name: '', code: '' }
|
|
308
|
+
}
|
|
309
|
+
if (this.contexts !== 4) {
|
|
310
|
+
this.activeKey = '小区'
|
|
298
311
|
}
|
|
299
312
|
this.getResultText(4)
|
|
313
|
+
} else if (e === '小区') {
|
|
314
|
+
if (this.model[4].name !== item.name) {
|
|
315
|
+
this.model[4].name = item.name
|
|
316
|
+
this.model[4].code = item.code
|
|
317
|
+
}
|
|
318
|
+
this.getResultText(5)
|
|
300
319
|
}
|
|
301
320
|
},
|
|
302
321
|
getResultText (tag) {
|
|
@@ -317,6 +336,7 @@ export default {
|
|
|
317
336
|
},
|
|
318
337
|
// 失去焦点回调
|
|
319
338
|
selectBlurHandle () {
|
|
339
|
+
console.log(this.model[this.contexts - 1])
|
|
320
340
|
if (!this.model[this.contexts - 1].code || this.model[this.contexts - 1].code === '') {
|
|
321
341
|
this.valueView = undefined
|
|
322
342
|
}
|
|
@@ -3,12 +3,17 @@ import { getConfigByName, runLogic } from '@vue2-client/services/api/common'
|
|
|
3
3
|
import { computed, reactive, ref, watch, defineExpose } from 'vue'
|
|
4
4
|
import executeStrFunction from '@vue2-client/utils/runEvalFunction'
|
|
5
5
|
import store from '@vue2-client/store/modules/account'
|
|
6
|
+
import debounce from 'lodash.debounce'
|
|
6
7
|
|
|
7
8
|
const config = reactive({})
|
|
9
|
+
// 是否加载中
|
|
10
|
+
const spinning = ref(false)
|
|
8
11
|
// 选中的 key
|
|
9
12
|
const checkedKeys = ref([])
|
|
10
13
|
// 定义 tree 数据
|
|
11
14
|
const _treeData = ref([])
|
|
15
|
+
// 存储搜索结果的树数据
|
|
16
|
+
const filteredTreeData = ref([])
|
|
12
17
|
// 定义最深一层的 数据
|
|
13
18
|
const deepestNodes = ref([])
|
|
14
19
|
// 替换字段
|
|
@@ -82,15 +87,17 @@ function onSelect (keys, e) {
|
|
|
82
87
|
emit('onSelect', keys, e)
|
|
83
88
|
}
|
|
84
89
|
|
|
85
|
-
function getData (param = {}) {
|
|
90
|
+
async function getData (param = {}) {
|
|
91
|
+
spinning.value = true
|
|
86
92
|
searchInfo.value = Object.assign(param, {
|
|
87
93
|
org_id: currentUser.value.orgid,
|
|
88
94
|
user_id: currentUser.value.id,
|
|
89
95
|
dep_id: currentUser.value.f_department_id
|
|
90
96
|
})
|
|
91
|
-
runLogic(config.treeData.substring(6), searchInfo.value, config.serviceName, props.env === 'dev').then(res => {
|
|
97
|
+
await runLogic(config.treeData.substring(6), searchInfo.value, config.serviceName, props.env === 'dev').then(res => {
|
|
92
98
|
_treeData.value = res
|
|
93
99
|
deepestNodes.value = getDeepestNodes(_treeData.value)
|
|
100
|
+
spinning.value = false
|
|
94
101
|
}).catch(e => {
|
|
95
102
|
console.error('获取数据失败:' + e)
|
|
96
103
|
})
|
|
@@ -100,8 +107,36 @@ function reLoad () {
|
|
|
100
107
|
getData(searchInfo.value)
|
|
101
108
|
}
|
|
102
109
|
|
|
103
|
-
|
|
104
|
-
console.log('
|
|
110
|
+
const debouncedSearch = debounce((value) => {
|
|
111
|
+
console.log('Search:', value)
|
|
112
|
+
// 在这里执行你的搜索逻辑
|
|
113
|
+
if (value) {
|
|
114
|
+
filteredTreeData.value = searchInTree(_treeData.value, value)
|
|
115
|
+
} else {
|
|
116
|
+
filteredTreeData.value = []
|
|
117
|
+
}
|
|
118
|
+
}, 233)
|
|
119
|
+
|
|
120
|
+
function onChange (e) {
|
|
121
|
+
const searchInput = e.target.value
|
|
122
|
+
debouncedSearch(searchInput)
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
function searchInTree (tree, keyword) {
|
|
126
|
+
return tree.reduce((acc, node) => {
|
|
127
|
+
if (node[_replaceFields.title].includes(keyword)) {
|
|
128
|
+
acc.push(node)
|
|
129
|
+
} else if (node[_replaceFields.children]) {
|
|
130
|
+
const childResults = searchInTree(node[_replaceFields.children], keyword)
|
|
131
|
+
if (childResults.length > 0) {
|
|
132
|
+
acc.push({
|
|
133
|
+
...node,
|
|
134
|
+
children: childResults
|
|
135
|
+
})
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
return acc
|
|
139
|
+
}, [])
|
|
105
140
|
}
|
|
106
141
|
|
|
107
142
|
function action (record, func) {
|
|
@@ -149,33 +184,35 @@ defineExpose({
|
|
|
149
184
|
:style="{
|
|
150
185
|
maxHeight:config.search?'calc(100vh - 200px - 5rem)':'calc(100vh - 200px - 3rem)'
|
|
151
186
|
}">
|
|
152
|
-
<a-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
<
|
|
164
|
-
|
|
165
|
-
item[
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
<a-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
187
|
+
<a-spin :spinning="spinning">
|
|
188
|
+
<a-tree
|
|
189
|
+
v-model="checkedKeys"
|
|
190
|
+
:tree-data="filteredTreeData && filteredTreeData.length> 0?filteredTreeData: _treeData"
|
|
191
|
+
:checkable="config.checkable"
|
|
192
|
+
:blockNode="true"
|
|
193
|
+
:replaceFields="_replaceFields"
|
|
194
|
+
:default-selected-keys="_treeData && _treeData.length > 0 ? [_treeData[0][_replaceFields.key]] : null"
|
|
195
|
+
:default-expand-all="true"
|
|
196
|
+
@select="onSelect"
|
|
197
|
+
>
|
|
198
|
+
<template slot="title" slot-scope="item">
|
|
199
|
+
<span>{{
|
|
200
|
+
item.dataRef[replaceFields.children] && item.dataRef[replaceFields.children].length > 0 ?
|
|
201
|
+
item[_replaceFields.title]
|
|
202
|
+
: config.deepNodeMaxWidth && item[_replaceFields.title].length > config.deepNodeMaxWidth ? item[_replaceFields.title].substring(0, config.deepNodeMaxWidth) + '...' : item[_replaceFields.title]
|
|
203
|
+
}}</span>
|
|
204
|
+
<a-space style="float:right;margin-right: .2rem">
|
|
205
|
+
<a-icon
|
|
206
|
+
v-for="icon in config.btn"
|
|
207
|
+
@click="action(item, icon.func)"
|
|
208
|
+
:key="icon.func"
|
|
209
|
+
v-if="executeStrFunction( icon.customFunction,[item])"
|
|
210
|
+
:type="icon.icon"
|
|
211
|
+
:style="{color:icon.color}"></a-icon>
|
|
212
|
+
</a-space>
|
|
213
|
+
</template>
|
|
214
|
+
</a-tree>
|
|
215
|
+
</a-spin>
|
|
179
216
|
</div>
|
|
180
217
|
</div>
|
|
181
218
|
</template>
|