n20-common-lib 3.2.2 → 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.2",
3
+ "version": "3.2.4",
4
4
  "private": false,
5
5
  "scripts": {
6
6
  "serve": "vue-cli-service serve",
@@ -185,12 +185,13 @@
185
185
  </template>
186
186
 
187
187
  <script>
188
+ import axios from '../../utils/axios.js'
188
189
  import ClDatePicker from '../DatePicker/index.vue'
189
190
  import ClDatePickerPor from '../DatePicker/por.vue'
190
191
  import ClInputNumber from '../InputNumber/index.vue'
191
192
  import ClInputNumberRange from '../InputNumber/numberRange.vue'
192
193
  import ClInputSearch from '../InputSearch/index.vue'
193
- import axios from '../../utils/axios.js'
194
+
194
195
  export default {
195
196
  name: 'AdvancedQuery',
196
197
  components: {
@@ -554,7 +555,16 @@ export default {
554
555
  updatefield(field, row) {
555
556
  this.$set(row, 'advancedQueryType', field.advancedQueryType)
556
557
  if (field.advancedQueryType === 4) {
557
- this.$set(row, 'options', field.options)
558
+ field.options = field?.options?.map((item) => {
559
+ if (field.props?.labelKey) {
560
+ item.label = item[field.props.labelKey]
561
+ }
562
+ if (field.props?.valueKey) {
563
+ item.value = item[field.props.valueKey]
564
+ }
565
+ return item
566
+ })
567
+ this.$set(row, 'options', field?.options)
558
568
  }
559
569
  // slot 类型特殊处理
560
570
  if (field.type === 'slot') {
@@ -604,42 +614,16 @@ export default {
604
614
  // 获取字段选项
605
615
  getFieldOptions(field) {
606
616
  const fieldConfig = this.fieldOptions.find((f) => f.value === field)
607
- return fieldConfig ? fieldConfig.options : []
617
+ return fieldConfig ? fieldConfig?.options : []
608
618
  },
609
619
  // 更新操作符对应的值
610
620
  updateOperatorOptions(field, condition) {
621
+ if (condition.valueType === 'slot') return
611
622
  this.$set(condition, 'valueType', field.type)
612
623
  this.$set(condition, 'value', '')
613
624
  if (field.type === 'dateRangePicker' || field.type === 'inputNumberRange') {
614
625
  this.$set(condition, 'value', {})
615
626
  }
616
-
617
- /* if (condition.operator === 'between') {
618
- const fieldType = this.getFieldType(condition.field)
619
- if (fieldType === 'number') {
620
- condition.value = { start: undefined, end: undefined }
621
- } else if (fieldType === 'date' || fieldType === 'daterange') {
622
- condition.value = []
623
- } else {
624
- condition.value = { start: '', end: '' }
625
- }
626
- } else {
627
- const fieldType = this.getFieldType(condition.field)
628
- if (fieldType === 'select') {
629
- condition.value = []
630
- } else {
631
- condition.value = ''
632
- }
633
- } */
634
- },
635
- // 提交表单
636
- submitForm() {
637
- /* const formData = {
638
- value: this.value
639
- }
640
- this.$emit('confirm', formData)
641
- this.$emit('close') */
642
- console.log(this.value, 'this.value')
643
627
  }
644
628
  }
645
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