From e7cc105641df0e6ec1ef9174c2b92a1f015ce127 Mon Sep 17 00:00:00 2001 From: wangqi <3188864257@qq.com> Date: Fri, 20 Dec 2024 14:35:54 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E4=B8=80=E4=BA=9B=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .env | 2 + .env.production | 4 +- components.d.ts | 3 - src/api/module/eam/device/fileConfig.ts | 90 +++++++++++ src/api/module/eam/device/firmware.ts | 5 +- src/api/module/index.ts | 3 +- src/api/server/config.ts | 4 + src/pages/Profile/components/ProfileUser.vue | 2 +- .../deviceInfo/components/DeliveryInfo.vue | 1 - .../deviceInfo/components/MaintainInfo.vue | 1 - src/pages/deviceInfo/index.vue | 52 ++++-- src/pages/deviceInfo/utils.ts | 2 +- src/pages/deviceStorage/index.vue | 2 +- src/pages/deviceStorage/utils.ts | 4 +- src/pages/deviceTest/testPlan/index.vue | 2 +- .../components/create-firmware-dlg.vue | 40 +++-- src/pages/ota/firmware/index.vue | 8 +- src/pages/system/config/index.vue | 150 +++++++++++++++++- src/pages/system/deviceField/index.vue | 6 +- 19 files changed, 330 insertions(+), 51 deletions(-) create mode 100644 src/api/module/eam/device/fileConfig.ts diff --git a/.env b/.env index d248e08..9116802 100644 --- a/.env +++ b/.env @@ -1,3 +1,5 @@ VITE_BASE_API_SYSTEM = '/remote/admin-api/system' VITE_BASE_API_EAM = '/remote/admin-api/eam' +VITE_BASE_API_INFRA = '/remote/admin-api/infra' + VITE_DEVICE_INFO_INTERVAL = 35000 \ No newline at end of file diff --git a/.env.production b/.env.production index 07b19a4..bb23583 100644 --- a/.env.production +++ b/.env.production @@ -1,2 +1,2 @@ -VITE_BASE_URL = 'http://62.234.18.176:7080' -VITE_SOCKET_SERVER = 'http://62.234.18.176:7080' \ No newline at end of file +VITE_BASE_URL = 'http://192.168.1.3:48080' +VITE_SOCKET_SERVER = 'http://192.168.1.3:48080' \ No newline at end of file diff --git a/components.d.ts b/components.d.ts index ec28093..004db6d 100644 --- a/components.d.ts +++ b/components.d.ts @@ -22,8 +22,6 @@ declare module 'vue' { EdfsWrap: typeof import('./src/components/dashboard/Edfs-wrap.vue')['default'] Editor: typeof import('./src/components/dashboard/Editor/src/Editor.vue')['default'] ElAvatar: typeof import('element-plus/es')['ElAvatar'] - ElBreadcrumb: typeof import('element-plus/es')['ElBreadcrumb'] - ElBreadcrumbItem: typeof import('element-plus/es')['ElBreadcrumbItem'] ElButton: typeof import('element-plus/es')['ElButton'] ElCard: typeof import('element-plus/es')['ElCard'] ElCascader: typeof import('element-plus/es')['ElCascader'] @@ -67,7 +65,6 @@ declare module 'vue' { ElTabPane: typeof import('element-plus/es')['ElTabPane'] ElTabs: typeof import('element-plus/es')['ElTabs'] ElTag: typeof import('element-plus/es')['ElTag'] - ElTextarea: typeof import('element-plus/es')['ElTextarea'] ElTooltip: typeof import('element-plus/es')['ElTooltip'] ElTree: typeof import('element-plus/es')['ElTree'] ElTreeSelect: typeof import('element-plus/es')['ElTreeSelect'] diff --git a/src/api/module/eam/device/fileConfig.ts b/src/api/module/eam/device/fileConfig.ts new file mode 100644 index 0000000..9e876f2 --- /dev/null +++ b/src/api/module/eam/device/fileConfig.ts @@ -0,0 +1,90 @@ +import { infraServer } from '../../index' + +export interface FileClientConfig { + basePath: string + host?: string + port?: number + username?: string + password?: string + mode?: string + endpoint?: string + bucket?: string + accessKey?: string + accessSecret?: string + domain: string +} + +export interface FileConfigVO { + id: number + name: string + storage?: number + master: boolean + visible: boolean + config: FileClientConfig + remark: string + createTime: Date +} + +// 查询文件配置列表 +export const getFileConfigPage = (params: PageParam) => { + return infraServer({ + url: '/file-config/page', + method: 'get', + params, + }) + +} + +// 查询文件配置详情 +export const getFileConfig = (id: number) => { + return infraServer({ + url: '/file-config/get', + method: 'get', + params: { id }, + }) +} + +// 更新文件配置为主配置 +export const updateFileConfigMaster = (id: number) => { + return infraServer({ + url: '/file-config/update-master', + method: 'put', + params: { id }, + }) +} + +// 新增文件配置 +export const createFileConfig = (data: FileConfigVO) => { + return infraServer({ + url: '/file-config/create', + method: 'post', + data, + }) +} + +// 修改文件配置 +export const updateFileConfig = (data: FileConfigVO) => { + return infraServer({ + url: '/file-config/update', + method: 'put', + data, + }) +} + +// 删除文件配置 +export const deleteFileConfig = (id: number) => { + return infraServer({ + url: '/file-config/delete', + method: 'delete', + params: { id }, + }) +} + +// 测试文件配置 +export const testFileConfig = (id: number) => { + return infraServer({ + url: '/file-config/test', + method: 'get', + params: { id }, + }) +} diff --git a/src/api/module/eam/device/firmware.ts b/src/api/module/eam/device/firmware.ts index 4ff63ac..5501bf7 100644 --- a/src/api/module/eam/device/firmware.ts +++ b/src/api/module/eam/device/firmware.ts @@ -11,8 +11,8 @@ export function getFirmwareList(params: PageParam) { export function deleteFirmware(id: string) { return eamServer({ url: '/firmware/delete', - method: 'post', - data: { id }, + method: 'delete', + params: { id }, }) } @@ -22,6 +22,7 @@ export function createFirmware(data: any) { method: 'post', data, headers: { 'Content-Type': 'multipart/form-data' }, + timeout: 20000, }) } diff --git a/src/api/module/index.ts b/src/api/module/index.ts index 1743a79..1a6ae80 100644 --- a/src/api/module/index.ts +++ b/src/api/module/index.ts @@ -3,5 +3,6 @@ import { API_Config } from '@/api/server/config' const systemServer = axiosInstance('system', API_Config.system) const eamServer = axiosInstance('eam', API_Config.eam) +const infraServer = axiosInstance('infra', API_Config.infra) -export { systemServer, eamServer } +export { systemServer, eamServer, infraServer } diff --git a/src/api/server/config.ts b/src/api/server/config.ts index 8add6ac..057ba55 100644 --- a/src/api/server/config.ts +++ b/src/api/server/config.ts @@ -1,6 +1,7 @@ export interface APIConfig { system: Config eam: Config + infra: Config } interface Config { @@ -15,6 +16,9 @@ const API_Config: APIConfig = { eam: { baseAPI: import.meta.env.VITE_BASE_API_EAM, }, + infra: { + baseAPI: import.meta.env.VITE_BASE_API_INFRA, + }, } export type APIConfigKeys = keyof typeof API_Config diff --git a/src/pages/Profile/components/ProfileUser.vue b/src/pages/Profile/components/ProfileUser.vue index a1b0b3c..2e30b8c 100644 --- a/src/pages/Profile/components/ProfileUser.vue +++ b/src/pages/Profile/components/ProfileUser.vue @@ -54,7 +54,7 @@ import { getUserProfile, type ProfileVO } from '@/api/module/system/user/profile import { isResError } from '@/hooks/useMessage' import Icon from '@/components/dashboard/Icon/src/Icon.vue' import { useI18n } from 'vue-i18n' -import Avatar from '../../../avatar.png' +import Avatar from '../../avatar.png' defineOptions({ name: 'ProfileUser' }) const { t } = useI18n() diff --git a/src/pages/deviceInfo/components/DeliveryInfo.vue b/src/pages/deviceInfo/components/DeliveryInfo.vue index d6a6f1a..cb8dcd8 100644 --- a/src/pages/deviceInfo/components/DeliveryInfo.vue +++ b/src/pages/deviceInfo/components/DeliveryInfo.vue @@ -109,7 +109,6 @@ async function loadDeviceStorageInfo() { if (!props.deviceId) return const res = await getStorageOutByDeviceId(props.deviceId) if (isResError(res)) return - debugger for (const key of Object.keys(params.value)) { params.value[key] = res.data[key] ?? '' } diff --git a/src/pages/deviceInfo/components/MaintainInfo.vue b/src/pages/deviceInfo/components/MaintainInfo.vue index 7ab2280..f4c3ed4 100644 --- a/src/pages/deviceInfo/components/MaintainInfo.vue +++ b/src/pages/deviceInfo/components/MaintainInfo.vue @@ -180,7 +180,6 @@ function oncancel(index: number) { } async function onSave(row: any) { - debugger for (const key of Object.keys(dataParams)) { if (isEmpty(row[key]) && key !== 'description') { msg.error(`请填写${tableCol.find(item => item.prop === key)?.label}`) diff --git a/src/pages/deviceInfo/index.vue b/src/pages/deviceInfo/index.vue index 164ae4f..dfac7a9 100644 --- a/src/pages/deviceInfo/index.vue +++ b/src/pages/deviceInfo/index.vue @@ -6,7 +6,7 @@