n20-common-lib 3.0.91 → 3.0.93

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.0.91",
3
+ "version": "3.0.93",
4
4
  "private": false,
5
5
  "scripts": {
6
6
  "serve": "vue-cli-service serve",
@@ -1,5 +1,5 @@
1
1
  // layout
2
- $--aside-width: 200px;
2
+ $--aside-width: 190px;
3
3
  $--aside-height: 40px;
4
4
  $--aside-collapse-width: 50px;
5
5
  $--header-height: 48px;
@@ -21,6 +21,9 @@ export default {
21
21
  InputNumberRange,
22
22
  datePickerPor
23
23
  },
24
+ inject: {
25
+ nFilter: { default: null }
26
+ },
24
27
  props: {
25
28
  form: {
26
29
  type: Object,
@@ -82,6 +85,15 @@ export default {
82
85
  })
83
86
  setOptionsMap(this.item.id, list)
84
87
  this.$set(this.item, 'options', list)
88
+ // 同步更新 filterList 中的 options,确保两者一致,
89
+ // 防止 AdvancedFilter 的 filterList watcher 用旧数据覆盖 reqOptions 结果
90
+ const nf = this.nFilter
91
+ if (nf) {
92
+ const filterItem = nf.filterList.find((f) => f[nf.onlyKey] === this.item[nf.onlyKey])
93
+ if (filterItem) {
94
+ this.$set(filterItem, 'options', list)
95
+ }
96
+ }
85
97
  })
86
98
  }
87
99
  },
@@ -225,6 +225,22 @@ export default {
225
225
  handler(val) {
226
226
  val && this.getFilterList()
227
227
  }
228
+ },
229
+ // 当 filterList 中某几项的 options 异步更新后,同步到 GroupData 保证渲染更新
230
+ filterList: {
231
+ handler(newList) {
232
+ if (!this.GroupData || this.GroupData.length === 0) return
233
+ this.GroupData.forEach((groupItem) => {
234
+ const filterItem = newList.find((f) => f[this.onlyKey] === groupItem[this.onlyKey])
235
+ // 仅在 options 引用确实发生变化时才同步,避免:
236
+ // 1. mackData 排序 filterList 后重复更新 GroupData(两者引用相同)
237
+ // 2. 用 filterList 中的空数组覆盖 reqOptions 已获取的正确数据
238
+ if (filterItem && filterItem.options !== undefined && filterItem.options !== groupItem.options) {
239
+ this.$set(groupItem, 'options', filterItem.options)
240
+ }
241
+ })
242
+ },
243
+ deep: true
228
244
  }
229
245
  },
230
246
  created() {
@@ -96,7 +96,10 @@
96
96
  <slot name="prefix"></slot>
97
97
  </div>
98
98
  <!-- 使用作用域插槽传递 searchValue -->
99
- <template v-for="filter in filterList.filter((item) => item.type === 'slot' && $scopedSlots[item.slotName])" #[filter.slotName]="{ model }">
99
+ <template
100
+ v-for="filter in filterList.filter((item) => item.type === 'slot' && $scopedSlots[item.slotName])"
101
+ #[filter.slotName]="{ model }"
102
+ >
100
103
  <slot
101
104
  :name="filter.slotName"
102
105
  :model="model"
@@ -145,7 +148,10 @@
145
148
  @saveCheckData="saveCheckData"
146
149
  >
147
150
  <!-- 使用作用域插槽传递 searchValue -->
148
- <template v-for="filter in filterList.filter((item) => item.type === 'slot' && $scopedSlots[item.slotName])" #[filter.slotName]="{ model }">
151
+ <template
152
+ v-for="filter in filterList.filter((item) => item.type === 'slot' && $scopedSlots[item.slotName])"
153
+ #[filter.slotName]="{ model }"
154
+ >
149
155
  <slot
150
156
  :name="filter.slotName"
151
157
  :model="model"
@@ -299,16 +305,27 @@ export default {
299
305
  watch: {
300
306
  initialValue: {
301
307
  handler(newVal) {
302
- // initialValue 发生变化时,更新 searchValue
303
- // 保留 slot 类型的字段默认值,合并新的 initialValue 值
308
+ if (!newVal) return
304
309
 
305
- this.searchValue = { ...this.getInitialSearchValue, ...newVal }
310
+ // 智能合并:保留用户已手动修改的值
311
+ // 策略:只有当 searchValue 的值等于初始值时,才用 newVal 更新
312
+ const mergedValue = { ...this.searchValue }
313
+
314
+ Object.keys(newVal || {}).forEach((key) => {
315
+ // 只有当前值与初始值相同时才更新(说明用户没修改过)
316
+ // 或者 searchValue 中没有这个字段
317
+ if (this.searchValue[key] === undefined || this.searchValue[key] === this.getInitialSearchValue[key]) {
318
+ this.$set(mergedValue, key, newVal[key])
319
+ }
320
+ // 否则保留用户已修改的值
321
+ })
322
+
323
+ this.searchValue = mergedValue
306
324
  },
307
325
  deep: true,
308
326
  immediate: false
309
327
  }
310
328
  },
311
- created() {},
312
329
  mounted() {
313
330
  // 只有在有 bussId 时才获取视图列表
314
331
  if (this.bussId) {
@@ -486,6 +503,10 @@ export default {
486
503
 
487
504
  const hasEmptyValue = this.conditionGroups.some((group) =>
488
505
  group.conditions.some((condition) => {
506
+ // operator 5(为空) 和 6(不为空) 不需要填写 value
507
+ if (condition.operator === 5 || condition.operator === 6) {
508
+ return false
509
+ }
489
510
  const val = condition.value
490
511
  return val === null || val === undefined || val === '' || (Array.isArray(val) && val.length === 0)
491
512
  })
@@ -1,4 +1,4 @@
1
- @import '@/assets/css/element-variables.scss';
1
+ @import '../../assets/css/element-variables.scss';
2
2
  .el-table div.hidden-columns {
3
3
  visibility: initial;
4
4
  position: initial;
@@ -159,7 +159,7 @@
159
159
  </vxe-colgroup>
160
160
  <vxe-column
161
161
  v-else-if="item.formatter"
162
- :key="'vxe-table-base__column' + i"
162
+ :key="'vxe-table-base__column_formatter' + i"
163
163
  :class-name="`${item.wrap && `vxe-table-custom-wrap`} ${item.bold && `font-w600`}`"
164
164
  :formatter="item.formatter ? item.formatter : 'formatName'"
165
165
  :filters="item.filters"
@@ -561,6 +561,10 @@ export default {
561
561
  exportFn: {
562
562
  type: Function,
563
563
  default: null
564
+ },
565
+ operateColumnWidth: {
566
+ type: Number,
567
+ default: 180
564
568
  }
565
569
  },
566
570
  data() {
@@ -637,10 +641,6 @@ export default {
637
641
  const hasExpand = this.$attrs.treeConfig || this.$attrs['tree-config']
638
642
  const activeCount = [this.showColumn, this.showSetsize, hasExpand].filter(Boolean).length
639
643
  return activeCount === 3 ? 112 : 76
640
- },
641
- // 固定操作列宽度
642
- operateColumnWidth() {
643
- return 180
644
644
  }
645
645
  },
646
646
  watch: {