From 4a4902ab722cb0151b5754e3d8dddf9f97bf71f5 Mon Sep 17 00:00:00 2001 From: fengerli <528575642@qq.com> Date: Tue, 7 Oct 2025 10:57:49 +0800 Subject: [PATCH] =?UTF-8?q?=E8=81=94=E8=B0=83=E4=B8=AD=E5=BF=83=EF=BC=8C?= =?UTF-8?q?=E6=A0=B9=E6=8D=AE=E7=B1=BB=E5=9E=8B=EF=BC=8C=E4=B8=8A=E4=BC=A0?= =?UTF-8?q?logo=E8=B0=83=E5=8F=96=E4=B8=8D=E5=90=8C=E6=8E=A5=E5=8F=A3?= =?UTF-8?q?=EF=BC=8C=E4=BC=98=E5=8C=96=E4=BA=86=E5=85=B6=E4=BB=96=E4=BB=A3?= =?UTF-8?q?=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/debugCenter/debugCenter.ts | 16 ++++++- src/api/debugCenter/deviceApi.ts | 40 ++++++++++------ .../controlPanel/components/map.vue | 7 +-- .../controlCenter/controlPanel/index.vue | 4 +- src/views/controlCenter/delivery/index.vue | 4 +- .../controlCenter/historyjectory/index.vue | 4 +- src/views/debugCenter/debugPanel/index.vue | 46 +++++++++++++------ src/views/homeIndex/components/AlarmEvent.vue | 4 +- .../homeIndex/components/DeviceUsage.vue | 10 ++-- .../homeIndex/components/RealTimeAlarm.vue | 2 - 10 files changed, 88 insertions(+), 49 deletions(-) diff --git a/src/api/debugCenter/debugCenter.ts b/src/api/debugCenter/debugCenter.ts index 52be9ec..f3a9e32 100644 --- a/src/api/debugCenter/debugCenter.ts +++ b/src/api/debugCenter/debugCenter.ts @@ -58,8 +58,17 @@ function uploadBoot(formData){ // }); } -function getDeviceInfoById(id){ +// 6170上传logo开机画面 +function deviceUploadLogo(formData){ + return request({ + url: '/api/bjq/device/batchUploadLogo', + method: 'post', + data: formData + }) +} + +function getDeviceInfoById(id){ return request({ url: '/api/device/debug/detail/'+id, method: 'get' @@ -67,11 +76,14 @@ function getDeviceInfoById(id){ } + + export default{ getDevice:getDevice, uploadFile:uploadFile, addVideo:addVideo, updateItem:updateItem, uploadBoot:uploadBoot, - getDeviceInfoById:getDeviceInfoById + getDeviceInfoById:getDeviceInfoById, + deviceUploadLogo:deviceUploadLogo } \ No newline at end of file diff --git a/src/api/debugCenter/deviceApi.ts b/src/api/debugCenter/deviceApi.ts index 60e69b9..43002a2 100644 --- a/src/api/debugCenter/deviceApi.ts +++ b/src/api/debugCenter/deviceApi.ts @@ -1,15 +1,29 @@ -import debugCenter from '@/api/debugCenter/debugCenter' -// 创建设备API映射 -const deviceApiMap = { - 1: debugCenter.uploadBoot, - 2: debugCenter.uploadLogo, - // 默认接口 - default: debugCenter.uploadBoot +import debugCenter from '@/api/debugCenter/debugCenter'; +const uploadConfig = { + 670: { + api: debugCenter.uploadBoot, // 670对应接口 + requiredParams: ['deviceIds', 'file'] + }, + 6170: { + api: debugCenter.deviceUploadLogo, + requiredParams: ['deviceIds', 'file',] + }, + default: { + api: debugCenter.uploadBoot, + requiredParams: ['deviceIds', 'file'] + } +}; +function handleParams(deviceType, deviceIds, file) { + const formattedIds = Array.isArray(deviceIds) ? deviceIds : [deviceIds]; + const formData = new FormData(); + formattedIds.forEach(id => formData.append('deviceIds', id)); + formData.append('file', file); + return formData; } - -// 获取对应设备的API -export function getDeviceApi(deviceType: number) { - console.log(deviceType,'deviceType'); - return deviceApiMap[deviceType] || deviceApiMap.default -} \ No newline at end of file +export function uploadLogo(deviceType, deviceIds, file) { + const currentConfig = uploadConfig[deviceType] || uploadConfig.default; + const formData = handleParams(deviceType, deviceIds, file); + return currentConfig.api(formData); +} +export default { uploadLogo }; \ No newline at end of file diff --git a/src/views/controlCenter/controlPanel/components/map.vue b/src/views/controlCenter/controlPanel/components/map.vue index 23b5dde..cd4bd9e 100644 --- a/src/views/controlCenter/controlPanel/components/map.vue +++ b/src/views/controlCenter/controlPanel/components/map.vue @@ -222,7 +222,7 @@ onUnmounted(() => { } .amap-container { - height: 640px; + height: calc(100vh - 22vh); border-radius: 4px; overflow: hidden; width: 100%; @@ -234,11 +234,12 @@ onUnmounted(() => { border-radius: 4px; box-shadow: 0px 0px 6px 0px rgba(0, 34, 96, 0.1); background: rgba(255, 255, 255, 1); - height: 620px; + height: calc(100vh - 25vh); position: absolute; z-index: 1; top: 10px; - left: 10px + left: 10px; + overflow: auto; } /* 其他样式保持不变... */ diff --git a/src/views/controlCenter/controlPanel/index.vue b/src/views/controlCenter/controlPanel/index.vue index 56b769d..872b29b 100644 --- a/src/views/controlCenter/controlPanel/index.vue +++ b/src/views/controlCenter/controlPanel/index.vue @@ -455,7 +455,7 @@ const forceAlarm = async () => { const typeName = firstDevice.typeName; // 取第一个设备的typeName,为空时给默认值 let data = { deviceIds: deviceIds, - typeName: typeName, + typeName: typeName, batchId: batchId, deviceImeiList: deviceImeiList, instructValue: '1' //强制报警1,解除报警0 @@ -563,7 +563,7 @@ const forceAlarm = async () => { } .Maplist { - height: 680px; + height: calc(100vh - 24vh); overflow: auto; } diff --git a/src/views/controlCenter/delivery/index.vue b/src/views/controlCenter/delivery/index.vue index ee0f107..c9766e4 100644 --- a/src/views/controlCenter/delivery/index.vue +++ b/src/views/controlCenter/delivery/index.vue @@ -251,7 +251,7 @@ const handleExport = () => { diff --git a/src/views/controlCenter/historyjectory/index.vue b/src/views/controlCenter/historyjectory/index.vue index a37d71d..33b3267 100644 --- a/src/views/controlCenter/historyjectory/index.vue +++ b/src/views/controlCenter/historyjectory/index.vue @@ -259,7 +259,7 @@ const historyjectory = (row: any) => { diff --git a/src/views/debugCenter/debugPanel/index.vue b/src/views/debugCenter/debugPanel/index.vue index f896450..6c95584 100644 --- a/src/views/debugCenter/debugPanel/index.vue +++ b/src/views/debugCenter/debugPanel/index.vue @@ -248,6 +248,7 @@ import api from '@/api/debugCenter/debugCenter'; import common from '@/utils/common'; import apiTypeAll from '@/api/equipmentManagement/device/index'; +import uploadHelper from '@/api/debugCenter/deviceApi'; var fileInput = document.getElementById('fileInput'); var fileInputs = { @@ -540,22 +541,39 @@ function SaveMultiData() { }, 0); } //上传开机画面 -function updaeLogo(ids, file) { - - if (!file || !ids) { +// function updaeLogo(ids, file) { +// if (!file || !ids) { +// return Promise.resolve({ code: 200, msg: '成功' }); +// } +// if (!Array.isArray(ids)) { +// ids = [ids]; +// } +// var formData = new FormData(); +// ids.forEach((element) => { +// formData.append('deviceIds', element); +// }); +// formData.append('file', file); +// return api.uploadBoot(formData); +// } +// 上传开机画面根据类型适配不同的上传接口,其他类型暂且默认670 +function updaeLogo(ids, file, deviceType?: number,) { + const selectedRows = getSelectionRows(grid); + let realDeviceType = 670; // 默认670 + if (selectedRows.length > 0) { + const deviceTypeName = selectedRows[0].typeName || ''; + if (deviceTypeName.includes('670')) { + realDeviceType = 670; + } else if (deviceTypeName.includes('6170')) { + realDeviceType = 6170; + } + } + const finalDeviceType = deviceType || realDeviceType; + const finalIds = Array.isArray(ids) ? ids : [ids]; + const finalFile = file || checkFile.file || cEdit.fileBoot.file; + if (!finalFile || finalIds.length === 0) { return Promise.resolve({ code: 200, msg: '成功' }); } - if (!Array.isArray(ids)) { - ids = [ids]; - } - var formData = new FormData(); - ids.forEach((element) => { - formData.append('deviceIds', element); - }); - - formData.append('file', file); - - return api.uploadBoot(formData); + return uploadHelper.uploadLogo(finalDeviceType, finalIds, finalFile); } //保存单个设备的数据 function SaveItemData() { diff --git a/src/views/homeIndex/components/AlarmEvent.vue b/src/views/homeIndex/components/AlarmEvent.vue index e1c4563..1c51240 100644 --- a/src/views/homeIndex/components/AlarmEvent.vue +++ b/src/views/homeIndex/components/AlarmEvent.vue @@ -1,10 +1,8 @@