Compare commits
7 Commits
a486f76aaf
...
3390f4806a
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
3390f4806a | ||
|
|
226d8855fd | ||
|
|
0e1fb75d2c | ||
|
|
ffdc8b0d4b | ||
|
|
3616276460 | ||
|
|
5e464f6e80 | ||
|
|
2dd599d2eb |
2
.env
2
.env
@@ -16,7 +16,7 @@ VITE_LAMP_PASSWORD = fjoc(1KHP(Ls&Bje)C
|
|||||||
VITE_LAMP_AUTHORIZATION = Y3VlZGVzX2FkbWluOmN1ZWRlc19hZG1pbl9zZWNyZXQ=
|
VITE_LAMP_AUTHORIZATION = Y3VlZGVzX2FkbWluOmN1ZWRlc19hZG1pbl9zZWNyZXQ=
|
||||||
|
|
||||||
# 当需要重置localStorage时, 修改此变量
|
# 当需要重置localStorage时, 修改此变量
|
||||||
VITE_STORAGE_VERSION = 1
|
VITE_STORAGE_VERSION = 2
|
||||||
|
|
||||||
# 调试授权码
|
# 调试授权码
|
||||||
VITE_DEBUG_CODE = ndm_debug
|
VITE_DEBUG_CODE = ndm_debug
|
||||||
|
|||||||
@@ -13,13 +13,13 @@ const GlobalFeedback = defineComponent({
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { dateZhCN, NConfigProvider, NDialogProvider, NLoadingBarProvider, NMessageProvider, NNotificationProvider, useDialog, useLoadingBar, useMessage, useNotification, zhCN } from 'naive-ui';
|
import { dateZhCN, NConfigProvider, NDialogProvider, NLoadingBarProvider, NMessageProvider, NNotificationProvider, useDialog, useLoadingBar, useMessage, useNotification, zhCN } from 'naive-ui';
|
||||||
import { defineComponent } from 'vue';
|
import { defineComponent } from 'vue';
|
||||||
import { useThemeStore } from '@/stores/theme';
|
import { useSettingStore } from '@/stores';
|
||||||
import { storeToRefs } from 'pinia';
|
import { storeToRefs } from 'pinia';
|
||||||
import { VueQueryDevtools } from '@tanstack/vue-query-devtools';
|
import { VueQueryDevtools } from '@tanstack/vue-query-devtools';
|
||||||
import { useVersionCheckQuery } from './composables/query';
|
import { useVersionCheckQuery } from './composables/query';
|
||||||
|
|
||||||
const themeStore = useThemeStore();
|
const settingStore = useSettingStore();
|
||||||
const { themeMode } = storeToRefs(themeStore);
|
const { themeMode } = storeToRefs(settingStore);
|
||||||
|
|
||||||
useVersionCheckQuery();
|
useVersionCheckQuery();
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
export * from './ndm-camera';
|
export * from './ndm-camera';
|
||||||
|
export * from './ndm-camera-ignore';
|
||||||
export * from './ndm-decoder';
|
export * from './ndm-decoder';
|
||||||
export * from './ndm-keyboard';
|
export * from './ndm-keyboard';
|
||||||
export * from './ndm-media-server';
|
export * from './ndm-media-server';
|
||||||
|
|||||||
14
src/apis/model/biz/entity/video/ndm-camera-ignore.ts
Normal file
14
src/apis/model/biz/entity/video/ndm-camera-ignore.ts
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
import type { BaseModel, ReduceForPageQuery, ReduceForSaveVO, ReduceForUpdateVO } from '@/apis';
|
||||||
|
|
||||||
|
export interface NdmCameraIgnore extends BaseModel {
|
||||||
|
deviceId: string;
|
||||||
|
ignoreType: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export type NdmCameraIgnoreResultVO = Partial<NdmCameraIgnore>;
|
||||||
|
|
||||||
|
export type NdmCameraIgnoreSaveVO = Partial<Omit<NdmCameraIgnore, ReduceForSaveVO>>;
|
||||||
|
|
||||||
|
export type NdmCameraIgnoreUpdateVO = Partial<Omit<NdmCameraIgnore, ReduceForUpdateVO>>;
|
||||||
|
|
||||||
|
export type NdmCameraIgnorePageQuery = Partial<Omit<NdmCameraIgnore, ReduceForPageQuery>>;
|
||||||
@@ -1,4 +1,5 @@
|
|||||||
export * from './ndm-camera';
|
export * from './ndm-camera';
|
||||||
|
export * from './ndm-camera-ignore';
|
||||||
export * from './ndm-decoder';
|
export * from './ndm-decoder';
|
||||||
export * from './ndm-keyboard';
|
export * from './ndm-keyboard';
|
||||||
export * from './ndm-media-server';
|
export * from './ndm-media-server';
|
||||||
|
|||||||
66
src/apis/request/biz/video/ndm-camera-ignore.ts
Normal file
66
src/apis/request/biz/video/ndm-camera-ignore.ts
Normal file
@@ -0,0 +1,66 @@
|
|||||||
|
import { ndmClient, userClient, type NdmCameraIgnorePageQuery, type NdmCameraIgnoreResultVO, type NdmCameraIgnoreSaveVO, type NdmCameraIgnoreUpdateVO, type PageParams, type PageResult } from '@/apis';
|
||||||
|
|
||||||
|
export const pageCameraIgnoreApi = async (pageQuery: PageParams<NdmCameraIgnorePageQuery>, options?: { stationCode?: string; signal?: AbortSignal }) => {
|
||||||
|
const { stationCode, signal } = options ?? {};
|
||||||
|
const client = stationCode ? ndmClient : userClient;
|
||||||
|
const prefix = stationCode ? `/${stationCode}` : '';
|
||||||
|
const endpoint = `${prefix}/api/ndm/ndmCameraIgnore/page`;
|
||||||
|
const resp = await client.post<PageResult<NdmCameraIgnoreResultVO>>(endpoint, pageQuery, { signal });
|
||||||
|
const [err, data] = resp;
|
||||||
|
if (err || !data) {
|
||||||
|
throw err;
|
||||||
|
}
|
||||||
|
return data;
|
||||||
|
};
|
||||||
|
|
||||||
|
export const detailCameraIgnoreApi = async (id: string, options?: { stationCode?: string; signal?: AbortSignal }) => {
|
||||||
|
const { stationCode, signal } = options ?? {};
|
||||||
|
const client = stationCode ? ndmClient : userClient;
|
||||||
|
const prefix = stationCode ? `/${stationCode}` : '';
|
||||||
|
const endpoint = `${prefix}/api/ndm/ndmCameraIgnore/detail`;
|
||||||
|
const resp = await client.get<NdmCameraIgnoreResultVO>(endpoint, { params: { id }, signal });
|
||||||
|
const [err, data] = resp;
|
||||||
|
if (err || !data) {
|
||||||
|
throw err;
|
||||||
|
}
|
||||||
|
return data;
|
||||||
|
};
|
||||||
|
|
||||||
|
export const saveCameraIgnoreApi = async (saveVO: NdmCameraIgnoreSaveVO, options?: { stationCode?: string; signal?: AbortSignal }) => {
|
||||||
|
const { stationCode, signal } = options ?? {};
|
||||||
|
const client = stationCode ? ndmClient : userClient;
|
||||||
|
const prefix = stationCode ? `/${stationCode}` : '';
|
||||||
|
const endpoint = `${prefix}/api/ndm/ndmCameraIgnore`;
|
||||||
|
const resp = await client.post<NdmCameraIgnoreResultVO>(endpoint, saveVO, { signal });
|
||||||
|
const [err, data] = resp;
|
||||||
|
if (err || !data) {
|
||||||
|
throw err;
|
||||||
|
}
|
||||||
|
return data;
|
||||||
|
};
|
||||||
|
|
||||||
|
export const updateCameraIgnoreApi = async (updateVO: NdmCameraIgnoreUpdateVO, options?: { stationCode?: string; signal?: AbortSignal }) => {
|
||||||
|
const { stationCode, signal } = options ?? {};
|
||||||
|
const client = stationCode ? ndmClient : userClient;
|
||||||
|
const prefix = stationCode ? `/${stationCode}` : '';
|
||||||
|
const endpoint = `${prefix}/api/ndm/ndmCameraIgnore`;
|
||||||
|
const resp = await client.put<NdmCameraIgnoreResultVO>(endpoint, updateVO, { signal });
|
||||||
|
const [err, data] = resp;
|
||||||
|
if (err || !data) {
|
||||||
|
throw err;
|
||||||
|
}
|
||||||
|
return data;
|
||||||
|
};
|
||||||
|
|
||||||
|
export const removeCameraIgnoreApi = async (ids: string[], options?: { stationCode?: string; signal?: AbortSignal }) => {
|
||||||
|
const { stationCode, signal } = options ?? {};
|
||||||
|
const client = stationCode ? ndmClient : userClient;
|
||||||
|
const prefix = stationCode ? `/${stationCode}` : '';
|
||||||
|
const endpoint = `${prefix}/api/ndm/ndmCameraIgnore`;
|
||||||
|
const resp = await client.delete<boolean>(endpoint, ids, { signal });
|
||||||
|
const [err, data] = resp;
|
||||||
|
if (err || !data) {
|
||||||
|
throw err;
|
||||||
|
}
|
||||||
|
return data;
|
||||||
|
};
|
||||||
@@ -1,18 +1,19 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import type { NdmCameraDiagInfo, NdmCameraResultVO } from '@/apis';
|
import type { NdmCameraDiagInfo, NdmCameraResultVO } from '@/apis';
|
||||||
import { useDebugModeStore } from '@/stores';
|
import { CameraHistoryDiagCard, DeviceCommonCard, DeviceHeaderCard } from '@/components';
|
||||||
import destr from 'destr';
|
import { useSettingStore } from '@/stores';
|
||||||
|
import { destr } from 'destr';
|
||||||
import { NCard, NFlex, NTabPane, NTabs } from 'naive-ui';
|
import { NCard, NFlex, NTabPane, NTabs } from 'naive-ui';
|
||||||
import { computed, ref, toRefs } from 'vue';
|
import { computed, ref, toRefs } from 'vue';
|
||||||
import { DeviceCommonCard, DeviceHeaderCard } from './current-diag-card';
|
import { storeToRefs } from 'pinia';
|
||||||
import { CameraHistoryDiagCard } from './history-diag-card';
|
|
||||||
|
|
||||||
const props = defineProps<{
|
const props = defineProps<{
|
||||||
stationCode: string;
|
stationCode: string;
|
||||||
ndmCamera: NdmCameraResultVO;
|
ndmCamera: NdmCameraResultVO;
|
||||||
}>();
|
}>();
|
||||||
|
|
||||||
const debugModeStore = useDebugModeStore();
|
const settingStore = useSettingStore();
|
||||||
|
const { debugModeEnabled } = storeToRefs(settingStore);
|
||||||
|
|
||||||
const { stationCode, ndmCamera } = toRefs(props);
|
const { stationCode, ndmCamera } = toRefs(props);
|
||||||
|
|
||||||
@@ -74,7 +75,7 @@ const selectedTab = ref('设备状态');
|
|||||||
<CameraHistoryDiagCard :station-code="stationCode" :ndm-camera="ndmCamera" :key="ndmCamera.id" />
|
<CameraHistoryDiagCard :station-code="stationCode" :ndm-camera="ndmCamera" :key="ndmCamera.id" />
|
||||||
</NTabPane>
|
</NTabPane>
|
||||||
<!-- <NTabPane name="设备配置" tab="设备配置"></NTabPane> -->
|
<!-- <NTabPane name="设备配置" tab="设备配置"></NTabPane> -->
|
||||||
<NTabPane v-if="debugModeStore.debugEnabled" name="原始数据" tab="原始数据">
|
<NTabPane v-if="debugModeEnabled" name="原始数据" tab="原始数据">
|
||||||
<pre class="raw-data">{{ { ...ndmCamera, lastDiagInfo } }}</pre>
|
<pre class="raw-data">{{ { ...ndmCamera, lastDiagInfo } }}</pre>
|
||||||
</NTabPane>
|
</NTabPane>
|
||||||
</NTabs>
|
</NTabs>
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { detailDeviceApi, probeDeviceApi, type NdmDeviceResultVO } from '@/apis';
|
import { detailDeviceApi, probeDeviceApi, type NdmDeviceResultVO } from '@/apis';
|
||||||
import { DeviceType, DeviceTypeName, tryGetDeviceTypeVal, type DeviceTypeVal } from '@/enums';
|
import { DeviceType, DeviceTypeName, tryGetDeviceTypeVal, type DeviceTypeVal } from '@/enums';
|
||||||
import { useLineDevicesStore } from '@/stores';
|
import { useDeviceStore } from '@/stores';
|
||||||
import { useMutation } from '@tanstack/vue-query';
|
import { useMutation } from '@tanstack/vue-query';
|
||||||
import { ApiOutlined, ReloadOutlined } from '@vicons/antd';
|
import { ApiOutlined, ReloadOutlined } from '@vicons/antd';
|
||||||
import { NButton, NCard, NFlex, NIcon, NTag, NTooltip } from 'naive-ui';
|
import { NButton, NCard, NFlex, NIcon, NTag, NTooltip } from 'naive-ui';
|
||||||
@@ -62,7 +62,7 @@ const { mutate: getDeviceDetail, isPending: loading } = useMutation({
|
|||||||
},
|
},
|
||||||
onSuccess: (device) => {
|
onSuccess: (device) => {
|
||||||
if (device) {
|
if (device) {
|
||||||
useLineDevicesStore().patch(stationCode.value, device);
|
useDeviceStore().patch(stationCode.value, device);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
onError: (error) => {
|
onError: (error) => {
|
||||||
|
|||||||
@@ -1,9 +1,10 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import type { NdmDecoderDiagInfo, NdmDecoderResultVO } from '@/apis';
|
import type { NdmDecoderDiagInfo, NdmDecoderResultVO } from '@/apis';
|
||||||
import { DecoderHistoryDiagCard, DeviceCommonCard, DeviceHardwareCard, DeviceHeaderCard } from '@/components';
|
import { DecoderHistoryDiagCard, DeviceCommonCard, DeviceHardwareCard, DeviceHeaderCard } from '@/components';
|
||||||
import { useDebugModeStore } from '@/stores';
|
import { useSettingStore } from '@/stores';
|
||||||
import { destr } from 'destr';
|
import { destr } from 'destr';
|
||||||
import { NCard, NFlex, NTabPane, NTabs } from 'naive-ui';
|
import { NCard, NFlex, NTabPane, NTabs } from 'naive-ui';
|
||||||
|
import { storeToRefs } from 'pinia';
|
||||||
import { computed, ref, toRefs } from 'vue';
|
import { computed, ref, toRefs } from 'vue';
|
||||||
|
|
||||||
const props = defineProps<{
|
const props = defineProps<{
|
||||||
@@ -11,7 +12,8 @@ const props = defineProps<{
|
|||||||
ndmDecoder: NdmDecoderResultVO;
|
ndmDecoder: NdmDecoderResultVO;
|
||||||
}>();
|
}>();
|
||||||
|
|
||||||
const debugModeStore = useDebugModeStore();
|
const settingStore = useSettingStore();
|
||||||
|
const { debugModeEnabled } = storeToRefs(settingStore);
|
||||||
|
|
||||||
const { stationCode, ndmDecoder } = toRefs(props);
|
const { stationCode, ndmDecoder } = toRefs(props);
|
||||||
|
|
||||||
@@ -53,7 +55,7 @@ const selectedTab = ref('设备状态');
|
|||||||
<DecoderHistoryDiagCard :station-code="stationCode" :ndm-decoder="ndmDecoder" :key="ndmDecoder.id" />
|
<DecoderHistoryDiagCard :station-code="stationCode" :ndm-decoder="ndmDecoder" :key="ndmDecoder.id" />
|
||||||
</NTabPane>
|
</NTabPane>
|
||||||
<!-- <NTabPane name="设备配置" tab="设备配置"></NTabPane> -->
|
<!-- <NTabPane name="设备配置" tab="设备配置"></NTabPane> -->
|
||||||
<NTabPane v-if="debugModeStore.debugEnabled" name="原始数据" tab="原始数据">
|
<NTabPane v-if="debugModeEnabled" name="原始数据" tab="原始数据">
|
||||||
<pre class="raw-data">{{ { ...ndmDecoder, lastDiagInfo } }}</pre>
|
<pre class="raw-data">{{ { ...ndmDecoder, lastDiagInfo } }}</pre>
|
||||||
</NTabPane>
|
</NTabPane>
|
||||||
</NTabs>
|
</NTabs>
|
||||||
|
|||||||
@@ -1,8 +1,9 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import type { NdmKeyboardResultVO } from '@/apis';
|
import type { NdmKeyboardResultVO } from '@/apis';
|
||||||
import { DeviceHeaderCard, KeyboardHistoryDiagCard } from '@/components';
|
import { DeviceHeaderCard, KeyboardHistoryDiagCard } from '@/components';
|
||||||
import { useDebugModeStore } from '@/stores';
|
import { useSettingStore } from '@/stores';
|
||||||
import { NCard, NFlex, NTabPane, NTabs } from 'naive-ui';
|
import { NCard, NFlex, NTabPane, NTabs } from 'naive-ui';
|
||||||
|
import { storeToRefs } from 'pinia';
|
||||||
import { ref, toRefs } from 'vue';
|
import { ref, toRefs } from 'vue';
|
||||||
|
|
||||||
const props = defineProps<{
|
const props = defineProps<{
|
||||||
@@ -10,7 +11,8 @@ const props = defineProps<{
|
|||||||
ndmKeyboard: NdmKeyboardResultVO;
|
ndmKeyboard: NdmKeyboardResultVO;
|
||||||
}>();
|
}>();
|
||||||
|
|
||||||
const debugModeStore = useDebugModeStore();
|
const settingStore = useSettingStore();
|
||||||
|
const { debugModeEnabled } = storeToRefs(settingStore);
|
||||||
|
|
||||||
const { stationCode, ndmKeyboard } = toRefs(props);
|
const { stationCode, ndmKeyboard } = toRefs(props);
|
||||||
|
|
||||||
@@ -30,7 +32,7 @@ const selectedTab = ref('设备状态');
|
|||||||
<KeyboardHistoryDiagCard :station-code="stationCode" :ndm-keyboard="ndmKeyboard" :key="ndmKeyboard.id" />
|
<KeyboardHistoryDiagCard :station-code="stationCode" :ndm-keyboard="ndmKeyboard" :key="ndmKeyboard.id" />
|
||||||
</NTabPane>
|
</NTabPane>
|
||||||
<!-- <NTabPane name="设备配置" tab="设备配置"></NTabPane> -->
|
<!-- <NTabPane name="设备配置" tab="设备配置"></NTabPane> -->
|
||||||
<NTabPane v-if="debugModeStore.debugEnabled" name="原始数据" tab="原始数据">
|
<NTabPane v-if="debugModeEnabled" name="原始数据" tab="原始数据">
|
||||||
<pre class="raw-data">{{ { ...ndmKeyboard } }}</pre>
|
<pre class="raw-data">{{ { ...ndmKeyboard } }}</pre>
|
||||||
</NTabPane>
|
</NTabPane>
|
||||||
</NTabs>
|
</NTabs>
|
||||||
|
|||||||
@@ -1,9 +1,10 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import type { NdmNvrDiagInfo, NdmNvrResultVO } from '@/apis';
|
import type { NdmNvrDiagInfo, NdmNvrResultVO } from '@/apis';
|
||||||
import { DeviceCommonCard, DeviceHardwareCard, DeviceHeaderCard, isNvrCluster, NvrDiskCard, NvrHistoryDiagCard, NvrRecordDiagCard } from '@/components';
|
import { DeviceCommonCard, DeviceHardwareCard, DeviceHeaderCard, isNvrCluster, NvrDiskCard, NvrHistoryDiagCard, NvrRecordDiagCard } from '@/components';
|
||||||
import { useDebugModeStore } from '@/stores';
|
import { useSettingStore } from '@/stores';
|
||||||
import { destr } from 'destr';
|
import { destr } from 'destr';
|
||||||
import { NCard, NFlex, NTabPane, NTabs } from 'naive-ui';
|
import { NCard, NFlex, NTabPane, NTabs } from 'naive-ui';
|
||||||
|
import { storeToRefs } from 'pinia';
|
||||||
import { computed, ref, toRefs } from 'vue';
|
import { computed, ref, toRefs } from 'vue';
|
||||||
|
|
||||||
const props = defineProps<{
|
const props = defineProps<{
|
||||||
@@ -11,7 +12,8 @@ const props = defineProps<{
|
|||||||
ndmNvr: NdmNvrResultVO;
|
ndmNvr: NdmNvrResultVO;
|
||||||
}>();
|
}>();
|
||||||
|
|
||||||
const debugModeStore = useDebugModeStore();
|
const settingStore = useSettingStore();
|
||||||
|
const { debugModeEnabled } = storeToRefs(settingStore);
|
||||||
|
|
||||||
const { stationCode, ndmNvr } = toRefs(props);
|
const { stationCode, ndmNvr } = toRefs(props);
|
||||||
|
|
||||||
@@ -63,7 +65,7 @@ const selectedTab = ref('设备状态');
|
|||||||
<NvrHistoryDiagCard :station-code="stationCode" :ndm-nvr="ndmNvr" :key="ndmNvr.id" />
|
<NvrHistoryDiagCard :station-code="stationCode" :ndm-nvr="ndmNvr" :key="ndmNvr.id" />
|
||||||
</NTabPane>
|
</NTabPane>
|
||||||
<!-- <NTabPane name="设备配置" tab="设备配置"></NTabPane> -->
|
<!-- <NTabPane name="设备配置" tab="设备配置"></NTabPane> -->
|
||||||
<NTabPane v-if="debugModeStore.debugEnabled" name="原始数据" tab="原始数据">
|
<NTabPane v-if="debugModeEnabled" name="原始数据" tab="原始数据">
|
||||||
<pre class="raw-data">{{ { ...ndmNvr, lastDiagInfo } }}</pre>
|
<pre class="raw-data">{{ { ...ndmNvr, lastDiagInfo } }}</pre>
|
||||||
</NTabPane>
|
</NTabPane>
|
||||||
</NTabs>
|
</NTabs>
|
||||||
|
|||||||
@@ -1,9 +1,10 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import type { NdmSecurityBoxDiagInfo, NdmSecurityBoxResultVO } from '@/apis';
|
import type { NdmSecurityBoxDiagInfo, NdmSecurityBoxResultVO } from '@/apis';
|
||||||
import { DeviceCommonCard, DeviceHardwareCard, DeviceHeaderCard, SecurityBoxCircuitCard, SecurityBoxHistoryDiagCard, SecurityBoxInfoCard } from '@/components';
|
import { DeviceCommonCard, DeviceHardwareCard, DeviceHeaderCard, SecurityBoxCircuitCard, SecurityBoxHistoryDiagCard, SecurityBoxInfoCard } from '@/components';
|
||||||
import { useDebugModeStore } from '@/stores';
|
import { useSettingStore } from '@/stores';
|
||||||
import { destr } from 'destr';
|
import { destr } from 'destr';
|
||||||
import { NCard, NFlex, NTabPane, NTabs } from 'naive-ui';
|
import { NCard, NFlex, NTabPane, NTabs } from 'naive-ui';
|
||||||
|
import { storeToRefs } from 'pinia';
|
||||||
import { computed, ref, toRefs } from 'vue';
|
import { computed, ref, toRefs } from 'vue';
|
||||||
|
|
||||||
const props = defineProps<{
|
const props = defineProps<{
|
||||||
@@ -11,7 +12,8 @@ const props = defineProps<{
|
|||||||
ndmSecurityBox: NdmSecurityBoxResultVO;
|
ndmSecurityBox: NdmSecurityBoxResultVO;
|
||||||
}>();
|
}>();
|
||||||
|
|
||||||
const debugModeStore = useDebugModeStore();
|
const settingStore = useSettingStore();
|
||||||
|
const { debugModeEnabled } = storeToRefs(settingStore);
|
||||||
|
|
||||||
const { stationCode, ndmSecurityBox } = toRefs(props);
|
const { stationCode, ndmSecurityBox } = toRefs(props);
|
||||||
|
|
||||||
@@ -62,7 +64,7 @@ const selectedTab = ref('设备状态');
|
|||||||
<SecurityBoxHistoryDiagCard :station-code="stationCode" :ndm-security-box="ndmSecurityBox" :key="ndmSecurityBox.id" />
|
<SecurityBoxHistoryDiagCard :station-code="stationCode" :ndm-security-box="ndmSecurityBox" :key="ndmSecurityBox.id" />
|
||||||
</NTabPane>
|
</NTabPane>
|
||||||
<!-- <NTabPane name="设备配置" tab="设备配置"></NTabPane> -->
|
<!-- <NTabPane name="设备配置" tab="设备配置"></NTabPane> -->
|
||||||
<NTabPane v-if="debugModeStore.debugEnabled" name="原始数据" tab="原始数据">
|
<NTabPane v-if="debugModeEnabled" name="原始数据" tab="原始数据">
|
||||||
<pre class="raw-data">{{ { ...ndmSecurityBox, lastDiagInfo } }}</pre>
|
<pre class="raw-data">{{ { ...ndmSecurityBox, lastDiagInfo } }}</pre>
|
||||||
</NTabPane>
|
</NTabPane>
|
||||||
</NTabs>
|
</NTabs>
|
||||||
|
|||||||
@@ -1,9 +1,10 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import type { NdmServerDiagInfo, NdmServerResultVO } from '@/apis';
|
import type { NdmServerDiagInfo, NdmServerResultVO } from '@/apis';
|
||||||
import { DeviceHardwareCard, DeviceHeaderCard, ServerHistoryDiagCard } from '@/components';
|
import { DeviceHardwareCard, DeviceHeaderCard, ServerHistoryDiagCard } from '@/components';
|
||||||
import { useDebugModeStore } from '@/stores';
|
import { useSettingStore } from '@/stores';
|
||||||
import { destr } from 'destr';
|
import { destr } from 'destr';
|
||||||
import { NCard, NFlex, NTabPane, NTabs } from 'naive-ui';
|
import { NCard, NFlex, NTabPane, NTabs } from 'naive-ui';
|
||||||
|
import { storeToRefs } from 'pinia';
|
||||||
import { computed, ref, toRefs } from 'vue';
|
import { computed, ref, toRefs } from 'vue';
|
||||||
|
|
||||||
const props = defineProps<{
|
const props = defineProps<{
|
||||||
@@ -11,7 +12,8 @@ const props = defineProps<{
|
|||||||
ndmServer: NdmServerResultVO;
|
ndmServer: NdmServerResultVO;
|
||||||
}>();
|
}>();
|
||||||
|
|
||||||
const debugModeStore = useDebugModeStore();
|
const settingStore = useSettingStore();
|
||||||
|
const { debugModeEnabled } = storeToRefs(settingStore);
|
||||||
|
|
||||||
const { stationCode, ndmServer } = toRefs(props);
|
const { stationCode, ndmServer } = toRefs(props);
|
||||||
|
|
||||||
@@ -44,7 +46,7 @@ const selectedTab = ref('设备状态');
|
|||||||
<ServerHistoryDiagCard :station-code="stationCode" :ndm-server="ndmServer" :key="ndmServer.id" />
|
<ServerHistoryDiagCard :station-code="stationCode" :ndm-server="ndmServer" :key="ndmServer.id" />
|
||||||
</NTabPane>
|
</NTabPane>
|
||||||
<!-- <NTabPane name="设备配置" tab="设备配置"></NTabPane> -->
|
<!-- <NTabPane name="设备配置" tab="设备配置"></NTabPane> -->
|
||||||
<NTabPane v-if="debugModeStore.debugEnabled" name="原始数据" tab="原始数据">
|
<NTabPane v-if="debugModeEnabled" name="原始数据" tab="原始数据">
|
||||||
<pre class="raw-data">{{ { ...ndmServer, lastDiagInfo } }}</pre>
|
<pre class="raw-data">{{ { ...ndmServer, lastDiagInfo } }}</pre>
|
||||||
</NTabPane>
|
</NTabPane>
|
||||||
</NTabs>
|
</NTabs>
|
||||||
|
|||||||
@@ -1,9 +1,10 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import type { NdmSwitchDiagInfo, NdmSwitchResultVO } from '@/apis';
|
import type { NdmSwitchDiagInfo, NdmSwitchResultVO } from '@/apis';
|
||||||
import { DeviceHardwareCard, DeviceHeaderCard, SwitchHistoryDiagCard, SwitchPortCard } from '@/components';
|
import { DeviceHardwareCard, DeviceHeaderCard, SwitchHistoryDiagCard, SwitchPortCard } from '@/components';
|
||||||
import { useDebugModeStore } from '@/stores';
|
import { useSettingStore } from '@/stores';
|
||||||
import { destr } from 'destr';
|
import { destr } from 'destr';
|
||||||
import { NCard, NFlex, NTabPane, NTabs } from 'naive-ui';
|
import { NCard, NFlex, NTabPane, NTabs } from 'naive-ui';
|
||||||
|
import { storeToRefs } from 'pinia';
|
||||||
import { computed, ref, toRefs } from 'vue';
|
import { computed, ref, toRefs } from 'vue';
|
||||||
|
|
||||||
const props = defineProps<{
|
const props = defineProps<{
|
||||||
@@ -11,7 +12,8 @@ const props = defineProps<{
|
|||||||
ndmSwitch: NdmSwitchResultVO;
|
ndmSwitch: NdmSwitchResultVO;
|
||||||
}>();
|
}>();
|
||||||
|
|
||||||
const debugModeStore = useDebugModeStore();
|
const settingStore = useSettingStore();
|
||||||
|
const { debugModeEnabled } = storeToRefs(settingStore);
|
||||||
|
|
||||||
const { stationCode, ndmSwitch } = toRefs(props);
|
const { stationCode, ndmSwitch } = toRefs(props);
|
||||||
|
|
||||||
@@ -45,7 +47,7 @@ const selectedTab = ref('设备状态');
|
|||||||
<SwitchHistoryDiagCard :station-code="stationCode" :ndm-switch="ndmSwitch" :key="ndmSwitch.id" />
|
<SwitchHistoryDiagCard :station-code="stationCode" :ndm-switch="ndmSwitch" :key="ndmSwitch.id" />
|
||||||
</NTabPane>
|
</NTabPane>
|
||||||
<!-- <NTabPane name="设备配置" tab="设备配置"></NTabPane> -->
|
<!-- <NTabPane name="设备配置" tab="设备配置"></NTabPane> -->
|
||||||
<NTabPane v-if="debugModeStore.debugEnabled" name="原始数据" tab="原始数据">
|
<NTabPane v-if="debugModeEnabled" name="原始数据" tab="原始数据">
|
||||||
<pre class="raw-data">{{ { ...ndmSwitch, lastDiagInfo } }}</pre>
|
<pre class="raw-data">{{ { ...ndmSwitch, lastDiagInfo } }}</pre>
|
||||||
</NTabPane>
|
</NTabPane>
|
||||||
</NTabs>
|
</NTabs>
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import type { VersionInfo } from '@/apis';
|
import type { VersionInfo } from '@/apis';
|
||||||
import { ThemeSwitch } from '@/components';
|
import { ThemeSwitch } from '@/components';
|
||||||
import { STATION_LIST_QUERY_KEY } from '@/constants';
|
import { LINE_STATIONS_QUERY_KEY } from '@/constants';
|
||||||
import { useDebugModeStore, useLayoutStore, useQueryControlStore } from '@/stores';
|
import { useSettingStore, usePollingStore } from '@/stores';
|
||||||
import { getAppEnvConfig } from '@/utils';
|
import { getAppEnvConfig } from '@/utils';
|
||||||
import { useQueryClient } from '@tanstack/vue-query';
|
import { useQueryClient } from '@tanstack/vue-query';
|
||||||
import { useEventListener } from '@vueuse/core';
|
import { useEventListener } from '@vueuse/core';
|
||||||
@@ -16,16 +16,16 @@ const route = useRoute();
|
|||||||
|
|
||||||
const show = defineModel<boolean>('show');
|
const show = defineModel<boolean>('show');
|
||||||
|
|
||||||
const layoutStore = useLayoutStore();
|
const settingStore = useSettingStore();
|
||||||
const { stationGridColumns } = storeToRefs(layoutStore);
|
const { stationGridColumns, debugModeEnabled } = storeToRefs(settingStore);
|
||||||
const queryControlStore = useQueryControlStore();
|
const pollingStore = usePollingStore();
|
||||||
const { stationVerifyMode } = storeToRefs(queryControlStore);
|
const { stationVerifyMode } = storeToRefs(pollingStore);
|
||||||
|
|
||||||
const queryClient = useQueryClient();
|
const queryClient = useQueryClient();
|
||||||
watch(stationVerifyMode, () => {
|
watch(stationVerifyMode, () => {
|
||||||
queryClient.cancelQueries({ queryKey: [STATION_LIST_QUERY_KEY] });
|
queryClient.cancelQueries({ queryKey: [LINE_STATIONS_QUERY_KEY] });
|
||||||
queryClient.invalidateQueries({ queryKey: [STATION_LIST_QUERY_KEY] });
|
queryClient.invalidateQueries({ queryKey: [LINE_STATIONS_QUERY_KEY] });
|
||||||
queryClient.refetchQueries({ queryKey: [STATION_LIST_QUERY_KEY] });
|
queryClient.refetchQueries({ queryKey: [LINE_STATIONS_QUERY_KEY] });
|
||||||
});
|
});
|
||||||
|
|
||||||
const versionInfo = ref<VersionInfo>({ version: '', buildTime: '' });
|
const versionInfo = ref<VersionInfo>({ version: '', buildTime: '' });
|
||||||
@@ -35,8 +35,6 @@ onMounted(async () => {
|
|||||||
versionInfo.value = data;
|
versionInfo.value = data;
|
||||||
});
|
});
|
||||||
|
|
||||||
const debugModeStore = useDebugModeStore();
|
|
||||||
const { debugEnabled } = storeToRefs(debugModeStore);
|
|
||||||
const debugCodeModalShow = ref(false);
|
const debugCodeModalShow = ref(false);
|
||||||
const debugCode = ref('');
|
const debugCode = ref('');
|
||||||
const enableDebug = () => {
|
const enableDebug = () => {
|
||||||
@@ -47,11 +45,11 @@ const enableDebug = () => {
|
|||||||
}
|
}
|
||||||
debugCodeModalShow.value = false;
|
debugCodeModalShow.value = false;
|
||||||
debugCode.value = '';
|
debugCode.value = '';
|
||||||
debugModeStore.enableDebug();
|
settingStore.enableDebugMode();
|
||||||
};
|
};
|
||||||
const disableDebug = () => {
|
const disableDebug = () => {
|
||||||
debugCodeModalShow.value = false;
|
debugCodeModalShow.value = false;
|
||||||
debugModeStore.disableDebug();
|
settingStore.disableDebugMode();
|
||||||
};
|
};
|
||||||
|
|
||||||
useEventListener('keydown', (event) => {
|
useEventListener('keydown', (event) => {
|
||||||
@@ -76,7 +74,7 @@ useEventListener('keydown', (event) => {
|
|||||||
<NInputNumber v-model:value="stationGridColumns" :min="1" :max="10" />
|
<NInputNumber v-model:value="stationGridColumns" :min="1" :max="10" />
|
||||||
</NFormItem>
|
</NFormItem>
|
||||||
</template>
|
</template>
|
||||||
<template v-if="debugEnabled">
|
<template v-if="debugModeEnabled">
|
||||||
<NDivider>调试</NDivider>
|
<NDivider>调试</NDivider>
|
||||||
<NFormItem label="车站Ping模式" label-placement="left">
|
<NFormItem label="车站Ping模式" label-placement="left">
|
||||||
<NRadioGroup v-model:value="stationVerifyMode">
|
<NRadioGroup v-model:value="stationVerifyMode">
|
||||||
@@ -96,13 +94,13 @@ useEventListener('keydown', (event) => {
|
|||||||
|
|
||||||
<NModal v-model:show="debugCodeModalShow" preset="dialog" type="info">
|
<NModal v-model:show="debugCodeModalShow" preset="dialog" type="info">
|
||||||
<template #header>
|
<template #header>
|
||||||
<NText v-if="!debugEnabled">请输入调试授权码</NText>
|
<NText v-if="!debugModeEnabled">请输入调试授权码</NText>
|
||||||
<NText v-else>确认关闭调试模式</NText>
|
<NText v-else>确认关闭调试模式</NText>
|
||||||
</template>
|
</template>
|
||||||
<NInput v-if="!debugEnabled" v-model:value="debugCode" placeholder="输入授权码" />
|
<NInput v-if="!debugModeEnabled" v-model:value="debugCode" placeholder="输入授权码" />
|
||||||
<template #action>
|
<template #action>
|
||||||
<NButton @click="debugCodeModalShow = false">取消</NButton>
|
<NButton @click="debugCodeModalShow = false">取消</NButton>
|
||||||
<NButton v-if="!debugEnabled" type="primary" @click="enableDebug">启用</NButton>
|
<NButton v-if="!debugModeEnabled" type="primary" @click="enableDebug">启用</NButton>
|
||||||
<NButton v-else type="primary" @click="disableDebug">确认</NButton>
|
<NButton v-else type="primary" @click="disableDebug">确认</NButton>
|
||||||
</template>
|
</template>
|
||||||
</NModal>
|
</NModal>
|
||||||
|
|||||||
@@ -1,12 +1,12 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { useThemeStore } from '@/stores';
|
import { useSettingStore } from '@/stores';
|
||||||
import { MoonOutline, SunnyOutline } from '@vicons/ionicons5';
|
import { MoonOutline, SunnyOutline } from '@vicons/ionicons5';
|
||||||
import { NIcon, NSwitch } from 'naive-ui';
|
import { NIcon, NSwitch } from 'naive-ui';
|
||||||
import { storeToRefs } from 'pinia';
|
import { storeToRefs } from 'pinia';
|
||||||
import type { ComponentInstance } from 'vue';
|
import type { ComponentInstance } from 'vue';
|
||||||
|
|
||||||
const themeStore = useThemeStore();
|
const settingStore = useSettingStore();
|
||||||
const { darkThemeEnabled } = storeToRefs(themeStore);
|
const { darkThemeEnabled } = storeToRefs(settingStore);
|
||||||
|
|
||||||
defineExpose({} as ComponentInstance<typeof NSwitch>);
|
defineExpose({} as ComponentInstance<typeof NSwitch>);
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@@ -68,7 +68,7 @@ const getItemSuffix = (name: string) => {
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { pageDefParameterApi, updateDefParameterApi, type Station } from '@/apis';
|
import { pageDefParameterApi, resetMonitorScheduleApi, updateDefParameterApi, type Station } from '@/apis';
|
||||||
import { useMutation } from '@tanstack/vue-query';
|
import { useMutation } from '@tanstack/vue-query';
|
||||||
import { NForm, NFormItemGi, NGrid, NInputNumber, NModal, NTabPane, NTabs, NTimePicker, NSpin, NFlex } from 'naive-ui';
|
import { NForm, NFormItemGi, NGrid, NInputNumber, NModal, NTabPane, NTabs, NTimePicker, NSpin, NFlex } from 'naive-ui';
|
||||||
import { ref, toRefs } from 'vue';
|
import { ref, toRefs } from 'vue';
|
||||||
@@ -201,6 +201,7 @@ const { mutate: saveDeviceParams } = useMutation({
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
await resetMonitorScheduleApi({ stationCode: station.value.code });
|
||||||
},
|
},
|
||||||
onError: (error) => {
|
onError: (error) => {
|
||||||
console.error(error);
|
console.error(error);
|
||||||
|
|||||||
@@ -1 +0,0 @@
|
|||||||
export * from './use-line-alarms-query';
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
export * from './use-line-devices-query';
|
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
export * from './alarm';
|
export * from './use-line-alarms-query';
|
||||||
export * from './device';
|
export * from './use-line-devices-query';
|
||||||
export * from './station';
|
export * from './use-station-list-query';
|
||||||
export * from './system';
|
export * from './use-version-check-query';
|
||||||
|
|||||||
@@ -1 +0,0 @@
|
|||||||
export * from './use-station-list-query';
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
export * from './use-version-check-query';
|
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
import { pageDeviceAlarmLogApi, type Station, type StationAlarmCounts } from '@/apis';
|
import { pageDeviceAlarmLogApi, type Station, type StationAlarmCounts } from '@/apis';
|
||||||
import { LINE_ALARMS_QUERY_KEY } from '@/constants';
|
import { LINE_ALARMS_QUERY_KEY } from '@/constants';
|
||||||
import { DeviceType, tryGetDeviceTypeVal } from '@/enums';
|
import { DeviceType, tryGetDeviceTypeVal } from '@/enums';
|
||||||
import { useLineAlarmsStore, useQueryControlStore, useStationStore } from '@/stores';
|
import { useAlarmStore, usePollingStore, useStationStore } from '@/stores';
|
||||||
import { runTask } from '@/utils';
|
import { runTask } from '@/utils';
|
||||||
import { isCancelledError, useMutation, useQuery } from '@tanstack/vue-query';
|
import { isCancelledError, useMutation, useQuery } from '@tanstack/vue-query';
|
||||||
import dayjs from 'dayjs';
|
import dayjs from 'dayjs';
|
||||||
@@ -25,8 +25,8 @@ const createEmptyStationAlarmCounts = () => {
|
|||||||
export function useLineAlarmsQuery() {
|
export function useLineAlarmsQuery() {
|
||||||
const stationStore = useStationStore();
|
const stationStore = useStationStore();
|
||||||
const { stationList } = storeToRefs(stationStore);
|
const { stationList } = storeToRefs(stationStore);
|
||||||
const queryControlStore = useQueryControlStore();
|
const pollingStore = usePollingStore();
|
||||||
const { alarmQueryStamp } = storeToRefs(queryControlStore);
|
const { alarmQueryStamp } = storeToRefs(pollingStore);
|
||||||
const { mutateAsync: getStationAlarmCounts } = useStationAlarmCountsMutation();
|
const { mutateAsync: getStationAlarmCounts } = useStationAlarmCountsMutation();
|
||||||
|
|
||||||
return useQuery({
|
return useQuery({
|
||||||
@@ -42,7 +42,7 @@ export function useLineAlarmsQuery() {
|
|||||||
await getStationAlarmCounts({ station, signal });
|
await getStationAlarmCounts({ station, signal });
|
||||||
}
|
}
|
||||||
console.timeEnd('useLineALarmCountsQuery');
|
console.timeEnd('useLineALarmCountsQuery');
|
||||||
// queryControlStore.updateAlarmQueryUpdatedAt();
|
// pollingStore.updateAlarmQueryUpdatedAt();
|
||||||
return null;
|
return null;
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
@@ -54,7 +54,7 @@ interface StationAlarmCountsMutationParams {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function useStationAlarmCountsMutation() {
|
function useStationAlarmCountsMutation() {
|
||||||
const lineAlarmsStore = useLineAlarmsStore();
|
const lineAlarmsStore = useAlarmStore();
|
||||||
const { lineAlarmCounts } = storeToRefs(lineAlarmsStore);
|
const { lineAlarmCounts } = storeToRefs(lineAlarmsStore);
|
||||||
|
|
||||||
return useMutation<StationAlarmCounts, Error, StationAlarmCountsMutationParams>({
|
return useMutation<StationAlarmCounts, Error, StationAlarmCountsMutationParams>({
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
import { ndmClient, type Station, type StationDevices } from '@/apis';
|
import { ndmClient, type Station, type StationDevices } from '@/apis';
|
||||||
import { LINE_DEVICES_QUERY_KEY } from '@/constants';
|
import { LINE_DEVICES_QUERY_KEY } from '@/constants';
|
||||||
import { DeviceType } from '@/enums';
|
import { DeviceType } from '@/enums';
|
||||||
import { useLineDevicesStore, useQueryControlStore, useStationStore } from '@/stores';
|
import { useDeviceStore, usePollingStore, useStationStore } from '@/stores';
|
||||||
import { runTask } from '@/utils';
|
import { runTask } from '@/utils';
|
||||||
import { isCancelledError, useMutation, useQuery } from '@tanstack/vue-query';
|
import { isCancelledError, useMutation, useQuery } from '@tanstack/vue-query';
|
||||||
import { storeToRefs } from 'pinia';
|
import { storeToRefs } from 'pinia';
|
||||||
@@ -32,8 +32,8 @@ const getNdmDevicesAll = async (stationCode: string, signal?: AbortSignal) => {
|
|||||||
export function useLineDevicesQuery() {
|
export function useLineDevicesQuery() {
|
||||||
const stationStore = useStationStore();
|
const stationStore = useStationStore();
|
||||||
const { stationList } = storeToRefs(stationStore);
|
const { stationList } = storeToRefs(stationStore);
|
||||||
const queryControlStore = useQueryControlStore();
|
const pollingStore = usePollingStore();
|
||||||
const { deviceQueryStamp } = storeToRefs(queryControlStore);
|
const { deviceQueryStamp } = storeToRefs(pollingStore);
|
||||||
const { mutateAsync: getStationDevices } = useStationDevicesMutation();
|
const { mutateAsync: getStationDevices } = useStationDevicesMutation();
|
||||||
|
|
||||||
return useQuery({
|
return useQuery({
|
||||||
@@ -49,7 +49,7 @@ export function useLineDevicesQuery() {
|
|||||||
await getStationDevices({ station, signal });
|
await getStationDevices({ station, signal });
|
||||||
}
|
}
|
||||||
console.timeEnd('useLineDevicesQuery');
|
console.timeEnd('useLineDevicesQuery');
|
||||||
// queryControlStore.updateDeviceQueryUpdatedAt();
|
// pollingStore.updateDeviceQueryUpdatedAt();
|
||||||
return null;
|
return null;
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
@@ -61,7 +61,7 @@ interface StationDevicesMutationParams {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function useStationDevicesMutation() {
|
function useStationDevicesMutation() {
|
||||||
const lineDevicesStore = useLineDevicesStore();
|
const lineDevicesStore = useDeviceStore();
|
||||||
const { lineDevices } = storeToRefs(lineDevicesStore);
|
const { lineDevices } = storeToRefs(lineDevicesStore);
|
||||||
|
|
||||||
return useMutation<StationDevices, Error, StationDevicesMutationParams>({
|
return useMutation<StationDevices, Error, StationDevicesMutationParams>({
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
import { batchVerifyApi, verifyApi, type Station } from '@/apis';
|
import { batchVerifyApi, verifyApi, type Station } from '@/apis';
|
||||||
import { STATION_LIST_QUERY_KEY } from '@/constants';
|
import { LINE_STATIONS_QUERY_KEY } from '@/constants';
|
||||||
import { useQueryControlStore, useStationStore } from '@/stores';
|
import { usePollingStore, useStationStore } from '@/stores';
|
||||||
import { getAppEnvConfig } from '@/utils';
|
import { getAppEnvConfig } from '@/utils';
|
||||||
import { isCancelledError, useMutation, useQuery } from '@tanstack/vue-query';
|
import { isCancelledError, useMutation, useQuery } from '@tanstack/vue-query';
|
||||||
import axios from 'axios';
|
import axios from 'axios';
|
||||||
@@ -8,13 +8,13 @@ import dayjs from 'dayjs';
|
|||||||
import { storeToRefs } from 'pinia';
|
import { storeToRefs } from 'pinia';
|
||||||
import { computed } from 'vue';
|
import { computed } from 'vue';
|
||||||
|
|
||||||
export function useStationListQuery() {
|
export function useLineStationsQuery() {
|
||||||
const queryControlStore = useQueryControlStore();
|
const pollingStore = usePollingStore();
|
||||||
const { pollingEnabled } = storeToRefs(queryControlStore);
|
const { pollingEnabled } = storeToRefs(pollingStore);
|
||||||
const { mutateAsync: getStationList } = useStationListMutation();
|
const { mutateAsync: getStationList } = useLineStationsMutation();
|
||||||
|
|
||||||
return useQuery({
|
return useQuery({
|
||||||
queryKey: computed(() => [STATION_LIST_QUERY_KEY]),
|
queryKey: computed(() => [LINE_STATIONS_QUERY_KEY]),
|
||||||
enabled: computed(() => pollingEnabled.value),
|
enabled: computed(() => pollingEnabled.value),
|
||||||
refetchInterval: getAppEnvConfig().requestInterval * 1000,
|
refetchInterval: getAppEnvConfig().requestInterval * 1000,
|
||||||
staleTime: getAppEnvConfig().requestInterval * 1000,
|
staleTime: getAppEnvConfig().requestInterval * 1000,
|
||||||
@@ -22,8 +22,8 @@ export function useStationListQuery() {
|
|||||||
console.time('useStationListQuery');
|
console.time('useStationListQuery');
|
||||||
await getStationList({ signal });
|
await getStationList({ signal });
|
||||||
console.timeEnd('useStationListQuery');
|
console.timeEnd('useStationListQuery');
|
||||||
queryControlStore.updateDeviceQueryStamp();
|
pollingStore.updateDeviceQueryStamp();
|
||||||
queryControlStore.updateAlarmQueryStamp();
|
pollingStore.updateAlarmQueryStamp();
|
||||||
return null;
|
return null;
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
@@ -33,11 +33,11 @@ interface StationListMutationParams {
|
|||||||
signal?: AbortSignal;
|
signal?: AbortSignal;
|
||||||
}
|
}
|
||||||
|
|
||||||
function useStationListMutation() {
|
function useLineStationsMutation() {
|
||||||
const stationStore = useStationStore();
|
const stationStore = useStationStore();
|
||||||
const { stationList } = storeToRefs(stationStore);
|
const { stationList } = storeToRefs(stationStore);
|
||||||
const queryControlStore = useQueryControlStore();
|
const pollingStore = usePollingStore();
|
||||||
const { stationVerifyMode } = storeToRefs(queryControlStore);
|
const { stationVerifyMode } = storeToRefs(pollingStore);
|
||||||
return useMutation<Station[], Error, StationListMutationParams>({
|
return useMutation<Station[], Error, StationListMutationParams>({
|
||||||
mutationFn: async ({ signal }) => {
|
mutationFn: async ({ signal }) => {
|
||||||
const { data: ndmStationList } = await axios.get<{ code: string; name: string }[]>(`/minio/ndm/ndm-stations.json?_t=${dayjs().unix()}`, { signal });
|
const { data: ndmStationList } = await axios.get<{ code: string; name: string }[]>(`/minio/ndm/ndm-stations.json?_t=${dayjs().unix()}`, { signal });
|
||||||
@@ -1,19 +1,26 @@
|
|||||||
import { type VersionInfo } from '@/apis';
|
import { verifyApi, type VersionInfo } from '@/apis';
|
||||||
|
import { useUserStore } from '@/stores';
|
||||||
import { useQuery } from '@tanstack/vue-query';
|
import { useQuery } from '@tanstack/vue-query';
|
||||||
import axios from 'axios';
|
import axios from 'axios';
|
||||||
import { useThemeVars } from 'naive-ui';
|
import { useThemeVars } from 'naive-ui';
|
||||||
|
import { storeToRefs } from 'pinia';
|
||||||
import { h, ref, watch } from 'vue';
|
import { h, ref, watch } from 'vue';
|
||||||
|
|
||||||
export function useVersionCheckQuery() {
|
export function useVersionCheckQuery() {
|
||||||
const localVersionInfo = ref<VersionInfo>();
|
const localVersionInfo = ref<VersionInfo>();
|
||||||
const dialogShow = ref<boolean>(false);
|
const dialogShow = ref<boolean>(false);
|
||||||
const themeVars = useThemeVars();
|
const themeVars = useThemeVars();
|
||||||
|
const userStore = useUserStore();
|
||||||
|
const { userLoginResult } = storeToRefs(userStore);
|
||||||
|
|
||||||
const { data: remoteVersionInfo, dataUpdatedAt } = useQuery({
|
const { data: remoteVersionInfo, dataUpdatedAt } = useQuery({
|
||||||
queryKey: ['version-check'],
|
queryKey: ['version-check'],
|
||||||
refetchInterval: 10 * 1000,
|
refetchInterval: 10 * 1000,
|
||||||
queryFn: async () => {
|
queryFn: async ({ signal }) => {
|
||||||
const { data } = await axios.get<VersionInfo>(`/manifest.json?t=${Date.now()}`);
|
if (!!userLoginResult.value?.token) {
|
||||||
|
await verifyApi({ signal });
|
||||||
|
}
|
||||||
|
const { data } = await axios.get<VersionInfo>(`/manifest.json?t=${Date.now()}`, { signal });
|
||||||
return data;
|
return data;
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
import type { NdmDeviceAlarmLogResultVO } from '@/apis';
|
import type { NdmDeviceAlarmLogResultVO } from '@/apis';
|
||||||
import { TOPIC_DEVICE_ALARM } from '@/constants';
|
import { TOPIC_DEVICE_ALARM } from '@/constants';
|
||||||
import { useCurrentAlarmsStore } from '@/stores';
|
import { useAlarmStore } from '@/stores';
|
||||||
import { Client } from '@stomp/stompjs';
|
import { Client } from '@stomp/stompjs';
|
||||||
import { destr } from 'destr';
|
import { destr } from 'destr';
|
||||||
import { storeToRefs } from 'pinia';
|
import { storeToRefs } from 'pinia';
|
||||||
@@ -15,8 +15,8 @@ const getBrokerUrl = () => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
export const useStompClient = () => {
|
export const useStompClient = () => {
|
||||||
const currentAlarmsStore = useCurrentAlarmsStore();
|
const alarmStore = useAlarmStore();
|
||||||
const { currentAlarmCount } = storeToRefs(currentAlarmsStore);
|
const { unreadAlarmCount } = storeToRefs(alarmStore);
|
||||||
const stompClient = ref<Client | null>(null);
|
const stompClient = ref<Client | null>(null);
|
||||||
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
@@ -30,7 +30,7 @@ export const useStompClient = () => {
|
|||||||
stompClient.value?.subscribe(TOPIC_DEVICE_ALARM, (message) => {
|
stompClient.value?.subscribe(TOPIC_DEVICE_ALARM, (message) => {
|
||||||
const alarm = destr<NdmDeviceAlarmLogResultVO>(message.body);
|
const alarm = destr<NdmDeviceAlarmLogResultVO>(message.body);
|
||||||
if (alarm.alarmCategory === '1') {
|
if (alarm.alarmCategory === '1') {
|
||||||
currentAlarmCount.value++;
|
unreadAlarmCount.value++;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
export const STATION_LIST_QUERY_KEY = 'station-list';
|
export const LINE_STATIONS_QUERY_KEY = 'line-stations';
|
||||||
export const LINE_DEVICES_QUERY_KEY = 'line-devices';
|
export const LINE_DEVICES_QUERY_KEY = 'line-devices';
|
||||||
export const LINE_ALARMS_QUERY_KEY = 'line-alarms';
|
export const LINE_ALARMS_QUERY_KEY = 'line-alarms';
|
||||||
export const DEVICE_SNMP_LOGS_QUERY_KEY = 'device-snmp-logs';
|
|
||||||
|
|||||||
@@ -7,9 +7,9 @@ function renderIcon(icon: Component): () => VNode {
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { SettingsDrawer } from '@/components';
|
import { SettingsDrawer } from '@/components';
|
||||||
import { useStompClient } from '@/composables';
|
import { useStompClient } from '@/composables';
|
||||||
import { useStationListQuery } from '@/composables';
|
import { useLineStationsQuery } from '@/composables';
|
||||||
import { STATION_LIST_QUERY_KEY, LINE_DEVICES_QUERY_KEY, LINE_ALARMS_QUERY_KEY } from '@/constants';
|
import { LINE_STATIONS_QUERY_KEY, LINE_DEVICES_QUERY_KEY, LINE_ALARMS_QUERY_KEY } from '@/constants';
|
||||||
import { useCurrentAlarmsStore, useUserStore } from '@/stores';
|
import { useAlarmStore, useUserStore } from '@/stores';
|
||||||
import { useIsFetching } from '@tanstack/vue-query';
|
import { useIsFetching } from '@tanstack/vue-query';
|
||||||
import { AlertFilled, BugFilled, CaretDownFilled, EnvironmentFilled, /* AreaChartOutlined, */ FileTextFilled, FundFilled, HddFilled, LogoutOutlined, SettingOutlined } from '@vicons/antd';
|
import { AlertFilled, BugFilled, CaretDownFilled, EnvironmentFilled, /* AreaChartOutlined, */ FileTextFilled, FundFilled, HddFilled, LogoutOutlined, SettingOutlined } from '@vicons/antd';
|
||||||
import type { AxiosError } from 'axios';
|
import type { AxiosError } from 'axios';
|
||||||
@@ -23,10 +23,10 @@ useStompClient();
|
|||||||
const userStore = useUserStore();
|
const userStore = useUserStore();
|
||||||
const { userInfo } = storeToRefs(userStore);
|
const { userInfo } = storeToRefs(userStore);
|
||||||
|
|
||||||
const currentAlarmsStore = useCurrentAlarmsStore();
|
const alarmStore = useAlarmStore();
|
||||||
const { currentAlarmCount, needReload } = storeToRefs(currentAlarmsStore);
|
const { unreadAlarmCount } = storeToRefs(alarmStore);
|
||||||
|
|
||||||
const { error: stationListQueryError } = useStationListQuery();
|
const { error: stationListQueryError } = useLineStationsQuery();
|
||||||
|
|
||||||
watch(stationListQueryError, (newStationListQueryError) => {
|
watch(stationListQueryError, (newStationListQueryError) => {
|
||||||
if (newStationListQueryError) {
|
if (newStationListQueryError) {
|
||||||
@@ -34,11 +34,11 @@ watch(stationListQueryError, (newStationListQueryError) => {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
const stationListFetchingCount = useIsFetching({ queryKey: [STATION_LIST_QUERY_KEY] });
|
const lineStationsFetchingCount = useIsFetching({ queryKey: [LINE_STATIONS_QUERY_KEY] });
|
||||||
const lineDevicesFetchingCount = useIsFetching({ queryKey: [LINE_DEVICES_QUERY_KEY] });
|
const lineDevicesFetchingCount = useIsFetching({ queryKey: [LINE_DEVICES_QUERY_KEY] });
|
||||||
const lineAlarmsFetchingCount = useIsFetching({ queryKey: [LINE_ALARMS_QUERY_KEY] });
|
const lineAlarmsFetchingCount = useIsFetching({ queryKey: [LINE_ALARMS_QUERY_KEY] });
|
||||||
const fetchingCount = computed(() => {
|
const fetchingCount = computed(() => {
|
||||||
return stationListFetchingCount.value + lineDevicesFetchingCount.value + lineAlarmsFetchingCount.value;
|
return lineStationsFetchingCount.value + lineDevicesFetchingCount.value + lineAlarmsFetchingCount.value;
|
||||||
});
|
});
|
||||||
|
|
||||||
onBeforeMount(() => {
|
onBeforeMount(() => {
|
||||||
@@ -119,12 +119,13 @@ const selectDropdownOption = (key: string, option: DropdownOption) => {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const toDashboardPage = () => router.push('/');
|
const routeToDashboardPage = () => {
|
||||||
const toAlarmPage = () => {
|
router.push('/dashboard');
|
||||||
currentAlarmCount.value = 0;
|
};
|
||||||
if (route.path === '/alarm') {
|
|
||||||
needReload.value = true;
|
const routeToAlarmPage = () => {
|
||||||
} else {
|
unreadAlarmCount.value = 0;
|
||||||
|
if (route.path !== '/alarm') {
|
||||||
router.push('/alarm');
|
router.push('/alarm');
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@@ -145,7 +146,7 @@ const openSettingsDrawer = () => {
|
|||||||
<NLayoutHeader bordered class="app-layout-header">
|
<NLayoutHeader bordered class="app-layout-header">
|
||||||
<NFlex justify="space-between" align="center" :size="8" style="width: 100%; height: 100%">
|
<NFlex justify="space-between" align="center" :size="8" style="width: 100%; height: 100%">
|
||||||
<NFlex>
|
<NFlex>
|
||||||
<div style="font-size: 16px; font-weight: 500; margin-left: 16px; cursor: pointer" @click="toDashboardPage">网络设备管理平台</div>
|
<div style="font-size: 16px; font-weight: 500; margin-left: 16px; cursor: pointer" @click="routeToDashboardPage">网络设备管理平台</div>
|
||||||
<NButton text size="tiny" :loading="fetchingCount > 0" />
|
<NButton text size="tiny" :loading="fetchingCount > 0" />
|
||||||
</NFlex>
|
</NFlex>
|
||||||
<NFlex align="center" :size="0" style="height: 100%">
|
<NFlex align="center" :size="0" style="height: 100%">
|
||||||
@@ -173,8 +174,8 @@ const openSettingsDrawer = () => {
|
|||||||
</NLayoutContent>
|
</NLayoutContent>
|
||||||
<NLayoutFooter bordered class="app-layout-footer">
|
<NLayoutFooter bordered class="app-layout-footer">
|
||||||
<NFlex :align="'center'" style="height: 100%; margin: 0 16px">
|
<NFlex :align="'center'" style="height: 100%; margin: 0 16px">
|
||||||
<NBadge :value="currentAlarmCount">
|
<NBadge :value="unreadAlarmCount">
|
||||||
<NButton secondary strong @click="toAlarmPage">
|
<NButton secondary strong @click="routeToAlarmPage">
|
||||||
<template #icon>
|
<template #icon>
|
||||||
<NIcon :component="AlertFilled" />
|
<NIcon :component="AlertFilled" />
|
||||||
</template>
|
</template>
|
||||||
|
|||||||
@@ -1,10 +1,21 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { getCameraSnapApi, exportDeviceAlarmLogApi, pageDeviceAlarmLogApi, updateDeviceAlarmLogApi, type NdmDeviceAlarmLogResultVO } from '@/apis';
|
import {
|
||||||
|
getCameraSnapApi,
|
||||||
|
exportDeviceAlarmLogApi,
|
||||||
|
pageDeviceAlarmLogApi,
|
||||||
|
updateDeviceAlarmLogApi,
|
||||||
|
pageCameraIgnoreApi,
|
||||||
|
saveCameraIgnoreApi,
|
||||||
|
removeCameraIgnoreApi,
|
||||||
|
type NdmDeviceAlarmLogResultVO,
|
||||||
|
} from '@/apis';
|
||||||
import { renderAlarmDateCell, renderAlarmTypeCell, renderDeviceTypeCell, renderFaultLevelCell } from '@/components';
|
import { renderAlarmDateCell, renderAlarmTypeCell, renderDeviceTypeCell, renderFaultLevelCell } from '@/components';
|
||||||
import { AlarmType, DeviceType, DeviceTypeCode, DeviceTypeName, FaultLevel, tryGetDeviceTypeVal, type DeviceTypeVal } from '@/enums';
|
import { AlarmType, DeviceType, DeviceTypeCode, DeviceTypeName, FaultLevel, tryGetDeviceTypeVal, type DeviceTypeVal } from '@/enums';
|
||||||
import { useCurrentAlarmsStore, useStationStore } from '@/stores';
|
import { useAlarmStore, useStationStore } from '@/stores';
|
||||||
import { downloadByData } from '@/utils';
|
import { downloadByData } from '@/utils';
|
||||||
import { useMutation } from '@tanstack/vue-query';
|
import { useMutation } from '@tanstack/vue-query';
|
||||||
|
import { CheckOutlined, EyeInvisibleOutlined, EyeOutlined } from '@vicons/antd';
|
||||||
|
import { watchDebounced } from '@vueuse/core';
|
||||||
import dayjs from 'dayjs';
|
import dayjs from 'dayjs';
|
||||||
import {
|
import {
|
||||||
NForm,
|
NForm,
|
||||||
@@ -17,7 +28,6 @@ import {
|
|||||||
NSelect,
|
NSelect,
|
||||||
NGridItem,
|
NGridItem,
|
||||||
NDatePicker,
|
NDatePicker,
|
||||||
NTag,
|
|
||||||
NPopconfirm,
|
NPopconfirm,
|
||||||
NModal,
|
NModal,
|
||||||
NImage,
|
NImage,
|
||||||
@@ -25,19 +35,38 @@ import {
|
|||||||
type DataTableColumns,
|
type DataTableColumns,
|
||||||
type DataTableRowData,
|
type DataTableRowData,
|
||||||
type PaginationProps,
|
type PaginationProps,
|
||||||
|
NFlex,
|
||||||
|
NSwitch,
|
||||||
} from 'naive-ui';
|
} from 'naive-ui';
|
||||||
import { storeToRefs } from 'pinia';
|
import { storeToRefs } from 'pinia';
|
||||||
import { ref, reactive, onBeforeMount, h, computed, watch } from 'vue';
|
import { ref, reactive, onBeforeMount, h, computed, watch } from 'vue';
|
||||||
|
|
||||||
const currentAlarmsStore = useCurrentAlarmsStore();
|
const alarmStore = useAlarmStore();
|
||||||
const { needReload } = storeToRefs(currentAlarmsStore);
|
const { unreadAlarmCount } = storeToRefs(alarmStore);
|
||||||
watch(needReload, async (newVal) => {
|
|
||||||
if (newVal) {
|
const unreadCountCleared = computed(() => unreadAlarmCount.value === 0);
|
||||||
needReload.value = false;
|
|
||||||
|
// 未读告警数量被清零时,代表需要刷新告警表格数据
|
||||||
|
watch(unreadCountCleared, (newValue, oldValue) => {
|
||||||
|
if (!oldValue && newValue) {
|
||||||
onClickReset();
|
onClickReset();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const realtimeRefresh = ref(false);
|
||||||
|
|
||||||
|
watchDebounced(
|
||||||
|
[unreadAlarmCount, realtimeRefresh],
|
||||||
|
([unreadCount, refresh]) => {
|
||||||
|
if (unreadCount > 0 && refresh) {
|
||||||
|
getTableData();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
debounce: 500,
|
||||||
|
},
|
||||||
|
);
|
||||||
|
|
||||||
const stationStore = useStationStore();
|
const stationStore = useStationStore();
|
||||||
const { stationList } = storeToRefs(stationStore);
|
const { stationList } = storeToRefs(stationStore);
|
||||||
|
|
||||||
@@ -116,6 +145,9 @@ const snapPreviewShow = ref(false);
|
|||||||
const snapPreviewUrl = ref('');
|
const snapPreviewUrl = ref('');
|
||||||
|
|
||||||
const tableColumns: DataTableColumns<NdmDeviceAlarmLogResultVO & { snapUrl: string }> = [
|
const tableColumns: DataTableColumns<NdmDeviceAlarmLogResultVO & { snapUrl: string }> = [
|
||||||
|
// { title: '设备ID', key: 'deviceId' },
|
||||||
|
// { title: '故障编码', key: 'faultCode', align: 'center' },
|
||||||
|
// { title: '故障位置', key: 'faultLocation' },
|
||||||
{ title: '告警流水号', key: 'alarmNo' },
|
{ title: '告警流水号', key: 'alarmNo' },
|
||||||
{
|
{
|
||||||
title: '告警时间',
|
title: '告警时间',
|
||||||
@@ -148,8 +180,6 @@ const tableColumns: DataTableColumns<NdmDeviceAlarmLogResultVO & { snapUrl: stri
|
|||||||
align: 'center',
|
align: 'center',
|
||||||
render: renderFaultLevelCell,
|
render: renderFaultLevelCell,
|
||||||
},
|
},
|
||||||
// { title: '故障编码', key: 'faultCode', align: 'center' },
|
|
||||||
// { title: '故障位置', key: 'faultLocation' },
|
|
||||||
{ title: '故障描述', key: 'faultDescription' },
|
{ title: '故障描述', key: 'faultDescription' },
|
||||||
{ title: '修复建议', key: 'alarmRepairSuggestion' },
|
{ title: '修复建议', key: 'alarmRepairSuggestion' },
|
||||||
{
|
{
|
||||||
@@ -198,30 +228,59 @@ const tableColumns: DataTableColumns<NdmDeviceAlarmLogResultVO & { snapUrl: stri
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: '告警确认',
|
title: '操作',
|
||||||
key: 'alarmConfirm',
|
key: 'action',
|
||||||
align: 'center',
|
align: 'center',
|
||||||
render: (rowData) => {
|
render: (rowData) => {
|
||||||
if (rowData.alarmConfirm === '1') {
|
|
||||||
return h(NTag, { type: 'default' }, { default: () => '已确认' });
|
|
||||||
}
|
|
||||||
const { id } = rowData;
|
const { id } = rowData;
|
||||||
return h(
|
return h(
|
||||||
|
NFlex,
|
||||||
|
{
|
||||||
|
size: 'small',
|
||||||
|
justify: 'center',
|
||||||
|
align: 'center',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
default: () => [
|
||||||
|
rowData.alarmConfirm === '1'
|
||||||
|
? h(NButton, { disabled: true, text: true, type: 'info', size: 'small' }, { icon: () => h(CheckOutlined) })
|
||||||
|
: h(
|
||||||
NPopconfirm,
|
NPopconfirm,
|
||||||
{
|
{
|
||||||
onPositiveClick: () => {
|
onPositiveClick: () => confirmAlarm({ id }),
|
||||||
rowData.alarmConfirm = '1';
|
|
||||||
confirmAlarm({ id });
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
trigger: () => h(NButton, { type: 'info', size: 'small' }, { default: () => '确认' }),
|
trigger: () => h(NButton, { text: true, type: 'info', size: 'small' }, { icon: () => h(CheckOutlined) }),
|
||||||
default: () => '确认告警?',
|
default: () => '确认告警?',
|
||||||
},
|
},
|
||||||
|
),
|
||||||
|
tryGetDeviceTypeVal(rowData.deviceType) === DeviceType.Camera && [
|
||||||
|
h(
|
||||||
|
NPopconfirm,
|
||||||
|
{
|
||||||
|
onPositiveClick: () => ignoreCamera({ id }),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
trigger: () => h(NButton, { text: true, type: 'info', size: 'small' }, { icon: () => h(EyeInvisibleOutlined) }),
|
||||||
|
default: () => '忽略设备?',
|
||||||
|
},
|
||||||
|
),
|
||||||
|
h(
|
||||||
|
NPopconfirm,
|
||||||
|
{
|
||||||
|
onPositiveClick: () => noticeCamera({ id }),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
trigger: () => h(NButton, { text: true, type: 'info', size: 'small' }, { icon: () => h(EyeOutlined) }),
|
||||||
|
default: () => '取消忽略设备?',
|
||||||
|
},
|
||||||
|
),
|
||||||
|
],
|
||||||
|
],
|
||||||
|
},
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
// { title: '设备ID', key: 'deviceId' },
|
|
||||||
];
|
];
|
||||||
|
|
||||||
const tableData = ref<DataTableRowData[]>([]);
|
const tableData = ref<DataTableRowData[]>([]);
|
||||||
@@ -302,8 +361,15 @@ const { mutateAsync: getSnapByDeviceId } = useMutation({
|
|||||||
|
|
||||||
const { mutate: confirmAlarm } = useMutation({
|
const { mutate: confirmAlarm } = useMutation({
|
||||||
mutationFn: async (params: { id?: string }) => {
|
mutationFn: async (params: { id?: string }) => {
|
||||||
|
const { id } = params;
|
||||||
|
if (id) {
|
||||||
|
const alarmLog = tableData.value.find((item) => item.id === id);
|
||||||
|
if (alarmLog) {
|
||||||
|
alarmLog['alarmConfirm'] = '1';
|
||||||
|
}
|
||||||
|
}
|
||||||
await updateDeviceAlarmLogApi({
|
await updateDeviceAlarmLogApi({
|
||||||
id: params.id,
|
id,
|
||||||
alarmConfirm: '1',
|
alarmConfirm: '1',
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
@@ -320,6 +386,61 @@ const { mutate: confirmAlarm } = useMutation({
|
|||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const { mutate: ignoreCamera } = useMutation({
|
||||||
|
mutationFn: async (params: { id?: string }) => {
|
||||||
|
const { id } = params;
|
||||||
|
if (!id) return;
|
||||||
|
const alarmLog = tableData.value.find((item) => item.id === id);
|
||||||
|
if (!alarmLog) return;
|
||||||
|
const { records } = await pageCameraIgnoreApi({
|
||||||
|
model: { deviceId: alarmLog.deviceId },
|
||||||
|
extra: {},
|
||||||
|
current: 1,
|
||||||
|
size: 10,
|
||||||
|
sort: 'id',
|
||||||
|
order: 'descending',
|
||||||
|
});
|
||||||
|
const ignoredCamera = records.at(0);
|
||||||
|
if (ignoredCamera) {
|
||||||
|
window.$message.info('设备已被忽略');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
await saveCameraIgnoreApi({ deviceId: alarmLog.deviceId });
|
||||||
|
window.$message.success('忽略设备成功');
|
||||||
|
},
|
||||||
|
onError: (error) => {
|
||||||
|
console.error(error);
|
||||||
|
window.$message.error(error.message);
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
const { mutate: noticeCamera } = useMutation({
|
||||||
|
mutationFn: async (params: { id?: string }) => {
|
||||||
|
const { id } = params;
|
||||||
|
if (!id) return;
|
||||||
|
const alarmLog = tableData.value.find((item) => item.id === id);
|
||||||
|
if (!alarmLog) return;
|
||||||
|
const { records } = await pageCameraIgnoreApi({
|
||||||
|
model: { deviceId: alarmLog.deviceId },
|
||||||
|
extra: {},
|
||||||
|
current: 1,
|
||||||
|
size: 10,
|
||||||
|
sort: 'id',
|
||||||
|
order: 'descending',
|
||||||
|
});
|
||||||
|
if (records.length === 0) {
|
||||||
|
window.$message.info('设备未被忽略');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
await removeCameraIgnoreApi([...records.map((record) => record.id ?? '')]);
|
||||||
|
window.$message.success('取消忽略设备成功');
|
||||||
|
},
|
||||||
|
onError: (error) => {
|
||||||
|
console.error(error);
|
||||||
|
window.$message.error(error.message);
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
const { mutate: exportTableData, isPending: exporting } = useMutation({
|
const { mutate: exportTableData, isPending: exporting } = useMutation({
|
||||||
mutationFn: async () => {
|
mutationFn: async () => {
|
||||||
const data = await exportDeviceAlarmLogApi({
|
const data = await exportDeviceAlarmLogApi({
|
||||||
@@ -425,9 +546,11 @@ onBeforeMount(() => getTableData());
|
|||||||
<!-- 工具栏:横向、右对齐按钮) -->
|
<!-- 工具栏:横向、右对齐按钮) -->
|
||||||
<div style="flex: 0 0 auto; display: flex; align-items: center; padding: 8px">
|
<div style="flex: 0 0 auto; display: flex; align-items: center; padding: 8px">
|
||||||
<div style="font-size: medium">设备告警列表</div>
|
<div style="font-size: medium">设备告警列表</div>
|
||||||
<NSpace style="margin-left: auto">
|
<NFlex align="center" style="margin-left: auto">
|
||||||
|
<div>实时刷新</div>
|
||||||
|
<NSwitch size="small" v-model:value="realtimeRefresh" />
|
||||||
<NButton type="primary" :loading="exporting" @click="() => exportTableData()">导出</NButton>
|
<NButton type="primary" :loading="exporting" @click="() => exportTableData()">导出</NButton>
|
||||||
</NSpace>
|
</NFlex>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- 表格区域:填满剩余空间 -->
|
<!-- 表格区域:填满剩余空间 -->
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
import { exportIcmpApi } from '@/apis';
|
import { exportIcmpApi } from '@/apis';
|
||||||
import { DeviceStatisticCard } from '@/components';
|
import { DeviceStatisticCard } from '@/components';
|
||||||
import { useLineAlarmsQuery, useLineDevicesQuery } from '@/composables';
|
import { useLineAlarmsQuery, useLineDevicesQuery } from '@/composables';
|
||||||
import { useLineDevicesStore, useStationStore } from '@/stores';
|
import { useDeviceStore, useStationStore } from '@/stores';
|
||||||
import { downloadByData } from '@/utils';
|
import { downloadByData } from '@/utils';
|
||||||
import { useMutation } from '@tanstack/vue-query';
|
import { useMutation } from '@tanstack/vue-query';
|
||||||
import dayjs from 'dayjs';
|
import dayjs from 'dayjs';
|
||||||
@@ -11,7 +11,7 @@ import { watch } from 'vue';
|
|||||||
|
|
||||||
const stationStore = useStationStore();
|
const stationStore = useStationStore();
|
||||||
const { stationList } = storeToRefs(stationStore);
|
const { stationList } = storeToRefs(stationStore);
|
||||||
const lineDevicesStore = useLineDevicesStore();
|
const lineDevicesStore = useDeviceStore();
|
||||||
const { lineDevices } = storeToRefs(lineDevicesStore);
|
const { lineDevices } = storeToRefs(lineDevicesStore);
|
||||||
|
|
||||||
const { error: lineDevicesQueryError } = useLineDevicesQuery();
|
const { error: lineDevicesQueryError } = useLineDevicesQuery();
|
||||||
|
|||||||
@@ -1,12 +1,12 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { useQueryControlStore } from '@/stores';
|
import { usePollingStore } from '@/stores';
|
||||||
import { NLayout, NLayoutContent } from 'naive-ui';
|
import { NLayout, NLayoutContent } from 'naive-ui';
|
||||||
import { onBeforeUnmount } from 'vue';
|
import { onBeforeUnmount } from 'vue';
|
||||||
|
|
||||||
const queryControlStore = useQueryControlStore();
|
const pollingStore = usePollingStore();
|
||||||
queryControlStore.disablePolling();
|
pollingStore.disablePolling();
|
||||||
onBeforeUnmount(() => {
|
onBeforeUnmount(() => {
|
||||||
queryControlStore.enablePolling();
|
pollingStore.enablePolling();
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { DeviceRenderer, DeviceTree } from '@/components';
|
import { DeviceRenderer, DeviceTree } from '@/components';
|
||||||
import { useDeviceSelection, useLineDevicesQuery } from '@/composables';
|
import { useDeviceSelection, useLineDevicesQuery } from '@/composables';
|
||||||
import { useLineDevicesStore, useStationStore } from '@/stores';
|
import { useDeviceStore, useStationStore } from '@/stores';
|
||||||
import { ChevronBack } from '@vicons/ionicons5';
|
import { ChevronBack } from '@vicons/ionicons5';
|
||||||
import { watchDebounced } from '@vueuse/core';
|
import { watchDebounced } from '@vueuse/core';
|
||||||
import { NEmpty, NIcon, NLayout, NLayoutContent, NLayoutSider, NPageHeader, NScrollbar } from 'naive-ui';
|
import { NEmpty, NIcon, NLayout, NLayoutContent, NLayoutSider, NPageHeader, NScrollbar } from 'naive-ui';
|
||||||
@@ -13,7 +13,7 @@ import { useRoute, useRouter } from 'vue-router';
|
|||||||
const { error: lineDevicesQueryError } = useLineDevicesQuery();
|
const { error: lineDevicesQueryError } = useLineDevicesQuery();
|
||||||
const stationStore = useStationStore();
|
const stationStore = useStationStore();
|
||||||
const { stationList } = storeToRefs(stationStore);
|
const { stationList } = storeToRefs(stationStore);
|
||||||
const lineDevicesStore = useLineDevicesStore();
|
const lineDevicesStore = useDeviceStore();
|
||||||
const { lineDevices } = storeToRefs(lineDevicesStore);
|
const { lineDevices } = storeToRefs(lineDevicesStore);
|
||||||
|
|
||||||
const route = useRoute();
|
const route = useRoute();
|
||||||
|
|||||||
@@ -2,22 +2,22 @@
|
|||||||
import type { Station } from '@/apis';
|
import type { Station } from '@/apis';
|
||||||
import { DeviceAlarmDetailModal, DeviceParamsConfigModal, OfflineDeviceDetailModal, StationCard } from '@/components';
|
import { DeviceAlarmDetailModal, DeviceParamsConfigModal, OfflineDeviceDetailModal, StationCard } from '@/components';
|
||||||
import { useLineAlarmsQuery, useLineDevicesQuery } from '@/composables';
|
import { useLineAlarmsQuery, useLineDevicesQuery } from '@/composables';
|
||||||
import { useLayoutStore, useLineAlarmsStore, useLineDevicesStore, useStationStore } from '@/stores';
|
import { useAlarmStore, useDeviceStore, useSettingStore, useStationStore } from '@/stores';
|
||||||
import { NGrid, NGi } from 'naive-ui';
|
import { NGrid, NGi } from 'naive-ui';
|
||||||
import { storeToRefs } from 'pinia';
|
import { storeToRefs } from 'pinia';
|
||||||
import { ref, watch } from 'vue';
|
import { ref, watch } from 'vue';
|
||||||
|
|
||||||
const stationStore = useStationStore();
|
const stationStore = useStationStore();
|
||||||
const { stationList } = storeToRefs(stationStore);
|
const { stationList } = storeToRefs(stationStore);
|
||||||
const lineDevicesStore = useLineDevicesStore();
|
const deviceStore = useDeviceStore();
|
||||||
const { lineDevices } = storeToRefs(lineDevicesStore);
|
const { lineDevices } = storeToRefs(deviceStore);
|
||||||
const lineAlarmsStore = useLineAlarmsStore();
|
const alarmStore = useAlarmStore();
|
||||||
const { lineAlarmCounts } = storeToRefs(lineAlarmsStore);
|
const { lineAlarmCounts } = storeToRefs(alarmStore);
|
||||||
|
|
||||||
const { error: lineDevicesQueryError } = useLineDevicesQuery();
|
const { error: lineDevicesQueryError } = useLineDevicesQuery();
|
||||||
const { error: lineAlarmsQueryError } = useLineAlarmsQuery();
|
const { error: lineAlarmsQueryError } = useLineAlarmsQuery();
|
||||||
const layoutStore = useLayoutStore();
|
const settingStore = useSettingStore();
|
||||||
const { stationGridColumns } = storeToRefs(layoutStore);
|
const { stationGridColumns } = storeToRefs(settingStore);
|
||||||
|
|
||||||
watch([lineDevicesQueryError, lineAlarmsQueryError], ([newLineDevicesQueryError, newLineAlarmsQueryError]) => {
|
watch([lineDevicesQueryError, lineAlarmsQueryError], ([newLineDevicesQueryError, newLineAlarmsQueryError]) => {
|
||||||
if (newLineDevicesQueryError) {
|
if (newLineDevicesQueryError) {
|
||||||
|
|||||||
@@ -2,10 +2,13 @@ import type { LineAlarmCounts } from '@/apis';
|
|||||||
import { defineStore } from 'pinia';
|
import { defineStore } from 'pinia';
|
||||||
import { ref } from 'vue';
|
import { ref } from 'vue';
|
||||||
|
|
||||||
export const useLineAlarmsStore = defineStore('ndm-line-alarms-store', () => {
|
export const useAlarmStore = defineStore('ndm-alarm-store', () => {
|
||||||
const lineAlarmCounts = ref<LineAlarmCounts>({});
|
const lineAlarmCounts = ref<LineAlarmCounts>({});
|
||||||
|
|
||||||
|
const unreadAlarmCount = ref(0);
|
||||||
|
|
||||||
return {
|
return {
|
||||||
lineAlarmCounts,
|
lineAlarmCounts,
|
||||||
|
unreadAlarmCount,
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
@@ -1,12 +0,0 @@
|
|||||||
import { defineStore } from 'pinia';
|
|
||||||
import { ref } from 'vue';
|
|
||||||
|
|
||||||
export const useCurrentAlarmsStore = defineStore('ndm-current-alarms-store', () => {
|
|
||||||
const currentAlarmCount = ref(0);
|
|
||||||
const needReload = ref(false);
|
|
||||||
|
|
||||||
return {
|
|
||||||
currentAlarmCount,
|
|
||||||
needReload,
|
|
||||||
};
|
|
||||||
});
|
|
||||||
@@ -1,24 +0,0 @@
|
|||||||
import { defineStore } from 'pinia';
|
|
||||||
import { ref } from 'vue';
|
|
||||||
|
|
||||||
export const useDebugModeStore = defineStore(
|
|
||||||
'ndm-debug-mode-store',
|
|
||||||
() => {
|
|
||||||
const debugEnabled = ref(false);
|
|
||||||
|
|
||||||
const enableDebug = () => (debugEnabled.value = true);
|
|
||||||
const disableDebug = () => (debugEnabled.value = false);
|
|
||||||
|
|
||||||
return {
|
|
||||||
debugEnabled,
|
|
||||||
enableDebug,
|
|
||||||
disableDebug,
|
|
||||||
};
|
|
||||||
},
|
|
||||||
{
|
|
||||||
persist: {
|
|
||||||
pick: ['debugEnabled'],
|
|
||||||
storage: window.sessionStorage,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
);
|
|
||||||
@@ -3,14 +3,14 @@ import { tryGetDeviceTypeVal } from '@/enums';
|
|||||||
import { defineStore } from 'pinia';
|
import { defineStore } from 'pinia';
|
||||||
import { ref } from 'vue';
|
import { ref } from 'vue';
|
||||||
|
|
||||||
export const useLineDevicesStore = defineStore('ndm-line-devices-store', () => {
|
export const useDeviceStore = defineStore('ndm-device-store', () => {
|
||||||
const lineDevices = ref<LineDevices>({});
|
const lineDevices = ref<LineDevices>({});
|
||||||
|
|
||||||
const patch = (stationCode: string, device: NdmDeviceResultVO) => {
|
const patch = (stationCode: string, device: NdmDeviceResultVO) => {
|
||||||
const deviceTypeVal = tryGetDeviceTypeVal(device.deviceType);
|
const deviceTypeVal = tryGetDeviceTypeVal(device.deviceType);
|
||||||
if (!!deviceTypeVal) {
|
if (!!deviceTypeVal) {
|
||||||
if (lineDevices.value[stationCode]) {
|
if (lineDevices.value[stationCode]) {
|
||||||
const index = lineDevices.value[stationCode][deviceTypeVal].findIndex((d) => d.id === device.id);
|
const index = lineDevices.value[stationCode][deviceTypeVal].findIndex((dev) => dev.id === device.id);
|
||||||
if (index > -1) {
|
if (index > -1) {
|
||||||
lineDevices.value[stationCode][deviceTypeVal][index] = device;
|
lineDevices.value[stationCode][deviceTypeVal][index] = device;
|
||||||
}
|
}
|
||||||
@@ -1,9 +1,6 @@
|
|||||||
export * from './current-alarms';
|
export * from './alarm';
|
||||||
export * from './debug-mode';
|
export * from './device';
|
||||||
export * from './layout';
|
export * from './polling';
|
||||||
export * from './line-alarms';
|
|
||||||
export * from './line-devices';
|
|
||||||
export * from './query-control';
|
|
||||||
export * from './station';
|
export * from './station';
|
||||||
export * from './theme';
|
export * from './setting';
|
||||||
export * from './user';
|
export * from './user';
|
||||||
|
|||||||
@@ -1,16 +0,0 @@
|
|||||||
import { defineStore } from 'pinia';
|
|
||||||
import { ref } from 'vue';
|
|
||||||
|
|
||||||
export const useLayoutStore = defineStore(
|
|
||||||
'ndm-layout-store',
|
|
||||||
() => {
|
|
||||||
const stationGridColumns = ref(6);
|
|
||||||
|
|
||||||
return {
|
|
||||||
stationGridColumns,
|
|
||||||
};
|
|
||||||
},
|
|
||||||
{
|
|
||||||
persist: true,
|
|
||||||
},
|
|
||||||
);
|
|
||||||
@@ -2,8 +2,8 @@ import dayjs from 'dayjs';
|
|||||||
import { defineStore } from 'pinia';
|
import { defineStore } from 'pinia';
|
||||||
import { ref } from 'vue';
|
import { ref } from 'vue';
|
||||||
|
|
||||||
export const useQueryControlStore = defineStore(
|
export const usePollingStore = defineStore(
|
||||||
'ndm-query-control-store',
|
'ndm-polling-store',
|
||||||
() => {
|
() => {
|
||||||
const pollingEnabled = ref(true);
|
const pollingEnabled = ref(true);
|
||||||
const enablePolling = () => (pollingEnabled.value = true);
|
const enablePolling = () => (pollingEnabled.value = true);
|
||||||
46
src/stores/setting.ts
Normal file
46
src/stores/setting.ts
Normal file
@@ -0,0 +1,46 @@
|
|||||||
|
import { darkTheme, lightTheme } from 'naive-ui';
|
||||||
|
import { defineStore } from 'pinia';
|
||||||
|
import { computed, ref } from 'vue';
|
||||||
|
|
||||||
|
export const useSettingStore = defineStore(
|
||||||
|
'ndm-setting-store',
|
||||||
|
() => {
|
||||||
|
const darkThemeEnabled = ref(true);
|
||||||
|
const themeMode = computed(() => {
|
||||||
|
return darkThemeEnabled.value ? darkTheme : lightTheme;
|
||||||
|
});
|
||||||
|
|
||||||
|
const stationGridColumns = ref(6);
|
||||||
|
|
||||||
|
const debugModeEnabled = ref(false);
|
||||||
|
const enableDebugMode = () => {
|
||||||
|
debugModeEnabled.value = true;
|
||||||
|
};
|
||||||
|
const disableDebugMode = () => {
|
||||||
|
debugModeEnabled.value = false;
|
||||||
|
};
|
||||||
|
|
||||||
|
return {
|
||||||
|
darkThemeEnabled,
|
||||||
|
themeMode,
|
||||||
|
|
||||||
|
stationGridColumns,
|
||||||
|
|
||||||
|
debugModeEnabled,
|
||||||
|
enableDebugMode,
|
||||||
|
disableDebugMode,
|
||||||
|
};
|
||||||
|
},
|
||||||
|
{
|
||||||
|
persist: [
|
||||||
|
{
|
||||||
|
omit: ['debugModeEnabled'],
|
||||||
|
storage: window.localStorage,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
pick: ['debugModeEnabled'],
|
||||||
|
storage: window.sessionStorage,
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
);
|
||||||
@@ -1,21 +0,0 @@
|
|||||||
import { ref, computed } from 'vue';
|
|
||||||
import { defineStore } from 'pinia';
|
|
||||||
import { darkTheme, lightTheme } from 'naive-ui';
|
|
||||||
|
|
||||||
export const useThemeStore = defineStore(
|
|
||||||
'ndm-theme-store',
|
|
||||||
() => {
|
|
||||||
const darkThemeEnabled = ref(true);
|
|
||||||
const themeMode = computed(() => {
|
|
||||||
return darkThemeEnabled.value ? darkTheme : lightTheme;
|
|
||||||
});
|
|
||||||
|
|
||||||
return {
|
|
||||||
darkThemeEnabled,
|
|
||||||
themeMode,
|
|
||||||
};
|
|
||||||
},
|
|
||||||
{
|
|
||||||
persist: true,
|
|
||||||
},
|
|
||||||
);
|
|
||||||
@@ -6,7 +6,7 @@ import { defineStore } from 'pinia';
|
|||||||
import { computed, ref } from 'vue';
|
import { computed, ref } from 'vue';
|
||||||
import dayjs from 'dayjs';
|
import dayjs from 'dayjs';
|
||||||
import { useStationStore } from './station';
|
import { useStationStore } from './station';
|
||||||
import { useQueryControlStore } from './query-control';
|
import { usePollingStore } from './polling';
|
||||||
|
|
||||||
const getHeaders = () => {
|
const getHeaders = () => {
|
||||||
const { lampAuthorization, lampClientId, lampClientSecret } = getAppEnvConfig();
|
const { lampAuthorization, lampClientId, lampClientSecret } = getAppEnvConfig();
|
||||||
@@ -131,8 +131,8 @@ export const useUserStore = defineStore(
|
|||||||
window.location.reload();
|
window.location.reload();
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
const queryControlStore = useQueryControlStore();
|
const pollingStore = usePollingStore();
|
||||||
queryControlStore.disablePolling();
|
pollingStore.disablePolling();
|
||||||
throw new AxiosError(respData.msg, `${respData.code}`);
|
throw new AxiosError(respData.msg, `${respData.code}`);
|
||||||
} else {
|
} else {
|
||||||
if (lampLoginResultRecord.value === null) {
|
if (lampLoginResultRecord.value === null) {
|
||||||
|
|||||||
@@ -106,7 +106,7 @@ export class RequestClient {
|
|||||||
const reqConfig = option ?? {};
|
const reqConfig = option ?? {};
|
||||||
return new Promise((resolve) => {
|
return new Promise((resolve) => {
|
||||||
this.instance
|
this.instance
|
||||||
.delete<Result<T>>(url, { ...reqConfig, data: { ids: idList } })
|
.delete<Result<T>>(url, { ...reqConfig, data: idList })
|
||||||
.then((res) => {
|
.then((res) => {
|
||||||
resolve([null, res.data.data, res.data]);
|
resolve([null, res.data.data, res.data]);
|
||||||
})
|
})
|
||||||
|
|||||||
Reference in New Issue
Block a user