fix(alarm-page): reset pagination when click search after fields chenge

This commit is contained in:
yangsy
2025-11-03 15:37:22 +08:00
parent 9b2f22be37
commit fb78c7a837

View File

@@ -42,6 +42,7 @@ const searchFields = reactive({
// deviceId_likeRight: '',
alarmDate: [dayjs().startOf('date').valueOf(), dayjs().endOf('date').valueOf()] as [number, number],
});
const searchFieldsChanged = ref(false);
const resetSearchFields = () => {
searchFields.stationCode_in = [];
@@ -90,6 +91,10 @@ const onDateChange = (value: [number, number] | null) => {
}
};
watch(searchFields, () => {
searchFieldsChanged.value = true;
});
const tableColumns: DataTableColumns<NdmDeviceAlarmLogResultVO> = [
{ title: '告警流水号', key: 'alarmNo' },
{
@@ -226,7 +231,14 @@ const onClickReset = () => {
tablePagination.itemCount = 0;
getAlarmList();
};
const onClickQuery = () => getAlarmList();
const onClickQuery = () => {
if (searchFieldsChanged.value) {
tablePagination.page = 1;
tablePagination.pageSize = 10;
searchFieldsChanged.value = false;
}
getAlarmList();
};
const { mutate: downloadTableData, isPending: isDownloading } = useMutation({
mutationFn: async () => {