Skip to content

Commit

Permalink
feat(frontend): 资源池统计视图 TencentBlueKing#6519
Browse files Browse the repository at this point in the history
# Reviewed, transaction id: 20037
  • Loading branch information
JustaCattt committed Oct 9, 2024
1 parent 477a5d2 commit e101c91
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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]();
});
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
ref="loadingRef"
:loading="loading">
<BkTable
ref="tableRef"
class="summary-view-table"
:data="tableData"
:pagination="pagination"
Expand Down Expand Up @@ -100,6 +101,7 @@
const loadingRef = ref();
const dimension = ref('spec');
const tableRef = ref();
const pagination = ref(useDefaultPagination());
const isAnomalies = ref(false);
const allTableData = shallowRef<SummaryModel[]>([]);
Expand Down Expand Up @@ -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) => {
Expand All @@ -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,
Expand Down

0 comments on commit e101c91

Please sign in to comment.