1
0
forked from dyf/dyf-vue-ui

Compare commits

..

4 Commits

11 changed files with 99 additions and 41 deletions

View File

@ -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
}

View File

@ -0,0 +1,29 @@
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;
}
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 };

View File

@ -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;
}
/* 其他样式保持不变... */

View File

@ -563,7 +563,7 @@ const forceAlarm = async () => {
}
.Maplist {
height: 680px;
height: calc(100vh - 24vh);
overflow: auto;
}
</style>

View File

@ -251,7 +251,7 @@ const handleExport = () => {
<style lang="scss" scoped>
.p-2{
background: rgba(247, 248, 252, 1);
min-height: 100vh;
height: calc(100vh - 8vh);
box-sizing: border-box;
padding: 15px;
}
@ -299,7 +299,7 @@ const handleExport = () => {
}
.Maplist {
height: 680px;
height: calc(100vh - 24vh);
overflow: auto;
}
</style>

View File

@ -259,7 +259,7 @@ const historyjectory = (row: any) => {
<style lang="scss" scoped>
.p-2{
background: rgba(247, 248, 252, 1);
min-height: 100vh;
height: calc(100vh - 8vh);
box-sizing: border-box;
padding: 15px;
}
@ -307,7 +307,7 @@ const historyjectory = (row: any) => {
}
.Maplist {
height: 680px;
height: calc(100vh - 24vh);
overflow: auto;
}
</style>

View File

@ -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() {

View File

@ -1,10 +1,8 @@
<template>
<!-- 图表容器设置宽高 -->
<div class="vchartPage">
<div ref="chartRef" class="chartRef"></div>
</div>
</template>
<script setup lang="ts">
@ -118,7 +116,7 @@ onMounted(() => {
myChart.setOption(option);
window.addEventListener('resize', handleResize);
}
}, 200)
},500)
});

View File

@ -22,7 +22,7 @@ let dataTimer: NodeJS.Timeout | null = null; // 数据更新定时器
const fetchDataAndUpdate = (days: number) => {
getDeviceUsageFrequency({ days }).then((res) => {
if (res.code === 200 && res.data && myChart) {
// 处理接口返回的真实数据(转换为图表所需格式)
//(转换为图表所需格式)
const chartData = res.data.map(item => ({
name: item.deviceName,
value: item.frequency
@ -78,8 +78,6 @@ const initChart = () => {
if (!chartRef.value) return;
myChart = echarts.init(chartRef.value);
// 初始图表配置(空数据占位)
const option = {
tooltip: {
trigger: 'axis',
@ -115,7 +113,7 @@ const initChart = () => {
name: '使用频次',
type: 'bar',
data: [], // 初始空数据
barWidth: '14px',
barWidth: '10px',
stack: 'total',
label: {
show: true,
@ -171,7 +169,7 @@ onUnmounted(() => {
<style scoped lang="scss">
.vchartPage {
margin-top: 4.8vh;
margin-top: 4.9vh;
position: relative; // 确保按钮定位正确
}
@ -203,6 +201,6 @@ onUnmounted(() => {
.chartRef {
width: 100%;
height: 25vh;
height: 24vh;
}
</style>

View File

@ -9,7 +9,6 @@
</div>
<div class="alarm-table-body">
<div ref="tableBody" class="alarm-table-body-inner">
<!-- 第一份数据 -->
<div v-for="(item, index) in displayData" :key="`first-${getKey(item, index)}`" class="alarm-item">
<div class="item-cell">{{ item.startTime }}</div>
<div class="item-cell">{{ item.deviceTypeName }}</div>
@ -19,7 +18,6 @@
</div>
<div class="item-cell loaction">{{ item.location }}</div>
</div>
<!-- 第二份数据用于无缝滚动 -->
<div v-for="(item, index) in displayData" :key="`second-${getKey(item, index)}`" class="alarm-item">
<div class="item-cell">{{ item.startTime }}</div>
<div class="item-cell">{{ item.deviceTypeName }}</div>
@ -109,9 +107,10 @@ const startScroll = () => {
scrollPosition.value += scrollSpeed;
// 当滚动超过一份数据的高度时,重置位置
if (itemHeight.value > 0 && scrollPosition.value >= itemHeight.value * displayData.value.length) {
scrollPosition.value = 0;
// 当滚动超过一份数据的高度时,减去整段高度,实现无缝衔接
const oneListHeight = itemHeight.value * displayData.value.length;
if (itemHeight.value > 0 && scrollPosition.value >= oneListHeight) {
scrollPosition.value -= oneListHeight;
}
// 应用滚动效果
@ -201,7 +200,10 @@ onUnmounted(() => {
}
.alarm-table-body-inner {
transition: transform 0.1s linear;
transition: none;
will-change: transform;
transform: translateZ(0);
backface-visibility: hidden;
}
.alarm-item {

View File

@ -369,7 +369,7 @@ const initAlarmBarChart = () => {
const alarmTypeMap = [
{ name: '强制报警', field: 'alarmForced' }, // alarmForced
{ name: '撞击闯入', field: 'intrusionImpact' }, // intrusionImpact
{ name: '自动报警', field: 'alarmManual' }, // alarmManual
{ name: '自动报警', field: 'alarmAuto' }, // alarmAuto
{ name: '电子围栏', field: 'fenceElectronic' } // fenceElectronic
];