n20-common-lib 3.2.3 → 3.2.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": "n20-common-lib",
3
- "version": "3.2.3",
3
+ "version": "3.2.4",
4
4
  "private": false,
5
5
  "scripts": {
6
6
  "serve": "vue-cli-service serve",
@@ -555,7 +555,7 @@ export default {
555
555
  updatefield(field, row) {
556
556
  this.$set(row, 'advancedQueryType', field.advancedQueryType)
557
557
  if (field.advancedQueryType === 4) {
558
- field.options = field.options.map((item) => {
558
+ field.options = field?.options?.map((item) => {
559
559
  if (field.props?.labelKey) {
560
560
  item.label = item[field.props.labelKey]
561
561
  }
@@ -564,7 +564,7 @@ export default {
564
564
  }
565
565
  return item
566
566
  })
567
- this.$set(row, 'options', field.options)
567
+ this.$set(row, 'options', field?.options)
568
568
  }
569
569
  // slot 类型特殊处理
570
570
  if (field.type === 'slot') {
@@ -614,42 +614,16 @@ export default {
614
614
  // 获取字段选项
615
615
  getFieldOptions(field) {
616
616
  const fieldConfig = this.fieldOptions.find((f) => f.value === field)
617
- return fieldConfig ? fieldConfig.options : []
617
+ return fieldConfig ? fieldConfig?.options : []
618
618
  },
619
619
  // 更新操作符对应的值
620
620
  updateOperatorOptions(field, condition) {
621
+ if (condition.valueType === 'slot') return
621
622
  this.$set(condition, 'valueType', field.type)
622
623
  this.$set(condition, 'value', '')
623
624
  if (field.type === 'dateRangePicker' || field.type === 'inputNumberRange') {
624
625
  this.$set(condition, 'value', {})
625
626
  }
626
-
627
- /* if (condition.operator === 'between') {
628
- const fieldType = this.getFieldType(condition.field)
629
- if (fieldType === 'number') {
630
- condition.value = { start: undefined, end: undefined }
631
- } else if (fieldType === 'date' || fieldType === 'daterange') {
632
- condition.value = []
633
- } else {
634
- condition.value = { start: '', end: '' }
635
- }
636
- } else {
637
- const fieldType = this.getFieldType(condition.field)
638
- if (fieldType === 'select') {
639
- condition.value = []
640
- } else {
641
- condition.value = ''
642
- }
643
- } */
644
- },
645
- // 提交表单
646
- submitForm() {
647
- /* const formData = {
648
- value: this.value
649
- }
650
- this.$emit('confirm', formData)
651
- this.$emit('close') */
652
- console.log(this.value, 'this.value')
653
627
  }
654
628
  }
655
629
  }
@@ -4,7 +4,7 @@
4
4
  <slot name="leftContent"></slot>
5
5
  <div class="flex-box flex-v">
6
6
  <el-popover
7
- v-if="bussId"
7
+ v-if="bussId && isFilter"
8
8
  v-model="viewPopoverVisible"
9
9
  popper-class="pro-filter-view-popover"
10
10
  placement="bottom-start"
@@ -52,7 +52,7 @@
52
52
  </div>
53
53
  </div>
54
54
  </el-popover>
55
- <el-button v-if="bussId && selectItem" class="activiti m-r" @click="edit(selectItem, true)">
55
+ <el-button v-if="bussId && selectItem && isFilter" class="activiti m-r" @click="edit(selectItem, true)">
56
56
  <div class="flex-box flex-v">
57
57
  <!-- <img src="./find.svg" alt="" /> -->
58
58
  <i class="v3-icon-find"></i>
@@ -67,14 +67,19 @@
67
67
  </div>
68
68
  </el-button>
69
69
  <div class="flex-box flex-v">
70
- <el-button icon="v3-icon-filter" class="m-r-s botton" @click="filterExpanded = !filterExpanded">{{
71
- '筛选' | $lc
72
- }}</el-button>
70
+ <el-button
71
+ v-if="isFilter"
72
+ icon="v3-icon-filter"
73
+ class="m-r-s botton"
74
+ @click="filterExpanded = !filterExpanded"
75
+ >{{ '筛选' | $lc }}</el-button
76
+ >
73
77
  <slot name="rightContent"></slot>
74
78
  </div>
75
79
  </div>
76
80
  </div>
77
81
  <cl-advanced-filter
82
+ v-if="isFilter"
78
83
  ref="filter"
79
84
  class="filter"
80
85
  :class="{ 'is-hidden': !filterExpanded }"
@@ -260,6 +265,11 @@ export default {
260
265
  autoExpandWithValues: {
261
266
  type: Boolean,
262
267
  default: false
268
+ },
269
+ // 是否显示筛选按钮及筛选区域,为 false 时不显示筛选按钮、视图相关 UI,且不请求筛选相关接口
270
+ isFilter: {
271
+ type: Boolean,
272
+ default: true
263
273
  }
264
274
  },
265
275
  data() {
@@ -327,16 +337,11 @@ export default {
327
337
  filterObj() {
328
338
  const filterKeys = new Set()
329
339
  this.filterList.forEach((item) => {
330
- ;[
331
- item.value,
332
- item.startDate,
333
- item.endDate,
334
- item.startValue,
335
- item.endValue,
336
- ...(item.slotFields || [])
337
- ].forEach((key) => {
338
- if (key) filterKeys.add(key)
339
- })
340
+ ;[item.value, item.startDate, item.endDate, item.startValue, item.endValue, ...(item.slotFields || [])].forEach(
341
+ (key) => {
342
+ if (key) filterKeys.add(key)
343
+ }
344
+ )
340
345
  })
341
346
 
342
347
  const extraInitialValues = {}
@@ -383,14 +388,16 @@ export default {
383
388
  }
384
389
  },
385
390
  mounted() {
386
- // 只有在有 bussId 时才获取视图列表
387
- if (this.bussId) {
391
+ // 只有在有 bussId 且 isFilter 为 true 时才获取视图列表
392
+ if (this.bussId && this.isFilter) {
388
393
  this.getFilterList()
389
394
  }
390
395
  // 合并初始筛选值:slot 字段使用默认值,其他字段使用 initialValue 传入的值
391
- this.searchValue = { ...this.getInitialSearchValue, ...this.initialValue }
392
- // 初始挂载后根据筛选值情况决定是否自动展开
393
- this.checkAndAutoExpand()
396
+ if (this.isFilter) {
397
+ this.searchValue = { ...this.getInitialSearchValue, ...this.initialValue }
398
+ // 初始挂载后根据筛选值情况决定是否自动展开
399
+ this.checkAndAutoExpand()
400
+ }
394
401
  },
395
402
  methods: {
396
403
  /**
@@ -537,8 +544,8 @@ export default {
537
544
  },
538
545
  // 通过bussId拿取视图列表
539
546
  getFilterList(viewId) {
540
- // 如果没有 bussId,不获取视图列表
541
- if (!this.bussId) {
547
+ // 如果没有 bussId 或 isFilter 为 false,不获取视图列表
548
+ if (!this.bussId || !this.isFilter) {
542
549
  return
543
550
  }
544
551