n20-common-lib 3.0.49 → 3.0.51
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
|
@@ -219,6 +219,11 @@ export default {
|
|
|
219
219
|
initialValue: {
|
|
220
220
|
type: Object,
|
|
221
221
|
default: () => ({})
|
|
222
|
+
},
|
|
223
|
+
// 外部表单对象,用于同步 slot 类型筛选器的值
|
|
224
|
+
outerForm: {
|
|
225
|
+
type: Object,
|
|
226
|
+
default: () => ({})
|
|
222
227
|
}
|
|
223
228
|
},
|
|
224
229
|
data() {
|
|
@@ -270,11 +275,20 @@ export default {
|
|
|
270
275
|
return obj
|
|
271
276
|
},
|
|
272
277
|
filterObj() {
|
|
278
|
+
// 合并 slot 类型筛选器的值(来自外部 form)到 searchValue 中
|
|
279
|
+
const slotValues = {}
|
|
280
|
+
this.filterList
|
|
281
|
+
.filter((item) => item.type === 'slot' && item.value)
|
|
282
|
+
.forEach((item) => {
|
|
283
|
+
if (this.outerForm && this.outerForm[item.value] !== undefined) {
|
|
284
|
+
slotValues[item.value] = this.outerForm[item.value]
|
|
285
|
+
}
|
|
286
|
+
})
|
|
273
287
|
return {
|
|
274
288
|
// 高级查询组合
|
|
275
289
|
conditionGroups: this.conditionGroups,
|
|
276
|
-
//
|
|
277
|
-
searchValue: this.searchValue,
|
|
290
|
+
// 筛选条件(合并 slot 类型的值)
|
|
291
|
+
searchValue: { ...this.searchValue, ...slotValues },
|
|
278
292
|
// 视图id
|
|
279
293
|
viewId: this.selectItem ? this.selectItem.viewId : null,
|
|
280
294
|
// 视图类型
|
|
@@ -287,6 +301,7 @@ export default {
|
|
|
287
301
|
handler(newVal) {
|
|
288
302
|
// 当 initialValue 发生变化时,更新 searchValue
|
|
289
303
|
// 保留 slot 类型的字段默认值,合并新的 initialValue 值
|
|
304
|
+
|
|
290
305
|
this.searchValue = { ...this.getInitialSearchValue, ...newVal }
|
|
291
306
|
},
|
|
292
307
|
deep: true,
|
|
@@ -319,7 +334,21 @@ export default {
|
|
|
319
334
|
})
|
|
320
335
|
},
|
|
321
336
|
changeFn(value) {
|
|
322
|
-
|
|
337
|
+
let obj = value
|
|
338
|
+
const filter = this.filterList.find((item) => item.value === value.field)
|
|
339
|
+
if (filter?.type === 'daterange') {
|
|
340
|
+
obj.value = {
|
|
341
|
+
[filter.startDate]: this.filterObj.searchValue?.[filter.startDate],
|
|
342
|
+
[filter.endDate]: this.filterObj.searchValue?.[filter.endDate]
|
|
343
|
+
}
|
|
344
|
+
}
|
|
345
|
+
if (filter?.type === 'numberrange') {
|
|
346
|
+
obj.value = {
|
|
347
|
+
[filter.startValue]: this.filterObj.searchValue?.[filter.startValue],
|
|
348
|
+
[filter.endValue]: this.filterObj.searchValue?.[filter.endValue]
|
|
349
|
+
}
|
|
350
|
+
}
|
|
351
|
+
this.$emit('changeFn', obj)
|
|
323
352
|
},
|
|
324
353
|
filterFn() {
|
|
325
354
|
this.$emit('filter', this.filterObj, 'filter')
|