agilebuilder-ui 1.0.92 → 1.0.93-temp2
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/lib/super-ui.css +1 -1
- package/lib/super-ui.js +3338 -3377
- package/lib/super-ui.umd.cjs +47 -47
- package/package.json +1 -1
- package/packages/department-tree-inline/src/department-tree-service.js +20 -41
- package/packages/organization-input/src/organization-input.vue +493 -542
- package/packages/super-grid/src/apis.js +1 -1
- package/packages/super-grid/src/dynamic-input.vue +33 -21
- package/packages/super-grid/src/normal-column-content.vue +2 -0
- package/src/utils/util.js +154 -205
|
@@ -2,81 +2,79 @@
|
|
|
2
2
|
<span style="width: 100%">
|
|
3
3
|
<template v-if="disabled">
|
|
4
4
|
<el-input
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
5
|
+
:disabled="true"
|
|
6
|
+
:model-value="value"
|
|
7
|
+
:readonly="true"
|
|
8
|
+
:size="size"
|
|
9
|
+
type="text"
|
|
10
|
+
:placeholder="$t('imatrixUIMessage.pleaseSelect')"
|
|
11
11
|
>
|
|
12
12
|
<template v-slot:append>
|
|
13
|
-
|
|
14
|
-
|
|
13
|
+
<el-icon v-slot:suffix class="el-input__icon"><el-icon-search /></el-icon>
|
|
14
|
+
<el-icon v-slot:suffix class="el-input__icon"><el-icon-delete /></el-icon>
|
|
15
15
|
</template>
|
|
16
16
|
</el-input>
|
|
17
17
|
</template>
|
|
18
18
|
<template v-else>
|
|
19
19
|
<el-input
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
20
|
+
:model-value="value"
|
|
21
|
+
:readonly="true"
|
|
22
|
+
:size="size"
|
|
23
|
+
type="text"
|
|
24
|
+
:placeholder="$t('imatrixUIMessage.pleaseSelect')"
|
|
25
|
+
@click="showOrganizationTree(false)"
|
|
26
|
+
@change="changeEvent"
|
|
27
27
|
>
|
|
28
28
|
<template v-slot:append>
|
|
29
|
-
<el-icon class="el-input__icon" @click="showOrganizationTree(false)"><el-icon-search/></el-icon>
|
|
30
|
-
<el-icon class="el-input__icon" @click="emptyOrganizationResult()"><el-icon-delete/></el-icon>
|
|
29
|
+
<el-icon class="el-input__icon" @click="showOrganizationTree(false)"><el-icon-search /></el-icon>
|
|
30
|
+
<el-icon class="el-input__icon" @click="emptyOrganizationResult()"><el-icon-delete /></el-icon>
|
|
31
31
|
</template>
|
|
32
32
|
</el-input>
|
|
33
33
|
</template>
|
|
34
|
-
|
|
34
|
+
<!-- 部门人员树 -->
|
|
35
35
|
<department-user-tree
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
36
|
+
v-if="treeType && treeType === 'DeptUserTree' && showOrganizationTreeFlag"
|
|
37
|
+
:department-info="departmentInfo"
|
|
38
|
+
:multiple="typeof multiple === 'undefined' ? false : multiple"
|
|
39
|
+
:search-field="searchField"
|
|
40
|
+
:select-user-info="selectOrganizationInfo"
|
|
41
|
+
:separator="separator"
|
|
42
|
+
@close="closeOrganizationTree"
|
|
43
43
|
/>
|
|
44
|
-
|
|
44
|
+
<!-- 部门树 -->
|
|
45
45
|
<department-tree
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
"
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
width="30%"
|
|
55
|
-
@close="closeOrganizationTree"
|
|
46
|
+
v-if="treeType && treeType === 'DeptTree' && showOrganizationTreeFlag"
|
|
47
|
+
:check-strictly="typeof checkStrictly === 'undefined' ? false : checkStrictly"
|
|
48
|
+
:multiple="typeof multiple === 'undefined' ? false : multiple"
|
|
49
|
+
:search-field="searchField"
|
|
50
|
+
:select-department-info="selectOrganizationInfo"
|
|
51
|
+
:separator="separator"
|
|
52
|
+
width="30%"
|
|
53
|
+
@close="closeOrganizationTree"
|
|
56
54
|
/>
|
|
57
|
-
|
|
55
|
+
<!-- 工作组树 -->
|
|
58
56
|
<workgroup-tree
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
57
|
+
v-if="treeType && treeType === 'WgTree' && showOrganizationTreeFlag"
|
|
58
|
+
:multiple="typeof multiple === 'undefined' ? false : multiple"
|
|
59
|
+
:branch-info="departmentInfo"
|
|
60
|
+
:search-field="searchField"
|
|
61
|
+
:select-workgroup-info="selectOrganizationInfo"
|
|
62
|
+
:separator="separator"
|
|
63
|
+
width="30%"
|
|
64
|
+
@close="closeOrganizationTree"
|
|
67
65
|
/>
|
|
68
|
-
|
|
66
|
+
<!-- 工作组人员树 -->
|
|
69
67
|
<workgroup-user-tree
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
68
|
+
v-if="treeType && treeType === 'WgUserTree' && showOrganizationTreeFlag"
|
|
69
|
+
:branch-info="departmentInfo"
|
|
70
|
+
:multiple="typeof multiple === 'undefined' ? false : multiple"
|
|
71
|
+
:search-field="searchField"
|
|
72
|
+
:select-user-info="selectOrganizationInfo"
|
|
73
|
+
:separator="separator"
|
|
74
|
+
width="30%"
|
|
75
|
+
@close="closeOrganizationTree"
|
|
78
76
|
/>
|
|
79
|
-
|
|
77
|
+
<!-- <remove-user
|
|
80
78
|
v-if="treeType && (treeType === 'DeptUserTree' || treeType === 'WgUserTree') && showRemoveComponent"
|
|
81
79
|
:select-user-info="selectOrganizationInfo"
|
|
82
80
|
:search-field="searchField"
|
|
@@ -90,7 +88,7 @@
|
|
|
90
88
|
:separator="separator"
|
|
91
89
|
@close="closeRemoveComponent"
|
|
92
90
|
/> -->
|
|
93
|
-
|
|
91
|
+
<!-- <remove-workgroup
|
|
94
92
|
v-if="treeType && treeType === 'WgTree' && showRemoveComponent"
|
|
95
93
|
:select-workgroup-info="selectOrganizationInfo"
|
|
96
94
|
:search-field="searchField"
|
|
@@ -101,494 +99,447 @@
|
|
|
101
99
|
</template>
|
|
102
100
|
|
|
103
101
|
<script>
|
|
104
|
-
import {Delete as ElIconDelete, Search as ElIconSearch
|
|
102
|
+
import { Delete as ElIconDelete, Search as ElIconSearch } from '@element-plus/icons-vue'
|
|
105
103
|
// import Vue from 'vue'
|
|
106
|
-
import {getPropNameWhenJoinTable, setEntityFieldValue
|
|
104
|
+
import { getPropNameWhenJoinTable, setEntityFieldValue } from '../../../src/utils/util'
|
|
107
105
|
|
|
108
106
|
export default {
|
|
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
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
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
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
console.log('this.value', this.models)
|
|
547
|
-
// 调用setValue事件
|
|
548
|
-
this.$emit('setValue', model, finallyOrgResult)
|
|
549
|
-
if (
|
|
550
|
-
finallyOrgResult === undefined ||
|
|
551
|
-
finallyOrgResult === null ||
|
|
552
|
-
finallyOrgResult === ''
|
|
553
|
-
) {
|
|
554
|
-
this.$emit( 'clear', model)
|
|
555
|
-
}
|
|
556
|
-
}
|
|
557
|
-
},
|
|
558
|
-
getParentObject(prop, models) {
|
|
559
|
-
const nestedProp = prop.split('.')
|
|
560
|
-
// 属性只有一个时父对象就是models
|
|
561
|
-
if (nestedProp.length === 1) {
|
|
562
|
-
return models
|
|
563
|
-
} else {
|
|
564
|
-
let parentObject
|
|
565
|
-
// 属性超过2个时先找到最后一层属性的父对象
|
|
566
|
-
for (let i = 0; i < nestedProp.length - 1; i++) {
|
|
567
|
-
if (i === 0) {
|
|
568
|
-
parentObject = this.getParentModelProp(nestedProp[i], models)
|
|
569
|
-
} else {
|
|
570
|
-
parentObject = this.getParentModelProp(nestedProp[i], parentObject)
|
|
571
|
-
}
|
|
572
|
-
}
|
|
573
|
-
return parentObject
|
|
574
|
-
}
|
|
575
|
-
},
|
|
576
|
-
getParentModelProp(prop, parentObj) {
|
|
577
|
-
if (!parentObj) {
|
|
578
|
-
parentObj = {}
|
|
579
|
-
}
|
|
580
|
-
if (!parentObj[prop]) {
|
|
581
|
-
parentObj[prop] = {}
|
|
582
|
-
}
|
|
583
|
-
return parentObj[prop]
|
|
584
|
-
},
|
|
585
|
-
},
|
|
586
|
-
emits: [
|
|
587
|
-
'replace',
|
|
588
|
-
'setValue',
|
|
589
|
-
'clear',
|
|
590
|
-
'focus',
|
|
591
|
-
'update:value',
|
|
592
|
-
],
|
|
107
|
+
components: {
|
|
108
|
+
ElIconSearch,
|
|
109
|
+
ElIconDelete
|
|
110
|
+
},
|
|
111
|
+
name: 'OrganizationInput',
|
|
112
|
+
model: {
|
|
113
|
+
prop: 'value',
|
|
114
|
+
event: 'input'
|
|
115
|
+
},
|
|
116
|
+
props: {
|
|
117
|
+
value: {
|
|
118
|
+
type: String,
|
|
119
|
+
default: ''
|
|
120
|
+
},
|
|
121
|
+
// 是否多选
|
|
122
|
+
multiple: {
|
|
123
|
+
type: Boolean,
|
|
124
|
+
default: false
|
|
125
|
+
},
|
|
126
|
+
// 是否 “不选中” 子部门
|
|
127
|
+
checkStrictly: {
|
|
128
|
+
type: Boolean,
|
|
129
|
+
default: false
|
|
130
|
+
},
|
|
131
|
+
// 树类型 部门人员树DeptUserTree、部门树DeptTree、工作组树WgTree、工作组人员树WgUserTree
|
|
132
|
+
treeType: {
|
|
133
|
+
type: String,
|
|
134
|
+
default: 'DeptUserTree'
|
|
135
|
+
},
|
|
136
|
+
// 是否禁用
|
|
137
|
+
disabled: {
|
|
138
|
+
type: Boolean,
|
|
139
|
+
default: false
|
|
140
|
+
},
|
|
141
|
+
// 字段与组织结构对应信息集合,格式为:[{type:'loginName',model:'字段名'}]
|
|
142
|
+
// 人员树时,type的可选值有:id、name、loginName、email、telephone、mainDeptName、mainDeptId、subCompanyName、subCompanyId
|
|
143
|
+
// 部门/工作组树时:type的可选值有:id、name、code
|
|
144
|
+
fields: {
|
|
145
|
+
type: Array,
|
|
146
|
+
default: null
|
|
147
|
+
},
|
|
148
|
+
// 当前表单数据信息
|
|
149
|
+
models: {
|
|
150
|
+
type: Object,
|
|
151
|
+
default: null
|
|
152
|
+
},
|
|
153
|
+
// 文本框大小large/medium/small/mini
|
|
154
|
+
size: {
|
|
155
|
+
type: String,
|
|
156
|
+
default: ''
|
|
157
|
+
},
|
|
158
|
+
// 列表组件行编辑使用,sql查询时数据表名称,用于自定义系统中列表组件中字段多表查询带有别名时,将点"."改成两个下划线"__"时使用
|
|
159
|
+
tableName: {
|
|
160
|
+
type: String,
|
|
161
|
+
default: null
|
|
162
|
+
},
|
|
163
|
+
// 列表组件行编辑使用,是否是关联表,用于确定属性名是否需要拼接tableName
|
|
164
|
+
isJoinTable: {
|
|
165
|
+
type: Boolean,
|
|
166
|
+
default: false
|
|
167
|
+
},
|
|
168
|
+
// 指定部门或者工作组
|
|
169
|
+
departmentInfo: {
|
|
170
|
+
type: Array,
|
|
171
|
+
default: null
|
|
172
|
+
},
|
|
173
|
+
// 多选树时结果之间的分隔符,默认是逗号分隔
|
|
174
|
+
separator: {
|
|
175
|
+
type: String,
|
|
176
|
+
default: ','
|
|
177
|
+
},
|
|
178
|
+
// 是否打开树
|
|
179
|
+
openTree: {
|
|
180
|
+
type: Boolean,
|
|
181
|
+
default: true
|
|
182
|
+
}
|
|
183
|
+
},
|
|
184
|
+
data() {
|
|
185
|
+
return {
|
|
186
|
+
showOrganizationTreeFlag: false, // 选择组织树所用
|
|
187
|
+
isAppendResult: false, // 是否添加用户、部门、工作组,默认是替换,false表示替换选择的结果,true表示追加选择的结果
|
|
188
|
+
showRemoveComponent: false, // 实现显示移除用户、部门、工作组组件
|
|
189
|
+
selectOrganizationInfo: null, // 已选择集合,多个信息之间以逗号隔开
|
|
190
|
+
searchField: null, // 已选的集合是什么内容,id、loginName(登录名)、name(用户名称/部门名称/工作组名称)、code(部门编码/工作组编码)、email(邮箱)、telephone(电话)等等
|
|
191
|
+
selectOrganizationAllInfo: {} // 选择的所有信息,{id:'xx',name:'xx',loginName:'xx',code:'xx',email:'xx',telephone:'xx'}
|
|
192
|
+
}
|
|
193
|
+
},
|
|
194
|
+
created() {},
|
|
195
|
+
methods: {
|
|
196
|
+
// change事件
|
|
197
|
+
changeEvent(value) {
|
|
198
|
+
this.$emit('change', value)
|
|
199
|
+
},
|
|
200
|
+
// 打开组织树
|
|
201
|
+
showOrganizationTree() {
|
|
202
|
+
if (this.openTree) {
|
|
203
|
+
let isMulti = this.multiple
|
|
204
|
+
if (typeof isMulti === 'undefined') {
|
|
205
|
+
isMulti = false
|
|
206
|
+
}
|
|
207
|
+
if (isMulti === true) {
|
|
208
|
+
// 多选时才需要显示结果集合
|
|
209
|
+
this.getSelectInfo()
|
|
210
|
+
}
|
|
211
|
+
this.$emit('focus')
|
|
212
|
+
this.showOrganizationTreeFlag = true
|
|
213
|
+
this.$emit('show-tree')
|
|
214
|
+
}
|
|
215
|
+
},
|
|
216
|
+
getPropName(prop, isJoinTable, tableName) {
|
|
217
|
+
return getPropNameWhenJoinTable(prop, isJoinTable, tableName)
|
|
218
|
+
},
|
|
219
|
+
// 清空已选的结果
|
|
220
|
+
emptyOrganizationResult() {
|
|
221
|
+
const orgFields = this.fields
|
|
222
|
+
if (orgFields && orgFields.length > 0) {
|
|
223
|
+
orgFields.forEach((orgField) => {
|
|
224
|
+
// orgDataType的值:
|
|
225
|
+
// 人员时:id、name、loginName、email、telephone
|
|
226
|
+
// 部门或工作组时:id、name
|
|
227
|
+
const model = this.getPropName(orgField.model)
|
|
228
|
+
this.setValue(model, null)
|
|
229
|
+
})
|
|
230
|
+
this.selectOrganizationAllInfo = {}
|
|
231
|
+
this.selectOrganizationInfo = null
|
|
232
|
+
this.searchField = null
|
|
233
|
+
}
|
|
234
|
+
},
|
|
235
|
+
// 关闭组织树
|
|
236
|
+
closeOrganizationTree(selectNodeInfo) {
|
|
237
|
+
if (selectNodeInfo) {
|
|
238
|
+
// 是否是多选树
|
|
239
|
+
this.setOrganizationData(selectNodeInfo)
|
|
240
|
+
}
|
|
241
|
+
this.showOrganizationTreeFlag = false
|
|
242
|
+
},
|
|
243
|
+
setOrganizationData(orgData, isRemove, removeItems) {
|
|
244
|
+
let isMulti = this.multiple
|
|
245
|
+
if (typeof isMulti === 'undefined') {
|
|
246
|
+
isMulti = false
|
|
247
|
+
}
|
|
248
|
+
const treeType = this.treeType
|
|
249
|
+
const orgFields = this.fields
|
|
250
|
+
if (orgFields && orgFields.length > 0) {
|
|
251
|
+
orgFields.forEach((orgField) => {
|
|
252
|
+
// orgDataType的值:
|
|
253
|
+
// 人员时:id、name、loginName、email、telephone
|
|
254
|
+
// 部门或工作组时:id、name、code
|
|
255
|
+
const orgDataType = orgField.type
|
|
256
|
+
const orgSelectData = this.getOrgSelectData(orgDataType, orgData, this.isUserTree(treeType), isMulti)
|
|
257
|
+
const model = this.getPropName(orgField.model)
|
|
258
|
+
this.getOrgDataModel(model, orgSelectData, isMulti, orgDataType, isRemove, removeItems)
|
|
259
|
+
})
|
|
260
|
+
}
|
|
261
|
+
},
|
|
262
|
+
/**
|
|
263
|
+
* @param orgDataType 字段属性:id、name、loginName、code、email、telephone
|
|
264
|
+
*/
|
|
265
|
+
getOrgDataModel(model, orgSelectData, isMulti, orgDataType, isRemove, removeItems) {
|
|
266
|
+
if (isMulti) {
|
|
267
|
+
// 表示是替换或添加操作
|
|
268
|
+
const orgResult = this.getModelValue(model)
|
|
269
|
+
// 表示替换结果
|
|
270
|
+
this.selectOrganizationAllInfo[orgDataType] = orgSelectData
|
|
271
|
+
this.setValue(model, orgSelectData)
|
|
272
|
+
// 参数分别为:属性名、原来的值、新替换的值
|
|
273
|
+
this.$emit('replace', model, orgResult, orgSelectData)
|
|
274
|
+
} else {
|
|
275
|
+
this.setValue(model, orgSelectData)
|
|
276
|
+
}
|
|
277
|
+
},
|
|
278
|
+
getModelValue(model) {
|
|
279
|
+
let modelValue = ''
|
|
280
|
+
if (this.isJoinTable === false && model && model.indexOf('.') > 0) {
|
|
281
|
+
const parentObj = this.getParentObject(model, this.models)
|
|
282
|
+
modelValue = parentObj[model.substring(model.lastIndexOf('.') + 1)]
|
|
283
|
+
} else {
|
|
284
|
+
model = this.getPropName(model)
|
|
285
|
+
modelValue = this.models[model]
|
|
286
|
+
}
|
|
287
|
+
return modelValue
|
|
288
|
+
},
|
|
289
|
+
// 是否是人员树
|
|
290
|
+
isUserTree(treeType) {
|
|
291
|
+
return treeType === 'DeptUserTree' || treeType === 'WgUserTree'
|
|
292
|
+
},
|
|
293
|
+
// 获得组织树选择的结果
|
|
294
|
+
getOrgSelectData(orgDataType, selectNodeInfo, isUserTree, isMulti) {
|
|
295
|
+
if (isMulti === true) {
|
|
296
|
+
// 多选树时
|
|
297
|
+
if (orgDataType === 'id') {
|
|
298
|
+
if (isUserTree) {
|
|
299
|
+
return selectNodeInfo.userIds.join(this.separator)
|
|
300
|
+
} else {
|
|
301
|
+
return selectNodeInfo.ids.join(this.separator)
|
|
302
|
+
}
|
|
303
|
+
} else if (orgDataType === 'name') {
|
|
304
|
+
if (isUserTree) {
|
|
305
|
+
return selectNodeInfo.userNames.join(this.separator)
|
|
306
|
+
} else {
|
|
307
|
+
return selectNodeInfo.names.join(this.separator)
|
|
308
|
+
}
|
|
309
|
+
} else if (orgDataType === 'code') {
|
|
310
|
+
if (!isUserTree) {
|
|
311
|
+
return selectNodeInfo.codes.join(this.separator)
|
|
312
|
+
}
|
|
313
|
+
} else if (orgDataType === 'loginName') {
|
|
314
|
+
return selectNodeInfo.loginNames.join(this.separator)
|
|
315
|
+
} else if (orgDataType === 'email') {
|
|
316
|
+
return selectNodeInfo.emails.join(this.separator)
|
|
317
|
+
} else if (orgDataType === 'telephone') {
|
|
318
|
+
return selectNodeInfo.telephones.join(this.separator)
|
|
319
|
+
} else if (orgDataType === 'mainDeptName') {
|
|
320
|
+
// 正职部门名称
|
|
321
|
+
const mainDeptNames = []
|
|
322
|
+
if (isUserTree) {
|
|
323
|
+
const users = selectNodeInfo.users
|
|
324
|
+
if (users) {
|
|
325
|
+
users.forEach((user) => {
|
|
326
|
+
mainDeptNames.push(user.mainDepartmentName)
|
|
327
|
+
})
|
|
328
|
+
}
|
|
329
|
+
}
|
|
330
|
+
return mainDeptNames.join(this.separator)
|
|
331
|
+
} else if (orgDataType === 'mainDeptId') {
|
|
332
|
+
// 正职部门id
|
|
333
|
+
const mainDeptIds = []
|
|
334
|
+
if (isUserTree) {
|
|
335
|
+
const users = selectNodeInfo.users
|
|
336
|
+
if (users) {
|
|
337
|
+
users.forEach((user) => {
|
|
338
|
+
if (user.mainDepartmentId) {
|
|
339
|
+
mainDeptIds.push(user.mainDepartmentId)
|
|
340
|
+
}
|
|
341
|
+
})
|
|
342
|
+
}
|
|
343
|
+
}
|
|
344
|
+
return mainDeptIds.join(this.separator)
|
|
345
|
+
} else if (orgDataType === 'mainDeptCode') {
|
|
346
|
+
// 正职部门code
|
|
347
|
+
const mainDeptCodes = []
|
|
348
|
+
if (isUserTree) {
|
|
349
|
+
const users = selectNodeInfo.users
|
|
350
|
+
if (users) {
|
|
351
|
+
users.forEach((user) => {
|
|
352
|
+
if (user.mainDepartmentCode) {
|
|
353
|
+
mainDeptCodes.push(user.mainDepartmentCode)
|
|
354
|
+
}
|
|
355
|
+
})
|
|
356
|
+
}
|
|
357
|
+
}
|
|
358
|
+
return mainDeptCodes.join(this.separator)
|
|
359
|
+
} else if (orgDataType === 'subCompanyName') {
|
|
360
|
+
// 分支名称
|
|
361
|
+
const branchNames = []
|
|
362
|
+
if (isUserTree) {
|
|
363
|
+
const users = selectNodeInfo.users
|
|
364
|
+
if (users) {
|
|
365
|
+
users.forEach((user) => {
|
|
366
|
+
if (user.subCompanyName) {
|
|
367
|
+
branchNames.push(user.subCompanyName)
|
|
368
|
+
}
|
|
369
|
+
})
|
|
370
|
+
}
|
|
371
|
+
}
|
|
372
|
+
return branchNames.join(this.separator)
|
|
373
|
+
} else if (orgDataType === 'subCompanyId') {
|
|
374
|
+
// 分支id
|
|
375
|
+
const branchDeptIds = []
|
|
376
|
+
if (isUserTree) {
|
|
377
|
+
const users = selectNodeInfo.users
|
|
378
|
+
if (users) {
|
|
379
|
+
users.forEach((user) => {
|
|
380
|
+
if (user.subCompanyId) {
|
|
381
|
+
branchDeptIds.push(user.subCompanyId)
|
|
382
|
+
}
|
|
383
|
+
})
|
|
384
|
+
}
|
|
385
|
+
}
|
|
386
|
+
return branchDeptIds.join(this.separator)
|
|
387
|
+
}
|
|
388
|
+
} else {
|
|
389
|
+
// 单选树时
|
|
390
|
+
if (orgDataType === 'mainDeptName') {
|
|
391
|
+
// 正职部门名称
|
|
392
|
+
let mainDeptName = null
|
|
393
|
+
if (isUserTree) {
|
|
394
|
+
const user = selectNodeInfo.user
|
|
395
|
+
if (user) {
|
|
396
|
+
mainDeptName = user.mainDepartmentName
|
|
397
|
+
}
|
|
398
|
+
}
|
|
399
|
+
return mainDeptName
|
|
400
|
+
} else if (orgDataType === 'mainDeptId') {
|
|
401
|
+
// 正职部门id
|
|
402
|
+
let mainDeptId = null
|
|
403
|
+
if (isUserTree) {
|
|
404
|
+
const user = selectNodeInfo.user
|
|
405
|
+
if (user) {
|
|
406
|
+
mainDeptId = user.mainDepartmentId
|
|
407
|
+
}
|
|
408
|
+
}
|
|
409
|
+
return mainDeptId
|
|
410
|
+
} else if (orgDataType === 'mainDeptCode') {
|
|
411
|
+
// 正职部门code
|
|
412
|
+
let mainDeptCode = null
|
|
413
|
+
if (isUserTree) {
|
|
414
|
+
const user = selectNodeInfo.user
|
|
415
|
+
if (user) {
|
|
416
|
+
mainDeptCode = user.mainDepartmentCode
|
|
417
|
+
}
|
|
418
|
+
}
|
|
419
|
+
return mainDeptCode
|
|
420
|
+
} else if (orgDataType === 'subCompanyName') {
|
|
421
|
+
// 分支名称
|
|
422
|
+
let branchName = null
|
|
423
|
+
if (isUserTree) {
|
|
424
|
+
const user = selectNodeInfo.user
|
|
425
|
+
if (user) {
|
|
426
|
+
branchName = user.subCompanyName
|
|
427
|
+
}
|
|
428
|
+
}
|
|
429
|
+
return branchName
|
|
430
|
+
} else if (orgDataType === 'subCompanyId') {
|
|
431
|
+
// 分支id
|
|
432
|
+
let branchId = null
|
|
433
|
+
if (isUserTree) {
|
|
434
|
+
const user = selectNodeInfo.user
|
|
435
|
+
if (user) {
|
|
436
|
+
branchId = user.subCompanyId
|
|
437
|
+
}
|
|
438
|
+
}
|
|
439
|
+
return branchId
|
|
440
|
+
} else {
|
|
441
|
+
return selectNodeInfo[orgDataType]
|
|
442
|
+
}
|
|
443
|
+
}
|
|
444
|
+
},
|
|
445
|
+
// 显示移除用户、部门、工作组组件
|
|
446
|
+
showMyRemoveComponent() {
|
|
447
|
+
this.getSelectInfo()
|
|
448
|
+
if (!this.selectOrganizationInfo || this.selectOrganizationInfo === null || this.selectOrganizationInfo === '') {
|
|
449
|
+
this.$message({
|
|
450
|
+
showClose: true,
|
|
451
|
+
type: 'warning',
|
|
452
|
+
message: this.$t('imatrixUIMessage.organizationTreeNoResultNotRemove')
|
|
453
|
+
})
|
|
454
|
+
} else {
|
|
455
|
+
this.showRemoveComponent = true
|
|
456
|
+
}
|
|
457
|
+
},
|
|
458
|
+
getSelectInfo() {
|
|
459
|
+
const searchFields = ['id', 'code', 'loginName', 'email', 'telephone', 'name']
|
|
460
|
+
const keys = Object.keys(this.selectOrganizationAllInfo)
|
|
461
|
+
if (keys.length === 0) {
|
|
462
|
+
// 表示是初始化时,从表单对象中获得信息
|
|
463
|
+
for (let i = 0; i < searchFields.length; i++) {
|
|
464
|
+
const prop = searchFields[i]
|
|
465
|
+
const fieldSettings = this.fields.filter((field) => {
|
|
466
|
+
return field.type === prop
|
|
467
|
+
})
|
|
468
|
+
if (fieldSettings && fieldSettings.length > 0) {
|
|
469
|
+
const fieldSetting = fieldSettings[0]
|
|
470
|
+
if (fieldSetting) {
|
|
471
|
+
const model = this.getPropName(fieldSetting.model)
|
|
472
|
+
const selectInfo = this.getModelValue(model)
|
|
473
|
+
if (selectInfo && selectInfo !== null && selectInfo !== '') {
|
|
474
|
+
this.selectOrganizationInfo = selectInfo
|
|
475
|
+
this.searchField = prop
|
|
476
|
+
break
|
|
477
|
+
}
|
|
478
|
+
}
|
|
479
|
+
}
|
|
480
|
+
}
|
|
481
|
+
} else {
|
|
482
|
+
// 表示是选择用户后
|
|
483
|
+
for (let i = 0; i < searchFields.length; i++) {
|
|
484
|
+
const prop = searchFields[i]
|
|
485
|
+
const selectInfo = this.selectOrganizationAllInfo[prop]
|
|
486
|
+
if (selectInfo && selectInfo !== null && selectInfo !== '') {
|
|
487
|
+
this.selectOrganizationInfo = selectInfo
|
|
488
|
+
this.searchField = prop
|
|
489
|
+
break
|
|
490
|
+
}
|
|
491
|
+
}
|
|
492
|
+
}
|
|
493
|
+
},
|
|
494
|
+
setValue(model, finallyOrgResult) {
|
|
495
|
+
if (this.models) {
|
|
496
|
+
if (this.isJoinTable === false && model && model.indexOf('.') > 0) {
|
|
497
|
+
const parentObj = this.getParentObject(model, this.models)
|
|
498
|
+
if (parentObj) {
|
|
499
|
+
setEntityFieldValue(parentObj, model.substring(model.lastIndexOf('.') + 1), finallyOrgResult)
|
|
500
|
+
// Vue.set(parentObj, model.substring(model.lastIndexOf('.') + 1), finallyOrgResult)
|
|
501
|
+
}
|
|
502
|
+
} else {
|
|
503
|
+
model = this.getPropName(model)
|
|
504
|
+
setEntityFieldValue(this.models, model, finallyOrgResult)
|
|
505
|
+
// Vue.set(this.models, model, finallyOrgResult)
|
|
506
|
+
}
|
|
507
|
+
console.log('this.value', this.models)
|
|
508
|
+
// 调用setValue事件
|
|
509
|
+
this.$emit('setValue', model, finallyOrgResult)
|
|
510
|
+
if (finallyOrgResult === undefined || finallyOrgResult === null || finallyOrgResult === '') {
|
|
511
|
+
this.$emit('clear', model)
|
|
512
|
+
}
|
|
513
|
+
}
|
|
514
|
+
},
|
|
515
|
+
getParentObject(prop, models) {
|
|
516
|
+
const nestedProp = prop.split('.')
|
|
517
|
+
// 属性只有一个时父对象就是models
|
|
518
|
+
if (nestedProp.length === 1) {
|
|
519
|
+
return models
|
|
520
|
+
} else {
|
|
521
|
+
let parentObject
|
|
522
|
+
// 属性超过2个时先找到最后一层属性的父对象
|
|
523
|
+
for (let i = 0; i < nestedProp.length - 1; i++) {
|
|
524
|
+
if (i === 0) {
|
|
525
|
+
parentObject = this.getParentModelProp(nestedProp[i], models)
|
|
526
|
+
} else {
|
|
527
|
+
parentObject = this.getParentModelProp(nestedProp[i], parentObject)
|
|
528
|
+
}
|
|
529
|
+
}
|
|
530
|
+
return parentObject
|
|
531
|
+
}
|
|
532
|
+
},
|
|
533
|
+
getParentModelProp(prop, parentObj) {
|
|
534
|
+
if (!parentObj) {
|
|
535
|
+
parentObj = {}
|
|
536
|
+
}
|
|
537
|
+
if (!parentObj[prop]) {
|
|
538
|
+
parentObj[prop] = {}
|
|
539
|
+
}
|
|
540
|
+
return parentObj[prop]
|
|
541
|
+
}
|
|
542
|
+
},
|
|
543
|
+
emits: ['replace', 'setValue', 'clear', 'focus', 'update:value', 'change']
|
|
593
544
|
}
|
|
594
545
|
</script>
|