three-trees-ui 1.0.2 → 1.0.3

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