From a7f9e1c2722d1c593f6f76e86fa68e1d3a3c8739 Mon Sep 17 00:00:00 2001 From: yangsy Date: Thu, 14 Aug 2025 03:22:59 +0800 Subject: [PATCH] format --- .../domains/diag-info/ndm-camera-diag-info.ts | 2 +- .../diag-info/ndm-decoder-diag-info.ts | 2 +- .../domains/diag-info/ndm-nvr-diag-info.ts | 2 +- .../diag-info/ndm-security-box-diag-info.ts | 2 +- .../domains/diag-info/ndm-server-diag-info.ts | 2 +- src/apis/models/base/model.ts | 20 +++++------ src/apis/models/base/page.ts | 36 +++++++++---------- src/apis/models/base/reduce.ts | 11 ++---- src/apis/requests/device/index.ts | 2 +- src/main.ts | 28 +++++++-------- src/stores/station.ts | 16 ++++----- src/stores/theme.ts | 18 +++++----- src/utils/env.ts | 10 +----- 13 files changed, 69 insertions(+), 82 deletions(-) diff --git a/src/apis/domains/diag-info/ndm-camera-diag-info.ts b/src/apis/domains/diag-info/ndm-camera-diag-info.ts index a0f6857..5a79f62 100644 --- a/src/apis/domains/diag-info/ndm-camera-diag-info.ts +++ b/src/apis/domains/diag-info/ndm-camera-diag-info.ts @@ -2,4 +2,4 @@ export interface NdmCameraDiagInfo { [key: string]: any; logTime: string; info: string; -} \ No newline at end of file +} diff --git a/src/apis/domains/diag-info/ndm-decoder-diag-info.ts b/src/apis/domains/diag-info/ndm-decoder-diag-info.ts index 1010c0e..e0750d4 100644 --- a/src/apis/domains/diag-info/ndm-decoder-diag-info.ts +++ b/src/apis/domains/diag-info/ndm-decoder-diag-info.ts @@ -11,4 +11,4 @@ export interface NdmDecoderDiagInfo { 内存使用率: string; CPU使用率: string; }; -} \ No newline at end of file +} diff --git a/src/apis/domains/diag-info/ndm-nvr-diag-info.ts b/src/apis/domains/diag-info/ndm-nvr-diag-info.ts index 9a77d4e..35bb255 100644 --- a/src/apis/domains/diag-info/ndm-nvr-diag-info.ts +++ b/src/apis/domains/diag-info/ndm-nvr-diag-info.ts @@ -20,4 +20,4 @@ export interface NdmNvrDiagInfo { 内存使用率: string; CPU使用率: string; }; -} \ No newline at end of file +} diff --git a/src/apis/domains/diag-info/ndm-security-box-diag-info.ts b/src/apis/domains/diag-info/ndm-security-box-diag-info.ts index daea867..401d881 100644 --- a/src/apis/domains/diag-info/ndm-security-box-diag-info.ts +++ b/src/apis/domains/diag-info/ndm-security-box-diag-info.ts @@ -18,4 +18,4 @@ export interface NdmSecurityBoxDiagInfo { 内存使用率: string; CPU使用率: string; }; -} \ No newline at end of file +} diff --git a/src/apis/domains/diag-info/ndm-server-diag-info.ts b/src/apis/domains/diag-info/ndm-server-diag-info.ts index f06385b..57fe700 100644 --- a/src/apis/domains/diag-info/ndm-server-diag-info.ts +++ b/src/apis/domains/diag-info/ndm-server-diag-info.ts @@ -6,4 +6,4 @@ export interface NdmServerDiagInfo { 磁盘使用率: string; 系统运行时间: string; }; -} \ No newline at end of file +} diff --git a/src/apis/models/base/model.ts b/src/apis/models/base/model.ts index 15ae811..cddd42d 100644 --- a/src/apis/models/base/model.ts +++ b/src/apis/models/base/model.ts @@ -1,18 +1,18 @@ export interface SuperModel { - id: string - createdBy: string - createdTime: string - echoMap?: any + id: string; + createdBy: string; + createdTime: string; + echoMap?: any; } export interface BaseModel extends SuperModel { - updatedBy: string - updatedTime: string + updatedBy: string; + updatedTime: string; } export interface TreeModel extends BaseModel { - parentId: string - sortValue: number - treeGrade: number - treePath: string + parentId: string; + sortValue: number; + treeGrade: number; + treePath: string; } diff --git a/src/apis/models/base/page.ts b/src/apis/models/base/page.ts index 8c064c1..ab39190 100644 --- a/src/apis/models/base/page.ts +++ b/src/apis/models/base/page.ts @@ -1,33 +1,33 @@ export interface BasicPageParams { - page: number - pageSize: number + page: number; + pageSize: number; } export interface BasicFetchResult { - items: T[] - total: number + items: T[]; + total: number; } export interface RemoteData { - key: string | number - data?: any + key: string | number; + data?: any; } export interface PageParams { - model: T - size: number - current: number - sort?: string - order?: string - extra?: any + model: T; + size: number; + current: number; + sort?: string; + order?: string; + extra?: any; } export interface PageResult { - records: T[] + records: T[]; // offset: number - pages: string - current: string - total: string - size: string - orders: any[] + pages: string; + current: string; + total: string; + size: string; + orders: any[]; } diff --git a/src/apis/models/base/reduce.ts b/src/apis/models/base/reduce.ts index 7258b33..63764a9 100644 --- a/src/apis/models/base/reduce.ts +++ b/src/apis/models/base/reduce.ts @@ -1,8 +1,3 @@ -export type ReduceForUpdateVO = - | 'createdTime' - | 'createdBy' - | 'updatedTime' - | 'updatedBy' - | 'echoMap' -export type ReduceForSaveVO = ReduceForUpdateVO | 'id' -export type ReduceForPageQuery = ReduceForUpdateVO +export type ReduceForUpdateVO = 'createdTime' | 'createdBy' | 'updatedTime' | 'updatedBy' | 'echoMap'; +export type ReduceForSaveVO = ReduceForUpdateVO | 'id'; +export type ReduceForPageQuery = ReduceForUpdateVO; diff --git a/src/apis/requests/device/index.ts b/src/apis/requests/device/index.ts index 014d922..8e18f91 100644 --- a/src/apis/requests/device/index.ts +++ b/src/apis/requests/device/index.ts @@ -5,4 +5,4 @@ export * from './ndm-media-server'; export * from './ndm-nvr'; export * from './ndm-security-box'; export * from './ndm-switch'; -export * from './ndm-video-server'; \ No newline at end of file +export * from './ndm-video-server'; diff --git a/src/main.ts b/src/main.ts index bcd86c7..0ca9727 100644 --- a/src/main.ts +++ b/src/main.ts @@ -1,16 +1,16 @@ -import { createApp } from 'vue' -import { createPinia } from 'pinia' -import persist from 'pinia-plugin-persistedstate' -import { VueQueryPlugin, QueryClient } from '@tanstack/vue-query' +import { createApp } from 'vue'; +import { createPinia } from 'pinia'; +import persist from 'pinia-plugin-persistedstate'; +import { VueQueryPlugin, QueryClient } from '@tanstack/vue-query'; -import App from './App.vue' -import router from './router' +import App from './App.vue'; +import router from './router'; -import '@/styles/reset.scss' +import '@/styles/reset.scss'; -import { getAppEnvConfig } from '@/utils/env' +import { getAppEnvConfig } from '@/utils/env'; -const app = createApp(App) +const app = createApp(App); const queryClient = new QueryClient({ defaultOptions: { @@ -21,10 +21,10 @@ const queryClient = new QueryClient({ refetchOnWindowFocus: true, }, }, -}) +}); -app.use(createPinia().use(persist)) -app.use(router) -app.use(VueQueryPlugin, { queryClient }) +app.use(createPinia().use(persist)); +app.use(router); +app.use(VueQueryPlugin, { queryClient }); -app.mount('#app') +app.mount('#app'); diff --git a/src/stores/station.ts b/src/stores/station.ts index eb4032c..124749d 100644 --- a/src/stores/station.ts +++ b/src/stores/station.ts @@ -1,11 +1,11 @@ -import type { Station } from '@/apis/domains' -import { defineStore } from 'pinia' -import { computed, ref } from 'vue' +import type { Station } from '@/apis/domains'; +import { defineStore } from 'pinia'; +import { computed, ref } from 'vue'; -export const useStationStore = defineStore('ndmstation', () => { - const stationList = ref([]) +export const useStationStore = defineStore('ndm-station-store', () => { + const stationList = ref([]); - const onlineStationList = computed(() => stationList.value.filter((station) => station.online)) + const onlineStationList = computed(() => stationList.value.filter((station) => station.online)); - return { stationList, onlineStationList } -}) + return { stationList, onlineStationList }; +}); diff --git a/src/stores/theme.ts b/src/stores/theme.ts index 452a197..e50aa9f 100644 --- a/src/stores/theme.ts +++ b/src/stores/theme.ts @@ -1,12 +1,12 @@ -import { ref, computed } from 'vue' -import { defineStore } from 'pinia' -import { darkTheme, lightTheme } from 'naive-ui' +import { ref, computed } from 'vue'; +import { defineStore } from 'pinia'; +import { darkTheme, lightTheme } from 'naive-ui'; -export const useThemeStore = defineStore('ndm-theme', () => { - const darkThemeEnabled = ref(false) +export const useThemeStore = defineStore('ndm-theme-store', () => { + const darkThemeEnabled = ref(true); const themeMode = computed(() => { - return darkThemeEnabled.value ? darkTheme : lightTheme - }) + return darkThemeEnabled.value ? darkTheme : lightTheme; + }); - return { darkThemeEnabled, themeMode } -}) + return { darkThemeEnabled, themeMode }; +}); diff --git a/src/utils/env.ts b/src/utils/env.ts index 8cc28c7..306187d 100644 --- a/src/utils/env.ts +++ b/src/utils/env.ts @@ -1,14 +1,6 @@ export const getAppEnvConfig = () => { const env = import.meta.env; - const { - VITE_REQUEST_INTERVAL, - VITE_NDM_APP_KEY, - VITE_LAMP_CLIENT_ID, - VITE_LAMP_CLIENT_SECRET, - VITE_LAMP_USERNAME, - VITE_LAMP_PASSWORD, - VITE_LAMP_AUTHORIZATION, - } = env; + const { VITE_REQUEST_INTERVAL, VITE_NDM_APP_KEY, VITE_LAMP_CLIENT_ID, VITE_LAMP_CLIENT_SECRET, VITE_LAMP_USERNAME, VITE_LAMP_PASSWORD, VITE_LAMP_AUTHORIZATION } = env; return { requestInterval: Number.parseInt(VITE_REQUEST_INTERVAL as string), ndmAppKey: VITE_NDM_APP_KEY as string,