format
This commit is contained in:
@@ -41,7 +41,7 @@ const tableColumns: DataTableColumns<NdmDeviceAlarmLogResultVO> = [
|
||||
|
||||
const tableData = ref<DataTableRowData[]>([]);
|
||||
const DEFAULT_PAGE_SIZE = 10;
|
||||
const tablePagination = reactive<PaginationProps>({
|
||||
const pagination = reactive<PaginationProps>({
|
||||
size: 'small',
|
||||
showSizePicker: true,
|
||||
page: 1,
|
||||
@@ -52,12 +52,12 @@ const tablePagination = reactive<PaginationProps>({
|
||||
return h('div', {}, { default: () => `共${itemCount}条` });
|
||||
},
|
||||
onUpdatePage: (page: number) => {
|
||||
tablePagination.page = page;
|
||||
pagination.page = page;
|
||||
getDeviceAlarmLogList();
|
||||
},
|
||||
onUpdatePageSize: (pageSize: number) => {
|
||||
tablePagination.pageSize = pageSize;
|
||||
tablePagination.page = 1;
|
||||
pagination.pageSize = pageSize;
|
||||
pagination.page = 1;
|
||||
getDeviceAlarmLogList();
|
||||
},
|
||||
});
|
||||
@@ -68,8 +68,8 @@ const { mutate: getDeviceAlarmLogList, isPending } = useMutation({
|
||||
const alarmDate_ge = dateTimeRange.value[0];
|
||||
const alarmDate_le = dateTimeRange.value[1];
|
||||
const restParams: Omit<PageParams<{ id: string }>, 'model' | 'extra'> = {
|
||||
current: tablePagination.page ?? 1,
|
||||
size: tablePagination.pageSize ?? DEFAULT_PAGE_SIZE,
|
||||
current: pagination.page ?? 1,
|
||||
size: pagination.pageSize ?? DEFAULT_PAGE_SIZE,
|
||||
sort: 'id',
|
||||
order: 'descending',
|
||||
};
|
||||
@@ -81,8 +81,8 @@ const { mutate: getDeviceAlarmLogList, isPending } = useMutation({
|
||||
return res;
|
||||
},
|
||||
onSuccess: ({ records, size, total }) => {
|
||||
tablePagination.pageSize = parseInt(size);
|
||||
tablePagination.itemCount = parseInt(total);
|
||||
pagination.pageSize = parseInt(size);
|
||||
pagination.itemCount = parseInt(total);
|
||||
tableData.value = records;
|
||||
},
|
||||
onError: (error) => {
|
||||
@@ -94,8 +94,8 @@ const { mutate: getDeviceAlarmLogList, isPending } = useMutation({
|
||||
defineExpose({
|
||||
isPending,
|
||||
refresh: () => {
|
||||
tablePagination.page = 1;
|
||||
tablePagination.pageSize = DEFAULT_PAGE_SIZE;
|
||||
pagination.page = 1;
|
||||
pagination.pageSize = DEFAULT_PAGE_SIZE;
|
||||
getDeviceAlarmLogList();
|
||||
},
|
||||
});
|
||||
@@ -103,7 +103,7 @@ defineExpose({
|
||||
|
||||
<template>
|
||||
<NCard size="small" title="设备告警记录">
|
||||
<NDataTable size="small" :loading="isPending" :columns="tableColumns" :data="tableData" :pagination="tablePagination" :single-line="false" remote flex-height style="height: 500px" />
|
||||
<NDataTable size="small" :loading="isPending" :columns="tableColumns" :data="tableData" :pagination="pagination" :single-line="false" remote flex-height style="height: 500px" />
|
||||
</NCard>
|
||||
</template>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user