eoss-ui 0.6.19 → 0.6.20

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 (102) hide show
  1. package/lib/eoss-ui.common.js +780 -678
  2. package/lib/flow.js +619 -515
  3. package/lib/index.js +1 -1
  4. package/lib/login.js +3 -2
  5. package/lib/main.js +143 -146
  6. package/lib/qr-code.js +13 -13
  7. package/lib/theme-chalk/index.css +1 -1
  8. package/lib/theme-chalk/login.css +1 -1
  9. package/package.json +157 -157
  10. package/packages/button/src/main.vue +418 -418
  11. package/packages/button-group/src/main.vue +298 -298
  12. package/packages/checkbox-group/src/main.vue +333 -333
  13. package/packages/clients/src/main.vue +144 -144
  14. package/packages/data-table/src/children.vue +39 -39
  15. package/packages/data-table/src/column.vue +983 -983
  16. package/packages/data-table/src/main.vue +1812 -1812
  17. package/packages/data-table/src/sizer.vue +195 -195
  18. package/packages/date-picker/src/main.vue +236 -236
  19. package/packages/flow/src/component/CustomPreset.vue +1 -1
  20. package/packages/flow/src/component/Preset.vue +1 -1
  21. package/packages/flow/src/component/SendMsg.vue +3 -1
  22. package/packages/flow/src/component/taskUnionExamine.vue +38 -20
  23. package/packages/flow/src/main.vue +2731 -2711
  24. package/packages/flow/src/processForm.vue +13 -2
  25. package/packages/flow/src/processReject.vue +14 -3
  26. package/packages/flow/src/startTaskRead.vue +23 -5
  27. package/packages/flow-group/src/main.vue +684 -684
  28. package/packages/form/src/main.vue +3582 -3582
  29. package/packages/form/src/table.vue +1420 -1420
  30. package/packages/handle-user/src/main.vue +134 -134
  31. package/packages/handler/src/main.vue +374 -374
  32. package/packages/icon/src/main.vue +101 -101
  33. package/packages/input/src/main.vue +356 -356
  34. package/packages/login/src/main.vue +1851 -1850
  35. package/packages/login/src/resetPassword.vue +557 -557
  36. package/packages/main/src/default/message.vue +249 -249
  37. package/packages/main/src/default/notice.vue +157 -157
  38. package/packages/main/src/default/userinfo.vue +494 -494
  39. package/packages/main/src/public/online.vue +89 -89
  40. package/packages/main/src/public/search.vue +454 -454
  41. package/packages/main/src/public/settings.vue +221 -221
  42. package/packages/main/src/simplicity/apps.vue +388 -388
  43. package/packages/main/src/simplicity/avatar.vue +82 -82
  44. package/packages/main/src/simplicity/handler.vue +183 -183
  45. package/packages/main/src/simplicity/index.vue +1930 -1931
  46. package/packages/main/src/simplicity/lists.vue +84 -84
  47. package/packages/main/src/simplicity/menu-list.vue +128 -128
  48. package/packages/main/src/simplicity/message.vue +259 -259
  49. package/packages/main/src/simplicity/notice.vue +190 -190
  50. package/packages/main/src/simplicity/router-page.vue +45 -45
  51. package/packages/main/src/simplicity/sub-menu.vue +241 -241
  52. package/packages/main/src/simplicity/user.vue +248 -248
  53. package/packages/main/src/simplicity/userinfo.vue +304 -304
  54. package/packages/menu/src/main.vue +536 -536
  55. package/packages/pagination/src/main.vue +96 -96
  56. package/packages/qr-code/src/main.vue +170 -170
  57. package/packages/radio-group/src/main.vue +319 -319
  58. package/packages/select/src/main.vue +761 -761
  59. package/packages/selector/src/main.vue +677 -677
  60. package/packages/selector-panel/src/main.vue +1020 -1020
  61. package/packages/selector-panel/src/selection.vue +160 -160
  62. package/packages/tabs/src/main.vue +788 -788
  63. package/packages/theme-chalk/lib/index.css +1 -1
  64. package/packages/theme-chalk/lib/login.css +1 -1
  65. package/packages/theme-chalk/src/base.scss +260 -260
  66. package/packages/theme-chalk/src/button-group.scss +175 -175
  67. package/packages/theme-chalk/src/calendar.scss +113 -113
  68. package/packages/theme-chalk/src/clients.scss +87 -87
  69. package/packages/theme-chalk/src/common/var.scss +1 -4
  70. package/packages/theme-chalk/src/data-table.scss +276 -276
  71. package/packages/theme-chalk/src/dialog.scss +77 -77
  72. package/packages/theme-chalk/src/flow-group.scss +110 -110
  73. package/packages/theme-chalk/src/form.scss +496 -496
  74. package/packages/theme-chalk/src/handler.scss +133 -133
  75. package/packages/theme-chalk/src/icon.scss +1745 -1745
  76. package/packages/theme-chalk/src/icons.scss +99 -99
  77. package/packages/theme-chalk/src/login.scss +917 -926
  78. package/packages/theme-chalk/src/main.scss +632 -632
  79. package/packages/theme-chalk/src/menu.scss +222 -222
  80. package/packages/theme-chalk/src/nav.scss +125 -125
  81. package/packages/theme-chalk/src/pagination.scss +29 -29
  82. package/packages/theme-chalk/src/selector-panel.scss +204 -204
  83. package/packages/theme-chalk/src/simplicity.scss +1246 -1246
  84. package/packages/theme-chalk/src/tabs.scss +87 -87
  85. package/packages/theme-chalk/src/toolbar.scss +179 -179
  86. package/packages/theme-chalk/src/tree-group.scss +72 -72
  87. package/packages/theme-chalk/src/tree.scss +165 -165
  88. package/packages/upload/src/main.vue +1313 -1313
  89. package/packages/wujie/src/main.vue +145 -145
  90. package/src/config/api.js +236 -236
  91. package/src/config/image.js +2 -2
  92. package/src/index.js +157 -157
  93. package/packages/.DS_Store +0 -0
  94. package/packages/checkbox-group/.DS_Store +0 -0
  95. package/packages/data-table/.DS_Store +0 -0
  96. package/packages/dialog/.DS_Store +0 -0
  97. package/packages/handler/.DS_Store +0 -0
  98. package/packages/login/.DS_Store +0 -0
  99. package/packages/main/.DS_Store +0 -0
  100. package/packages/main/src/.DS_Store +0 -0
  101. package/packages/theme-chalk/src/.DS_Store +0 -0
  102. package/src/.DS_Store +0 -0
