refactor(stock): 重构组件的过滤参数处理逻辑

- 将单一的 filterParams 对象拆分为多个键值对,分别存储操作符和值
- 优化了过滤参数的处理方式,提高了代码可读性和可维护性
This commit is contained in:
user 2025-03-20 11:06:43 +08:00
parent 71e4414b06
commit 1e9ab24918

View File

@ -73,7 +73,8 @@ export default defineComponent({
const processedParams = showFilter.value
? Object.entries(filterParams.value).reduce((acc, [key, filterParam]) => {
if (filterParam.value !== null && filterParam.value !== '') {
acc[key] = encodeURIComponent(JSON.stringify({ op: filterParam.op, value: filterParam.value }));
acc[`${key}[op]`] = filterParam.op;
acc[`${key}[value]`] = filterParam.value;
}
return acc;
}, {})