mirror of
https://gitee.com/js-yhsec/energy_storage.git
synced 2026-05-27 18:59:26 +08:00
实现系统总览、统计分析的图标数据接口
This commit is contained in:
@@ -113,14 +113,14 @@ function setDeviceCardParam(deviceid, subid, key, text) {
|
||||
}
|
||||
|
||||
var activeCardBtn = null
|
||||
var activeModuleId = null
|
||||
|
||||
function onClickCardBtn(btn, id) {
|
||||
if (activeCardBtn) activeCardBtn.className = 'mycardbtn'
|
||||
activeCardBtn = btn
|
||||
activeCardBtn.className = 'mycardbtn-active'
|
||||
|
||||
var deviceType = id
|
||||
initDeviceList(deviceType)
|
||||
activeModuleId = id
|
||||
initDeviceList(activeModuleId)
|
||||
}
|
||||
|
||||
function creatElementSwitch(id, x, y) {
|
||||
@@ -223,19 +223,46 @@ function initDeviceList(deviceType) {
|
||||
})
|
||||
}
|
||||
var elemtPanel = document.getElementById(item.device_id)
|
||||
elemtPanel.innerHTML += `<button
|
||||
class="btn btn-outline-primary btn-sm"
|
||||
style="height:30px; margin: 5px 0 0 10px"
|
||||
onclick="onDeviceSetting(${item.device_id})">
|
||||
|
||||
|
||||
//JSON.stringify(item)
|
||||
var paramStr = JSON.stringify(item).replace(/"/g, '"')
|
||||
elemtPanel.innerHTML += `<button
|
||||
class="btn btn-outline-primary btn-sm"
|
||||
style="height:30px; margin: 5px 0 0 10px"
|
||||
onclick='onDeviceSetting(${paramStr})'>
|
||||
参数设置
|
||||
</button>`
|
||||
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
function onDeviceSetting(deviceid) {
|
||||
function onDeviceSetting(param) {
|
||||
var deviceType = getDeviceTypeName(param.type)
|
||||
$('#popDeviceInfo').text(param.device_id + ":" + deviceType + ":" + param.name)
|
||||
G.showElement('deviceSettingPop', true)
|
||||
|
||||
if (deviceType == "逆变器") {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
function updatePageData() {
|
||||
if (activeModuleId == "security") {
|
||||
// 查询数据获取环境信息:光照、风速、环境温度、湿度
|
||||
G.cppNative.getEnvironmentInfo().then(res => {
|
||||
// $('#envIllumination').text(res['illumination'] + ' Lux')
|
||||
// $('#envWindspeed').text(res['windspeed'] + ' m/s')
|
||||
$('#envTemperture').text(res['temperature'] + '℃')
|
||||
$('#envHumidity').text(res['humidity'] + '%')
|
||||
})
|
||||
|
||||
// 消防信息
|
||||
G.cppNative.getFireInfo().then(res => {
|
||||
//res.data.forEach(item => { })
|
||||
})
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
// ====================================================================================================
|
||||
@@ -252,9 +279,6 @@ document.currentScript.addEventListener('DOMNodeRemoved', () => {
|
||||
|
||||
$(document).ready(function () {
|
||||
onClickCardBtn(document.getElementById('solarCardBtn'), 'solar')
|
||||
// timerId = setInterval(() => {
|
||||
// updateParam('1', '电压', Math.floor(Math.random() * 220) + ' V')
|
||||
// }, 2000);
|
||||
|
||||
G.cppNative.getDeviceInfo([0]).then((res) => {
|
||||
var nums = {
|
||||
@@ -271,6 +295,7 @@ $(document).ready(function () {
|
||||
if (item.err != 0) nums[deviceType].numFault += 1
|
||||
}
|
||||
})
|
||||
|
||||
$('#solarDeviceNum').text('光伏板数量: ' + nums['103'].num + ' 个')
|
||||
$('#solarIdleNum').text('空闲: ' + nums['103'].numIdle + ' 个')
|
||||
$('#solarOfflineNum').text('离线: ' + nums['103'].numOffline + ' 个')
|
||||
@@ -285,7 +310,8 @@ $(document).ready(function () {
|
||||
$('#chargeIdleNum').text('空闲: ' + nums['108'].numIdle + ' 个')
|
||||
$('#chargeOfflineNum').text('离线: ' + nums['108'].numOffline + ' 个')
|
||||
$('#chargeFaultNum').text('故障: ' + nums['108'].numFault + ' 个')
|
||||
|
||||
})
|
||||
|
||||
// 定时更新页面数据
|
||||
timerId = setInterval(updatePageData, 1000);
|
||||
})
|
||||
Reference in New Issue
Block a user