账单导出
This commit is contained in:
@@ -99,7 +99,10 @@ function SearchForm<T extends Record<string, any> = any>(props: SearchFormProps<
|
||||
|
||||
const resetButton = (
|
||||
<Button
|
||||
onClick={() => form.resetFields()}
|
||||
onClick={() => {
|
||||
form.resetFields();
|
||||
form.submit();
|
||||
}}
|
||||
{...submitter?.resetButtonProps}
|
||||
>
|
||||
{submitter?.resetText || t('xin.table.search.reset')}
|
||||
|
||||
@@ -225,7 +225,7 @@ export default function XinTable<T extends Record<string, any> = any>(props: Xin
|
||||
// 移除 空值
|
||||
Object.keys(searchValues).forEach((key) => {
|
||||
const value = searchValues[key];
|
||||
if (value === '' || value === undefined || value === null) {
|
||||
if (value === '' || value === undefined || value === null || (isArray(value) && value.length === 0)) {
|
||||
delete searchValues[key];
|
||||
} else if (dayjs.isDayjs(value)) {
|
||||
dateSearch[key] = value.format('YYYY-MM-DD');
|
||||
@@ -235,12 +235,14 @@ export default function XinTable<T extends Record<string, any> = any>(props: Xin
|
||||
delete searchValues[key];
|
||||
}
|
||||
});
|
||||
const params: RequestParams = {
|
||||
...requestParams,
|
||||
...searchValues,
|
||||
...dateSearch,
|
||||
page: 1,
|
||||
};
|
||||
const params: RequestParams = { ...requestParams };
|
||||
// 先移除上一次搜索条件,再写入当前表单值,避免清空或重置后旧条件仍留在请求中
|
||||
columns.forEach((column) => {
|
||||
if (!column.hideInSearch && column.dataIndex) {
|
||||
delete params[String(column.dataIndex)];
|
||||
}
|
||||
});
|
||||
Object.assign(params, searchValues, dateSearch, { page: 1 });
|
||||
setRequestParams(params);
|
||||
await handleRequest(params);
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user