refactor: reorganize files

This commit is contained in:
yangsy
2025-11-22 01:46:16 +08:00
parent 00a961c346
commit a486f76aaf
148 changed files with 1440 additions and 1170 deletions

View File

@@ -1,5 +1,5 @@
<script setup lang="ts">
import type { NdmCameraResultVO } from '@/apis/models';
import type { NdmCameraResultVO } from '@/apis';
import { DeviceAlarmHistoryDiagCard, DeviceStatusHistoryDiagCard } from '@/components';
import dayjs from 'dayjs';
import { NButton, NCard, NDatePicker, NFlex, NGi, NGrid, NSelect, type DatePickerProps, type SelectOption } from 'naive-ui';

View File

@@ -1,5 +1,5 @@
<script setup lang="ts">
import { postNdmDeviceAlarmLogPage, type NdmDeviceAlarmLogResultVO, type NdmDeviceResultVO, type PageParams } from '@/apis';
import { pageDeviceAlarmLogApi, type NdmDeviceAlarmLogResultVO, type NdmDeviceResultVO, type PageParams } from '@/apis';
import { renderAlarmDateCell, renderAlarmTypeCell, renderFaultDescriptionCell, renderFaultLevelCell } from '@/components';
import { useMutation } from '@tanstack/vue-query';
import { NCard, NDataTable, type DataTableColumns, type DataTableRowData, type DatePickerProps, type PaginationProps } from 'naive-ui';
@@ -86,11 +86,16 @@ const { mutate: getDeviceAlarmLogList, isPending } = useMutation({
sort: 'id',
order: 'descending',
};
const res = await postNdmDeviceAlarmLogPage(stationCode.value, {
model: { deviceId },
extra: { alarmDate_ge, alarmDate_le },
...restParams,
});
const res = await pageDeviceAlarmLogApi(
{
model: { deviceId },
extra: { alarmDate_ge, alarmDate_le },
...restParams,
},
{
stationCode: stationCode.value,
},
);
return res;
},
onSuccess: ({ records, size, total }) => {

View File

@@ -1,5 +1,5 @@
<script setup lang="ts">
import { postIcmpLogPage, type NdmDeviceResultVO, type NdmIcmpLogResultVO, type NdmIcmpLogVO, type PageParams, type PageResult } from '@/apis';
import { pageIcmpLogApi, type NdmDeviceResultVO, type NdmIcmpLogResultVO, type NdmIcmpLog, type PageParams, type PageResult } from '@/apis';
import { formatDuration } from '@/utils';
import { useMutation } from '@tanstack/vue-query';
import dayjs from 'dayjs';
@@ -52,19 +52,29 @@ const { mutate: getDeviceIcmpLogList, isPending } = useMutation({
sort: 'id',
order: 'descending',
};
const currentPageRes = await postIcmpLogPage(stationCode.value, {
model: { deviceId: id },
extra: { createdTime_precisest, createdTime_preciseed },
...restParams,
});
let previousPageRes: PageResult<Partial<NdmIcmpLogVO>> | undefined = undefined;
if ((pagination.page ?? 1) > 1) {
previousPageRes = await postIcmpLogPage(stationCode.value, {
const currentPageRes = await pageIcmpLogApi(
{
model: { deviceId: id },
extra: { createdTime_precisest, createdTime_preciseed },
...restParams,
current: (pagination.page ?? 1) - 1,
});
},
{
stationCode: stationCode.value,
},
);
let previousPageRes: PageResult<Partial<NdmIcmpLog>> | undefined = undefined;
if ((pagination.page ?? 1) > 1) {
previousPageRes = await pageIcmpLogApi(
{
model: { deviceId: id },
extra: { createdTime_precisest, createdTime_preciseed },
...restParams,
current: (pagination.page ?? 1) - 1,
},
{
stationCode: stationCode.value,
},
);
}
return { currentPageRes, previousPageRes };
},

View File

@@ -7,7 +7,7 @@ function getValueByFieldPath(record: Record<string, any>, fieldPath?: string) {
<script setup lang="ts">
import type { NdmDeviceResultVO, NdmSnmpLogResultVO, PageParams } from '@/apis';
import { postSnmpLogPage } from '@/apis';
import { pageSnmpLogApi } from '@/apis';
import { useMutation } from '@tanstack/vue-query';
import dayjs from 'dayjs';
import { destr } from 'destr';
@@ -75,11 +75,16 @@ const { mutate: getDeviceSnmpLogList, isPending } = useMutation({
sort: 'id',
order: 'descending',
};
const respData = await postSnmpLogPage(stationCode.value, {
model: { deviceId },
extra: { createdTime_precisest, createdTime_preciseed },
...restParams,
});
const respData = await pageSnmpLogApi(
{
model: { deviceId },
extra: { createdTime_precisest, createdTime_preciseed },
...restParams,
},
{
stationCode: stationCode.value,
},
);
return respData;
},
onSuccess: ({ records, size, total }) => {

View File

@@ -1,5 +1,5 @@
<script setup lang="ts">
import { postSnmpLogPage, type NdmNvrDiagInfo, type NdmNvrResultVO, type PageParams } from '@/apis';
import { pageSnmpLogApi, type NdmNvrDiagInfo, type NdmNvrResultVO, type PageParams } from '@/apis';
import { useMutation } from '@tanstack/vue-query';
import dayjs from 'dayjs';
import { destr } from 'destr';
@@ -73,11 +73,16 @@ const { mutate: getDeviceSnmpLogList, isPending } = useMutation({
sort: 'id',
order: 'descending',
};
const respData = await postSnmpLogPage(stationCode.value, {
model: { deviceId },
extra: { createdTime_precisest, createdTime_preciseed },
...restParams,
});
const respData = await pageSnmpLogApi(
{
model: { deviceId },
extra: { createdTime_precisest, createdTime_preciseed },
...restParams,
},
{
stationCode: stationCode.value,
},
);
return respData;
},
onSuccess: ({ records, size, total }) => {

View File

@@ -1,5 +1,5 @@
<script setup lang="ts">
import { postSnmpLogPage, type NdmSecurityBoxCircuit, type NdmSecurityBoxDiagInfo, type NdmSecurityBoxResultVO, type PageParams } from '@/apis';
import { pageSnmpLogApi, type NdmSecurityBoxCircuit, type NdmSecurityBoxDiagInfo, type NdmSecurityBoxResultVO, type PageParams } from '@/apis';
import { useMutation } from '@tanstack/vue-query';
import dayjs from 'dayjs';
import destr from 'destr';
@@ -149,11 +149,16 @@ const { mutate: getDeviceSnmpLogList, isPending } = useMutation({
sort: 'id',
order: 'descending',
};
const respData = await postSnmpLogPage(stationCode.value, {
model: { deviceId },
extra: { createdTime_precisest, createdTime_preciseed },
...restParams,
});
const respData = await pageSnmpLogApi(
{
model: { deviceId },
extra: { createdTime_precisest, createdTime_preciseed },
...restParams,
},
{
stationCode: stationCode.value,
},
);
return respData;
},
onSuccess: ({ records, size, total }) => {

View File

@@ -1,5 +1,5 @@
<script setup lang="ts">
import { postSnmpLogPage, type NdmSwitchDiagInfo, type NdmSwitchPortInfo, type NdmSwitchResultVO, type PageParams } from '@/apis';
import { pageSnmpLogApi, type NdmSwitchDiagInfo, type NdmSwitchPortInfo, type NdmSwitchResultVO, type PageParams } from '@/apis';
import { getPortStatusVal, transformPortSpeed } from '@/components';
import { useMutation } from '@tanstack/vue-query';
import dayjs from 'dayjs';
@@ -127,11 +127,16 @@ const { mutate: getDeviceSnmpLogList, isPending } = useMutation({
sort: 'id',
order: 'descending',
};
const respData = await postSnmpLogPage(stationCode.value, {
model: { deviceId },
extra: { createdTime_precisest, createdTime_preciseed },
...restParams,
});
const respData = await pageSnmpLogApi(
{
model: { deviceId },
extra: { createdTime_precisest, createdTime_preciseed },
...restParams,
},
{
stationCode: stationCode.value,
},
);
return respData;
},
onSuccess: ({ records, size, total }) => {