feat: 用户添加字段排序

This commit is contained in:
ray
2024-11-19 00:03:19 +08:00
parent 4f592cb812
commit 3e496f75d7
2 changed files with 15 additions and 4 deletions

View File

@@ -175,8 +175,11 @@ export interface UserPageQuery extends PageQuery {
/** 开始时间 */
createTime?: [string, string];
/** 排序类型(1:最近创建2:最近更新) */
sortType?: number;
/** 排序字段 */
field?: string;
/** 排序方式(asc:正序,desc:倒序) */
direction?: string;
}
/** 用户分页对象 */

View File

@@ -119,7 +119,6 @@ const dataList = ref<UserPageVO[]>([]);
const queryParams: UserPageQuery = {
pageNum: 1,
pageSize: 10,
sortType: 1,
};
const daterange = ref<any[]>(["", Date.now()]);
@@ -175,9 +174,18 @@ const sortOptions = ref<Record<string, any>[]>([
/**
* 排序改变
*/
const handleSortChange = (value: number) => {
const handleSortChange = ({ value }: { value: number }) => {
console.log("排序", value);
queryParams.pageNum = 1;
if (value === 1) {
queryParams.field = "create_time";
queryParams.direction = "DESC";
} else if (value === 2) {
queryParams.field = "update_time";
queryParams.direction = "DESC";
}
loadmore();
};