refactor:
- extend NdmDeviceAlarmLogVO - only query alarm counts - separate request and store update in useQuery - refactor station card and alarm modal, data fetching is now inside modal - optimize device tree - optimize query station list - make export size follow page size - fix query sequence and make them follow stations -> devices -> alarms
This commit is contained in:
@@ -1,7 +1,6 @@
|
||||
<script setup lang="ts">
|
||||
import type { NdmDeviceAlarmLogResultVO } from '@/apis/models';
|
||||
import { ndmDeviceAlarmLogDefaultExportByTemplate, postNdmDeviceAlarmLogPage } from '@/apis/requests';
|
||||
import { JAVA_INTEGER_MAX_VALUE } from '@/constants';
|
||||
import { DeviceType, DeviceTypeCode, DeviceTypeName, type DeviceTypeVal } from '@/enums/device-type';
|
||||
import { useCurrentAlarmsStore } from '@/stores/current-alarms';
|
||||
import { useStationStore } from '@/stores/station';
|
||||
@@ -140,18 +139,18 @@ const { mutate: getAlarmList, isPending: isTableLoading } = useMutation({
|
||||
alarmDate_ge: searchFields.alarmDate[0],
|
||||
alarmDate_le: searchFields.alarmDate[1],
|
||||
},
|
||||
size: tablePagination.pageSize!,
|
||||
current: tablePagination.page!,
|
||||
sort: 'id',
|
||||
current: tablePagination.page ?? 1,
|
||||
size: tablePagination.pageSize ?? 10,
|
||||
order: 'descending',
|
||||
sort: 'id',
|
||||
});
|
||||
return res;
|
||||
},
|
||||
onSuccess: (res) => {
|
||||
const { records, pages, size, total } = res;
|
||||
tablePagination.pageSize = parseInt(size);
|
||||
tablePagination.pageCount = parseInt(pages);
|
||||
tablePagination.itemCount = parseInt(total);
|
||||
return records;
|
||||
},
|
||||
onSuccess: (records) => {
|
||||
tableData.value = records;
|
||||
},
|
||||
onError: (error) => {
|
||||
@@ -180,10 +179,10 @@ const { mutate: downloadTableData, isPending: isDownloading } = useMutation({
|
||||
alarmDate_ge: searchFields.alarmDate[0],
|
||||
alarmDate_le: searchFields.alarmDate[1],
|
||||
},
|
||||
current: 1,
|
||||
size: JAVA_INTEGER_MAX_VALUE,
|
||||
sort: 'id',
|
||||
current: tablePagination.page ?? 1,
|
||||
size: tablePagination.pageSize ?? 10,
|
||||
order: 'descending',
|
||||
sort: 'id',
|
||||
});
|
||||
return data;
|
||||
},
|
||||
@@ -255,7 +254,7 @@ onBeforeMount(() => getAlarmList());
|
||||
|
||||
<!-- 表格区域:填满剩余空间 -->
|
||||
<div style="flex: 1 1 auto; min-height: 0; padding: 8px">
|
||||
<NDataTable remote :columns="tableColumns" :data="tableData" :pagination="tablePagination" :loading="isTableLoading" :single-line="false" flex-height style="height: 100%" />
|
||||
<NDataTable :loading="isTableLoading" :columns="tableColumns" :data="tableData" :pagination="tablePagination" :single-line="false" remote flex-height style="height: 100%" />
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
Reference in New Issue
Block a user