n20-common-lib 3.2.0 → 3.2.1

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.0",
3
+ "version": "3.2.1",
4
4
  "private": false,
5
5
  "scripts": {
6
6
  "serve": "vue-cli-service serve",
@@ -14,11 +14,17 @@ export default {
14
14
  column: {
15
15
  type: Number,
16
16
  default: 2
17
+ },
18
+ autoResize: {
19
+ type: Boolean,
20
+ default: true
17
21
  }
18
22
  },
19
23
  created() {
20
- this.resize()
21
- window.addEventListener('resize', this.resize)
24
+ if (this.autoResize) {
25
+ this.resize()
26
+ window.addEventListener('resize', this.resize)
27
+ }
22
28
  },
23
29
  beforeDestroy() {
24
30
  window.removeEventListener('resize', this.resize)
@@ -325,20 +325,32 @@ export default {
325
325
  return obj
326
326
  },
327
327
  filterObj() {
328
- // 合并 slot 类型筛选器的值(来自 initialValue)到 searchValue 中
329
- const slotValues = {}
330
- this.filterList
331
- .filter((item) => item.type === 'slot' && item.value)
332
- .forEach((item) => {
333
- if (this.initialValue && this.initialValue[item.value] !== undefined) {
334
- slotValues[item.value] = this.initialValue[item.value]
335
- }
328
+ const filterKeys = new Set()
329
+ 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)
336
339
  })
340
+ })
341
+
342
+ const extraInitialValues = {}
343
+ Object.keys(this.initialValue || {}).forEach((key) => {
344
+ if (!filterKeys.has(key)) {
345
+ extraInitialValues[key] = this.initialValue[key]
346
+ }
347
+ })
348
+
337
349
  return {
338
350
  // 高级查询组合
339
351
  conditionGroups: this.conditionGroups,
340
- // 筛选条件(合并 slot 类型的值)
341
- searchValue: { ...this.searchValue, ...slotValues },
352
+ // 筛选条件:保留 initialValue 中的额外业务参数,但不覆盖视图自身的筛选字段
353
+ searchValue: { ...extraInitialValues, ...this.searchValue },
342
354
  // 视图id
343
355
  viewId: this.selectItem ? this.selectItem.viewId : null,
344
356
  // 视图类型
@@ -706,13 +718,13 @@ export default {
706
718
  this.selectedItem = item.viewName
707
719
  if (item.viewName === '无视图') {
708
720
  this.selectItem = ''
709
- this.searchValue = {}
721
+ this.searchValue = { ...this.getInitialSearchValue, ...this.initialValue }
710
722
  this.conditionGroups = []
711
723
  }
712
724
  if (item.viewType === VIEW_TYPE.ADVANCED) {
713
725
  const config = this.safeParse(item.viewConfig)
714
726
  this.searchForm = config
715
- this.searchValue = config
727
+ this.searchValue = { ...this.getInitialSearchValue, ...config }
716
728
  } else if (item.viewType === VIEW_TYPE.BASIC) {
717
729
  this.conditionGroups = this.safeParse(item.viewConfig).conditionGroups || []
718
730
  this.searchValue = { ...this.getInitialSearchValue }
@@ -494,6 +494,7 @@ export default {
494
494
  // sessionStorage 不可用时忽略
495
495
  }
496
496
  const row = {
497
+ ...item,
497
498
  [this.keys.type]: item.type || item.attno,
498
499
  [this.keys.user]: uname
499
500
  }