fix(vimp-log-page): reset pagination when click search after fields chenge
This commit is contained in:
@@ -74,6 +74,7 @@ const searchFields = reactive({
|
|||||||
logType_in: [] as number[],
|
logType_in: [] as number[],
|
||||||
createdTime: [dayjs().startOf('date').subtract(1, 'week').format('YYYY-MM-DD HH:mm:ss'), dayjs().endOf('date').format('YYYY-MM-DD HH:mm:ss')] as [string, string],
|
createdTime: [dayjs().startOf('date').subtract(1, 'week').format('YYYY-MM-DD HH:mm:ss'), dayjs().endOf('date').format('YYYY-MM-DD HH:mm:ss')] as [string, string],
|
||||||
});
|
});
|
||||||
|
|
||||||
const resetSearchFields = () => {
|
const resetSearchFields = () => {
|
||||||
searchFields.stationCode = stationList.value.find((station) => station.online)?.code;
|
searchFields.stationCode = stationList.value.find((station) => station.online)?.code;
|
||||||
searchFields.logType_in = [];
|
searchFields.logType_in = [];
|
||||||
@@ -104,21 +105,44 @@ const onDateChange = (value: [number, number] | null) => {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const searchFieldsChanged = ref(false);
|
||||||
|
watch(searchFields, () => {
|
||||||
|
searchFieldsChanged.value = true;
|
||||||
|
});
|
||||||
|
|
||||||
const tableColumns: DataTableColumns<NdmVimpLogResultVO> = [
|
const tableColumns: DataTableColumns<NdmVimpLogResultVO> = [
|
||||||
{ title: '时间', key: 'createdTime' },
|
{ title: '时间', key: 'createdTime' },
|
||||||
{ title: '操作类型', key: 'description' },
|
{ title: '操作类型', key: 'description' },
|
||||||
{ title: '请求IP', key: 'requestIp' },
|
{ title: '请求IP', key: 'requestIp' },
|
||||||
|
{ title: '耗时(ms)', key: 'consumedTime' },
|
||||||
{
|
{
|
||||||
title: '操作参数',
|
title: '操作参数',
|
||||||
key: 'params',
|
key: 'params',
|
||||||
|
width: 100,
|
||||||
render(rowData) {
|
render(rowData) {
|
||||||
const result = JSON.stringify(destr(rowData.params), null, 2);
|
const result = JSON.stringify(destr(rowData.params), null, 2);
|
||||||
return h('pre', {}, { default: () => result });
|
// return h('pre', {}, { default: () => result });
|
||||||
|
return h(
|
||||||
|
NPopover,
|
||||||
|
{ trigger: 'click' },
|
||||||
|
{
|
||||||
|
trigger: () => h(NButton, { size: 'tiny', text: true, type: 'primary' }, { default: () => '查看' }),
|
||||||
|
default: () =>
|
||||||
|
h(
|
||||||
|
NScrollbar,
|
||||||
|
{ style: { maxHeight: '40vh' } },
|
||||||
|
{
|
||||||
|
default: () => h('pre', {}, { default: () => result }),
|
||||||
|
},
|
||||||
|
),
|
||||||
|
},
|
||||||
|
);
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: '操作结果',
|
title: '操作结果',
|
||||||
key: 'result',
|
key: 'result',
|
||||||
|
width: 100,
|
||||||
render: (rowData) => {
|
render: (rowData) => {
|
||||||
const result = JSON.stringify(destr(rowData.result), null, 2);
|
const result = JSON.stringify(destr(rowData.result), null, 2);
|
||||||
return h(
|
return h(
|
||||||
@@ -194,7 +218,14 @@ const onClickReset = () => {
|
|||||||
tablePagination.itemCount = 0;
|
tablePagination.itemCount = 0;
|
||||||
getVimpLogList();
|
getVimpLogList();
|
||||||
};
|
};
|
||||||
const onClickQuery = () => getVimpLogList();
|
const onClickQuery = () => {
|
||||||
|
if (searchFieldsChanged.value) {
|
||||||
|
tablePagination.page = 1;
|
||||||
|
tablePagination.pageSize = 10;
|
||||||
|
searchFieldsChanged.value = false;
|
||||||
|
}
|
||||||
|
getVimpLogList();
|
||||||
|
};
|
||||||
|
|
||||||
const { mutate: downloadTableData, isPending: isDownloading } = useMutation({
|
const { mutate: downloadTableData, isPending: isDownloading } = useMutation({
|
||||||
mutationFn: async () => {
|
mutationFn: async () => {
|
||||||
|
|||||||
Reference in New Issue
Block a user