mirror of
https://gitee.com/js-yhsec/energy_storage.git
synced 2026-05-28 03:09:24 +08:00
[WEB]1.修改首页场站图标显示颜色不正确的问题,2.修改运行监控页面储能系统的运行模式和预制舱参数在页面切换时数据不显示问题
This commit is contained in:
91
src/qt/widgets/QWStatistics.cpp
Normal file
91
src/qt/widgets/QWStatistics.cpp
Normal file
@@ -0,0 +1,91 @@
|
||||
#include "QWStatistics.h"
|
||||
|
||||
#include "app/Application.h"
|
||||
#include "app/AppData.h"
|
||||
#include "app/Station.h"
|
||||
#include "database/DAO.h"
|
||||
|
||||
QWStatistics::QWStatistics(QWidget* parent) : MyWidget(parent)
|
||||
{
|
||||
comboxStation = make_shared<QComboBox>(this);
|
||||
comboxStation->setGeometry(10, 10, 200, 28);
|
||||
comboxStation->setStyleSheet(QSS_BTN_COMBOX.c_str());
|
||||
|
||||
QStringList listStation;
|
||||
listStation << "所有";
|
||||
for (auto item: Application::data().mapStation)
|
||||
{
|
||||
listStation << item.second->name.c_str();
|
||||
}
|
||||
comboxStation->addItems(listStation);
|
||||
|
||||
|
||||
QStringList headerTextList;
|
||||
headerTextList << "日期" << "日充电\n电量" << "日放电\n电量"
|
||||
<< "日充电\n电量(尖)" << "日充电\n电量(峰)" << "日充电\n电量(平)" << "日充电\n电量(谷)"
|
||||
<< "日放电\n电量(尖)" << "日放电\n电量(峰)" << "日放电\n电量(平)" << "日放电\n电量(谷)"
|
||||
<< "日充电\n费用" << "日放电\n费用" << "日收益" ;
|
||||
//<< "总充电\n电量" << "总放电\n电量"
|
||||
//<< "总充电\n电量(尖)" << "总充电\n电量(峰)" << "总充电\n电量(平)" << "总充电\n电量(谷)"
|
||||
//<< "总放电\n电量(尖)" << "总放电\n电量(峰)" << "总放电\n电量(平)" << "总放电\n电量(谷)";
|
||||
|
||||
table = MyQUI::TableWidget(this, 10, 50, 1190, 800);
|
||||
table->horizontalHeader()->setDefaultSectionSize(80);
|
||||
// 设置为水平表头
|
||||
table->setColumnCount(headerTextList.size());
|
||||
table->setHorizontalHeaderLabels(headerTextList);
|
||||
table->setColumnWidth(0, 120);
|
||||
|
||||
btnRefresh = make_shared<QPushButton>("刷新", this);
|
||||
btnRefresh->setGeometry(220, 10, 60, 30);
|
||||
//btnRefresh->setStyleSheet();
|
||||
|
||||
connect(comboxStation.get(), &QComboBox::currentIndexChanged, this, &QWStatistics::onCurrentIndexChanged);
|
||||
connect(btnRefresh.get(), &QPushButton::clicked, this, &QWStatistics::onCurrentIndexChanged);
|
||||
}
|
||||
|
||||
QWStatistics::~QWStatistics()
|
||||
{
|
||||
}
|
||||
|
||||
void QWStatistics::onCurrentIndexChanged(int index)
|
||||
{
|
||||
auto& appdata = Application::data();
|
||||
|
||||
string stationName = comboxStation->itemText(index).toStdString();
|
||||
if (stationName == "所有")
|
||||
{
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
auto station = appdata.getStationByName(stationName);
|
||||
if (station)
|
||||
{
|
||||
string sql = "SELECT * FROM stat_total_day std WHERE station_id='" + std::to_string(station->stationId)
|
||||
+ "' ORDER BY dt DESC LIMIT 100;";
|
||||
vector<Fields> result;
|
||||
DAO::exec(NULL, sql, result);
|
||||
table->clearContents();
|
||||
table->setRowCount(0);
|
||||
for (int i = 0; i<result.size(); ++i)
|
||||
{
|
||||
auto& fields = result[i];
|
||||
MyQUI::setTableCell(table, i, 0, fields.value("dt"));
|
||||
MyQUI::setTableCell(table, i, 1, fields.value("E_in"));
|
||||
MyQUI::setTableCell(table, i, 2, fields.value("E_in_J"));
|
||||
MyQUI::setTableCell(table, i, 3, fields.value("E_in_F"));
|
||||
MyQUI::setTableCell(table, i, 4, fields.value("E_in_P"));
|
||||
MyQUI::setTableCell(table, i, 5, fields.value("E_in_G"));
|
||||
MyQUI::setTableCell(table, i, 6, fields.value("E_out"));
|
||||
MyQUI::setTableCell(table, i, 7, fields.value("E_out_J"));
|
||||
MyQUI::setTableCell(table, i, 8, fields.value("E_out_F"));
|
||||
MyQUI::setTableCell(table, i, 9, fields.value("E_out_P"));
|
||||
MyQUI::setTableCell(table, i, 10, fields.value("E_out_G"));
|
||||
MyQUI::setTableCell(table, i, 11, fields.value("fee_in"));
|
||||
MyQUI::setTableCell(table, i, 12, fields.value("fee_out"));
|
||||
MyQUI::setTableCell(table, i, 13, fields.value("income"));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user