37 lines
1.3 KiB
JavaScript
37 lines
1.3 KiB
JavaScript
// config.js
|
||
const dtConfig = {
|
||
serverAddress: 'http://124.220.32.217:41100/api/database/command',
|
||
// serverAddress: 'http://192.168.1.133:41100/api/database/command',
|
||
mqttIp: '124.220.32.217',
|
||
// mqttIp: '192.168.1.182',
|
||
mqttPort: '8083',
|
||
topBoxTitle: '基于数字孪生的智能物联网机床',
|
||
mqttTopic: 'SCADAMain/demo_device_mqtt_tfjj', // 默认值,登录后会被覆盖
|
||
timeout: 15000,
|
||
// 设备运行履刷新时间配置(毫秒)
|
||
equipmentRuntimeHistoryRefreshInterval: 60000,
|
||
// 伺服负载曲线刷新时间配置(毫秒)
|
||
ServoLoadCurveRefreshInterval: 5000,
|
||
// OEE刷新时间配置(毫秒)
|
||
OEEAnalysisRefreshInterval: 5000,
|
||
//质量管理轮播时间配置(毫秒)
|
||
QualityManagementRefreshInterval: 6000,
|
||
// 报警刷新时间配置(毫秒)
|
||
WarningRefreshInterval: 5000,
|
||
}
|
||
|
||
// 更新 MQTT Topic 的方法
|
||
const updateMqttTopic = (newTopic) => {
|
||
dtConfig.mqttTopic = newTopic
|
||
// 同时更新到 localStorage 以便其他页面使用
|
||
localStorage.setItem('mqttTopic', newTopic)
|
||
console.log('MQTT Topic 已更新:', newTopic)
|
||
}
|
||
|
||
// 确保在全局对象上设置配置
|
||
if (typeof window !== 'undefined') {
|
||
window.dt_Config = dtConfig
|
||
window.updateMqttTopic = updateMqttTopic
|
||
// console.log('全局配置已设置:', dtConfig)
|
||
}
|