优化客户端请求时候操作的页面不更新
This commit is contained in:
@@ -226,19 +226,19 @@ export async function getDocuments(searchParams: DocumentSearchParams = {}): Pro
|
||||
// 处理日期范围
|
||||
if (searchParams.dateFrom) {
|
||||
// 添加当天开始时间 00:00:00
|
||||
filter['created_at'] = `gte.${searchParams.dateFrom + ' 00:00:00'}`;
|
||||
filter['updated_at'] = `gte.${searchParams.dateFrom + ' 00:00:00'}`;
|
||||
}
|
||||
|
||||
if (searchParams.dateTo) {
|
||||
// 如果有开始日期,使用and条件;否则直接设置结束日期
|
||||
const dateToKey = searchParams.dateFrom ? 'and' : 'created_at';
|
||||
const dateToKey = searchParams.dateFrom ? 'and' : 'updated_at';
|
||||
// 添加当天结束时间 23:59:59
|
||||
if (dateToKey === 'and') {
|
||||
delete filter['created_at'];
|
||||
delete filter['updated_at'];
|
||||
// 使用OR操作符连接两个条件
|
||||
filter[dateToKey] = `(created_at.gte.${searchParams.dateFrom+' 00:00:00'},created_at.lte.${searchParams.dateTo+' 23:59:59'})`;
|
||||
filter[dateToKey] = `(updated_at.gte.${searchParams.dateFrom+' 00:00:00'},updated_at.lte.${searchParams.dateTo+' 23:59:59'})`;
|
||||
} else {
|
||||
filter['created_at'] = `lte.${searchParams.dateTo+' 23:59:59'}`;
|
||||
filter['updated_at'] = `lte.${searchParams.dateTo+' 23:59:59'}`;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user