From 7c9ce8a097b770c9b87d4a51ab5dce191977dc12 Mon Sep 17 00:00:00 2001 From: lion <120344285@qq.com> Date: Wed, 5 Aug 2026 10:32:03 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B4=BB=E5=8A=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/activities/ActivityList.vue | 49 +++++++-- src/views/activities/Registrations.vue | 47 +++++--- src/views/activities/Verify.vue | 144 ++++++++++++++++++++++--- 3 files changed, 206 insertions(+), 34 deletions(-) diff --git a/src/views/activities/ActivityList.vue b/src/views/activities/ActivityList.vue index 921cba5..34325b3 100644 --- a/src/views/activities/ActivityList.vue +++ b/src/views/activities/ActivityList.vue @@ -136,8 +136,14 @@ const filters = reactive({ is_active: undefined as '1' | '0' | undefined, schedule_status: undefined as 'not_started' | 'ongoing' | 'ended' | undefined, audit_status: undefined as 'approved' | 'pending' | 'rejected' | undefined, - /** 活动开始日期区间 [start, end] YYYY-MM-DD */ - dateRange: undefined as string[] | undefined, + /** 活动开始日 ≥ */ + start_at_from: undefined as string | undefined, + /** 活动开始日 ≤(可空) */ + start_at_to: undefined as string | undefined, + /** 活动结束日 ≥ */ + end_at_from: undefined as string | undefined, + /** 活动结束日 ≤(可空) */ + end_at_to: undefined as string | undefined, }) const exportActivitiesLoading = ref(false) @@ -152,8 +158,10 @@ function buildActivitiesListParams(page: number, pageSize: number) { is_active: filters.is_active, schedule_status: filters.schedule_status, audit_status: filters.audit_status, - start_date: filters.dateRange?.[0] || undefined, - end_date: filters.dateRange?.[1] || undefined, + start_at_from: filters.start_at_from || undefined, + start_at_to: filters.start_at_to || undefined, + end_at_from: filters.end_at_from || undefined, + end_at_to: filters.end_at_to || undefined, } } @@ -1022,7 +1030,7 @@ const activityListScrollX = computed(() => { let w = 50 + 220 + - 200 + + 280 + 130 + 100 + 80 + @@ -2143,12 +2151,33 @@ async function removeActivity(row: Activity) { 待审核 已退回 - + + + 查询 新增活动 @@ -2178,7 +2207,7 @@ async function removeActivity(row: Activity) { :ellipsis="true" :tooltip="true" /> - + diff --git a/src/views/activities/Registrations.vue b/src/views/activities/Registrations.vue index 6ef21e9..8416792 100644 --- a/src/views/activities/Registrations.vue +++ b/src/views/activities/Registrations.vue @@ -73,6 +73,8 @@ const venuesList = ref([]) const filterVenueId = ref(undefined) const filterActivityId = ref(undefined) const activityOptions = ref<{ label: string; value: number }[]>([]) +const activitySearchLoading = ref(false) +let activitySearchTimer: ReturnType | null = null function isSuperAdmin() { return currentUser.value?.full_admin_access === true @@ -97,23 +99,39 @@ async function loadVenuesAndActivities() { await loadActivityOptions() } -async function loadActivityOptions() { +async function loadActivityOptions(keyword = '') { + activitySearchLoading.value = true try { - const params: Record = { page: 1, page_size: 500 } + const params: Record = { limit: 500 } + const kw = keyword.trim() + if (kw) params.keyword = kw if (isSuperAdmin() && filterVenueId.value != null && filterVenueId.value > 0) { params.venue_id = filterVenueId.value } - const { data } = await http.get('/activities', { params }) - const list = data?.data ?? [] - activityOptions.value = list.map((a: { id: number; title: string }) => ({ - label: a.title, - value: a.id, - })) + const { data } = await http.get('/activities/options', { params }) + const list = (data?.data ?? []) as { id: number; title: string }[] + const mapped = list.map((a) => ({ label: a.title, value: a.id })) + // 已选活动不在本次结果中时保留,避免回显丢失 + const selectedId = filterActivityId.value + if (selectedId != null && selectedId > 0 && !mapped.some((o) => o.value === selectedId)) { + const prev = activityOptions.value.find((o) => o.value === selectedId) + if (prev) mapped.unshift(prev) + } + activityOptions.value = mapped } catch { activityOptions.value = [] + } finally { + activitySearchLoading.value = false } } +function onActivitySelectSearch(value: string) { + if (activitySearchTimer) clearTimeout(activitySearchTimer) + activitySearchTimer = setTimeout(() => { + void loadActivityOptions(value) + }, 300) +} + /** 列表与导出共用:不含分页参数 */ function activityRegistrationsQueryParams(): Record { const params: Record = { @@ -240,8 +258,9 @@ function onPageChange(p: number) { v-if="isSuperAdmin()" v-model="filterVenueId" allow-clear - placeholder="全部场馆" - style="width: 200px" + allow-search + placeholder="搜索或选择场馆" + style="width: 220px" > {{ v.name }} @@ -249,9 +268,13 @@ function onPageChange(p: number) { v-model="filterActivityId" allow-clear allow-search - placeholder="全部活动" - style="width: 260px" + :filter-option="false" + :loading="activitySearchLoading" + placeholder="搜索或选择活动" + style="width: 280px" + @search="onActivitySelectSearch" @change="onSearch" + @clear="() => loadActivityOptions()" > {{ opt.label }} diff --git a/src/views/activities/Verify.vue b/src/views/activities/Verify.vue index f16d6ce..cd047ac 100644 --- a/src/views/activities/Verify.vue +++ b/src/views/activities/Verify.vue @@ -1,5 +1,5 @@