From c242435c067dfa16cdf0989eca6827ab12e228ee Mon Sep 17 00:00:00 2001 From: chenwenchang <479999519@qq.com> Date: Wed, 9 Oct 2024 16:22:05 +0800 Subject: [PATCH] =?UTF-8?q?feat(frontend):=20=E8=B5=84=E6=BA=90=E6=B1=A0?= =?UTF-8?q?=E7=BB=9F=E8=AE=A1=E8=A7=86=E5=9B=BE=20#6519=20#=20Reviewed,=20?= =?UTF-8?q?transaction=20id:=2020037?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../host-list/components/search-box/Index.vue | 30 ++++++++++--------- .../pool/summary-view/components/List.vue | 6 +++- 2 files changed, 21 insertions(+), 15 deletions(-) diff --git a/dbm-ui/frontend/src/views/resource-manage/pool/host-list/components/search-box/Index.vue b/dbm-ui/frontend/src/views/resource-manage/pool/host-list/components/search-box/Index.vue index e722e5945b..53adb89878 100644 --- a/dbm-ui/frontend/src/views/resource-manage/pool/host-list/components/search-box/Index.vue +++ b/dbm-ui/frontend/src/views/resource-manage/pool/host-list/components/search-box/Index.vue @@ -68,21 +68,23 @@ const config = fieldConfig[fieldName as keyof typeof fieldConfig]; const value = route.query[fieldName] as string; - if (config && value) { - switch (config.type) { - case 'array': - searchParams.value[fieldName] = value.split(','); - break; - case 'rang': - searchParams.value[fieldName] = value.split('-'); - break; - case 'number': - searchParams.value[fieldName] = Number(value); - break; - default: - searchParams.value[fieldName] = value; - } + if (!config) { + return; } + + if (value === '') { + delete searchParams.value[fieldName]; + return; + } + + const typeHandlers = { + array: () => value.split(','), + rang: () => value.split('-'), + number: () => Number(value), + string: () => value, + }; + + searchParams.value[fieldName] = typeHandlers[config.type](); }); }; diff --git a/dbm-ui/frontend/src/views/resource-manage/pool/summary-view/components/List.vue b/dbm-ui/frontend/src/views/resource-manage/pool/summary-view/components/List.vue index 4280f4e5f3..0b9e3cbf95 100644 --- a/dbm-ui/frontend/src/views/resource-manage/pool/summary-view/components/List.vue +++ b/dbm-ui/frontend/src/views/resource-manage/pool/summary-view/components/List.vue @@ -15,6 +15,7 @@ ref="loadingRef" :loading="loading"> ([]); @@ -135,11 +137,13 @@ const handleChangeDimension = (value: string) => { dimension.value = value; + handleChangePage(1); fetchListData(); }; const handleChangePage = (value: number) => { pagination.value.current = value; + tableRef.value.scrollTo(0, 0); }; const handeChangeLimit = (value: number) => { @@ -152,7 +156,7 @@ for_biz: row.dedicated_biz, resource_type: getSearchParams().db_type, city: row.city, - subzone_ids: subzoneId, + subzone_ids: subzoneId || '', spec_id: row.spec_id, device_class: row.device_class, mount_point: row.disk_summary?.[0].mount_point,