three-trees-ui 1.0.1 → 1.0.2
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/three-trees-ui.common.js +469 -328
- package/lib/three-trees-ui.css +1 -1
- package/lib/three-trees-ui.umd.js +469 -328
- package/lib/three-trees-ui.umd.min.js +1 -1
- package/package.json +1 -1
- package/packages/CustomDialog/src/customDialog.vue +190 -131
- package/packages/CustomDialog/src/customMobileDialog.vue +166 -111
- package/packages/CustomDialog/src/main.vue +109 -5
package/package.json
CHANGED
|
@@ -328,6 +328,7 @@
|
|
|
328
328
|
type: Boolean,
|
|
329
329
|
default: false,
|
|
330
330
|
},
|
|
331
|
+
dialogConfig: Object,
|
|
331
332
|
},
|
|
332
333
|
data() {
|
|
333
334
|
return {
|
|
@@ -402,6 +403,19 @@
|
|
|
402
403
|
}
|
|
403
404
|
return []
|
|
404
405
|
},
|
|
406
|
+
jumpParamKey() {
|
|
407
|
+
return this.dialogConfig && this.dialogConfig.jumpParamKey
|
|
408
|
+
? this.dialogConfig.jumpParamKey
|
|
409
|
+
: ''
|
|
410
|
+
},
|
|
411
|
+
// 是否保存成跳转url参数
|
|
412
|
+
isHaveJumpUrl() {
|
|
413
|
+
return (
|
|
414
|
+
this.dialogConfig &&
|
|
415
|
+
((this.isMobile && this.dialogConfig.mobileUrl) ||
|
|
416
|
+
(!this.isMobile && this.dialogConfig.pcUrl))
|
|
417
|
+
)
|
|
418
|
+
},
|
|
405
419
|
},
|
|
406
420
|
watch: {
|
|
407
421
|
dialogData: {
|
|
@@ -440,142 +454,144 @@
|
|
|
440
454
|
},
|
|
441
455
|
methods: {
|
|
442
456
|
showDialog(isMounted = false) {
|
|
443
|
-
const this_ = this
|
|
444
457
|
this.fixedParams = {}
|
|
458
|
+
// 如果已存在配置信息就不去请求配置信息 直接初始化数据
|
|
459
|
+
if (this.dialogConfig) {
|
|
460
|
+
this.initDialog(this.dialogConfig, isMounted)
|
|
461
|
+
return
|
|
462
|
+
}
|
|
445
463
|
var alias = this.custdialog.custDialog.alias
|
|
446
464
|
this.$requestConfig
|
|
447
465
|
.getCustomDialogByAlias(alias)
|
|
448
466
|
.then((customDialog) => {
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
467
|
+
this.initDialog(customDialog, isMounted)
|
|
468
|
+
})
|
|
469
|
+
},
|
|
470
|
+
initDialog(customDialog, isMounted) {
|
|
471
|
+
let alias = this.custdialog.custDialog.alias
|
|
472
|
+
const this_ = this
|
|
473
|
+
if (!customDialog || !customDialog.alias) {
|
|
474
|
+
this.$message.error('对话框别名【' + alias + '】不存在!')
|
|
475
|
+
return
|
|
476
|
+
}
|
|
477
|
+
if (customDialog.style == 1) {
|
|
478
|
+
var displaylist = JSON.parse(customDialog.displayfield)
|
|
479
|
+
this_.nodeKey = displaylist.id
|
|
480
|
+
}
|
|
481
|
+
if (customDialog.needPage && customDialog.requestType === 'POST') {
|
|
482
|
+
let obj = {}
|
|
483
|
+
this.getLastKeyByPath(obj, customDialog.pageKey, 1)
|
|
484
|
+
this.getLastKeyByPath(obj, customDialog.pageSizeKey, 10)
|
|
485
|
+
this.getLastKeyByPath(obj, customDialog.totalKey, true)
|
|
486
|
+
const exp = utils.parseExp(customDialog.dataParam, obj, true)
|
|
487
|
+
if (exp) {
|
|
488
|
+
const params = JSON.parse(exp)
|
|
489
|
+
if (params.pageBean) {
|
|
490
|
+
this.pagination = {
|
|
491
|
+
...params.pageBean,
|
|
470
492
|
}
|
|
471
493
|
}
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
//取值对象为脚本时获取value
|
|
490
|
-
if (ele.bindType === 3) {
|
|
491
|
-
this_.$requestConfig.executeScript(ele.bind).then((res) => {
|
|
492
|
-
this_.executeScriptResult = res && res.value
|
|
493
|
-
})
|
|
494
|
-
}
|
|
495
|
-
})
|
|
494
|
+
}
|
|
495
|
+
}
|
|
496
|
+
//对话框按表单字段查询(参数传入的)
|
|
497
|
+
let bindList = this_.custdialog.custDialog.conditions
|
|
498
|
+
this_.param = [] //绑定的表单字段
|
|
499
|
+
if (bindList.length > 0) {
|
|
500
|
+
bindList.forEach((ele) => {
|
|
501
|
+
//绑定表单字段
|
|
502
|
+
if (
|
|
503
|
+
ele.bind &&
|
|
504
|
+
(ele.defaultType == '3' || ele.bind.startsWith('data.searchForm'))
|
|
505
|
+
) {
|
|
506
|
+
let obj = {}
|
|
507
|
+
obj.field = ele.field
|
|
508
|
+
obj.bind = ele.bind
|
|
509
|
+
obj.bindType = ele.bindType
|
|
510
|
+
this_.param.push(obj)
|
|
496
511
|
}
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
let queryParams = []
|
|
502
|
-
let placeholders = []
|
|
503
|
-
if (userInputList.length > 0) {
|
|
504
|
-
userInputList.forEach((ele) => {
|
|
505
|
-
var obj = {}
|
|
506
|
-
//条件查询参数(用户输入的) 文本框输入 defaultType 1 用户输入 2固定值 3参数传入 5脚本
|
|
507
|
-
if (ele.defaultType == '1') {
|
|
508
|
-
obj[ele.field] = ''
|
|
509
|
-
queryParams.push(obj)
|
|
510
|
-
// queryParams[ele.field] = "";
|
|
511
|
-
this_.conditionBind.push(ele)
|
|
512
|
-
placeholders.push('请输入' + ele.comment)
|
|
513
|
-
}
|
|
514
|
-
if (ele.defaultType == '2' && ele.defaultValue) {
|
|
515
|
-
this_.fixedParams[ele.field] = ele.defaultValue
|
|
516
|
-
}
|
|
512
|
+
//取值对象为脚本时获取value
|
|
513
|
+
if (ele.bindType === 3) {
|
|
514
|
+
this_.$requestConfig.executeScript(ele.bind).then((res) => {
|
|
515
|
+
this_.executeScriptResult = res && res.value
|
|
517
516
|
})
|
|
518
|
-
this.$set(this, 'queryParams', queryParams)
|
|
519
|
-
this.$set(this, 'placeholders', placeholders)
|
|
520
517
|
}
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
518
|
+
})
|
|
519
|
+
}
|
|
520
|
+
//判断对话框查询是否有条件
|
|
521
|
+
let userInputList = JSON.parse(customDialog.conditionfield)
|
|
522
|
+
this_.quickSearch = '' //填写提示 placeholder
|
|
523
|
+
this_.conditionBind = []
|
|
524
|
+
let queryParams = []
|
|
525
|
+
let placeholders = []
|
|
526
|
+
if (userInputList.length > 0) {
|
|
527
|
+
userInputList.forEach((ele) => {
|
|
528
|
+
var obj = {}
|
|
529
|
+
//条件查询参数(用户输入的) 文本框输入 defaultType 1 用户输入 2固定值 3参数传入 5脚本
|
|
530
|
+
if (ele.defaultType == '1') {
|
|
531
|
+
obj[ele.field] = ''
|
|
532
|
+
queryParams.push(obj)
|
|
533
|
+
// queryParams[ele.field] = "";
|
|
534
|
+
this_.conditionBind.push(ele)
|
|
535
|
+
placeholders.push('请输入' + ele.comment)
|
|
526
536
|
}
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
if (window.screen.height && window.screen.height <= 900) {
|
|
530
|
-
this.style = 'height:440px'
|
|
537
|
+
if (ele.defaultType == '2' && ele.defaultValue) {
|
|
538
|
+
this_.fixedParams[ele.field] = ele.defaultValue
|
|
531
539
|
}
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
if (
|
|
571
|
-
this_.
|
|
572
|
-
|
|
573
|
-
//无动态传入的字段
|
|
574
|
-
this_.customDialogTreeShow(this_.pageParam)
|
|
540
|
+
})
|
|
541
|
+
this.$set(this, 'queryParams', queryParams)
|
|
542
|
+
this.$set(this, 'placeholders', placeholders)
|
|
543
|
+
}
|
|
544
|
+
//判断是否显示条件查询输入框
|
|
545
|
+
if (this_.quickSearch != '') {
|
|
546
|
+
this_.querysShow = true
|
|
547
|
+
} else {
|
|
548
|
+
this_.querysShow = true
|
|
549
|
+
}
|
|
550
|
+
this_.quickSearch = '请输入' + this.quickSearch + '查询'
|
|
551
|
+
this_.style = 'height:' + customDialog.height + 'px'
|
|
552
|
+
if (window.screen.height && window.screen.height <= 900) {
|
|
553
|
+
this.style = 'height:440px'
|
|
554
|
+
}
|
|
555
|
+
if (customDialog.style == 0 || customDialog.style == 2) {
|
|
556
|
+
//列表
|
|
557
|
+
setTimeout(() => {
|
|
558
|
+
this_.customDialogShow(
|
|
559
|
+
{
|
|
560
|
+
alias: alias,
|
|
561
|
+
customDialog: customDialog,
|
|
562
|
+
},
|
|
563
|
+
isMounted
|
|
564
|
+
)
|
|
565
|
+
}, 100)
|
|
566
|
+
} else if (customDialog.style == 1) {
|
|
567
|
+
//树形
|
|
568
|
+
this_.pageParam = { alias: alias, customDialog: customDialog }
|
|
569
|
+
this_.customDialog = customDialog
|
|
570
|
+
let param = {}
|
|
571
|
+
this_.conditionfieldTree = []
|
|
572
|
+
//判断是否存在条件
|
|
573
|
+
if (customDialog.conditionfield) {
|
|
574
|
+
this_.conditionfieldTree = JSON.parse(customDialog.conditionfield)
|
|
575
|
+
if (this_.conditionfieldTree.length > 0) {
|
|
576
|
+
for (let i = this_.conditionfieldTree.length - 1; i >= 0; i--) {
|
|
577
|
+
//判断条件字段是否是动态传入(defaultType:4:动态传入,2:固定值 )
|
|
578
|
+
if (this_.conditionfieldTree[i].defaultType == '4') {
|
|
579
|
+
param[this_.conditionfieldTree[i].field] =
|
|
580
|
+
this_.conditionfieldTree[i].comment
|
|
575
581
|
}
|
|
576
582
|
}
|
|
577
583
|
}
|
|
578
|
-
}
|
|
584
|
+
}
|
|
585
|
+
//有动态传入的字段
|
|
586
|
+
if (!isMounted) {
|
|
587
|
+
if (JSON.stringify(param) != '{}') {
|
|
588
|
+
this_.dialogVisible = true
|
|
589
|
+
} else {
|
|
590
|
+
//无动态传入的字段
|
|
591
|
+
this_.customDialogTreeShow(this_.pageParam)
|
|
592
|
+
}
|
|
593
|
+
}
|
|
594
|
+
}
|
|
579
595
|
},
|
|
580
596
|
initTableHeight() {
|
|
581
597
|
this.$nextTick(() => {
|
|
@@ -722,13 +738,22 @@
|
|
|
722
738
|
}
|
|
723
739
|
// 添加用户id 岗位id 组织id
|
|
724
740
|
try {
|
|
725
|
-
if (
|
|
741
|
+
if (
|
|
742
|
+
this.$requestConfig.getUserId &&
|
|
743
|
+
this.$requestConfig.getUserId()
|
|
744
|
+
) {
|
|
726
745
|
ctx.userId = this.$requestConfig.getUserId()
|
|
727
746
|
}
|
|
728
|
-
if (
|
|
747
|
+
if (
|
|
748
|
+
this.$requestConfig.getOrgId &&
|
|
749
|
+
this.$requestConfig.getOrgId()
|
|
750
|
+
) {
|
|
729
751
|
ctx.orgId = this.$requestConfig.getOrgId()
|
|
730
752
|
}
|
|
731
|
-
if (
|
|
753
|
+
if (
|
|
754
|
+
this.$requestConfig.getPostId &&
|
|
755
|
+
this.$requestConfig.getPostId()
|
|
756
|
+
) {
|
|
732
757
|
ctx.postId = this.$requestConfig.getPostId()
|
|
733
758
|
}
|
|
734
759
|
} catch (e) {
|
|
@@ -801,6 +826,7 @@
|
|
|
801
826
|
if (this.customDialog.selectNum === 1) {
|
|
802
827
|
nodes = this.propsData[0]
|
|
803
828
|
var temp = ''
|
|
829
|
+
debugger
|
|
804
830
|
for (var j = 0; j < comment.length; j++) {
|
|
805
831
|
temp += '"' + comment[j] + '":"' + nodes[field[j]] + '",'
|
|
806
832
|
}
|
|
@@ -823,10 +849,21 @@
|
|
|
823
849
|
}
|
|
824
850
|
const pInst = utils.getOnlineFormInstance(this)
|
|
825
851
|
this.selectOrgs = this.convertComment2Field(str, field)
|
|
826
|
-
this.custdialog.custDialog.mappingConf.forEach((con) => {
|
|
852
|
+
this.custdialog.custDialog.mappingConf.forEach((con, index) => {
|
|
827
853
|
var val = ''
|
|
828
854
|
str.forEach((item) => {
|
|
829
|
-
|
|
855
|
+
// 此处添加url跳转参数保存逻辑
|
|
856
|
+
if (
|
|
857
|
+
this.jumpParamKey &&
|
|
858
|
+
this.isHaveJumpUrl &&
|
|
859
|
+
this.modelName == 'data.' + con['target'][0]
|
|
860
|
+
) {
|
|
861
|
+
val += `${item[con.from]}¯${this.jumpParamKey}:${
|
|
862
|
+
this.selectOrgs[index][this.jumpParamKey]
|
|
863
|
+
},`
|
|
864
|
+
} else {
|
|
865
|
+
val += item[con.from] + ','
|
|
866
|
+
}
|
|
830
867
|
})
|
|
831
868
|
if (this.modelName == 'data.' + con['target'][0]) {
|
|
832
869
|
utils.setValueByPath(
|
|
@@ -989,13 +1026,22 @@
|
|
|
989
1026
|
queryParamMap.total = pageBean.pageBean.total
|
|
990
1027
|
// 添加用户id 岗位id 组织id
|
|
991
1028
|
try {
|
|
992
|
-
if (
|
|
1029
|
+
if (
|
|
1030
|
+
this.$requestConfig.getUserId &&
|
|
1031
|
+
this.$requestConfig.getUserId()
|
|
1032
|
+
) {
|
|
993
1033
|
ctx.userId = this.$requestConfig.getUserId()
|
|
994
1034
|
}
|
|
995
|
-
if (
|
|
1035
|
+
if (
|
|
1036
|
+
this.$requestConfig.getOrgId &&
|
|
1037
|
+
this.$requestConfig.getOrgId()
|
|
1038
|
+
) {
|
|
996
1039
|
ctx.orgId = this.$requestConfig.getOrgId()
|
|
997
1040
|
}
|
|
998
|
-
if (
|
|
1041
|
+
if (
|
|
1042
|
+
this.$requestConfig.getPostId &&
|
|
1043
|
+
this.$requestConfig.getPostId()
|
|
1044
|
+
) {
|
|
999
1045
|
ctx.postId = this.$requestConfig.getPostId()
|
|
1000
1046
|
}
|
|
1001
1047
|
} catch (e) {
|
|
@@ -1020,7 +1066,7 @@
|
|
|
1020
1066
|
value: queryParamMap[bindKey] || ctx[bindKey] || '',
|
|
1021
1067
|
}
|
|
1022
1068
|
})
|
|
1023
|
-
param.querys = queryList
|
|
1069
|
+
param.querys = queryList || []
|
|
1024
1070
|
if (this.customDialog.needPage) {
|
|
1025
1071
|
param.pageBean = obj
|
|
1026
1072
|
} else {
|
|
@@ -1316,6 +1362,8 @@
|
|
|
1316
1362
|
},
|
|
1317
1363
|
// 同步选择结果
|
|
1318
1364
|
syncInputValue() {
|
|
1365
|
+
// 对话框跳转url需要两个参数 1当前控件绑定的对象参数modelName 2对话框配置中配置的key名称
|
|
1366
|
+
// 同步值时,如果有绑定url跳转参数,值格式为 名称¯跳转key:跳转value
|
|
1319
1367
|
let thisIndex = null //当前数据所在下标
|
|
1320
1368
|
let parentIndex = null //父节点所在下标
|
|
1321
1369
|
if (this.$parent.$el) {
|
|
@@ -1408,8 +1456,19 @@
|
|
|
1408
1456
|
var val = ''
|
|
1409
1457
|
var from = con.from.toLowerCase()
|
|
1410
1458
|
str.forEach((item) => {
|
|
1459
|
+
// 如果有绑定url跳转参数 需获取跳转参数的key
|
|
1411
1460
|
if (item) {
|
|
1412
|
-
|
|
1461
|
+
if (
|
|
1462
|
+
this.jumpParamKey &&
|
|
1463
|
+
this.isHaveJumpUrl &&
|
|
1464
|
+
this.modelName == 'data.' + con['target'][0]
|
|
1465
|
+
) {
|
|
1466
|
+
val += `${decodeURIComponent(item[from])}¯${
|
|
1467
|
+
this.jumpParamKey
|
|
1468
|
+
}:${item[this.jumpParamKey]},`
|
|
1469
|
+
} else {
|
|
1470
|
+
val += decodeURIComponent(item[from]) + ','
|
|
1471
|
+
}
|
|
1413
1472
|
}
|
|
1414
1473
|
})
|
|
1415
1474
|
if (this.modelName == 'data.' + con['target'][0]) {
|