three-trees-ui 1.0.70 → 1.0.72

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.70",
3
+ "version": "1.0.72",
4
4
  "publicPath": "/ui",
5
5
  "author": "hotent",
6
6
  "private": false,
@@ -231,9 +231,9 @@
231
231
  SubPagination._map.set(instKey, pInst)
232
232
  }
233
233
  },
234
- destroyed() {
235
- SubPagination.clear(this.dataSubname, this)
236
- },
234
+ // destroyed() {
235
+ // SubPagination.clear(this.dataSubname, this)
236
+ // },
237
237
  methods: {
238
238
  transformFieldData(data) {
239
239
  return new Promise(async (resolve) => {
@@ -106,9 +106,9 @@
106
106
  mounted() {
107
107
  this.paginationChange()
108
108
  },
109
- destroyed() {
110
- SubPagination.clear(this.dataSubname, this)
111
- },
109
+ // destroyed() {
110
+ // SubPagination.clear(this.dataSubname, this)
111
+ // },
112
112
  methods: {
113
113
  paginationChange() {
114
114
  // 分页变化时,以dataPath为key设置到公共的js对象中
@@ -526,7 +526,7 @@ export default {
526
526
  }
527
527
  })
528
528
  },
529
- validateSearchRequired(querys) {
529
+ validateSearchRequired(querys = []) {
530
530
  let errorMsg = ''
531
531
  let conditions = JSON.parse(this.queryView.conditions)
532
532
  if (conditions && querys) {
@@ -543,6 +543,20 @@ export default {
543
543
  }
544
544
  return errorMsg
545
545
  },
546
+ checkHaveRequired() {
547
+ let haveRequired = false
548
+ try {
549
+ let conditions = JSON.parse(this.queryView.conditions)
550
+ if (conditions) {
551
+ haveRequired = conditions.some((item) => {
552
+ return item.isRequired
553
+ })
554
+ }
555
+ } catch (e) {
556
+ console.log(e)
557
+ }
558
+ return haveRequired
559
+ },
546
560
  async search(param, cb, isSearchBtn, needRequestTotal = false) {
547
561
  // 不需要请求后端接口统计列表数据
548
562
  this.needRequestTotal = needRequestTotal
@@ -553,7 +567,6 @@ export default {
553
567
  }
554
568
  //初始化时,把查询字段的默认值加进去
555
569
  if (this.isInit) {
556
- this.isInit = false
557
570
  let querys = await this.buildDefaultQuerys()
558
571
  dataTemplateQueryVo.queryFilter.querys =
559
572
  dataTemplateQueryVo.queryFilter.querys || []
@@ -569,17 +582,21 @@ export default {
569
582
  this.defaultQuerys
570
583
  )
571
584
  }
585
+ // 检查是否有必填字段
586
+ if (this.checkHaveRequired() && this.isInit) {
587
+ this.$refs.queryViewList.showAdvancedSearch = true
588
+ }
572
589
  // 查询字段 校验是否必填,如果是必填没数据,需返回提示
573
- if (isSearchBtn) {
574
- let errorMsg = this.validateSearchRequired(
575
- dataTemplateQueryVo.queryFilter.querys
576
- )
577
- if (errorMsg) {
578
- this.$message.warning(errorMsg)
579
- cb && cb()
580
- return
581
- }
590
+ let errorMsg = this.validateSearchRequired(
591
+ dataTemplateQueryVo.queryFilter.querys
592
+ )
593
+ if (errorMsg) {
594
+ !this.isInit && this.$message.warning(errorMsg)
595
+ cb && cb()
596
+ this.isInit = false
597
+ return
582
598
  }
599
+ this.isInit = false
583
600
  //保存查询参数,用于作为导出的查询参数
584
601
  if (this.queryViewOptions) {
585
602
  //关联查询字段
@@ -775,11 +792,19 @@ export default {
775
792
  ? operationType[operation]
776
793
  : operation
777
794
  } else if (
778
- typeof $(searchItems[i]).children().attr('ht-query') != 'undefined'
795
+ typeof $(searchItems[i])
796
+ .children()
797
+ .attr('ht-query') != 'undefined'
779
798
  ) {
780
799
  //查询条件类型
781
- operation = $(searchItems[i]).children().attr('operation')
782
- operationMap[$(searchItems[i]).children().attr('ht-query')] =
800
+ operation = $(searchItems[i])
801
+ .children()
802
+ .attr('operation')
803
+ operationMap[
804
+ $(searchItems[i])
805
+ .children()
806
+ .attr('ht-query')
807
+ ] =
783
808
  typeof operationType[operation] != 'undefined'
784
809
  ? operationType[operation]
785
810
  : operation
@@ -801,12 +826,16 @@ export default {
801
826
  searchItems[i]
802
827
  ).attr('field-query')
803
828
  } else if (
804
- typeof $(searchItems[i]).children().attr('ht-query') != 'undefined'
829
+ typeof $(searchItems[i])
830
+ .children()
831
+ .attr('ht-query') != 'undefined'
805
832
  ) {
806
833
  //查询条件字段
807
- fieldQueryMap[$(searchItems[i]).children().attr('ht-query')] = $(
808
- searchItems[i]
809
- )
834
+ fieldQueryMap[
835
+ $(searchItems[i])
836
+ .children()
837
+ .attr('ht-query')
838
+ ] = $(searchItems[i])
810
839
  .children()
811
840
  .attr('field-query')
812
841
  }
@@ -828,12 +857,19 @@ export default {
828
857
  ? true
829
858
  : false
830
859
  } else if (
831
- typeof $(searchItems[i]).children().attr('ht-query') != 'undefined'
860
+ typeof $(searchItems[i])
861
+ .children()
862
+ .attr('ht-query') != 'undefined'
832
863
  ) {
833
864
  //查询条件字段
834
- fieldQueryMap[$(searchItems[i]).children().attr('ht-query')] =
835
- typeof $(searchItems[i]).children().attr('special-query') !=
836
- 'undefined'
865
+ fieldQueryMap[
866
+ $(searchItems[i])
867
+ .children()
868
+ .attr('ht-query')
869
+ ] =
870
+ typeof $(searchItems[i])
871
+ .children()
872
+ .attr('special-query') != 'undefined'
837
873
  ? true
838
874
  : false
839
875
  }
@@ -987,6 +1023,14 @@ export default {
987
1023
  dataTemplateQueryVo.selectList = this.queryViewOptions.selectList
988
1024
  }
989
1025
  }
1026
+ // 查询字段 校验是否必填,如果是必填没数据,需返回提示
1027
+ let errorMsg = this.validateSearchRequired(
1028
+ dataTemplateQueryVo.queryFilter.querys
1029
+ )
1030
+ if (errorMsg) {
1031
+ this.$message.warning(errorMsg)
1032
+ return
1033
+ }
990
1034
 
991
1035
  let data = {
992
1036
  sqlAlias: this.sqlAlias || this.queryView.sqlAlias,
@@ -1408,7 +1408,8 @@ export default {
1408
1408
  for (let x = 0; x < display.length; x++) {
1409
1409
  let item = JSON.parse(display[x])
1410
1410
  if (this.rows[index][item.name] || this.rows[index][item.fieldsAlias]) {
1411
- const qrCode = this.rows[index][item.name] || this.rows[index][item.fieldsAlias]
1411
+ const qrCode =
1412
+ this.rows[index][item.name] || this.rows[index][item.fieldsAlias]
1412
1413
  this.QRCodeDesc.push(`${item.desc}:${qrCode}`)
1413
1414
  }
1414
1415
  }
@@ -1605,7 +1606,7 @@ export default {
1605
1606
  params.defKey = this_.defKey
1606
1607
  }
1607
1608
  // 检查是否有必填字段
1608
- if (this.checkHaveRequired && this.isInit) {
1609
+ if (this.checkHaveRequired() && this.isInit) {
1609
1610
  this.$refs.multipleTemplateTable.showAdvancedSearch = true
1610
1611
  }
1611
1612
  // 查询字段 校验是否必填,如果是必填没数据,需返回提示
@@ -1625,7 +1626,7 @@ export default {
1625
1626
  }
1626
1627
  },
1627
1628
  // 校验查询字段必填
1628
- validateSearchRequired(querys) {
1629
+ validateSearchRequired(querys = []) {
1629
1630
  let errorMsg = ''
1630
1631
  let conditions = JSON.parse(this.templateInfo.conditionField)
1631
1632
  if (conditions) {
@@ -3525,6 +3526,12 @@ export default {
3525
3526
  params.defKey = this_.defKey
3526
3527
  }
3527
3528
  await this.handleInitQuery(params)
3529
+ // 查询字段 校验是否必填,如果是必填没数据,需返回提示
3530
+ let errorMsg = this.validateSearchRequired(params.pagination.querys)
3531
+ if (errorMsg) {
3532
+ this.$message.warning(errorMsg)
3533
+ return
3534
+ }
3528
3535
  this.getBpmTemplateByPagination(params)
3529
3536
  },
3530
3537
  filterChange(filters) {