@@ -1,761 +1,761 @@
1
- <script>
2
- import { findSysCode, getDictList } from 'eoss-ui/src/config/api.js';
3
- import { debounce } from 'throttle-debounce';
4
- import store from 'eoss-ui/src/utils/store';
5
- import util from 'eoss-ui/src/utils/util';
6
- export default {
7
- name: 'EsSelect',
8
- componentName: 'EsSelect',
9
- inheritAttrs: false,
10
- provide() {
11
- return {
12
- esSelect: this
13
- };
14
- },
15
- inject: {
16
- esForm: {
17
- default: ''
18
- }
19
- },
20
- props: {
21
- service: String,
22
- value: [String, Array, Object, Number],
23
- method: {
24
- type: String,
25
- default: 'get'
26
- },
27
- param: {
28
- type: Object,
29
- default() {
30
- return {};
31
- }
32
- },
33
- // 显示隐藏组件
34
- display: {
35
- type: Boolean,
36
- default: true
37
- },
38
- // 是否不渲染组件
39
- hide: {
40
- type: Boolean,
41
- default: false
42
- },
43
- valueType: {
44
- type: String,
45
- default: 'string',
46
- validator: function (value) {
47
- return ['string', 'object'].includes(value);
48
- }
49
- },
50
- // 选择项的值字段
51
- valueKey: {
52
- type: String,
53
- default: 'value'
54
- },
55
- // 指定选择项显示值的键名,data元素是对象类型时必填
56
- labelKey: {
57
- type: String,
58
- default: 'name'
59
- },
60
- data: {
61
- type: Array,
62
- default() {
63
- return [];
64
- }
65
- },
66
- // 远程搜索
67
- remote: Boolean,
68
- remoteKey: {
69
- type: String,
70
- default: 'searchKey'
71
- },
72
- remoteMethod: Function,
73
- // 选择项远程地址
74
- url: String,
75
- // 选择项获取代码表数据(优先级大于url)
76
- sysCode: String,
77
- filtrate: [String, Object, Array],
78
- filtrateKey: {
79
- type: String,
80
- default: 'pid'
81
- },
82
- readonly: Boolean,
83
- separator: {
84
- type: String,
85
- default: '-'
86
- },
87
- symbol: {
88
- type: String,
89
- default: ','
90
- },
91
- plain: Boolean,
92
- where: Object,
93
- parseData: Function,
94
- disabled: Boolean,
95
- // 是否下拉树选择
96
- tree: {
97
- type: [Boolean, Object],
98
- default: false
99
- },
100
- // 父级是否可选
101
- parentCheck: {
102
- type: Boolean,
103
- default: true
104
- },
105
- // 父级可选时父级是否作为单独的值
106
- parentAsValue: {
107
- type: Boolean,
108
- default: true
109
- },
110
- group: Boolean,
111
- multiple: Boolean,
112
- defaultValue: Boolean,
113
- onExpand: Function,
114
- onLoadsub: Function,
115
- subParamKey: Object,
116
- lazy: Boolean,
117
- //是否请求代码表
118
- ajax: {
119
- type: Boolean,
120
- default: true
121
- },
122
- isNoParamRequest: {
123
- type: Boolean,
124
- default: true
125
- },
126
- dataKey: String
127
- },
128
- data() {
129
- return {
130
- loading: false,
131
- options: '',
132
- valKey: this.valueKey,
133
- label: this.labelKey,
134
- hidden: false,
135
- canceled: false
136
- };
137
- },
138
- computed: {
139
- isObject() {
140
- if (this.valueType === 'object') {
141
- return true;
142
- }
143
- if (
144
- util.isObject(this.value) ||
145
- (this.value && this.value[0] && util.isObject(this.value[0]))
146
- ) {
147
- return true;
148
- }
149
- return false;
150
- },
151
- isRemote() {
152
- return new Boolean(this.remote);
153
- },
154
- results() {
155
- if (this.options.length) {
156
- return this.options;
157
- }
158
- if (this.filtrate) {
159
- if (Array.isArray(this.filtrate) && this.filtrate.length) {
160
- let ary = [];
161
- this.filtrate.forEach((items) => {
162
- let val = typeof items === 'string' ? items : items[this.valKey];
163
- ary = ary.concat(
164
- this.data.filter((item) => {
165
- return item[this.filtrateKey] == val;
166
- })
167
- );
168
- });
169
- return ary;
170
- } else {
171
- let val =
172
- typeof this.filtrate === 'string'
173
- ? this.filtrate
174
- : this.filtrate[this.valKey];
175
- return this.data.filter((item) => {
176
- return item[this.filtrateKey] == val;
177
- });
178
- }
179
- }
180
- return this.data;
181
- },
182
- models: {
183
- get() {
184
- return this.value;
185
- },
186
- set(val) {
187
- return val;
188
- }
189
- },
190
- findCode() {
191
- if (this.service) {
192
- return `/${this.service}${getDictList}`;
193
- }
194
- return findSysCode;
195
- }
196
- },
197
- watch: {
198
- sysCode: {
199
- immediate: true,
200
- handler(val, old) {
201
- if (val && val !== old) {
202
- this.label = this.service ? 'label' : 'shortName';
203
- this.valKey = this.service ? 'value' : 'cciValue';
204
- const options = store.get(val);
205
- if (options) {
206
- this.options = JSON.parse(JSON.stringify(options));
207
- } else {
208
- this.getData(val);
209
- }
210
- }
211
- }
212
- },
213
- url: {
214
- immediate: true,
215
- handler(val, old) {
216
- if (val && old !== val && !this.sysCode) {
217
- this.getData(this.sysCode);
218
- }
219
- }
220
- },
221
- param: {
222
- deep: true,
223
- handler(val, old) {
224
- if (this.url && JSON.stringify(val) !== JSON.stringify(old)) {
225
- this.options = [];
226
- this.getData(this.sysCode);
227
- }
228
- }
229
- }
230
- },
231
- beforeCreate() {
232
- this.getData = debounce(500, (sysCode, param, reload) => {
233
- this.getDatas(sysCode, param, reload);
234
- });
235
- },
236
- created() {
237
- this.bindEventBus();
238
- },
239
- mounted() {},
240
- methods: {
241
- createOption({ filtrate, data, readonly = false, h }) {
242
- let filte =
243
- filtrate && util.isObject(filtrate) ? filtrate[this.valKey] : filtrate;
244
- let eles = [];
245
- data.forEach((item) => {
246
- if (this.models === undefined && item.selected) {
247
- this.$emit(
248
- 'input',
249
- this.valueType === 'object' ? item : item[this.valKey]
250
- );
251
- }
252
- if (
253
- (Object.prototype.hasOwnProperty.call(item, 'children') ||
254
- Object.prototype.hasOwnProperty.call(item, 'options')) &&
255
- (item.children || item.options)
256
- ) {
257
- const children = item.children || item.options;
258
- if (readonly) {
259
- eles.push(
260
- this.createOption({ filtrate, data: children, readonly, h })
261
- );
262
- } else {
263
- eles.push(
264
- h(
265
- 'el-option-group',
266
- { attrs: { label: item[this.label] || item.label } },
267
- this.createOption({ filtrate, data: children, readonly, h })
268
- )
269
- );
270
- }
271
- } else {
272
- if (readonly) {
273
- if (item[this.valKey] === filte) {
274
- eles.push(item[this.label] || item.label);
275
- }
276
- } else {
277
- if (
278
- filte === null ||
279
- filte === undefined ||
280
- filte === '' ||
281
- filte === item[this.filtrateKey]
282
- ) {
283
- if (typeof item === 'string') {
284
- eles.push(
285
- h('el-option', {
286
- attrs: {
287
- label: item,
288
- value: item
289
- }
290
- })
291
- );
292
- } else {
293
- let content = [item[this.label] || item.label];
294
- if (item.render) {
295
- content = [item.render(h, item)];
296
- }
297
- if (item.tips) {
298
- let attrs =
299
- typeof item.tips == 'string'
300
- ? { content: item.tips }
301
- : item.tips;
302
- content.push(
303
- h('es-tips', {
304
- attrs: attrs
305
- })
306
- );
307
- }
308
- eles.push(
309
- h(
310
- 'el-option',
311
- {
312
- attrs: {
313
- label: item[this.label] || item.label,
314
- value: this.isObject ? item : item[this.valKey],
315
- disabled: item.disabled
316
- }
317
- },
318
- content
319
- )
320
- );
321
- }
322
- }
323
- }
324
- }
325
- });
326
- return eles;
327
- },
328
- getDatas(sysCode, param, reload) {
329
- if (
330
- !reload &&
331
- (!this.ajax ||
332
- (!this.isNoParamRequest && Object.keys(this.param).length == 0))
333
- ) {
334
- return false;
335
- }
336
- let params = {};
337
- if (this.results.length === 0 || reload) {
338
- params = util.extend(
339
- {},
340
- this.param,
341
- sysCode ? { sysAppCode: sysCode, code: sysCode } : {},
342
- param ? param : {}
343
- );
344
- } else {
345
- return false;
346
- }
347
- if (!sysCode && !this.url) {
348
- return false;
349
- }
350
- this.loading = true;
351
- util
352
- .ajax({
353
- url: sysCode ? this.findCode : this.url,
354
- method: this.method,
355
- params: params,
356
- data: params
357
- })
358
- .then((res) => {
359
- this.loading = false;
360
- this.canceled = false;
361
- if (res.rCode === 0) {
362
- if (this.parseData) {
363
- this.options = this.parseData(
364
- JSON.parse(JSON.stringify(res.results))
365
- );
366
- } else {
367
- this.options = JSON.parse(JSON.stringify(res.results));
368
- }
369
- if (sysCode || this.dataKey) {
370
- const bus = this.bus || this.$root.Bus;
371
- bus &&
372
- bus.$emit(
373
- sysCode || this.dataKey,
374
- JSON.parse(JSON.stringify(this.options))
375
- );
376
- store.set(sysCode, JSON.parse(JSON.stringify(this.options)));
377
- }
378
- } else {
379
- this.$message.error(res.msg);
380
- }
381
- })
382
- .catch((err) => {
383
- this.loading = false;
384
- if (err.message) {
385
- if (err.message !== 'canceled') {
386
- this.$message.error(err.message);
387
- }
388
- if (err.message === 'canceled' && sysCode) {
389
- this.canceled = true;
390
- }
391
- }
392
- });
393
- },
394
- search(query) {
395
- if (query && query !== '') {
396
- if (this.url && this.url !== '') {
397
- this.loading = true;
398
- let params = {};
399
- params[this.remoteKey] = query;
400
- params = util.extend({}, this.param, params);
401
- util
402
- .ajax({
403
- url: this.url,
404
- method: this.method,
405
- params: params,
406
- data: params
407
- })
408
- .then((res) => {
409
- this.loading = false;
410
- if (res.rCode === 0) {
411
- this.options = JSON.parse(JSON.stringify(res.results));
412
- }
413
- })
414
- .catch((err) => {
415
- this.loading = false;
416
- if (err.message && err.message !== 'canceled') {
417
- this.$message.error(err.message);
418
- }
419
- });
420
- } else {
421
- this.options = [];
422
- }
423
- } else {
424
- this.options = this.data;
425
- }
426
- },
427
- renderd(doms, h, type) {
428
- if (typeof this.$attrs[type] === 'boolean') {
429
- if (this.$attrs.render) {
430
- if (typeof this.$attrs.render == 'string') {
431
- try {
432
- doms.push(
433
- h(
434
- 'template',
435
- { slot: type },
436
- util.toFunction(this.$attrs.render)(h, this)
437
- )
438
- );
439
- } catch (error) {
440
- throw error;
441
- }
442
- } else {
443
- doms.push(
444
- h('template', { slot: type }, this.$attrs.render(h, this))
445
- );
446
- }
447
- }
448
- } else if (typeof this.$attrs[type] === 'object') {
449
- doms.push(
450
- h(
451
- 'es-button',
452
- {
453
- slot: type,
454
- class: ['el-primeval', this.$attrs[type].class],
455
- props: {
456
- ...this.$attrs[type].props,
457
- size: this.$attrs[type].size
458
- ? this.$attrs[type].size
459
- : type === 'prefix' || type === 'suffix'
460
- ? 'small'
461
- : '',
462
- type: 'primary'
463
- },
464
- domProps: this.$attrs[type].icon
465
- ? { innerHTML: this.$attrs[type].icon }
466
- : {},
467
- on: {
468
- click: (e) => {
469
- this.$attrs[type].click &&
470
- this.$attrs[type].click(this, this.model);
471
- this.$attrs[type].event &&
472
- this.$attrs[type].event(this, this.model);
473
- }
474
- },
475
- ref: 'selectBtn'
476
- },
477
- [this.$attrs[type].text]
478
- )
479
- );
480
- } else {
481
- doms.push(h('template', { slot: type }, [this.$attrs[type]]));
482
- }
483
- },
484
- getLabel(value, data) {
485
- if ((value || value === 0) && data) {
486
- if (util.isObject(data)) {
487
- if (value === data[this.valKey]) {
488
- return data[this.label];
489
- } else if (value === data[this.label]) {
490
- return value;
491
- } else if (
492
- Object.prototype.hasOwnProperty.call(data, 'children') &&
493
- data.children &&
494
- data.children.length
495
- ) {
496
- let val = this.getLabel(value, data.children);
497
- if (val) {
498
- return val;
499
- }
500
- }
501
- } else {
502
- if (
503
- typeof data === 'string' ||
504
- (!data.length && !this.sysCode && !this.url)
505
- ) {
506
- return value;
507
- }
508
- if (Array.isArray(data) && data.length) {
509
- for (let i = 0; i < data.length; i++) {
510
- let val = this.getLabel(value, data[i]);
511
- if (val) {
512
- return val;
513
- }
514
- }
515
- }
516
- }
517
- }
518
- return '';
519
- },
520
- reload() {
521
- this.getData(...arguments);
522
- },
523
- handleExpand(data, node) {
524
- if (this.onExpand) {
525
- this.onExpand(data, node);
526
- } else {
527
- if (this.lazy) {
528
- this.loadsub(data, node);
529
- }
530
- this.$emit('node-expand', data, node);
531
- }
532
- },
533
- //请求子节点数据
534
- loadsub(data, node) {
535
- if (data.state !== '' && (!data.children || data.children.length === 0)) {
536
- let param = {};
537
- if (this.subParamKey) {
538
- for (let i in this.subParamKey) {
539
- param[i] = data[this.subParamKey[i]];
540
- }
541
- } else {
542
- param[this.valKey] = data[this.valKey];
543
- }
544
- let params = util.extend({}, this.param, this.where, param);
545
- if (this.parseParams) {
546
- params = this.parseParams({ data, params, node });
547
- }
548
- if (this.onLoadsub) {
549
- this.onLoadsub({ data, params, node })
550
- .then((res) => {
551
- this.loading = false;
552
- this.$set(data, 'children', JSON.parse(JSON.stringify(res)));
553
- if (this.dataKey && this.esForm) {
554
- this.esForm.setSysCodes(
555
- this.dataKey,
556
- JSON.parse(JSON.stringify(this.options))
557
- );
558
- }
559
- })
560
- .catch((e) => {
561
- this.loading = false;
562
- });
563
- } else {
564
- util
565
- .ajax({
566
- method: this.method,
567
- url: this.url,
568
- data: params,
569
- params: params
570
- })
571
- .then((res) => {
572
- if (res.rCode === 0) {
573
- this.loading = false;
574
- let results = JSON.parse(JSON.stringify(res.results));
575
- if (Array.isArray(results)) {
576
- if (data.id === results[0].id) {
577
- this.$set(data, 'children', results[0].children);
578
- } else {
579
- this.$set(data, 'children', results);
580
- }
581
- } else if (data.id === results.id) {
582
- this.$set(data, 'children', results.children);
583
- } else {
584
- console.error('tree数据格式错误');
585
- }
586
- if (this.dataKey && this.esForm) {
587
- this.esForm.setSysCodes(
588
- this.dataKey,
589
- JSON.parse(JSON.stringify(this.options))
590
- );
591
- }
592
- }
593
- })
594
- .catch((err) => {
595
- this.loading = false;
596
- if (err.message && err.message !== 'canceled') {
597
- this.$message.error(err.message);
598
- }
599
- });
600
- }
601
- }
602
- },
603
- toggleMenu() {
604
- this.$refs.elSelect.toggleMenu();
605
- },
606
- setOptions(val) {
607
- this.options = val;
608
- },
609
- bindEventBus() {
610
- const bus = this.bus || this.$root.Bus;
611
- bus && bus.$on(this.sysCode || this.dataKey, this.setOptions);
612
- },
613
- unbindEventBus() {
614
- const bus = this.bus || this.$root.Bus;
615
- bus && bus.$off(this.sysCode || this.dataKey, this.setOptions);
616
- }
617
- },
618
- beforeDestroy() {
619
- this.unbindEventBus();
620
- },
621
- render(h) {
622
- if (!this.hide) {
623
- if (this.readonly) {
624
- let dom = [];
625
- if (Array.isArray(this.models)) {
626
- dom = this.models.map((item) => {
627
- if (util.isObject(item)) {
628
- if (!item[this.label] && !item.label) {
629
- return this.getLabel(value[this.valKey], data);
630
- }
631
- return item[this.label] || item.label;
632
- }
633
- return this.getLabel(item, this.results);
634
- });
635
- } else if (util.isObject(this.models)) {
636
- if (!this.models[this.label] && !this.models.label) {
637
- dom = [this.getLabel(this.models[this.valKey], this.results)];
638
- } else {
639
- dom = [this.models[this.label] || this.models.label];
640
- }
641
- } else {
642
- dom = [this.getLabel(this.models, this.results)];
643
- }
644
- return h(
645
- 'div',
646
- {
647
- class: [
648
- {
649
- 'es-plain': this.plain,
650
- 'es-textarea__inner el-textarea__inner': this.multiple,
651
- 'el-input__inner es-input__inner': !this.multiple
652
- }
653
- ]
654
- },
655
- [dom.join(this.symbol)]
656
- );
657
- }
658
- let doms = [];
659
- let cls = [];
660
- if (this.results.length && !this.tree) {
661
- if (this.filtrate && Array.isArray(this.filtrate)) {
662
- doms = this.filtrate.map((item) => {
663
- return h(
664
- 'el-option-group',
665
- {
666
- attrs: {
667
- label: item[this.label] || item.label,
668
- key: item[this.valKey]
669
- }
670
- },
671
- this.createOption({ filtrate: item, data: this.results, h })
672
- );
673
- });
674
- } else {
675
- doms = this.createOption({
676
- filtrate: this.filtrate,
677
- data: this.results,
678
- h
679
- });
680
- }
681
- }
682
- let { prefix, suffix, prepend, append, ...attrs } = this.$attrs;
683
- if (this.$slots.prefix) {
684
- doms.push(h('template', { slot: 'prefix' }, this.$slots.prefix));
685
- } else if (prefix) {
686
- this.renderd(doms, h, 'prefix');
687
- cls.push('es-select-button-prefix');
688
- }
689
- if (this.$slots.suffix) {
690
- doms.push(h('template', { slot: 'suffix' }, this.$slots.suffix));
691
- } else if (suffix) {
692
- this.renderd(doms, h, 'suffix');
693
- cls.push('es-select-button-suffix');
694
- }
695
- if (this.$slots.prepend) {
696
- doms.push(h('template', { slot: 'prepend' }, this.$slots.prepend));
697
- } else if (prepend) {
698
- this.renderd(doms, h, 'prepend');
699
- }
700
- if (this.$slots.append) {
701
- doms.push(h('template', { slot: 'append' }, this.$slots.append));
702
- } else if (append) {
703
- this.renderd(doms, h, 'append');
704
- }
705
- if (!this.models && this.results.length && this.defaultValue) {
706
- if (this.valueType === 'object') {
707
- this.models = this.results[0];
708
- //this.$emit('input', this.results[0]);
709
- } else {
710
- this.models = this.results[0][this.valKey];
711
- //this.$emit('input', this.results[0][this.valKey]);
712
- }
713
- this.$emit('change', this.results[0], 0);
714
- }
715
- return h(
716
- 'el-select',
717
- {
718
- class: cls,
719
- ref: 'elSelect',
720
- directives: [
721
- {
722
- name: 'show',
723
- value: this.display
724
- }
725
- ],
726
- props: {
727
- ...attrs,
728
- multiple: this.multiple,
729
- valueType: this.valueType,
730
- valueKey: this.valKey,
731
- labelKey: this.label,
732
- loading: this.loading,
733
- disabled: this.disabled,
734
- tree:
735
- typeof this.tree === 'boolean'
736
- ? this.tree
737
- : { ...this.tree, lazy: this.label },
738
- data: this.results,
739
- // 父级是否可选
740
- parentCheck: this.parentCheck,
741
- // 父级可选时父级是否作为单独的值
742
- parentAsValue: this.parentAsValue,
743
- value: this.models
744
- },
745
- attrs: {
746
- remoteMethod: !this.remoteMethod ? this.search : this.remoteMethod,
747
- remote: this.remote
748
- },
749
- on: {
750
- ...this.$listeners,
751
- 'node-expand': this.handleExpand
752
- }
753
- },
754
- this.$slots.default ? this.$slots.default : doms
755
- );
756
- } else {
757
- return '';
758
- }
759
- }
760
- };
761
- </script>
1
+ <script>
2
+ import { findSysCode, getDictList } from 'eoss-ui/src/config/api.js';
3
+ import { debounce } from 'throttle-debounce';
4
+ import store from 'eoss-ui/src/utils/store';
5
+ import util from 'eoss-ui/src/utils/util';
6
+ export default {
7
+ name: 'EsSelect',
8
+ componentName: 'EsSelect',
9
+ inheritAttrs: false,
10
+ provide() {
11
+ return {
12
+ esSelect: this
13
+ };
14
+ },
15
+ inject: {
16
+ esForm: {
17
+ default: ''
18
+ }
19
+ },
20
+ props: {
21
+ service: String,
22
+ value: [String, Array, Object, Number],
23
+ method: {
24
+ type: String,
25
+ default: 'get'
26
+ },
27
+ param: {
28
+ type: Object,
29
+ default() {
30
+ return {};
31
+ }
32
+ },
33
+ // 显示隐藏组件
34
+ display: {
35
+ type: Boolean,
36
+ default: true
37
+ },
38
+ // 是否不渲染组件
39
+ hide: {
40
+ type: Boolean,
41
+ default: false
42
+ },
43
+ valueType: {
44
+ type: String,
45
+ default: 'string',
46
+ validator: function (value) {
47
+ return ['string', 'object'].includes(value);
48
+ }
49
+ },
50
+ // 选择项的值字段
51
+ valueKey: {
52
+ type: String,
53
+ default: 'value'
54
+ },
55
+ // 指定选择项显示值的键名,data元素是对象类型时必填
56
+ labelKey: {
57
+ type: String,
58
+ default: 'name'
59
+ },
60
+ data: {
61
+ type: Array,
62
+ default() {
63
+ return [];
64
+ }
65
+ },
66
+ // 远程搜索
67
+ remote: Boolean,
68
+ remoteKey: {
69
+ type: String,
70
+ default: 'searchKey'
71
+ },
72
+ remoteMethod: Function,
73
+ // 选择项远程地址
74
+ url: String,
75
+ // 选择项获取代码表数据(优先级大于url)
76
+ sysCode: String,
77
+ filtrate: [String, Object, Array],
78
+ filtrateKey: {
79
+ type: String,
80
+ default: 'pid'
81
+ },
82
+ readonly: Boolean,
83
+ separator: {
84
+ type: String,
85
+ default: '-'
86
+ },
87
+ symbol: {
88
+ type: String,
89
+ default: ','
90
+ },
91
+ plain: Boolean,
92
+ where: Object,
93
+ parseData: Function,
94
+ disabled: Boolean,
95
+ // 是否下拉树选择
96
+ tree: {
97
+ type: [Boolean, Object],
98
+ default: false
99
+ },
100
+ // 父级是否可选
101
+ parentCheck: {
102
+ type: Boolean,
103
+ default: true
104
+ },
105
+ // 父级可选时父级是否作为单独的值
106
+ parentAsValue: {
107
+ type: Boolean,
108
+ default: true
109
+ },
110
+ group: Boolean,
111
+ multiple: Boolean,
112
+ defaultValue: Boolean,
113
+ onExpand: Function,
114
+ onLoadsub: Function,
115
+ subParamKey: Object,
116
+ lazy: Boolean,
117
+ //是否请求代码表
118
+ ajax: {
119
+ type: Boolean,
120
+ default: true
121
+ },
122
+ isNoParamRequest: {
123
+ type: Boolean,
124
+ default: true
125
+ },
126
+ dataKey: String
127
+ },
128
+ data() {
129
+ return {
130
+ loading: false,
131
+ options: '',
132
+ valKey: this.valueKey,
133
+ label: this.labelKey,
134
+ hidden: false,
135
+ canceled: false
136
+ };
137
+ },
138
+ computed: {
139
+ isObject() {
140
+ if (this.valueType === 'object') {
141
+ return true;
142
+ }
143
+ if (
144
+ util.isObject(this.value) ||
145
+ (this.value && this.value[0] && util.isObject(this.value[0]))
146
+ ) {
147
+ return true;
148
+ }
149
+ return false;
150
+ },
151
+ isRemote() {
152
+ return new Boolean(this.remote);
153
+ },
154
+ results() {
155
+ if (this.options.length) {
156
+ return this.options;
157
+ }
158
+ if (this.filtrate) {
159
+ if (Array.isArray(this.filtrate) && this.filtrate.length) {
160
+ let ary = [];
161
+ this.filtrate.forEach((items) => {
162
+ let val = typeof items === 'string' ? items : items[this.valKey];
163
+ ary = ary.concat(
164
+ this.data.filter((item) => {
165
+ return item[this.filtrateKey] == val;
166
+ })
167
+ );
168
+ });
169
+ return ary;
170
+ } else {
171
+ let val =
172
+ typeof this.filtrate === 'string'
173
+ ? this.filtrate
174
+ : this.filtrate[this.valKey];
175
+ return this.data.filter((item) => {
176
+ return item[this.filtrateKey] == val;
177
+ });
178
+ }
179
+ }
180
+ return this.data;
181
+ },
182
+ models: {
183
+ get() {
184
+ return this.value;
185
+ },
186
+ set(val) {
187
+ return val;
188
+ }
189
+ },
190
+ findCode() {
191
+ if (this.service) {
192
+ return `/${this.service}${getDictList}`;
193
+ }
194
+ return findSysCode;
195
+ }
196
+ },
197
+ watch: {
198
+ sysCode: {
199
+ immediate: true,
200
+ handler(val, old) {
201
+ if (val && val !== old) {
202
+ this.label = this.service ? 'label' : 'shortName';
203
+ this.valKey = this.service ? 'value' : 'cciValue';
204
+ const options = store.get(val);
205
+ if (options) {
206
+ this.options = JSON.parse(JSON.stringify(options));
207
+ } else {
208
+ this.getData(val);
209
+ }
210
+ }
211
+ }
212
+ },
213
+ url: {
214
+ immediate: true,
215
+ handler(val, old) {
216
+ if (val && old !== val && !this.sysCode) {
217
+ this.getData(this.sysCode);
218
+ }
219
+ }
220
+ },
221
+ param: {
222
+ deep: true,
223
+ handler(val, old) {
224
+ if (this.url && JSON.stringify(val) !== JSON.stringify(old)) {
225
+ this.options = [];
226
+ this.getData(this.sysCode);
227
+ }
228
+ }
229
+ }
230
+ },
231
+ beforeCreate() {
232
+ this.getData = debounce(500, (sysCode, param, reload) => {
233
+ this.getDatas(sysCode, param, reload);
234
+ });
235
+ },
236
+ created() {
237
+ this.bindEventBus();
238
+ },
239
+ mounted() {},
240
+ methods: {
241
+ createOption({ filtrate, data, readonly = false, h }) {
242
+ let filte =
243
+ filtrate && util.isObject(filtrate) ? filtrate[this.valKey] : filtrate;
244
+ let eles = [];
245
+ data.forEach((item) => {
246
+ if (this.models === undefined && item.selected) {
247
+ this.$emit(
248
+ 'input',
249
+ this.valueType === 'object' ? item : item[this.valKey]
250
+ );
251
+ }
252
+ if (
253
+ (Object.prototype.hasOwnProperty.call(item, 'children') ||
254
+ Object.prototype.hasOwnProperty.call(item, 'options')) &&
255
+ (item.children || item.options)
256
+ ) {
257
+ const children = item.children || item.options;
258
+ if (readonly) {
259
+ eles.push(
260
+ this.createOption({ filtrate, data: children, readonly, h })
261
+ );
262
+ } else {
263
+ eles.push(
264
+ h(
265
+ 'el-option-group',
266
+ { attrs: { label: item[this.label] || item.label } },
267
+ this.createOption({ filtrate, data: children, readonly, h })
268
+ )
269
+ );
270
+ }
271
+ } else {
272
+ if (readonly) {
273
+ if (item[this.valKey] === filte) {
274
+ eles.push(item[this.label] || item.label);
275
+ }
276
+ } else {
277
+ if (
278
+ filte === null ||
279
+ filte === undefined ||
280
+ filte === '' ||
281
+ filte === item[this.filtrateKey]
282
+ ) {
283
+ if (typeof item === 'string') {
284
+ eles.push(
285
+ h('el-option', {
286
+ attrs: {
287
+ label: item,
288
+ value: item
289
+ }
290
+ })
291
+ );
292
+ } else {
293
+ let content = [item[this.label] || item.label];
294
+ if (item.render) {
295
+ content = [item.render(h, item)];
296
+ }
297
+ if (item.tips) {
298
+ let attrs =
299
+ typeof item.tips == 'string'
300
+ ? { content: item.tips }
301
+ : item.tips;
302
+ content.push(
303
+ h('es-tips', {
304
+ attrs: attrs
305
+ })
306
+ );
307
+ }
308
+ eles.push(
309
+ h(
310
+ 'el-option',
311
+ {
312
+ attrs: {
313
+ label: item[this.label] || item.label,
314
+ value: this.isObject ? item : item[this.valKey],
315
+ disabled: item.disabled
316
+ }
317
+ },
318
+ content
319
+ )
320
+ );
321
+ }
322
+ }
323
+ }
324
+ }
325
+ });
326
+ return eles;
327
+ },
328
+ getDatas(sysCode, param, reload) {
329
+ if (
330
+ !reload &&
331
+ (!this.ajax ||
332
+ (!this.isNoParamRequest && Object.keys(this.param).length == 0))
333
+ ) {
334
+ return false;
335
+ }
336
+ let params = {};
337
+ if (this.results.length === 0 || reload) {
338
+ params = util.extend(
339
+ {},
340
+ this.param,
341
+ sysCode ? { sysAppCode: sysCode, code: sysCode } : {},
342
+ param ? param : {}
343
+ );
344
+ } else {
345
+ return false;
346
+ }
347
+ if (!sysCode && !this.url) {
348
+ return false;
349
+ }
350
+ this.loading = true;
351
+ util
352
+ .ajax({
353
+ url: sysCode ? this.findCode : this.url,
354
+ method: this.method,
355
+ params: params,
356
+ data: params
357
+ })
358
+ .then((res) => {
359
+ this.loading = false;
360
+ this.canceled = false;
361
+ if (res.rCode === 0) {
362
+ if (this.parseData) {
363
+ this.options = this.parseData(
364
+ JSON.parse(JSON.stringify(res.results))
365
+ );
366
+ } else {
367
+ this.options = JSON.parse(JSON.stringify(res.results));
368
+ }
369
+ if (sysCode || this.dataKey) {
370
+ const bus = this.bus || this.$root.Bus;
371
+ bus &&
372
+ bus.$emit(
373
+ sysCode || this.dataKey,
374
+ JSON.parse(JSON.stringify(this.options))
375
+ );
376
+ store.set(sysCode, JSON.parse(JSON.stringify(this.options)));
377
+ }
378
+ } else {
379
+ this.$message.error(res.msg);
380
+ }
381
+ })
382
+ .catch((err) => {
383
+ this.loading = false;
384
+ if (err.message) {
385
+ if (err.message !== 'canceled') {
386
+ this.$message.error(err.message);
387
+ }
388
+ if (err.message === 'canceled' && sysCode) {
389
+ this.canceled = true;
390
+ }
391
+ }
392
+ });
393
+ },
394
+ search(query) {
395
+ if (query && query !== '') {
396
+ if (this.url && this.url !== '') {
397
+ this.loading = true;
398
+ let params = {};
399
+ params[this.remoteKey] = query;
400
+ params = util.extend({}, this.param, params);
401
+ util
402
+ .ajax({
403
+ url: this.url,
404
+ method: this.method,
405
+ params: params,
406
+ data: params
407
+ })
408
+ .then((res) => {
409
+ this.loading = false;
410
+ if (res.rCode === 0) {
411
+ this.options = JSON.parse(JSON.stringify(res.results));
412
+ }
413
+ })
414
+ .catch((err) => {
415
+ this.loading = false;
416
+ if (err.message && err.message !== 'canceled') {
417
+ this.$message.error(err.message);
418
+ }
419
+ });
420
+ } else {
421
+ this.options = [];
422
+ }
423
+ } else {
424
+ this.options = this.data;
425
+ }
426
+ },
427
+ renderd(doms, h, type) {
428
+ if (typeof this.$attrs[type] === 'boolean') {
429
+ if (this.$attrs.render) {
430
+ if (typeof this.$attrs.render == 'string') {
431
+ try {
432
+ doms.push(
433
+ h(
434
+ 'template',
435
+ { slot: type },
436
+ util.toFunction(this.$attrs.render)(h, this)
437
+ )
438
+ );
439
+ } catch (error) {
440
+ throw error;
441
+ }
442
+ } else {
443
+ doms.push(
444
+ h('template', { slot: type }, this.$attrs.render(h, this))
445
+ );
446
+ }
447
+ }
448
+ } else if (typeof this.$attrs[type] === 'object') {
449
+ doms.push(
450
+ h(
451
+ 'es-button',
452
+ {
453
+ slot: type,
454
+ class: ['el-primeval', this.$attrs[type].class],
455
+ props: {
456
+ ...this.$attrs[type].props,
457
+ size: this.$attrs[type].size
458
+ ? this.$attrs[type].size
459
+ : type === 'prefix' || type === 'suffix'
460
+ ? 'small'
461
+ : '',
462
+ type: 'primary'
463
+ },
464
+ domProps: this.$attrs[type].icon
465
+ ? { innerHTML: this.$attrs[type].icon }
466
+ : {},
467
+ on: {
468
+ click: (e) => {
469
+ this.$attrs[type].click &&
470
+ this.$attrs[type].click(this, this.model);
471
+ this.$attrs[type].event &&
472
+ this.$attrs[type].event(this, this.model);
473
+ }
474
+ },
475
+ ref: 'selectBtn'
476
+ },
477
+ [this.$attrs[type].text]
478
+ )
479
+ );
480
+ } else {
481
+ doms.push(h('template', { slot: type }, [this.$attrs[type]]));
482
+ }
483
+ },
484
+ getLabel(value, data) {
485
+ if ((value || value === 0) && data) {
486
+ if (util.isObject(data)) {
487
+ if (value === data[this.valKey]) {
488
+ return data[this.label];
489
+ } else if (value === data[this.label]) {
490
+ return value;
491
+ } else if (
492
+ Object.prototype.hasOwnProperty.call(data, 'children') &&
493
+ data.children &&
494
+ data.children.length
495
+ ) {
496
+ let val = this.getLabel(value, data.children);
497
+ if (val) {
498
+ return val;
499
+ }
500
+ }
501
+ } else {
502
+ if (
503
+ typeof data === 'string' ||
504
+ (!data.length && !this.sysCode && !this.url)
505
+ ) {
506
+ return value;
507
+ }
508
+ if (Array.isArray(data) && data.length) {
509
+ for (let i = 0; i < data.length; i++) {
510
+ let val = this.getLabel(value, data[i]);
511
+ if (val) {
512
+ return val;
513
+ }
514
+ }
515
+ }
516
+ }
517
+ }
518
+ return '';
519
+ },
520
+ reload() {
521
+ this.getData(...arguments);
522
+ },
523
+ handleExpand(data, node) {
524
+ if (this.onExpand) {
525
+ this.onExpand(data, node);
526
+ } else {
527
+ if (this.lazy) {
528
+ this.loadsub(data, node);
529
+ }
530
+ this.$emit('node-expand', data, node);
531
+ }
532
+ },
533
+ //请求子节点数据
534
+ loadsub(data, node) {
535
+ if (data.state !== '' && (!data.children || data.children.length === 0)) {
536
+ let param = {};
537
+ if (this.subParamKey) {
538
+ for (let i in this.subParamKey) {
539
+ param[i] = data[this.subParamKey[i]];
540
+ }
541
+ } else {
542
+ param[this.valKey] = data[this.valKey];
543
+ }
544
+ let params = util.extend({}, this.param, this.where, param);
545
+ if (this.parseParams) {
546
+ params = this.parseParams({ data, params, node });
547
+ }
548
+ if (this.onLoadsub) {
549
+ this.onLoadsub({ data, params, node })
550
+ .then((res) => {
551
+ this.loading = false;
552
+ this.$set(data, 'children', JSON.parse(JSON.stringify(res)));
553
+ if (this.dataKey && this.esForm) {
554
+ this.esForm.setSysCodes(
555
+ this.dataKey,
556
+ JSON.parse(JSON.stringify(this.options))
557
+ );
558
+ }
559
+ })
560
+ .catch((e) => {
561
+ this.loading = false;
562
+ });
563
+ } else {
564
+ util
565
+ .ajax({
566
+ method: this.method,
567
+ url: this.url,
568
+ data: params,
569
+ params: params
570
+ })
571
+ .then((res) => {
572
+ if (res.rCode === 0) {
573
+ this.loading = false;
574
+ let results = JSON.parse(JSON.stringify(res.results));
575
+ if (Array.isArray(results)) {
576
+ if (data.id === results[0].id) {
577
+ this.$set(data, 'children', results[0].children);
578
+ } else {
579
+ this.$set(data, 'children', results);
580
+ }
581
+ } else if (data.id === results.id) {
582
+ this.$set(data, 'children', results.children);
583
+ } else {
584
+ console.error('tree数据格式错误');
585
+ }
586
+ if (this.dataKey && this.esForm) {
587
+ this.esForm.setSysCodes(
588
+ this.dataKey,
589
+ JSON.parse(JSON.stringify(this.options))
590
+ );
591
+ }
592
+ }
593
+ })
594
+ .catch((err) => {
595
+ this.loading = false;
596
+ if (err.message && err.message !== 'canceled') {
597
+ this.$message.error(err.message);
598
+ }
599
+ });
600
+ }
601
+ }
602
+ },
603
+ toggleMenu() {
604
+ this.$refs.elSelect.toggleMenu();
605
+ },
606
+ setOptions(val) {
607
+ this.options = val;
608
+ },
609
+ bindEventBus() {
610
+ const bus = this.bus || this.$root.Bus;
611
+ bus && bus.$on(this.sysCode || this.dataKey, this.setOptions);
612
+ },
613
+ unbindEventBus() {
614
+ const bus = this.bus || this.$root.Bus;
615
+ bus && bus.$off(this.sysCode || this.dataKey, this.setOptions);
616
+ }
617
+ },
618
+ beforeDestroy() {
619
+ this.unbindEventBus();
620
+ },
621
+ render(h) {
622
+ if (!this.hide) {
623
+ if (this.readonly) {
624
+ let dom = [];
625
+ if (Array.isArray(this.models)) {
626
+ dom = this.models.map((item) => {
627
+ if (util.isObject(item)) {
628
+ if (!item[this.label] && !item.label) {
629
+ return this.getLabel(value[this.valKey], data);
630
+ }
631
+ return item[this.label] || item.label;
632
+ }
633
+ return this.getLabel(item, this.results);
634
+ });
635
+ } else if (util.isObject(this.models)) {
636
+ if (!this.models[this.label] && !this.models.label) {
637
+ dom = [this.getLabel(this.models[this.valKey], this.results)];
638
+ } else {
639
+ dom = [this.models[this.label] || this.models.label];
640
+ }
641
+ } else {
642
+ dom = [this.getLabel(this.models, this.results)];
643
+ }
644
+ return h(
645
+ 'div',
646
+ {
647
+ class: [
648
+ {
649
+ 'es-plain': this.plain,
650
+ 'es-textarea__inner el-textarea__inner': this.multiple,
651
+ 'el-input__inner es-input__inner': !this.multiple
652
+ }
653
+ ]
654
+ },
655
+ [dom.join(this.symbol)]
656
+ );
657
+ }
658
+ let doms = [];
659
+ let cls = [];
660
+ if (this.results.length && !this.tree) {
661
+ if (this.filtrate && Array.isArray(this.filtrate)) {
662
+ doms = this.filtrate.map((item) => {
663
+ return h(
664
+ 'el-option-group',
665
+ {
666
+ attrs: {
667
+ label: item[this.label] || item.label,
668
+ key: item[this.valKey]
669
+ }
670
+ },
671
+ this.createOption({ filtrate: item, data: this.results, h })
672
+ );
673
+ });
674
+ } else {
675
+ doms = this.createOption({
676
+ filtrate: this.filtrate,
677
+ data: this.results,
678
+ h
679
+ });
680
+ }
681
+ }
682
+ let { prefix, suffix, prepend, append, ...attrs } = this.$attrs;
683
+ if (this.$slots.prefix) {
684
+ doms.push(h('template', { slot: 'prefix' }, this.$slots.prefix));
685
+ } else if (prefix) {
686
+ this.renderd(doms, h, 'prefix');
687
+ cls.push('es-select-button-prefix');
688
+ }
689
+ if (this.$slots.suffix) {
690
+ doms.push(h('template', { slot: 'suffix' }, this.$slots.suffix));
691
+ } else if (suffix) {
692
+ this.renderd(doms, h, 'suffix');
693
+ cls.push('es-select-button-suffix');
694
+ }
695
+ if (this.$slots.prepend) {
696
+ doms.push(h('template', { slot: 'prepend' }, this.$slots.prepend));
697
+ } else if (prepend) {
698
+ this.renderd(doms, h, 'prepend');
699
+ }
700
+ if (this.$slots.append) {
701
+ doms.push(h('template', { slot: 'append' }, this.$slots.append));
702
+ } else if (append) {
703
+ this.renderd(doms, h, 'append');
704
+ }
705
+ if (!this.models && this.results.length && this.defaultValue) {
706
+ if (this.valueType === 'object') {
707
+ this.models = this.results[0];
708
+ //this.$emit('input', this.results[0]);
709
+ } else {
710
+ this.models = this.results[0][this.valKey];
711
+ //this.$emit('input', this.results[0][this.valKey]);
712
+ }
713
+ this.$emit('change', this.results[0], 0);
714
+ }
715
+ return h(
716
+ 'el-select',
717
+ {
718
+ class: cls,
719
+ ref: 'elSelect',
720
+ directives: [
721
+ {
722
+ name: 'show',
723
+ value: this.display
724
+ }
725
+ ],
726
+ props: {
727
+ ...attrs,
728
+ multiple: this.multiple,
729
+ valueType: this.valueType,
730
+ valueKey: this.valKey,
731
+ labelKey: this.label,
732
+ loading: this.loading,
733
+ disabled: this.disabled,
734
+ tree:
735
+ typeof this.tree === 'boolean'
736
+ ? this.tree
737
+ : { ...this.tree, lazy: this.label },
738
+ data: this.results,
739
+ // 父级是否可选
740
+ parentCheck: this.parentCheck,
741
+ // 父级可选时父级是否作为单独的值
742
+ parentAsValue: this.parentAsValue,
743
+ value: this.models
744
+ },
745
+ attrs: {
746
+ remoteMethod: !this.remoteMethod ? this.search : this.remoteMethod,
747
+ remote: this.remote
748
+ },
749
+ on: {
750
+ ...this.$listeners,
751
+ 'node-expand': this.handleExpand
752
+ }
753
+ },
754
+ this.$slots.default ? this.$slots.default : doms
755
+ );
756
+ } else {
757
+ return '';
758
+ }
759
+ }
760
+ };
761
+ </script>