Skip to content

Commit

Permalink
Feat: admin room list filter
Browse files Browse the repository at this point in the history
  • Loading branch information
LazyCreeper committed Dec 12, 2023
1 parent 8787230 commit 22b28f7
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 26 deletions.
5 changes: 4 additions & 1 deletion src/services/apis/admin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -258,6 +258,9 @@ export const roomListApi = useDefineApi<
max: number;
sort: string;
order: string;
search: string;
keyword: string;
status: string;
};
},
{
Expand Down Expand Up @@ -341,4 +344,4 @@ export const assignSettingApi = useDefineApi<
Record<string, Record<string, any>>
>({
method: "GET"
});
});
62 changes: 37 additions & 25 deletions src/views/admin/settings/RoomsManager.vue
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ const order = ref("desc");
const sort = ref("createdAt");
const keyword = ref("");
const search = ref("all");
const status = ref("");
const { state, execute: reqRoomListApi, isLoading: roomListLoading } = roomListApi();
const getRoomListApi = async () => {
try {
Expand All @@ -35,7 +36,8 @@ const getRoomListApi = async () => {
sort: sort.value,
order: order.value,
search: search.value,
keyword: keyword.value
keyword: keyword.value,
status: status.value
}
});
if (state.value) {
Expand Down Expand Up @@ -117,30 +119,40 @@ onMounted(async () => {
<div>
{{ props.title }}
</div>

<el-input
class="w-fit max-lg:w-full max-xl:my-2"
v-model="keyword"
placeholder="搜索"
@keyup.enter="getRoomListApi()"
required
>
<template #prepend>
<el-select
v-model="search"
@change="getRoomListApi()"
placeholder="Select"
style="width: 90px"
>
<el-option label="综合" value="all" />
<el-option label="名称" value="name" />
<el-option label="ID" value="roomId" />
</el-select>
</template>
<template #append>
<el-button :icon="Search" @click="getRoomListApi()" />
</template>
</el-input>
<div>
<el-select
v-model="status"
placeholder="状态"
style="width: 100px"
@change="getRoomListApi()"
>
<el-option label="ALL" value="" />
<el-option v-for="r in Object.values(roomStatus)" :label="r" :value="r.toLowerCase()" />
</el-select>
<el-input
class="w-fit max-lg:w-full max-xl:my-2"
v-model="keyword"
placeholder="搜索"
@keyup.enter="getRoomListApi()"
required
>
<template #prepend>
<el-select
v-model="search"
@change="getRoomListApi()"
placeholder="Select"
style="width: 90px"
>
<el-option label="综合" value="all" />
<el-option label="名称" value="name" />
<el-option label="ID" value="roomId" />
</el-select>
</template>
<template #append>
<el-button :icon="Search" @click="getRoomListApi()" />
</template>
</el-input>
</div>

<div class="text-base max-xl:w-full">
排序方式:<el-select
Expand Down

0 comments on commit 22b28f7

Please sign in to comment.