mirror of
https://gitee.com/js-yhsec/energy_storage.git
synced 2026-05-27 18:59:26 +08:00
添加QT的webengineview开发者调试功能
This commit is contained in:
@@ -798,37 +798,50 @@ Errcode HttpEntity::queryDevicByCategory(const httplib::Request& req, njson& jso
|
||||
|
||||
njson jsondata = njson::array();
|
||||
auto station = Application::data().getStation(stationId);
|
||||
if (station)
|
||||
if (station && station->status == 1)
|
||||
{
|
||||
std::vector<std::shared_ptr<Device>> vecDevice;
|
||||
station->getDeviceByGroup(category, vecDevice);
|
||||
|
||||
for(auto& device: vecDevice)
|
||||
{
|
||||
njson jsonnode;
|
||||
jsonnode["stationId"] = stationId;
|
||||
jsonnode["category"] = category;
|
||||
jsonnode["device_id"] = device->deviceId;
|
||||
jsonnode["name"] = device->name;
|
||||
jsonnode["code"] = device->code;
|
||||
jsonnode["type"] = device->type;
|
||||
jsonnode["typename"] = Application::data().getDeviceNameById(device->type);
|
||||
jsonnode["view"] = 1;
|
||||
|
||||
jsonnode["is_online"] = device->online;// ? "在线" : "离线";
|
||||
jsonnode["is_error"] = device->err;// ? "故障" : "正常";
|
||||
jsonnode["is_running"] = device->running;// ? "工作" : "空闲";
|
||||
|
||||
njson jsonarrayParams = njson::array();
|
||||
VecPairSS vec;
|
||||
device->getRuntimeParams(vec);
|
||||
for (auto& item: vec)
|
||||
if (device->isOpen)
|
||||
{
|
||||
jsonarrayParams.push_back({{"k", item.first}, {"v", item.second}});
|
||||
njson jsonnode;
|
||||
jsonnode["stationId"] = stationId;
|
||||
jsonnode["category"] = category;
|
||||
jsonnode["device_id"] = device->deviceId;
|
||||
jsonnode["name"] = device->name;
|
||||
jsonnode["code"] = device->code;
|
||||
jsonnode["type"] = device->type;
|
||||
jsonnode["typename"] = Application::data().getDeviceNameById(device->type);
|
||||
jsonnode["view"] = 1;
|
||||
jsonnode["is_online"] = device->online;// ? "在线" : "离线";
|
||||
jsonnode["is_error"] = device->err;// ? "故障" : "正常";
|
||||
jsonnode["is_running"] = device->running;// ? "工作" : "空闲";
|
||||
{
|
||||
VecPairSS vec;
|
||||
device->getRuntimeParams(vec);
|
||||
njson jsonarrayParams = njson::array();
|
||||
for (auto& item: vec)
|
||||
{
|
||||
jsonarrayParams.push_back({{"k", item.first}, {"v", item.second}});
|
||||
}
|
||||
jsonnode["params"] = jsonarrayParams;
|
||||
}
|
||||
if (device->type == 106)
|
||||
{
|
||||
VecPairSS vec;
|
||||
device->getRuntimeParams1(vec);
|
||||
njson jsonarrayParams = njson::array();
|
||||
for (auto& item: vec)
|
||||
{
|
||||
jsonarrayParams.push_back({{"k", item.first}, {"v", item.second}});
|
||||
}
|
||||
jsonnode["params1"] = jsonarrayParams;
|
||||
}
|
||||
jsondata.push_back(jsonnode);
|
||||
}
|
||||
|
||||
jsonnode["params"] = jsonarrayParams;
|
||||
jsondata.push_back(jsonnode);
|
||||
}
|
||||
}
|
||||
json["data"] = jsondata;
|
||||
|
||||
Reference in New Issue
Block a user