n20-common-lib 3.2.13 → 3.2.15

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.13",
3
+ "version": "3.2.15",
4
4
  "private": false,
5
5
  "scripts": {
6
6
  "serve": "vue-cli-service serve",
@@ -67,9 +67,19 @@
67
67
  </el-select>
68
68
  <!-- 值输入区域 -->
69
69
  <div class="value-inputs">
70
+ <!-- slot类型 - 支持自定义插槽 -->
71
+ <slot
72
+ v-if="condition.valueType === 'slot'"
73
+ :name="condition.slotName"
74
+ :model="condition"
75
+ :value="condition.value"
76
+ :input="(val) => (condition.value = val)"
77
+ :disabled="[5, 6].includes(condition.operator)"
78
+ ></slot>
79
+
70
80
  <!-- 下拉框 -->
71
81
  <el-select
72
- v-if="condition.valueType === 'select' || condition.valueType === 'selectMultiple'"
82
+ v-else-if="condition.valueType === 'select' || condition.valueType === 'selectMultiple'"
73
83
  v-model="condition.value"
74
84
  class="input-w"
75
85
  placeholder="请选择"
@@ -146,15 +156,6 @@
146
156
  clearable
147
157
  @change="searchFn"
148
158
  />
149
- <!-- slot类型 - 支持自定义插槽 -->
150
- <slot
151
- v-else-if="condition.valueType === 'slot'"
152
- :name="condition.slotName"
153
- :model="condition"
154
- :value="condition.value"
155
- :input="(val) => (condition.value = val)"
156
- :disabled="[5, 6].includes(condition.operator)"
157
- ></slot>
158
159
  </div>
159
160
  <!-- 添加按钮 -->
160
161
  <el-button type="text" class="add-btn" icon="v3-icon-add-fill" @click.stop="addCondition(groupIndex)" />
@@ -452,14 +453,6 @@ export default {
452
453
  options: []
453
454
  }
454
455
  },
