bri-components 1.2.54 → 1.2.55
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 +2 -2
- package/src/components/controls/{BriControlInput.vue → DshControlInput.vue} +15 -12
- package/src/components/controls/base/DshCascader/DshCascader.vue +116 -141
- package/src/components/controls/base/DshCascader/cascaderMixin.js +25 -36
- package/src/components/controls/base/DshCascader/cascaderModal.vue +374 -0
- package/src/components/controls/base/DshCascader/cascaderPicker.vue +86 -210
- package/src/components/controls/base/DshCascader/cascaderPickerMixin.js +202 -0
- package/src/components/controls/base/DshCoordinates.vue +6 -10
- package/src/components/controls/base/DshDate/DshDaterange.vue +15 -12
- package/src/components/controls/senior/BriLabels.vue +5 -10
- package/src/components/controls/senior/flatTable.vue +119 -3
- package/src/components/controls/senior/flatTableImportModal.vue +279 -0
- package/src/components/controls/senior/selectDepartments.vue +5 -11
- package/src/components/controls/senior/selectUsers/selectUsers.vue +5 -11
- package/src/components/form/DshDefaultSearch.vue +1 -1
- package/src/components/list/DshBox/DshCrossTable.vue +12 -0
- package/src/index.js +3 -3
- package/src/components/controls/base/DshCascader/InfoCascader.vue +0 -345
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
<div @click.stop="clickInput">
|
|
14
14
|
<slot>
|
|
15
15
|
<Input
|
|
16
|
-
|
|
16
|
+
v-model="inputStr"
|
|
17
17
|
:placeholder="selfPropsObj._placeholder"
|
|
18
18
|
:disabled="selfPropsObj._disabled"
|
|
19
19
|
:readonly="true"
|
|
@@ -28,46 +28,49 @@
|
|
|
28
28
|
slot="list"
|
|
29
29
|
class="wrap"
|
|
30
30
|
>
|
|
31
|
-
<!--
|
|
31
|
+
<!-- 头部 -->
|
|
32
32
|
<div class="wrap-header">
|
|
33
33
|
<!-- 搜索 -->
|
|
34
34
|
<div class="wrap-header-left">
|
|
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
|
-
|
|
35
|
+
<template v-if="filterable">
|
|
36
|
+
<!-- 搜索框 -->
|
|
37
|
+
<Input
|
|
38
|
+
class="search"
|
|
39
|
+
v-model="searchName"
|
|
40
|
+
placeholder="请输入关键字或标识"
|
|
41
|
+
search
|
|
42
|
+
@on-enter="search"
|
|
43
|
+
@on-search="search"
|
|
44
|
+
@on-change="search"
|
|
45
|
+
/>
|
|
46
|
+
|
|
47
|
+
<!-- 模式切换 -->
|
|
48
|
+
<template>
|
|
49
|
+
<div
|
|
50
|
+
v-if="useMode"
|
|
51
|
+
class="mode"
|
|
52
|
+
@click="showMode = showMode === 'default' ? 'flat' : 'default'"
|
|
53
|
+
>
|
|
54
|
+
<dsh-icons :list="[{ icon: 'md-swap' }]" />
|
|
55
|
+
<span class="mode-name">
|
|
56
|
+
{{ showMode === "default" ? "按层级" : "按平级" }}
|
|
57
|
+
</span>
|
|
58
|
+
</div>
|
|
59
|
+
|
|
60
|
+
<Tooltip
|
|
61
|
+
v-else
|
|
62
|
+
style="margin-left: 5px; cursor: pointer;"
|
|
63
|
+
:content="modeTip"
|
|
64
|
+
max-width="250"
|
|
65
|
+
transfer
|
|
66
|
+
>
|
|
67
|
+
<Icon
|
|
68
|
+
class="item-header-help"
|
|
69
|
+
type="md-help-circle"
|
|
70
|
+
size="16"
|
|
71
|
+
></Icon>
|
|
72
|
+
</Tooltip>
|
|
73
|
+
</template>
|
|
71
74
|
</template>
|
|
72
75
|
</div>
|
|
73
76
|
|
|
@@ -84,7 +87,7 @@
|
|
|
84
87
|
<!-- 选中项tabs -->
|
|
85
88
|
<div class="wrap-content-tabs">
|
|
86
89
|
<span
|
|
87
|
-
v-for="(tabItem, tabIndex) in
|
|
90
|
+
v-for="(tabItem, tabIndex) in selectedLinealDatas"
|
|
88
91
|
:key="tabIndex"
|
|
89
92
|
class="item"
|
|
90
93
|
@click="curTabIndex = tabIndex"
|
|
@@ -113,7 +116,7 @@
|
|
|
113
116
|
:key="dataItem[valueKey]"
|
|
114
117
|
:class="{
|
|
115
118
|
'item': true,
|
|
116
|
-
'item-active':
|
|
119
|
+
'item-active': selectedLastOption && dataItem[valueKey] === selectedLastOption[valueKey],
|
|
117
120
|
'item-disabled': dataItem.disabled
|
|
118
121
|
}"
|
|
119
122
|
:name="dataItem[valueKey]"
|
|
@@ -126,7 +129,7 @@
|
|
|
126
129
|
|
|
127
130
|
<span class="item-icon">
|
|
128
131
|
<dsh-icons :list="[{
|
|
129
|
-
icon:
|
|
132
|
+
icon: selectedLastOption && dataItem[valueKey] === selectedLastOption[valueKey]
|
|
130
133
|
? 'md-checkmark'
|
|
131
134
|
: ''
|
|
132
135
|
}]" />
|
|
@@ -137,15 +140,14 @@
|
|
|
137
140
|
<!-- 层级方式 -->
|
|
138
141
|
<template v-else>
|
|
139
142
|
<DropdownItem
|
|
140
|
-
v-for="dataItem in
|
|
143
|
+
v-for="dataItem in curSelectedLinealData.data"
|
|
141
144
|
:key="dataItem[valueKey]"
|
|
142
145
|
:class="{
|
|
143
146
|
'item': true,
|
|
144
|
-
'item-active': dataItem[valueKey] ===
|
|
147
|
+
'item-active': dataItem[valueKey] === curSelectedLinealData[valueKey],
|
|
145
148
|
'item-disabled': dataItem.disabled
|
|
146
149
|
}"
|
|
147
150
|
:name="dataItem[valueKey]"
|
|
148
|
-
:disabled="dataItem.disabled"
|
|
149
151
|
@click.native.stop="clickItem(dataItem)"
|
|
150
152
|
>
|
|
151
153
|
<span class="item-name">
|
|
@@ -154,7 +156,7 @@
|
|
|
154
156
|
|
|
155
157
|
<span class="item-icon">
|
|
156
158
|
<dsh-icons :list="[{
|
|
157
|
-
icon: dataItem[valueKey] ===
|
|
159
|
+
icon: dataItem[valueKey] === curSelectedLinealData[valueKey]
|
|
158
160
|
? 'md-checkmark'
|
|
159
161
|
: dataItem.children.length
|
|
160
162
|
? 'ios-arrow-forward'
|
|
@@ -180,39 +182,15 @@
|
|
|
180
182
|
</template>
|
|
181
183
|
|
|
182
184
|
<script>
|
|
185
|
+
import cascaderPickerMixin from "./cascaderPickerMixin.js";
|
|
186
|
+
|
|
183
187
|
export default {
|
|
184
188
|
name: "cascaderPicker",
|
|
185
|
-
mixins: [
|
|
189
|
+
mixins: [
|
|
190
|
+
cascaderPickerMixin
|
|
191
|
+
],
|
|
186
192
|
components: {},
|
|
187
193
|
props: {
|
|
188
|
-
value: {
|
|
189
|
-
type: Boolean,
|
|
190
|
-
default: false
|
|
191
|
-
},
|
|
192
|
-
|
|
193
|
-
activeValue: {
|
|
194
|
-
type: Array,
|
|
195
|
-
default () {
|
|
196
|
-
return [];
|
|
197
|
-
}
|
|
198
|
-
},
|
|
199
|
-
activeStr: {
|
|
200
|
-
type: String,
|
|
201
|
-
default: ""
|
|
202
|
-
},
|
|
203
|
-
data: {
|
|
204
|
-
type: Array,
|
|
205
|
-
drfault () {
|
|
206
|
-
return [];
|
|
207
|
-
}
|
|
208
|
-
},
|
|
209
|
-
propsObj: {
|
|
210
|
-
type: Object,
|
|
211
|
-
default () {
|
|
212
|
-
return {};
|
|
213
|
-
}
|
|
214
|
-
},
|
|
215
|
-
|
|
216
194
|
placement: {
|
|
217
195
|
type: String,
|
|
218
196
|
default: "bottom-start"
|
|
@@ -220,103 +198,15 @@
|
|
|
220
198
|
},
|
|
221
199
|
data () {
|
|
222
200
|
return {
|
|
223
|
-
|
|
224
|
-
showMode: "default", // "flat", "default"
|
|
225
|
-
|
|
226
|
-
curTabIndex: 0,
|
|
227
|
-
curSelectObj: undefined,
|
|
228
|
-
curSelectVal: [],
|
|
229
|
-
|
|
230
|
-
operationMap: {
|
|
231
|
-
canCancel: {
|
|
232
|
-
name: "取消",
|
|
233
|
-
type: "canCancel",
|
|
234
|
-
btnType: "cancel",
|
|
235
|
-
size: "small",
|
|
236
|
-
event: "clickCancel"
|
|
237
|
-
},
|
|
238
|
-
canConfirm: {
|
|
239
|
-
name: "确认",
|
|
240
|
-
type: "canConfirm",
|
|
241
|
-
btnType: "primary",
|
|
242
|
-
size: "small",
|
|
243
|
-
event: "clickConfirm"
|
|
244
|
-
}
|
|
245
|
-
}
|
|
201
|
+
curTabIndex: 0
|
|
246
202
|
};
|
|
247
203
|
},
|
|
248
204
|
computed: {
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
return this.value;
|
|
252
|
-
},
|
|
253
|
-
set (bool) {
|
|
254
|
-
this.$emit("input", bool);
|
|
255
|
-
}
|
|
256
|
-
},
|
|
257
|
-
|
|
258
|
-
selfPropsObj () {
|
|
259
|
-
return {
|
|
260
|
-
...this.propsObj
|
|
261
|
-
};
|
|
262
|
-
},
|
|
263
|
-
filterable () {
|
|
264
|
-
return this.selfPropsObj._filterable;
|
|
265
|
-
},
|
|
266
|
-
changeOnSelect () {
|
|
267
|
-
return this.selfPropsObj._changeOnSelect;
|
|
268
|
-
},
|
|
269
|
-
saveKey () {
|
|
270
|
-
return this.selfPropsObj._saveKey;
|
|
271
|
-
},
|
|
272
|
-
valueKey () {
|
|
273
|
-
return this.selfPropsObj._valueKey;
|
|
274
|
-
},
|
|
275
|
-
nameKey () {
|
|
276
|
-
return this.selfPropsObj._nameKey;
|
|
277
|
-
},
|
|
278
|
-
renderFormat () {
|
|
279
|
-
return this.selfPropsObj._renderFormat;
|
|
205
|
+
initData () {
|
|
206
|
+
return this.data;
|
|
280
207
|
},
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
return this.filterable &&
|
|
284
|
-
this.searchName.trim() &&
|
|
285
|
-
this.showFlatData.length < 200;
|
|
286
|
-
},
|
|
287
|
-
useFlatMode () {
|
|
288
|
-
return this.useMode &&
|
|
289
|
-
this.showMode === "flat";
|
|
290
|
-
},
|
|
291
|
-
showTreeData () {
|
|
292
|
-
return this.$getTreeDataByMatchFunc(node => {
|
|
293
|
-
return (
|
|
294
|
-
this.changeOnSelect
|
|
295
|
-
? true
|
|
296
|
-
: node.isLeaf
|
|
297
|
-
) && (
|
|
298
|
-
this.searchName.trim()
|
|
299
|
-
? node[this.nameKey].includes(this.searchName.trim()) || node[this.valueKey].includes(this.searchName.trim())
|
|
300
|
-
: true
|
|
301
|
-
);
|
|
302
|
-
}, this.data);
|
|
303
|
-
},
|
|
304
|
-
showFlatData () {
|
|
305
|
-
return this.$getTreeLinealDatasArr(this.showTreeData).map(arrItem => {
|
|
306
|
-
return {
|
|
307
|
-
...arrItem.slice(-1)[0],
|
|
308
|
-
[this.nameKey]: this.renderFormat(arrItem.map(item => item[this.nameKey]))
|
|
309
|
-
};
|
|
310
|
-
});
|
|
311
|
-
},
|
|
312
|
-
curSelectedOptions () {
|
|
313
|
-
return this.$getTreeLinealDatas(this.curSelectVal, this.showTreeData, undefined, this.saveKey);
|
|
314
|
-
},
|
|
315
|
-
curSelectLinealData () {
|
|
316
|
-
return this.curSelectLinealDatas[this.curTabIndex];
|
|
317
|
-
},
|
|
318
|
-
curSelectLinealDatas () {
|
|
319
|
-
const arr = this.curSelectedOptions.map((item, index, list) => {
|
|
208
|
+
selectedLinealDatas () {
|
|
209
|
+
const arr = this.selectedOptions.map((item, index, list) => {
|
|
320
210
|
return {
|
|
321
211
|
...item,
|
|
322
212
|
data: index === 0 ? this.showTreeData : list[index - 1].children
|
|
@@ -327,66 +217,49 @@
|
|
|
327
217
|
...arr,
|
|
328
218
|
|
|
329
219
|
...(
|
|
330
|
-
this.
|
|
331
|
-
?
|
|
332
|
-
{
|
|
333
|
-
data: this.showTreeData
|
|
334
|
-
}
|
|
335
|
-
]
|
|
336
|
-
: this.curTabIndex + 1 > this.curSelectedOptions.length && this.curSelectedOptions.slice(-1)[0].children.length
|
|
220
|
+
this.selectedOptions.length
|
|
221
|
+
? this.selectedLastOption.children.length && this.curTabIndex + 1 > this.selectedOptions.length
|
|
337
222
|
? [
|
|
338
223
|
{
|
|
339
|
-
data: this.
|
|
224
|
+
data: this.selectedLastOption.children
|
|
340
225
|
}
|
|
341
226
|
]
|
|
342
227
|
: []
|
|
228
|
+
: [
|
|
229
|
+
{
|
|
230
|
+
data: this.showTreeData
|
|
231
|
+
}
|
|
232
|
+
]
|
|
343
233
|
)
|
|
344
234
|
];
|
|
235
|
+
},
|
|
236
|
+
curSelectedLinealData () {
|
|
237
|
+
return this.selectedLinealDatas[this.curTabIndex];
|
|
345
238
|
}
|
|
346
239
|
},
|
|
347
240
|
created () {
|
|
348
241
|
this.init();
|
|
349
242
|
},
|
|
350
243
|
methods: {
|
|
244
|
+
// 初始化
|
|
351
245
|
init () {
|
|
352
|
-
this.
|
|
353
|
-
this.curTabIndex = this.
|
|
246
|
+
this.selectedValue = this.activeValue;
|
|
247
|
+
this.curTabIndex = this.selectedOptions.length
|
|
248
|
+
? this.selectedLastOption.children.length
|
|
249
|
+
? this.selectedOptions.length
|
|
250
|
+
: this.selectedOptions.length - 1
|
|
251
|
+
: 0;
|
|
354
252
|
},
|
|
355
253
|
|
|
356
254
|
search () {
|
|
357
|
-
this.
|
|
255
|
+
this.selectedValue = [];
|
|
358
256
|
this.curTabIndex = 0;
|
|
359
257
|
},
|
|
360
|
-
|
|
361
|
-
if (!this.selfPropsObj._disabled) {
|
|
362
|
-
this.showModal = true;
|
|
363
|
-
}
|
|
364
|
-
},
|
|
365
|
-
clickItem (dataItem) {
|
|
366
|
-
this.curSelectObj = dataItem;
|
|
367
|
-
this.curOldSelectVal = this.curSelectVal;
|
|
368
|
-
this.curSelectVal = dataItem.keys;
|
|
369
|
-
// 过滤重复点击
|
|
370
|
-
if (JSON.stringify(this.curSelectVal) !== JSON.stringify(this.curOldSelectVal)) {
|
|
371
|
-
const obj = {
|
|
372
|
-
value: this.curSelectVal,
|
|
373
|
-
selectedOptions: this.curSelectedOptions,
|
|
374
|
-
tabIndex: this.curTabIndex
|
|
375
|
-
};
|
|
376
|
-
this.$emit("change", obj);
|
|
377
|
-
!dataItem.children.length && this.$emit("finish", obj);
|
|
378
|
-
}
|
|
379
|
-
|
|
258
|
+
clickItemCb (node) {
|
|
380
259
|
// 区分展示方式
|
|
381
|
-
if (this.showMode === "default" &&
|
|
260
|
+
if (this.showMode === "default" && node.children.length) {
|
|
382
261
|
this.curTabIndex = this.curTabIndex + 1;
|
|
383
262
|
}
|
|
384
|
-
},
|
|
385
|
-
clickCancel () {
|
|
386
|
-
this.showModal = false;
|
|
387
|
-
},
|
|
388
|
-
clickConfirm () {
|
|
389
|
-
this.$emit("confirm", this.curSelectVal, this.curSelectedOptions);
|
|
390
263
|
}
|
|
391
264
|
}
|
|
392
265
|
};
|
|
@@ -395,11 +268,13 @@
|
|
|
395
268
|
<style lang="less">
|
|
396
269
|
.cascaderPicker {
|
|
397
270
|
&-down {
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
271
|
+
&.ivu-select-dropdown {
|
|
272
|
+
min-width: 400px;
|
|
273
|
+
max-width: 400px;
|
|
274
|
+
max-height: 600px; // 必须有
|
|
275
|
+
border: 0.5px solid #e5e5e5;
|
|
276
|
+
box-shadow: 0 3px 14px 2px rgba(0,0,0,0.05), 0 8px 10px 1px rgba(0,0,0,0.06), 0 5px 5px -3px rgba(0,0,0,0.1);
|
|
277
|
+
}
|
|
403
278
|
|
|
404
279
|
.wrap {
|
|
405
280
|
&-header {
|
|
@@ -484,6 +359,7 @@
|
|
|
484
359
|
padding: 8px 10px;
|
|
485
360
|
border-radius: @borderRadius;
|
|
486
361
|
line-height: 16px;
|
|
362
|
+
cursor: pointer;
|
|
487
363
|
display: flex;
|
|
488
364
|
flex-direction: row;
|
|
489
365
|
justify-content: space-between;
|
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
export default {
|
|
2
|
+
mixins: [],
|
|
3
|
+
components: {},
|
|
4
|
+
props: {
|
|
5
|
+
value: {
|
|
6
|
+
type: Boolean,
|
|
7
|
+
default: false
|
|
8
|
+
},
|
|
9
|
+
|
|
10
|
+
activeValue: {
|
|
11
|
+
type: Array,
|
|
12
|
+
default () {
|
|
13
|
+
return [];
|
|
14
|
+
}
|
|
15
|
+
},
|
|
16
|
+
activeStr: {
|
|
17
|
+
type: String,
|
|
18
|
+
default: ""
|
|
19
|
+
},
|
|
20
|
+
data: {
|
|
21
|
+
type: Array,
|
|
22
|
+
drfault () {
|
|
23
|
+
return [];
|
|
24
|
+
}
|
|
25
|
+
},
|
|
26
|
+
propsObj: {
|
|
27
|
+
type: Object,
|
|
28
|
+
default () {
|
|
29
|
+
return {};
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
},
|
|
33
|
+
data () {
|
|
34
|
+
return {
|
|
35
|
+
searchName: "",
|
|
36
|
+
showMode: "default", // "flat", "default"
|
|
37
|
+
maxFlatModeSearchNum: 80,
|
|
38
|
+
|
|
39
|
+
selectedValue: [],
|
|
40
|
+
|
|
41
|
+
operationMap: {
|
|
42
|
+
canCancel: {
|
|
43
|
+
name: "取消",
|
|
44
|
+
type: "canCancel",
|
|
45
|
+
btnType: "cancel",
|
|
46
|
+
size: "small",
|
|
47
|
+
event: "clickCancel"
|
|
48
|
+
},
|
|
49
|
+
canConfirm: {
|
|
50
|
+
name: "确认",
|
|
51
|
+
type: "canConfirm",
|
|
52
|
+
btnType: "primary",
|
|
53
|
+
size: "small",
|
|
54
|
+
event: "clickConfirm"
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
};
|
|
58
|
+
},
|
|
59
|
+
computed: {
|
|
60
|
+
showModal: {
|
|
61
|
+
get () {
|
|
62
|
+
return this.value;
|
|
63
|
+
},
|
|
64
|
+
set (bool) {
|
|
65
|
+
this.$emit("input", bool);
|
|
66
|
+
}
|
|
67
|
+
},
|
|
68
|
+
|
|
69
|
+
selfPropsObj () {
|
|
70
|
+
return {
|
|
71
|
+
...this.propsObj
|
|
72
|
+
};
|
|
73
|
+
},
|
|
74
|
+
filterable () {
|
|
75
|
+
return this.selfPropsObj._filterable;
|
|
76
|
+
},
|
|
77
|
+
changeOnSelect () {
|
|
78
|
+
return this.selfPropsObj._changeOnSelect;
|
|
79
|
+
},
|
|
80
|
+
saveKey () {
|
|
81
|
+
return this.selfPropsObj._saveKey;
|
|
82
|
+
},
|
|
83
|
+
valueKey () {
|
|
84
|
+
return this.selfPropsObj._valueKey;
|
|
85
|
+
},
|
|
86
|
+
nameKey () {
|
|
87
|
+
return this.selfPropsObj._nameKey;
|
|
88
|
+
},
|
|
89
|
+
renderFormat () {
|
|
90
|
+
return this.selfPropsObj._renderFormat;
|
|
91
|
+
},
|
|
92
|
+
resourceKey () {
|
|
93
|
+
return this.selfPropsObj._resourceKey;
|
|
94
|
+
},
|
|
95
|
+
|
|
96
|
+
useMode () {
|
|
97
|
+
return this.searchName.trim() &&
|
|
98
|
+
this.showFlatData.length < this.maxFlatModeSearchNum;
|
|
99
|
+
},
|
|
100
|
+
useFlatMode () {
|
|
101
|
+
return this.filterable &&
|
|
102
|
+
this.showMode === "flat" &&
|
|
103
|
+
this.useMode;
|
|
104
|
+
},
|
|
105
|
+
modeTip () {
|
|
106
|
+
return `在搜索时,会出现层级和平级切换开关,但搜索出的结果超${this.maxFlatModeSearchNum}个时,\
|
|
107
|
+
将不支持使用模式切换,因为此时平级方式不方便,不适用`;
|
|
108
|
+
},
|
|
109
|
+
|
|
110
|
+
inputStr: {
|
|
111
|
+
get () {
|
|
112
|
+
return this.activeStr;
|
|
113
|
+
},
|
|
114
|
+
set (str) {
|
|
115
|
+
if (!str) {
|
|
116
|
+
this.$emit("clear", []);
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
},
|
|
120
|
+
matchFunc () {
|
|
121
|
+
return node => {
|
|
122
|
+
return (
|
|
123
|
+
this.changeOnSelect
|
|
124
|
+
? true
|
|
125
|
+
: node.isLeaf
|
|
126
|
+
) && (
|
|
127
|
+
this.searchName.trim()
|
|
128
|
+
? node[this.nameKey].includes(this.searchName.trim()) || node[this.valueKey].includes(this.searchName.trim())
|
|
129
|
+
: true
|
|
130
|
+
);
|
|
131
|
+
};
|
|
132
|
+
},
|
|
133
|
+
showTreeData () {
|
|
134
|
+
return this.$getTreeDataByMatchFunc(this.matchFunc, this.initData);
|
|
135
|
+
},
|
|
136
|
+
showFlatData () {
|
|
137
|
+
return this.$getListDataByMatchFunc(this.matchFunc, this.initData).map(arrItem => {
|
|
138
|
+
return {
|
|
139
|
+
...arrItem.slice(-1)[0],
|
|
140
|
+
[this.nameKey]: this.renderFormat(arrItem.map(item => item[this.nameKey]))
|
|
141
|
+
};
|
|
142
|
+
});
|
|
143
|
+
},
|
|
144
|
+
// 选中项 -各级数据对象集合
|
|
145
|
+
selectedOptions () {
|
|
146
|
+
return this.$getTreeLinealDatas(this.selectedValue, this.showTreeData, undefined, this.saveKey);
|
|
147
|
+
},
|
|
148
|
+
// 选中项 -最后一级数据对象
|
|
149
|
+
selectedLastOption () {
|
|
150
|
+
return this.selectedOptions.slice(-1)[0];
|
|
151
|
+
},
|
|
152
|
+
// 选中项 -名字
|
|
153
|
+
selectedName () {
|
|
154
|
+
return this.selectedLastOption ? this.selectedLastOption[this.nameKey] : "";
|
|
155
|
+
}
|
|
156
|
+
},
|
|
157
|
+
created () { },
|
|
158
|
+
methods: {
|
|
159
|
+
clickInput () {
|
|
160
|
+
if (!this.selfPropsObj._disabled) {
|
|
161
|
+
this.showModal = true;
|
|
162
|
+
}
|
|
163
|
+
},
|
|
164
|
+
clickItem (node) {
|
|
165
|
+
this.oldSelectedValue = this.selectedValue;
|
|
166
|
+
this.selectedValue = node.keys;
|
|
167
|
+
// 避免重复点击
|
|
168
|
+
if (JSON.stringify(this.selectedValue) !== JSON.stringify(this.oldSelectedValue)) {
|
|
169
|
+
const obj = {
|
|
170
|
+
value: this.selectedValue,
|
|
171
|
+
selectedOptions: this.selectedOptions,
|
|
172
|
+
tabIndex: this.curTabIndex
|
|
173
|
+
};
|
|
174
|
+
this.$emit("change", obj);
|
|
175
|
+
!node.children.length && this.$emit("finish", obj);
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
this.clickItemCb && this.clickItemCb(node);
|
|
179
|
+
},
|
|
180
|
+
clickCancel () {
|
|
181
|
+
this.showModal = false;
|
|
182
|
+
},
|
|
183
|
+
clickConfirm () {
|
|
184
|
+
if (this.selectedValue.length && this.selectedOptions.length) {
|
|
185
|
+
if (!this.changeOnSelect && !this.selectedLastOption.isLeaf) {
|
|
186
|
+
this.$Message.error({
|
|
187
|
+
content: "请选择到末级数据!",
|
|
188
|
+
duration: 2
|
|
189
|
+
});
|
|
190
|
+
} else {
|
|
191
|
+
this.$emit("confirm", this.selectedValue, this.selectedOptions);
|
|
192
|
+
}
|
|
193
|
+
} else {
|
|
194
|
+
this.$Message.error({
|
|
195
|
+
content: "请选择数据!",
|
|
196
|
+
duration: 2
|
|
197
|
+
});
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
}
|
|
202
|
+
};
|
|
@@ -7,18 +7,15 @@
|
|
|
7
7
|
:transfer="true"
|
|
8
8
|
>
|
|
9
9
|
<!-- 编辑 -->
|
|
10
|
-
<
|
|
10
|
+
<dsh-control-input
|
|
11
11
|
v-if="canEdit"
|
|
12
|
-
:class="
|
|
13
|
-
...commonClass
|
|
14
|
-
}"
|
|
15
|
-
:canEdit="finalCanEdit"
|
|
12
|
+
:class="commonClass"
|
|
16
13
|
:value="curVal"
|
|
17
|
-
:
|
|
14
|
+
:disabled="selfPropsObj._disabled"
|
|
18
15
|
:propsObj="selfPropsObj"
|
|
19
16
|
@clear="clickClear"
|
|
20
17
|
@click.native="clickInput"
|
|
21
|
-
></
|
|
18
|
+
></dsh-control-input>
|
|
22
19
|
|
|
23
20
|
<!-- 查看 -->
|
|
24
21
|
<div
|
|
@@ -194,6 +191,8 @@
|
|
|
194
191
|
computed: {
|
|
195
192
|
selfPropsObj () {
|
|
196
193
|
return {
|
|
194
|
+
_icon: "ios-map-outline",
|
|
195
|
+
|
|
197
196
|
...this.propsObj,
|
|
198
197
|
...this.commonDealPropsObj
|
|
199
198
|
};
|
|
@@ -201,9 +200,6 @@
|
|
|
201
200
|
showType () {
|
|
202
201
|
return this.selfPropsObj._showType;
|
|
203
202
|
},
|
|
204
|
-
inputIcon () {
|
|
205
|
-
return "ios-map-outline";
|
|
206
|
-
},
|
|
207
203
|
|
|
208
204
|
curVal: {
|
|
209
205
|
get () {
|