2D监控
This commit is contained in:
@@ -1308,30 +1308,30 @@ $(document).ready(function () {
|
||||
|
||||
|
||||
// **********************定期检查配置文件更新**********************
|
||||
setInterval(function () {
|
||||
$.ajax({
|
||||
url: 'json/config.json',
|
||||
type: 'GET',
|
||||
dataType: 'json',
|
||||
cache: false, // 禁用缓存,确保每次都获取最新的配置
|
||||
success: function (data) {
|
||||
// 如果配置有变化,更新显示(不论editMode状态)
|
||||
if (JSON.stringify(data) !== JSON.stringify(config)) {
|
||||
config = data;
|
||||
// 确保deviceDraggable默认为false
|
||||
if (typeof config.deviceDraggable === 'undefined') {
|
||||
config.deviceDraggable = false;
|
||||
}
|
||||
// 更新全局config引用
|
||||
window.config = config;
|
||||
createBoxes();
|
||||
// 更新设备拖动状态
|
||||
updateDevicesDraggableState();
|
||||
}
|
||||
},
|
||||
error: function (xhr, status, error) {
|
||||
console.error('检查配置更新失败:', error);
|
||||
}
|
||||
});
|
||||
}, 1000); // 每秒检查一次
|
||||
// setInterval(function () {
|
||||
// $.ajax({
|
||||
// url: 'json/config.json',
|
||||
// type: 'GET',
|
||||
// dataType: 'json',
|
||||
// cache: false, // 禁用缓存,确保每次都获取最新的配置
|
||||
// success: function (data) {
|
||||
// // 如果配置有变化,更新显示(不论editMode状态)
|
||||
// if (JSON.stringify(data) !== JSON.stringify(config)) {
|
||||
// config = data;
|
||||
// // 确保deviceDraggable默认为false
|
||||
// if (typeof config.deviceDraggable === 'undefined') {
|
||||
// config.deviceDraggable = false;
|
||||
// }
|
||||
// // 更新全局config引用
|
||||
// window.config = config;
|
||||
// createBoxes();
|
||||
// // 更新设备拖动状态
|
||||
// updateDevicesDraggableState();
|
||||
// }
|
||||
// },
|
||||
// error: function (xhr, status, error) {
|
||||
// console.error('检查配置更新失败:', error);
|
||||
// }
|
||||
// });
|
||||
// }, 1000); // 每秒检查一次
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user