three-trees-ui 1.0.2 → 1.0.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "three-trees-ui",
3
- "version": "1.0.2",
3
+ "version": "1.0.4",
4
4
  "publicPath": "/ui",
5
5
  "author": "hotent",
6
6
  "private": false,
@@ -130,7 +130,7 @@
130
130
  </el-button>
131
131
  </div>
132
132
  </el-header>
133
- <el-main class="custom-dialog_main">
133
+ <el-main class="custom-dialog_main" ref="customTableRef">
134
134
  <el-table
135
135
  ref="orgTable"
136
136
  :data="dialogData"
@@ -328,7 +328,6 @@
328
328
  type: Boolean,
329
329
  default: false,
330
330
  },
331
- dialogConfig: Object,
332
331
  },
333
332
  data() {
334
333
  return {
@@ -403,19 +402,6 @@
403
402
  }
404
403
  return []
405
404
  },
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
- },
419
405
  },
420
406
  watch: {
421
407
  dialogData: {
@@ -436,7 +422,6 @@
436
422
  })
437
423
  }
438
424
  }
439
- this.initTableHeight()
440
425
  },
441
426
  immediate: true,
442
427
  deep: true,
@@ -454,150 +439,151 @@
454
439
  },
455
440
  methods: {
456
441
  showDialog(isMounted = false) {
442
+ const this_ = this
457
443
  this.fixedParams = {}
458
- // 如果已存在配置信息就不去请求配置信息 直接初始化数据
459
- if (this.dialogConfig) {
460
- this.initDialog(this.dialogConfig, isMounted)
461
- return
462
- }
463
444
  var alias = this.custdialog.custDialog.alias
464
445
  this.$requestConfig
465
446
  .getCustomDialogByAlias(alias)
466
447
  .then((customDialog) => {
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,
492
- }
448
+ if (!customDialog || !customDialog.alias) {
449
+ this.$message.error('对话框别名【' + alias + '】不存在!')
450
+ return
493
451
  }
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
- ) {
452
+ if (customDialog.style == 1) {
453
+ var displaylist = JSON.parse(customDialog.displayfield)
454
+ this_.nodeKey = displaylist.id
455
+ }
456
+ if (customDialog.needPage && customDialog.requestType === 'POST') {
506
457
  let obj = {}
507
- obj.field = ele.field
508
- obj.bind = ele.bind
509
- obj.bindType = ele.bindType
510
- this_.param.push(obj)
458
+ this.getLastKeyByPath(obj, customDialog.pageKey, 1)
459
+ this.getLastKeyByPath(obj, customDialog.pageSizeKey, 10)
460
+ this.getLastKeyByPath(obj, customDialog.totalKey, true)
461
+ const exp = utils.parseExp(customDialog.dataParam, obj, true)
462
+ if (exp) {
463
+ const params = JSON.parse(exp)
464
+ if (params.pageBean) {
465
+ this.pagination = {
466
+ ...params.pageBean,
467
+ }
468
+ }
469
+ }
511
470
  }
512
- //取值对象为脚本时获取value
513
- if (ele.bindType === 3) {
514
- this_.$requestConfig.executeScript(ele.bind).then((res) => {
515
- this_.executeScriptResult = res && res.value
471
+ //对话框按表单字段查询(参数传入的)
472
+ let bindList = this_.custdialog.custDialog.conditions
473
+ this_.param = [] //绑定的表单字段
474
+ if (bindList.length > 0) {
475
+ bindList.forEach((ele) => {
476
+ //绑定表单字段
477
+ if (
478
+ ele.bind &&
479
+ (ele.defaultType == '3' ||
480
+ ele.bind.startsWith('data.searchForm'))
481
+ ) {
482
+ let obj = {}
483
+ obj.field = ele.field
484
+ obj.bind = ele.bind
485
+ obj.bindType = ele.bindType
486
+ this_.param.push(obj)
487
+ }
488
+ //取值对象为脚本时获取value
489
+ if (ele.bindType === 3) {
490
+ this_.$requestConfig.executeScript(ele.bind).then((res) => {
491
+ this_.executeScriptResult = res && res.value
492
+ })
493
+ }
516
494
  })
517
495
  }
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)
496
+ //判断对话框查询是否有条件
497
+ let userInputList = JSON.parse(customDialog.conditionfield)
498
+ this_.quickSearch = '' //填写提示 placeholder
499
+ this_.conditionBind = []
500
+ let queryParams = []
501
+ let placeholders = []
502
+ if (userInputList.length > 0) {
503
+ userInputList.forEach((ele) => {
504
+ var obj = {}
505
+ //条件查询参数(用户输入的) 文本框输入 defaultType 1 用户输入 2固定值 3参数传入 5脚本
506
+ if (ele.defaultType == '1') {
507
+ obj[ele.field] = ''
508
+ queryParams.push(obj)
509
+ // queryParams[ele.field] = "";
510
+ this_.conditionBind.push(ele)
511
+ placeholders.push('请输入' + ele.comment)
512
+ }
513
+ if (ele.defaultType == '2' && ele.defaultValue) {
514
+ this_.fixedParams[ele.field] = ele.defaultValue
515
+ }
516
+ })
517
+ this.$set(this, 'queryParams', queryParams)
518
+ this.$set(this, 'placeholders', placeholders)
536
519
  }
537
- if (ele.defaultType == '2' && ele.defaultValue) {
538
- this_.fixedParams[ele.field] = ele.defaultValue
520
+ //判断是否显示条件查询输入框
521
+ if (this_.quickSearch != '') {
522
+ this_.querysShow = true
523
+ } else {
524
+ this_.querysShow = true
539
525
  }
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
526
+ this_.quickSearch = '请输入' + this.quickSearch + '查询'
527
+ this_.style = 'height:' + customDialog.height + 'px'
528
+ if (window.screen.height && window.screen.height <= 900) {
529
+ this.style = 'height:440px'
530
+ }
531
+ if (customDialog.style == 0 || customDialog.style == 2) {
532
+ //列表
533
+ setTimeout(() => {
534
+ this_.customDialogShow(
535
+ {
536
+ alias: alias,
537
+ customDialog: customDialog,
538
+ },
539
+ isMounted
540
+ )
541
+ }, 100)
542
+ } else if (customDialog.style == 1) {
543
+ //树形
544
+ this_.pageParam = { alias: alias, customDialog: customDialog }
545
+ this_.customDialog = customDialog
546
+ let param = {}
547
+ this_.conditionfieldTree = []
548
+ //判断是否存在条件
549
+ if (customDialog.conditionfield) {
550
+ this_.conditionfieldTree = JSON.parse(
551
+ customDialog.conditionfield
552
+ )
553
+ if (this_.conditionfieldTree.length > 0) {
554
+ for (
555
+ let i = this_.conditionfieldTree.length - 1;
556
+ i >= 0;
557
+ i--
558
+ ) {
559
+ //判断条件字段是否是动态传入(defaultType:4:动态传入,2:固定值
560
+ if (this_.conditionfieldTree[i].defaultType == '4') {
561
+ param[this_.conditionfieldTree[i].field] =
562
+ this_.conditionfieldTree[i].comment
563
+ }
564
+ }
565
+ }
566
+ }
567
+ //有动态传入的字段
568
+ if (!isMounted) {
569
+ if (JSON.stringify(param) != '{}') {
570
+ this_.dialogVisible = true
571
+ } else {
572
+ //无动态传入的字段
573
+ this_.customDialogTreeShow(this_.pageParam)
581
574
  }
582
575
  }
583
576
  }
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
- }
577
+ })
595
578
  },
596
579
  initTableHeight() {
597
580
  this.$nextTick(() => {
598
- let mainEl = document.getElementsByClassName('custom-dialog_main')
599
- if (mainEl && mainEl.length) {
600
- this.tableHeight = mainEl[0].clientHeight - 40
581
+ let mainEl = this.$refs.customTableRef
582
+ if (mainEl) {
583
+ this.tableHeight =
584
+ mainEl.$el.clientHeight - 2 > 350
585
+ ? mainEl.$el.clientHeight - 2
586
+ : 350
601
587
  }
602
588
  })
603
589
  },
@@ -738,22 +724,13 @@
738
724
  }
739
725
  // 添加用户id 岗位id 组织id
740
726
  try {
741
- if (
742
- this.$requestConfig.getUserId &&
743
- this.$requestConfig.getUserId()
744
- ) {
727
+ if (this.$requestConfig.getUserId()) {
745
728
  ctx.userId = this.$requestConfig.getUserId()
746
729
  }
747
- if (
748
- this.$requestConfig.getOrgId &&
749
- this.$requestConfig.getOrgId()
750
- ) {
730
+ if (this.$requestConfig.getOrgId()) {
751
731
  ctx.orgId = this.$requestConfig.getOrgId()
752
732
  }
753
- if (
754
- this.$requestConfig.getPostId &&
755
- this.$requestConfig.getPostId()
756
- ) {
733
+ if (this.$requestConfig.getPostId()) {
757
734
  ctx.postId = this.$requestConfig.getPostId()
758
735
  }
759
736
  } catch (e) {
@@ -826,7 +803,6 @@
826
803
  if (this.customDialog.selectNum === 1) {
827
804
  nodes = this.propsData[0]
828
805
  var temp = ''
829
- debugger
830
806
  for (var j = 0; j < comment.length; j++) {
831
807
  temp += '"' + comment[j] + '":"' + nodes[field[j]] + '",'
832
808
  }
@@ -849,21 +825,10 @@
849
825
  }
850
826
  const pInst = utils.getOnlineFormInstance(this)
851
827
  this.selectOrgs = this.convertComment2Field(str, field)
852
- this.custdialog.custDialog.mappingConf.forEach((con, index) => {
828
+ this.custdialog.custDialog.mappingConf.forEach((con) => {
853
829
  var val = ''
854
830
  str.forEach((item) => {
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
- }
831
+ val += item[con.from] + ','
867
832
  })
868
833
  if (this.modelName == 'data.' + con['target'][0]) {
869
834
  utils.setValueByPath(
@@ -1026,22 +991,13 @@
1026
991
  queryParamMap.total = pageBean.pageBean.total
1027
992
  // 添加用户id 岗位id 组织id
1028
993
  try {
1029
- if (
1030
- this.$requestConfig.getUserId &&
1031
- this.$requestConfig.getUserId()
1032
- ) {
994
+ if (this.$requestConfig.getUserId()) {
1033
995
  ctx.userId = this.$requestConfig.getUserId()
1034
996
  }
1035
- if (
1036
- this.$requestConfig.getOrgId &&
1037
- this.$requestConfig.getOrgId()
1038
- ) {
997
+ if (this.$requestConfig.getOrgId()) {
1039
998
  ctx.orgId = this.$requestConfig.getOrgId()
1040
999
  }
1041
- if (
1042
- this.$requestConfig.getPostId &&
1043
- this.$requestConfig.getPostId()
1044
- ) {
1000
+ if (this.$requestConfig.getPostId()) {
1045
1001
  ctx.postId = this.$requestConfig.getPostId()
1046
1002
  }
1047
1003
  } catch (e) {
@@ -1066,7 +1022,7 @@
1066
1022
  value: queryParamMap[bindKey] || ctx[bindKey] || '',
1067
1023
  }
1068
1024
  })
1069
- param.querys = queryList || []
1025
+ param.querys = queryList
1070
1026
  if (this.customDialog.needPage) {
1071
1027
  param.pageBean = obj
1072
1028
  } else {
@@ -1084,6 +1040,7 @@
1084
1040
  totalKey: this.customDialog.totalKey,
1085
1041
  }
1086
1042
  this.getDialoglistJson(requestParam).then(() => {
1043
+ this.initTableHeight()
1087
1044
  this.checkList()
1088
1045
  })
1089
1046
  } catch (e) {
@@ -1097,11 +1054,13 @@
1097
1054
  })
1098
1055
  this.customDialog.pageBean = queryFilter
1099
1056
  this.getDialoglistJson(this.customDialog).then(() => {
1057
+ this.initTableHeight()
1100
1058
  this.checkList()
1101
1059
  })
1102
1060
  } else {
1103
1061
  this.customDialog.pageBean = pageBean
1104
1062
  this.getDialoglistJson(this.customDialog).then(() => {
1063
+ this.initTableHeight()
1105
1064
  this.checkList()
1106
1065
  })
1107
1066
  }
@@ -1362,8 +1321,6 @@
1362
1321
  },
1363
1322
  // 同步选择结果
1364
1323
  syncInputValue() {
1365
- // 对话框跳转url需要两个参数 1当前控件绑定的对象参数modelName 2对话框配置中配置的key名称
1366
- // 同步值时,如果有绑定url跳转参数,值格式为 名称¯跳转key:跳转value
1367
1324
  let thisIndex = null //当前数据所在下标
1368
1325
  let parentIndex = null //父节点所在下标
1369
1326
  if (this.$parent.$el) {
@@ -1456,19 +1413,8 @@
1456
1413
  var val = ''
1457
1414
  var from = con.from.toLowerCase()
1458
1415
  str.forEach((item) => {
1459
- // 如果有绑定url跳转参数 需获取跳转参数的key
1460
1416
  if (item) {
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
- }
1417
+ val += decodeURIComponent(item[from]) + ','
1472
1418
  }
1473
1419
  })
1474
1420
  if (this.modelName == 'data.' + con['target'][0]) {
@@ -1939,5 +1885,6 @@
1939
1885
  }
1940
1886
  .custom-dialog_main {
1941
1887
  min-height: 350px;
1888
+ padding: 0 20px !important;
1942
1889
  }
1943
1890
  </style>