feat: 移动式检修车间系统前端完成

- 完成系统日志页面,优化表格滚动和样式
- 完成报警记录页面,优化表格滚动和报警级别显示
- 完成环境参数页面,优化参数显示和监控画面
- 完成参数记录页面,优化图表样式和简洁设计
- 集成MQTT配置,支持实时数据对接
- 统一UI设计风格,采用现代化卡片式布局
- 添加响应式设计,适配不同屏幕尺寸
- 预留MQTT数据接口,支持AC空调和WSD温湿度设备
This commit is contained in:
吉浩茹
2025-09-26 10:34:00 +08:00
commit 8f6dcca19f
35 changed files with 17474 additions and 0 deletions

59
src/config/mqtt.js Normal file
View File

@ -0,0 +1,59 @@
// MQTT配置文件
export const MQTT_CONFIG = {
// EMQX服务器地址
broker: 'ws://122.51.194.184:8083/mqtt', // WebSocket MQTT端口
// broker: 'mqtt://122.51.194.184:1883', // 标准MQTT端口
// 连接选项
options: {
clientId: 'mobile-inspection-system-' + Math.random().toString(16).substr(2, 8),
// 暂时不设置账号密码
// username: '',
// password: '',
keepalive: 60,
clean: true,
reconnectPeriod: 5000,
connectTimeout: 30 * 1000,
},
// 主题配置
topics: {
// 设备数据主题
deviceData: 'hdydcj_01_UP',
// 设备类型
deviceTypes: {
WSD: '温湿度', // 温湿度传感器
AC: '空调', // 空调设备
PM: 'PM2.5', // PM2.5传感器
// 可以根据需要添加更多设备类型
}
}
}
// 数据解析工具
export const DataParser = {
// 解析设备数据
parseDeviceData(rawData) {
try {
const data = JSON.parse(rawData)
if (Array.isArray(data) && data.length > 0) {
return data[0] // 取第一个设备数据
}
return null
} catch (error) {
console.error('解析设备数据失败:', error)
return null
}
},
// 获取设备类型名称
getDeviceTypeName(deviceCode) {
return MQTT_CONFIG.topics.deviceTypes[deviceCode] || deviceCode
},
// 转换Unix时间戳为可读时间
formatTimestamp(timestamp) {
return new Date(timestamp * 1000).toLocaleString('zh-CN')
}
}