455
- mounted() {
456
- // 先基于 filterList 初始化 canSetFilter,避免闪烁
457
- this.canSetFilter = this.filterList
458
- // 立即过滤一次无效条件
459
- this.filterInvalidConditions()
460
- // 然后再发起异步请求获取更精确的字段配置
461
- this.getAdvancedQueryFields()
462
- },
463
456
  watch: {
464
457
  canSetFilter: {
465
458
  handler(newVal) {
@@ -486,6 +479,14 @@ export default {
486
479
  immediate: true
487
480
  }
488
481
  },
482
+ mounted() {
483
+ // 先基于 filterList 初始化 canSetFilter,避免闪烁
484
+ this.canSetFilter = this.filterList
485
+ // 立即过滤一次无效条件
486
+ this.filterInvalidConditions()
487
+ // 然后再发起异步请求获取更精确的字段配置
488
+ this.getAdvancedQueryFields()
489
+ },
489
490
  methods: {
490
491
  // 查询支持可配置高级查询的字段
491
492
  async getAdvancedQueryFields() {
@@ -618,8 +619,7 @@ export default {
618
619
  },
619
620
  // 更新操作符对应的值
620
621
  updateOperatorOptions(field, condition) {
621
- // if (condition.valueType === 'slot') return
622
- this.$set(condition, 'valueType', field.type)
622
+ this.$set(condition, 'valueType', condition.valueType === 'slot' ? condition.valueType : field.type)
623
623
  this.$set(condition, 'value', '')
624
624
  if (field.type === 'dateRangePicker' || field.type === 'inputNumberRange') {
625
625
  this.$set(condition, 'value', {})
@@ -142,13 +142,9 @@
142
142
  </el-form-item>
143
143
  <div class="flex-box flex-lr flex-v">
144
144
  <div>{{ $lc('数据范围') }}</div>
145
- <div
146
- v-if="showTypeSwitch"
147
- style="color: var(--color-primary); cursor: pointer"
148
- @click="typeChange"
149
- >
145
+ <div v-if="showTypeSwitch" style="color: var(--color-primary); cursor: pointer" @click="typeChange">
150
146
  <i class="v3-icon-switch"></i>
151
- <span v-if="form.viewType === VIEW_TYPE.ADVANCED"> {{ $lc('高级查询') }}</span>
147
+ <span v-if="form.viewType === VIEW_TYPE.BASIC"> {{ $lc('高级查询') }}</span>
152
148
  <span v-else> {{ $lc('基础查询') }}</span>
153
149
  </div>
154
150
  </div>
@@ -518,10 +514,10 @@ export default {
518
514
  item.type === 'daterange'
519
515
  ? [item.startDate, item.endDate]
520
516
  : item.type === 'numberrange'
521
- ? [item.startValue, item.endValue]
522
- : item.slotFields?.length
523
- ? item.slotFields
524
- : [item.value]
517
+ ? [item.startValue, item.endValue]
518
+ : item.slotFields?.length
519
+ ? item.slotFields
520
+ : [item.value]
525
521
 
526
522
  keys.forEach((k) => allFilterKeys.add(k))
527
523
  if (item.required) {
@@ -648,9 +644,7 @@ export default {
648
644
  },
649
645
  // 保存筛选条件
650
646
  saveCheckData(data = []) {
651
- this.form.keyIds = data
652
- .map((item) => item.id)
653
- .filter((id) => id !== undefined && id !== null && id !== '')
647
+ this.form.keyIds = data.map((item) => item.id).filter((id) => id !== undefined && id !== null && id !== '')
654
648
  },
655
649
  // 同步弹窗内基础查询筛选器当前选中项,覆盖 filterId 存在时 saveCheckData 不触发的场景
656
650
  syncDialogFilterKeyIds() {
@@ -634,6 +634,10 @@ export default {
634
634
  getOperateBtns: {
635
635
  type: Function,
636
636
  default: null
637
+ },
638
+ isExpand: {
639
+ type: Boolean,
640
+ default: false
637
641
  }
638
642
  },
639
643
  data() {
@@ -656,11 +660,11 @@ export default {
656
660
  isOperateFixed: true, // 操作按钮是否固定为列模式
657
661
  hoverHeaderProp: null, // 当前悬停表头列的 prop
658
662
  hoverIconKey: null, // 当前悬停的静态列头图标标识
659
- isExpand: false,
660
663
  isExport: false, // 是否导出
661
664
  dialogVisible: false, // 显示列设置对话框
662
665
  checkColumns: this.filterDefaultHidden(this.columns), // 显示列设置对话框中已选择的列(默认过滤 defaultHidden 列)
663
- headerHeight: 40 // 表头实际高度,骨架屏定位用
666
+ headerHeight: 40, // 表头实际高度,骨架屏定位用
667
+ innerIsExpand: this.isExpand // 本地展开状态,避免直接修改 prop
664
668
  }
665
669
  },
666
670
  computed: {
@@ -736,6 +740,9 @@ export default {
736
740
  size(val) {
737
741
  this.sizeC = val
738
742
  },
743
+ isExpand(val) {
744
+ this.innerIsExpand = val
745
+ },
739
746
  data() {
740
747
  // 翻页清除选中
741
748
  if (this.clearSelect) {
@@ -881,10 +888,11 @@ export default {
881
888
  const topLevelRows = this.data || []
882
889
  if (topLevelRows.length === 0) return
883
890
  // 切换展开状态:当前已展开则折叠,当前已折叠则展开
884
- const nextExpand = !this.isExpand
891
+ const nextExpand = !this.innerIsExpand
885
892
  // setTreeExpand 返回 Promise,await 确保展开动作完成后再更新图标状态
886
893
  await $table.setTreeExpand(topLevelRows, nextExpand)
887
- this.isExpand = nextExpand
894
+ this.innerIsExpand = nextExpand
895
+ this.$emit('update:isExpand', nextExpand)
888
896
  },
889
897
  /**
890
898
  * 同步单行手动展开/折叠后的图标状态
@@ -897,7 +905,8 @@ export default {
897
905
  if (topLevelRows.length === 0) return
898
906
  // 若顶层行全部处于展开状态则认为是"已展开",否则为"未全部展开"
899
907
  const expandSet = new Set(expandRecords)
900
- this.isExpand = topLevelRows.every((row) => expandSet.has(row))
908
+ this.innerIsExpand = topLevelRows.every((row) => expandSet.has(row))
909
+ this.$emit('update:isExpand', this.innerIsExpand)
901
910
  },
902
911
  // 锁定列:将该列 fixed 设为 'left',直接修改 prop 对象并刷新表格
903
912
  lockColumn(item) {