refactor: reorganize files
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
<script setup lang="ts">
|
||||
import { getRecordCheckByParentId, reloadAllRecordCheck, type NdmNvrResultVO, type NdmRecordCheck, type RecordInfo, type RecordItem } from '@/apis';
|
||||
import { getRecordCheckApi, reloadAllRecordCheckApi, type NdmNvrResultVO, type NdmRecordCheck, type RecordInfo, type RecordItem } from '@/apis';
|
||||
import { useStationStore } from '@/stores';
|
||||
import { downloadByData, formatDuration } from '@/utils';
|
||||
import { useMutation } from '@tanstack/vue-query';
|
||||
@@ -118,7 +118,7 @@ const recordDiagStatistics = computed(() => {
|
||||
|
||||
const { mutate: getRecordChecks, isPending: loading } = useMutation({
|
||||
mutationFn: async () => {
|
||||
const recordCheckList = await getRecordCheckByParentId(stationCode.value, ndmNvr.value, 90);
|
||||
const recordCheckList = await getRecordCheckApi(ndmNvr.value, 90, [], { stationCode: stationCode.value });
|
||||
return recordCheckList;
|
||||
},
|
||||
onSuccess: (checkList) => {
|
||||
@@ -132,7 +132,7 @@ const { mutate: getRecordChecks, isPending: loading } = useMutation({
|
||||
|
||||
const { mutate: reloadAllRecordChecks, isPending: reloading } = useMutation({
|
||||
mutationFn: async () => {
|
||||
await reloadAllRecordCheck(stationCode.value, 90);
|
||||
await reloadAllRecordCheckApi(90, { stationCode: stationCode.value });
|
||||
},
|
||||
onSuccess: () => {
|
||||
window.$message.success('正在逐步刷新中,请稍后点击刷新按钮查看');
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<script setup lang="ts">
|
||||
import { getDeviceDetailApi, probeDeviceApi, type NdmDeviceResultVO } from '@/apis';
|
||||
import { detailDeviceApi, probeDeviceApi, type NdmDeviceResultVO } from '@/apis';
|
||||
import { DeviceType, DeviceTypeName, tryGetDeviceTypeVal, type DeviceTypeVal } from '@/enums';
|
||||
import { useLineDevicesStore } from '@/stores';
|
||||
import { useMutation } from '@tanstack/vue-query';
|
||||
@@ -48,7 +48,7 @@ const canProbe = computed(() => device.value.snmpEnabled);
|
||||
|
||||
const { mutate: probeDevice, isPending: probing } = useMutation({
|
||||
mutationFn: async () => {
|
||||
await probeDeviceApi(stationCode.value, device.value);
|
||||
await probeDeviceApi(device.value, { stationCode: stationCode.value });
|
||||
},
|
||||
onError: (error) => {
|
||||
console.error(error);
|
||||
@@ -58,8 +58,7 @@ const { mutate: probeDevice, isPending: probing } = useMutation({
|
||||
|
||||
const { mutate: getDeviceDetail, isPending: loading } = useMutation({
|
||||
mutationFn: async () => {
|
||||
const { id, deviceType } = device.value;
|
||||
return await getDeviceDetailApi(stationCode.value, id, tryGetDeviceTypeVal(deviceType));
|
||||
return await detailDeviceApi(device.value, { stationCode: stationCode.value });
|
||||
},
|
||||
onSuccess: (device) => {
|
||||
if (device) {
|
||||
|
||||
@@ -1,11 +1,6 @@
|
||||
<script setup lang="ts">
|
||||
import type { NdmNvrResultVO, NdmRecordCheck, RecordInfo, RecordItem, Station } from '@/apis';
|
||||
import {
|
||||
getChannelList,
|
||||
getRecordCheckByParentId as getRecordCheckByParentIdApi,
|
||||
reloadAllRecordCheck as reloadAllRecordCheckApi,
|
||||
reloadRecordCheckByGbId as reloadRecordCheckByGbIdApi,
|
||||
} from '@/apis';
|
||||
import { getChannelListApi, getRecordCheckApi as getRecordCheckByParentIdApi, reloadAllRecordCheckApi as reloadAllRecordCheckApi, reloadRecordCheckApi as reloadRecordCheckByGbIdApi } from '@/apis';
|
||||
import { useStationStore } from '@/stores';
|
||||
import { downloadByData, formatDuration } from '@/utils';
|
||||
import { useMutation } from '@tanstack/vue-query';
|
||||
@@ -107,7 +102,7 @@ const recordDiags = computed(() => {
|
||||
|
||||
const { mutate: getRecordCheckByParentId, isPending: loading } = useMutation({
|
||||
mutationFn: async () => {
|
||||
const checks = await getRecordCheckByParentIdApi(stationCode.value, ndmNvr.value, 90);
|
||||
const checks = await getRecordCheckByParentIdApi(ndmNvr.value, 90, [], { stationCode: stationCode.value });
|
||||
return checks;
|
||||
},
|
||||
onSuccess: (checks) => {
|
||||
@@ -121,7 +116,7 @@ const { mutate: getRecordCheckByParentId, isPending: loading } = useMutation({
|
||||
|
||||
const { mutate: reloadAllRecordCheck, isPending: reloading } = useMutation({
|
||||
mutationFn: async () => {
|
||||
await reloadAllRecordCheckApi(stationCode.value, 90);
|
||||
await reloadAllRecordCheckApi(90, { stationCode: stationCode.value });
|
||||
},
|
||||
onSuccess: () => {
|
||||
window.$message.success('正在逐步刷新中,请稍后点击刷新按钮查看');
|
||||
@@ -177,13 +172,13 @@ const getLostChunkDOMStyle = (lostChunk: RecordItem, duration: RecordItem) => {
|
||||
|
||||
const { mutate: reloadRecordCheckByGbId } = useMutation({
|
||||
mutationFn: async (params: { gbCode: string }) => {
|
||||
const channelList = await getChannelList(stationCode.value, ndmNvr.value);
|
||||
const channelList = await getChannelListApi(ndmNvr.value, { stationCode: stationCode.value });
|
||||
const channel = channelList.find((channel) => channel.code === params.gbCode);
|
||||
if (!channel) throw new Error('通道不存在');
|
||||
window.$message.loading('刷新耗时较长, 请不要多次刷新, 并耐心等待...', {
|
||||
duration: 1000 * 60 * 60 * 24 * 300,
|
||||
});
|
||||
const isSuccess = await reloadRecordCheckByGbIdApi(stationCode.value, channel, 90);
|
||||
const isSuccess = await reloadRecordCheckByGbIdApi(channel, 90, { stationCode: stationCode.value });
|
||||
window.$message.destroyAll();
|
||||
if (isSuccess) {
|
||||
window.$message.success('刷新成功');
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<script setup lang="ts">
|
||||
import { probeDeviceApi, rebootSecurityBox as rebootSecurityBoxApi, turnStatus as turnStatusApi, type NdmSecurityBoxCircuit, type NdmSecurityBoxResultVO } from '@/apis';
|
||||
import { probeDeviceApi, rebootSecurityBoxApi as rebootSecurityBoxApi, turnCircuitStatusApi as turnStatusApi, type NdmSecurityBoxCircuit, type NdmSecurityBoxResultVO } from '@/apis';
|
||||
import { useMutation } from '@tanstack/vue-query';
|
||||
import { PowerOutline, FlashOutline } from '@vicons/ionicons5';
|
||||
import { NCard, NGrid, NGridItem, NPopover, NSwitch, NIcon, NFlex, NPopconfirm, NButton } from 'naive-ui';
|
||||
@@ -59,8 +59,8 @@ const { mutate: turnStatus, isPending: turning } = useMutation({
|
||||
throw new Error('设备IP地址不存在');
|
||||
}
|
||||
const status = newStatus ? 1 : 0;
|
||||
await turnStatusApi(stationCode.value, ndmSecurityBox.value.ipAddress, circuitIndex, status);
|
||||
await probeDeviceApi(stationCode.value, ndmSecurityBox.value);
|
||||
await turnStatusApi(ndmSecurityBox.value.ipAddress, circuitIndex, status, { stationCode: stationCode.value });
|
||||
await probeDeviceApi(ndmSecurityBox.value, { stationCode: stationCode.value });
|
||||
return status;
|
||||
},
|
||||
onSuccess: (status, params) => {
|
||||
@@ -83,7 +83,7 @@ const { mutate: rebootSecurityBox, isPending: rebooting } = useMutation({
|
||||
if (!ndmSecurityBox.value.ipAddress) {
|
||||
throw new Error('设备IP地址不存在');
|
||||
}
|
||||
await rebootSecurityBoxApi(stationCode.value, ndmSecurityBox.value.ipAddress);
|
||||
await rebootSecurityBoxApi(ndmSecurityBox.value.ipAddress, { stationCode: stationCode.value });
|
||||
},
|
||||
onSuccess: () => {
|
||||
window.$message.success('设备重启成功');
|
||||
|
||||
@@ -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';
|
||||
|
||||
@@ -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 }) => {
|
||||
|
||||
@@ -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 };
|
||||
},
|
||||
|
||||
@@ -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 }) => {
|
||||
|
||||
@@ -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 }) => {
|
||||
|
||||
@@ -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 }) => {
|
||||
|
||||
@@ -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 }) => {
|
||||
|
||||
@@ -1,16 +1,9 @@
|
||||
<script setup lang="ts">
|
||||
import type { NdmDeviceResultVO } from '@/apis/models';
|
||||
import { DeviceType, tryGetDeviceTypeVal, type DeviceTypeVal } from '@/enums/device-type';
|
||||
import type { NdmDeviceResultVO } from '@/apis';
|
||||
import { CameraCard, DecoderCard, KeyboardCard, NvrCard, SecurityBoxCard, ServerCard, SwitchCard } from '@/components';
|
||||
import { DeviceType, tryGetDeviceTypeVal, type DeviceTypeVal } from '@/enums';
|
||||
import { computed, toRefs } from 'vue';
|
||||
|
||||
import CameraCard from './device-card/camera-card.vue';
|
||||
import DecoderCard from './device-card/decoder-card.vue';
|
||||
import KeyboardCard from './device-card/keyboard-card.vue';
|
||||
import NvrCard from './device-card/nvr-card.vue';
|
||||
import SecurityBoxCard from './device-card/security-box-card.vue';
|
||||
import ServerCard from './device-card/server-card.vue';
|
||||
import SwitchCard from './device-card/switch-card.vue';
|
||||
|
||||
const props = defineProps<{
|
||||
stationCode: string;
|
||||
device: NdmDeviceResultVO;
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
import type { NdmDeviceAlarmLogResultVO, NdmDeviceResultVO, NdmNvrResultVO } from '@/apis/models';
|
||||
import { AlarmType } from '@/enums/alarm-type';
|
||||
import { DeviceType, DeviceTypeName, tryGetDeviceTypeVal } from '@/enums/device-type';
|
||||
import { FaultLevel } from '@/enums/fault-level';
|
||||
import type { NdmDeviceAlarmLogResultVO, NdmDeviceResultVO, NdmNvrResultVO } from '@/apis';
|
||||
import { AlarmType, DeviceType, DeviceTypeName, FaultLevel, tryGetDeviceTypeVal } from '@/enums';
|
||||
import dayjs from 'dayjs';
|
||||
import { NButton, NPopover, NScrollbar, NTag, type TagProps } from 'naive-ui';
|
||||
import { h } from 'vue';
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import type { NdmNvrResultVO } from '@/apis/models';
|
||||
import type { NdmNvrResultVO } from '@/apis';
|
||||
|
||||
export const isNvrCluster = (maybeNvrCluster: NdmNvrResultVO) => {
|
||||
const { ipAddress, clusterList } = maybeNvrCluster;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import type { NdmSwitchPortInfo } from '@/apis/domains';
|
||||
import type { NdmSwitchPortInfo } from '@/apis';
|
||||
import { JAVA_UNSIGNED_INTEGER_MAX_VALUE, NDM_SWITCH_PROBE_INTERVAL } from '@/constants';
|
||||
|
||||
export const getPortStatusVal = (portInfo: NdmSwitchPortInfo): string => {
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
<script setup lang="ts">
|
||||
import {
|
||||
ndmDeviceAlarmLogDefaultExportByTemplate,
|
||||
postNdmDeviceAlarmLogPage,
|
||||
exportDeviceAlarmLogApi,
|
||||
pageDeviceAlarmLogApi,
|
||||
type NdmDeviceAlarmLogPageQuery,
|
||||
type NdmDeviceAlarmLogResultVO,
|
||||
type NdmDeviceAlarmLogVO,
|
||||
type NdmDeviceAlarmLog,
|
||||
type PageQueryExtra,
|
||||
type Station,
|
||||
type StationAlarmCounts,
|
||||
@@ -110,7 +110,7 @@ const tableColumns: DataTableColumns<NdmDeviceAlarmLogResultVO> = [
|
||||
// { title: '设备ID', key: 'deviceId' },
|
||||
];
|
||||
|
||||
const filterFields = reactive<NdmDeviceAlarmLogPageQuery & PageQueryExtra<NdmDeviceAlarmLogVO>>({
|
||||
const filterFields = reactive<NdmDeviceAlarmLogPageQuery & PageQueryExtra<NdmDeviceAlarmLog>>({
|
||||
alarmCategory: '',
|
||||
alarmConfirm: '',
|
||||
deviceType_in: [] as string[],
|
||||
@@ -174,24 +174,29 @@ const onUpdateFilters: DataTableProps['onUpdateFilters'] = (filterState) => {
|
||||
const { mutate: getStaionAlarmList, isPending: tableLoading } = useMutation({
|
||||
mutationFn: async () => {
|
||||
const now = dayjs();
|
||||
const res = await postNdmDeviceAlarmLogPage(station.value?.code ?? '', {
|
||||
model: {
|
||||
const res = await pageDeviceAlarmLogApi(
|
||||
{
|
||||
model: {
|
||||
stationCode: station.value?.code,
|
||||
alarmCategory: filterFields.alarmCategory,
|
||||
alarmConfirm: filterFields.alarmConfirm,
|
||||
},
|
||||
extra: {
|
||||
deviceType_in: filterFields.deviceType_in,
|
||||
alarmType_in: filterFields.alarmType_in,
|
||||
faultLevel_in: filterFields.faultLevel_in,
|
||||
createdTime_precisest: now.startOf('date').format('YYYY-MM-DD HH:mm:ss'),
|
||||
createdTime_preciseed: now.endOf('date').format('YYYY-MM-DD HH:mm:ss'),
|
||||
},
|
||||
current: tablePagination.page ?? 1,
|
||||
size: tablePagination.pageSize ?? 10,
|
||||
order: 'descending',
|
||||
sort: 'id',
|
||||
},
|
||||
{
|
||||
stationCode: station.value?.code,
|
||||
alarmCategory: filterFields.alarmCategory,
|
||||
alarmConfirm: filterFields.alarmConfirm,
|
||||
},
|
||||
extra: {
|
||||
deviceType_in: filterFields.deviceType_in,
|
||||
alarmType_in: filterFields.alarmType_in,
|
||||
faultLevel_in: filterFields.faultLevel_in,
|
||||
createdTime_precisest: now.startOf('date').format('YYYY-MM-DD HH:mm:ss'),
|
||||
createdTime_preciseed: now.endOf('date').format('YYYY-MM-DD HH:mm:ss'),
|
||||
},
|
||||
current: tablePagination.page ?? 1,
|
||||
size: tablePagination.pageSize ?? 10,
|
||||
order: 'descending',
|
||||
sort: 'id',
|
||||
});
|
||||
);
|
||||
return res;
|
||||
},
|
||||
onSuccess: (res) => {
|
||||
@@ -209,22 +214,27 @@ const { mutate: getStaionAlarmList, isPending: tableLoading } = useMutation({
|
||||
const { mutate: exportTableData, isPending: exporting } = useMutation({
|
||||
mutationFn: async () => {
|
||||
const now = dayjs();
|
||||
const data = await ndmDeviceAlarmLogDefaultExportByTemplate(station.value?.code ?? '', {
|
||||
model: {
|
||||
const data = await exportDeviceAlarmLogApi(
|
||||
{
|
||||
model: {
|
||||
stationCode: station.value?.code,
|
||||
alarmCategory: filterFields.alarmCategory,
|
||||
alarmConfirm: filterFields.alarmConfirm,
|
||||
},
|
||||
extra: {
|
||||
deviceType_in: filterFields.deviceType_in,
|
||||
createdTime_precisest: now.startOf('date').format('YYYY-MM-DD HH:mm:ss'),
|
||||
createdTime_preciseed: now.endOf('date').format('YYYY-MM-DD HH:mm:ss'),
|
||||
},
|
||||
current: tablePagination.page ?? 1,
|
||||
size: tablePagination.pageSize ?? 10,
|
||||
order: 'descending',
|
||||
sort: 'id',
|
||||
},
|
||||
{
|
||||
stationCode: station.value?.code,
|
||||
alarmCategory: filterFields.alarmCategory,
|
||||
alarmConfirm: filterFields.alarmConfirm,
|
||||
},
|
||||
extra: {
|
||||
deviceType_in: filterFields.deviceType_in,
|
||||
createdTime_precisest: now.startOf('date').format('YYYY-MM-DD HH:mm:ss'),
|
||||
createdTime_preciseed: now.endOf('date').format('YYYY-MM-DD HH:mm:ss'),
|
||||
},
|
||||
current: tablePagination.page ?? 1,
|
||||
size: tablePagination.pageSize ?? 10,
|
||||
order: 'descending',
|
||||
sort: 'id',
|
||||
});
|
||||
);
|
||||
return data;
|
||||
},
|
||||
onSuccess: (data) => {
|
||||
|
||||
@@ -68,7 +68,7 @@ const getItemSuffix = (name: string) => {
|
||||
</script>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { postDefParameterPage, putDefParameter, type Station } from '@/apis';
|
||||
import { pageDefParameterApi, updateDefParameterApi, type Station } from '@/apis';
|
||||
import { useMutation } from '@tanstack/vue-query';
|
||||
import { NForm, NFormItemGi, NGrid, NInputNumber, NModal, NTabPane, NTabs, NTimePicker, NSpin, NFlex } from 'naive-ui';
|
||||
import { ref, toRefs } from 'vue';
|
||||
@@ -128,14 +128,19 @@ const deviceConfigParams = ref<DeviceParamItem[]>([]);
|
||||
const { mutate: getDeviceParams, isPending: paramsLoading } = useMutation({
|
||||
mutationFn: async ({ deviceKeyPrefix }: { deviceKeyPrefix: string }) => {
|
||||
if (!station.value) throw new Error('请先选择车站');
|
||||
const { records } = await postDefParameterPage(station.value.code, {
|
||||
model: {},
|
||||
extra: { key_likeRight: deviceKeyPrefix },
|
||||
current: 1,
|
||||
size: 1000,
|
||||
sort: 'id',
|
||||
order: 'descending',
|
||||
});
|
||||
const { records } = await pageDefParameterApi(
|
||||
{
|
||||
model: {},
|
||||
extra: { key_likeRight: deviceKeyPrefix },
|
||||
current: 1,
|
||||
size: 1000,
|
||||
sort: 'id',
|
||||
order: 'descending',
|
||||
},
|
||||
{
|
||||
stationCode: station.value.code,
|
||||
},
|
||||
);
|
||||
return records;
|
||||
},
|
||||
onSuccess: (records) => {
|
||||
@@ -171,19 +176,29 @@ const { mutate: saveDeviceParams } = useMutation({
|
||||
if (!station.value) throw new Error('请先选择车站');
|
||||
for (const item of params) {
|
||||
if (tabName.includes(DeviceConfigParamPrefix.Monitor)) {
|
||||
await putDefParameter(station.value.code, {
|
||||
id: item.id,
|
||||
key: item.key,
|
||||
name: item.name,
|
||||
value: item.timeValue,
|
||||
});
|
||||
await updateDefParameterApi(
|
||||
{
|
||||
id: item.id,
|
||||
key: item.key,
|
||||
name: item.name,
|
||||
value: item.timeValue,
|
||||
},
|
||||
{
|
||||
stationCode: station.value.code,
|
||||
},
|
||||
);
|
||||
} else {
|
||||
await putDefParameter(station.value.code, {
|
||||
id: item.id,
|
||||
key: item.key,
|
||||
name: item.name,
|
||||
value: `${deparseNumericValue(item.name, item.numValue ?? 0)}`,
|
||||
});
|
||||
await updateDefParameterApi(
|
||||
{
|
||||
id: item.id,
|
||||
key: item.key,
|
||||
name: item.name,
|
||||
value: `${deparseNumericValue(item.name, item.numValue ?? 0)}`,
|
||||
},
|
||||
{
|
||||
stationCode: station.value.code,
|
||||
},
|
||||
);
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user