2025-08-26 18:36:25 +08:00
|
|
|
|
#include "PageSysmgr.h"
|
2025-08-22 19:06:50 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#include "app/Application.h"
|
|
|
|
|
|
#include "database/Dao.h"
|
|
|
|
|
|
#include "database/DataModelDef.h"
|
|
|
|
|
|
#include "common/Snowflake.h"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
// === PageUser ===
|
|
|
|
|
|
PageUser::PageUser(PARAM* p, EPvCode pvcode) :PageTable(p)
|
|
|
|
|
|
{
|
|
|
|
|
|
auto& appdata = Application::data();
|
|
|
|
|
|
table->addHead(DMUser::USER_ID, "用户编号", 180, {});
|
|
|
|
|
|
table->addHead(DMUser::ACCOUNT, "用户名", 180, {});
|
|
|
|
|
|
table->addHead(DMUser::NAME, "姓名", 180, {});
|
|
|
|
|
|
table->addHead(DMUser::GENDER, "性别", 180, appdata.mapping.gender);
|
|
|
|
|
|
table->addHead(DMUser::AGE, "年龄", 180, {});
|
|
|
|
|
|
table->addHead(DMUser::PHONE, "手机号", 180, {});
|
|
|
|
|
|
table->addHead(DMUser::EMAIL, "邮箱", 180, {});
|
|
|
|
|
|
table->addHead(DMRole::ROLE_ID, "角色", 180, appdata.mapping.role);
|
|
|
|
|
|
table->addHead(DMUser::LOGINTIME, "上次登录时间", 200, {});
|
|
|
|
|
|
table->addOperate({"编辑"});
|
|
|
|
|
|
|
|
|
|
|
|
int btnNew = PvApp::button(p, PV_ID_MAIN, 20, 160, 80, 35, POP_OPER_NEW);
|
|
|
|
|
|
PvApp::bind(p, PvEvent::BUTTON_EVENT, btnNew, [=](std::string) { this->onOperate(-1, -1, POP_OPER_NEW); });
|
|
|
|
|
|
|
|
|
|
|
|
int x = 50, y = 80, w = 350, h = 60;
|
|
|
|
|
|
auto pop = this->addPop(700, 500, 180, "用户信息", {DMUser::USER_ID});
|
|
|
|
|
|
pop->addParamLineEdit(DMUser::USER_ID, "编号", x, y, false);
|
|
|
|
|
|
pop->addParamCombox(DMRole::ROLE_ID, "角色", x+w, y, appdata.getRoleNames());
|
|
|
|
|
|
pop->addParamLineEdit(DMUser::ACCOUNT, "用户名", x, y += h);
|
|
|
|
|
|
pop->addParamLineEdit(DMUser::NAME, "姓名", x+w, y);
|
|
|
|
|
|
pop->addParamCombox(DMUser::GENDER, "性别", x, y += h, {"女", "男"});
|
|
|
|
|
|
pop->addParamLineEdit(DMUser::AGE, "年龄", x+w, y);
|
|
|
|
|
|
pop->addParamLineEdit(DMUser::PHONE, "手机号", x, y += h);
|
|
|
|
|
|
pop->addParamLineEdit(DMUser::EMAIL, "邮箱", x+w, y);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void PageUser::onQueryTable(PageInfo& pageInfo, std::vector<Fields>& result)
|
|
|
|
|
|
{
|
|
|
|
|
|
DAO::queryUserList(pageInfo, result);
|
|
|
|
|
|
}
|
|
|
|
|
|
void PageUser::onOperate(int row, int col, std::string oper)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (oper == POP_OPER_NEW)
|
|
|
|
|
|
{
|
|
|
|
|
|
Fields fields;
|
|
|
|
|
|
fields.set(DMUser::USER_ID, Snowflake::instance().getIdStr());
|
|
|
|
|
|
this->showPop(0, oper, fields);
|
|
|
|
|
|
}
|
|
|
|
|
|
else if (oper == POP_OPER_EDIT)
|
|
|
|
|
|
{
|
|
|
|
|
|
this->showPop(0, oper, table->getRowData(row));
|
|
|
|
|
|
}
|
|
|
|
|
|
};
|
|
|
|
|
|
std::string PageUser::onValidation(std::shared_ptr<PvPopWidget> pop, Fields& fields)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (fields.value(DMUser::ACCOUNT).empty()) { return "请输入用户名"; }
|
|
|
|
|
|
return "";
|
|
|
|
|
|
};
|
|
|
|
|
|
std::string PageUser::onPopConfirm(std::shared_ptr<PvPopWidget> pop, Fields& fields)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (pop->status == POP_OPER_NEW)
|
|
|
|
|
|
{
|
|
|
|
|
|
Errcode err = DAO::insertUser(fields);
|
|
|
|
|
|
if (err == Errcode::OK) { return ""; }
|
|
|
|
|
|
else if (err == Errcode::ERR_DB_DUPLICATE) { return "用户名已经存在"; }
|
|
|
|
|
|
else { return "系统错误"; }
|
|
|
|
|
|
}
|
|
|
|
|
|
else if (pop->status == POP_OPER_EDIT)
|
|
|
|
|
|
{
|
|
|
|
|
|
Errcode err = DAO::updateUserById(fields);
|
|
|
|
|
|
if (err == Errcode::OK) { return ""; }
|
|
|
|
|
|
else { return "系统错误"; }
|
|
|
|
|
|
}
|
|
|
|
|
|
return "";
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
// === PageRole ===
|
|
|
|
|
|
PageRole::PageRole(PARAM* p, EPvCode pvcode) : PageTable(p)
|
|
|
|
|
|
{
|
|
|
|
|
|
auto& appdata = Application::data();
|
|
|
|
|
|
|
|
|
|
|
|
table->addHead(DMRole::ROLE_ID, "角色编号", 200, {});
|
|
|
|
|
|
table->addHead(DMRole::NAME, "角色名称", 200, {});
|
|
|
|
|
|
table->addHead(DMRole::DESCRIBE, "角色描述", 900, {});
|
|
|
|
|
|
table->addHead(DMRole::IS_OPEN, "是否启用", 200, appdata.mapping.isopen);
|
|
|
|
|
|
table->addOperate({"编辑"});
|
|
|
|
|
|
|
|
|
|
|
|
int btnNew = PvApp::button(p, PV_ID_MAIN, 20, 160, 80, 35, POP_OPER_NEW);
|
|
|
|
|
|
PvApp::bind(p, PvEvent::BUTTON_EVENT, btnNew, [=](std::string) { this->onOperate(-1, -1, POP_OPER_NEW); });
|
|
|
|
|
|
|
|
|
|
|
|
int x = 80, y = 80, h = 60;
|
|
|
|
|
|
auto pop = this->addPop(500, 600, 180, "角色信息", {DMUser::USER_ID});
|
|
|
|
|
|
pop->addParamLineEdit(DMRole::ROLE_ID, "编号", x, y, false);
|
|
|
|
|
|
pop->addParamLineEdit(DMRole::NAME, "名称", x, y += h);
|
|
|
|
|
|
pop->addParamCombox(DMUser::IS_OPEN, "是否启用", x, y += h, {"启用", "禁用"});
|
|
|
|
|
|
pop->addParamTextEdit(DMRole::DESCRIBE, "描述", x, y += h);
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
void PageRole::onQueryTable(PageInfo& pageInfo, std::vector<Fields>& result)
|
|
|
|
|
|
{
|
|
|
|
|
|
DAO::queryRoleList(pageInfo, result);
|
|
|
|
|
|
}
|
|
|
|
|
|
void PageRole::onOperate(int row, int col, std::string oper)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (oper == POP_OPER_NEW)
|
|
|
|
|
|
{
|
|
|
|
|
|
Fields fields;
|
|
|
|
|
|
fields.set(DMUser::USER_ID, Snowflake::instance().getIdStr());
|
|
|
|
|
|
this->showPop(0, oper, fields);
|
|
|
|
|
|
}
|
|
|
|
|
|
else if (oper == POP_OPER_EDIT)
|
|
|
|
|
|
{
|
|
|
|
|
|
this->showPop(0, oper, table->getRowData(row));
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
std::string PageRole::onValidation(std::shared_ptr<PvPopWidget> pop, Fields& fields)
|
|
|
|
|
|
{
|
|
|
|
|
|
return "";
|
|
|
|
|
|
};
|
|
|
|
|
|
std::string PageRole::onPopConfirm(std::shared_ptr<PvPopWidget> pop, Fields& fields)
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
return "";
|
|
|
|
|
|
}
|
2025-08-26 18:36:25 +08:00
|
|
|
|
|
2025-08-22 19:06:50 +08:00
|
|
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
// === PagePermission ===
|
|
|
|
|
|
PagePermission::PagePermission(PARAM* p, EPvCode pvcode) : PageTable(p)
|
|
|
|
|
|
{
|
|
|
|
|
|
auto& appdata = Application::data();
|
|
|
|
|
|
table->addHead(DMPermission::PERMISSION_ID, "权限编号", 200, {});
|
|
|
|
|
|
table->addHead(DMPermission::NAME, "权限名称", 200, {});
|
|
|
|
|
|
table->addHead(DMPermission::DESCRIBE, "权限描述", 900, {});
|
|
|
|
|
|
table->addHead(DMPermission::IS_OPEN, "是否启用", 200, appdata.mapping.isopen);
|
|
|
|
|
|
table->addOperate({"编辑"});
|
|
|
|
|
|
|
|
|
|
|
|
int btnNew = PvApp::button(p, PV_ID_MAIN, 20, 160, 80, 35, POP_OPER_NEW);
|
|
|
|
|
|
PvApp::bind(p, PvEvent::BUTTON_EVENT, btnNew, [=](std::string) { this->onOperate(-1, -1, POP_OPER_NEW); });
|
|
|
|
|
|
|
|
|
|
|
|
int x = 80, y = 80, h = 60;
|
|
|
|
|
|
auto pop = this->addPop(500, 600, 180, "角色信息", {DMPermission::PERMISSION_ID});
|
|
|
|
|
|
pop->addParamLineEdit(DMPermission::PERMISSION_ID, "编号", x, y, false);
|
|
|
|
|
|
pop->addParamLineEdit(DMPermission::NAME, "名称", x, y += h);
|
|
|
|
|
|
pop->addParamCombox(DMPermission::IS_OPEN, "是否启用", x, y += h, {"启用", "禁用"});
|
|
|
|
|
|
pop->addParamTextEdit(DMPermission::DESCRIBE, "描述", x, y += h);
|
|
|
|
|
|
}
|
|
|
|
|
|
void PagePermission::onQueryTable(PageInfo& pageInfo, std::vector<Fields>& result)
|
|
|
|
|
|
{
|
|
|
|
|
|
DAO::queryPermissionList(pageInfo, result);
|
|
|
|
|
|
}
|
|
|
|
|
|
void PagePermission::onOperate(int row, int col, std::string oper)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (oper == POP_OPER_NEW)
|
|
|
|
|
|
{
|
|
|
|
|
|
Fields fields;
|
|
|
|
|
|
fields.set(DMUser::USER_ID, Snowflake::instance().getIdStr());
|
|
|
|
|
|
this->showPop(0, oper, fields);
|
|
|
|
|
|
}
|
|
|
|
|
|
else if (oper == POP_OPER_EDIT)
|
|
|
|
|
|
{
|
|
|
|
|
|
this->showPop(0, oper, table->getRowData(row));
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
std::string PagePermission::onValidation(std::shared_ptr<PvPopWidget> pop, Fields& fields)
|
|
|
|
|
|
{
|
|
|
|
|
|
return "";
|
|
|
|
|
|
};
|
|
|
|
|
|
std::string PagePermission::onPopConfirm(std::shared_ptr<PvPopWidget> pop, Fields& fields)
|
|
|
|
|
|
{
|
|
|
|
|
|
return "";
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
// === PageStation ===
|
|
|
|
|
|
PageStation::PageStation(PARAM* p, EPvCode pvcode) : PageTable(p)
|
|
|
|
|
|
{
|
|
|
|
|
|
auto& appdata = Application::data();
|
|
|
|
|
|
table->addHead(DMStation::STATION_ID, "场站编号", 200, {});
|
|
|
|
|
|
table->addHead(DMStation::NAME, "场站名称", 200, {});
|
|
|
|
|
|
table->addHead(DMStation::ADDRESS, "地址", 200, {});
|
|
|
|
|
|
table->addHead(DMStation::LONGITUDE, "经度", 200, {});
|
|
|
|
|
|
table->addHead(DMStation::LATITUDE, "维度", 200, {});
|
|
|
|
|
|
table->addHead(DMStation::TEL, "电话", 200, {});
|
|
|
|
|
|
table->addHead(DMStation::STATUS, "状态", 200, appdata.mapping.isopen);
|
|
|
|
|
|
table->addOperate({"编辑"});
|
|
|
|
|
|
|
|
|
|
|
|
int btnNew = PvApp::button(p, PV_ID_MAIN, 20, 160, 80, 35, POP_OPER_NEW);
|
|
|
|
|
|
PvApp::bind(p, PvEvent::BUTTON_EVENT, btnNew, [=](std::string) { this->onOperate(-1, -1, POP_OPER_NEW); });
|
|
|
|
|
|
|
|
|
|
|
|
int x = 80, y = 80, h = 60;
|
|
|
|
|
|
auto pop = this->addPop(500, 600, 240, "场站信息", {DMStation::STATION_ID});
|
|
|
|
|
|
pop->addParamLineEdit(DMStation::STATION_ID, "编号", x, y, false);
|
|
|
|
|
|
pop->addParamLineEdit(DMStation::NAME, "名称", x, y += h);
|
|
|
|
|
|
pop->addParamLineEdit(DMStation::ADDRESS, "地址", x, y += h);
|
|
|
|
|
|
pop->addParamLineEdit(DMStation::LONGITUDE, "经度", x, y += h);
|
|
|
|
|
|
pop->addParamLineEdit(DMStation::LATITUDE, "维度", x, y += h);
|
|
|
|
|
|
pop->addParamLineEdit(DMStation::TEL, "电话", x, y += h);
|
|
|
|
|
|
pop->addParamCombox(DMStation::STATUS, "状态", x, y += h, {"启用", "禁用"});
|
|
|
|
|
|
}
|
|
|
|
|
|
void PageStation::onQueryTable(PageInfo& pageInfo, std::vector<Fields>& result)
|
|
|
|
|
|
{
|
|
|
|
|
|
DAO::queryStationList(pageInfo, result);
|
|
|
|
|
|
}
|
|
|
|
|
|
void PageStation::onOperate(int row, int col, std::string oper)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (oper == POP_OPER_NEW)
|
|
|
|
|
|
{
|
|
|
|
|
|
Fields fields;
|
|
|
|
|
|
fields.set(DMUser::USER_ID, Snowflake::instance().getIdStr());
|
|
|
|
|
|
this->showPop(0, oper, fields);
|
|
|
|
|
|
}
|
|
|
|
|
|
else if (oper == POP_OPER_EDIT)
|
|
|
|
|
|
{
|
|
|
|
|
|
this->showPop(0, oper, table->getRowData(row));
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
std::string PageStation::onValidation(std::shared_ptr<PvPopWidget> pop, Fields& fields)
|
|
|
|
|
|
{
|
|
|
|
|
|
return "";
|
|
|
|
|
|
};
|
|
|
|
|
|
std::string PageStation::onPopConfirm(std::shared_ptr<PvPopWidget> pop, Fields& fields)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (pop->status == POP_OPER_NEW)
|
|
|
|
|
|
{
|
|
|
|
|
|
Errcode err = DAO::insertStation(fields);
|
|
|
|
|
|
if (err == Errcode::OK) { return ""; }
|
|
|
|
|
|
else { return "系统错误"; }
|
|
|
|
|
|
}
|
|
|
|
|
|
else if (pop->status == POP_OPER_EDIT)
|
|
|
|
|
|
{
|
|
|
|
|
|
Errcode err = DAO::updateStationById(fields);
|
|
|
|
|
|
if (err == Errcode::OK) { return ""; }
|
|
|
|
|
|
else { return "系统错误"; }
|
|
|
|
|
|
}
|
|
|
|
|
|
return "";
|
|
|
|
|
|
}
|
2025-08-26 18:36:25 +08:00
|
|
|
|
|
2025-08-22 19:06:50 +08:00
|
|
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
// === PageDevice ===
|
|
|
|
|
|
PageDevice::PageDevice(PARAM* p, EPvCode pvcode) : PageTable(p)
|
|
|
|
|
|
{
|
|
|
|
|
|
auto& appdata = Application::data();
|
|
|
|
|
|
table->addHead(DMDevice::DEVICE_ID, "设备编号", 120, {});
|
2025-08-26 18:36:25 +08:00
|
|
|
|
table->addHead(DMDevice::TYPE, "设备类型", 120, appdata.mapping.deviceType);
|
2025-08-22 19:06:50 +08:00
|
|
|
|
table->addHead(DMDevice::NAME, "设备名称", 180, {});
|
|
|
|
|
|
table->addHead(DMDevice::CODE, "设备编码", 160, {});
|
|
|
|
|
|
table->addHead(DMDevice::MODEL, "设备型号", 160, {});
|
|
|
|
|
|
table->addHead(DMDevice::FACTORY, "厂家", 160, {});
|
|
|
|
|
|
table->addHead(DMDevice::TEL, "厂家电话", 160, {});
|
|
|
|
|
|
table->addHead(DMDevice::ATTRS, "设备参数", 460, {});
|
|
|
|
|
|
table->addHead(DMDevice::IS_OPEN, "是否启用", 120, appdata.mapping.isopen);
|
|
|
|
|
|
table->addOperate({"编辑"});
|
|
|
|
|
|
|
|
|
|
|
|
int btnNew = PvApp::button(p, PV_ID_MAIN, 20, 160, 80, 35, POP_OPER_NEW);
|
|
|
|
|
|
PvApp::bind(p, PvEvent::BUTTON_EVENT, btnNew, [=](std::string) { this->onOperate(-1, -1, POP_OPER_NEW); });
|
|
|
|
|
|
|
|
|
|
|
|
int x = 50, y = 80, w = 350, h = 60;
|
|
|
|
|
|
auto pop = this->addPop(700, 520, 180, "设备信息", {DMDevice::DEVICE_ID});
|
|
|
|
|
|
pop->addParamLineEdit(DMDevice::DEVICE_ID, "设备编号", x, y, false);
|
2025-08-26 18:36:25 +08:00
|
|
|
|
pop->addParamCombox(DMDevice::TYPE, "类型", x+w, y, appdata.getDeviceTypeNames());
|
2025-08-22 19:06:50 +08:00
|
|
|
|
pop->addParamLineEdit(DMDevice::NAME, "设备名称", x, y += h);
|
|
|
|
|
|
pop->addParamLineEdit(DMDevice::CODE, "设备编码", x+w, y);
|
|
|
|
|
|
pop->addParamLineEdit(DMDevice::MODEL, "设备型号", x, y += h);
|
|
|
|
|
|
pop->addParamLineEdit(DMDevice::FACTORY, "厂家", x+w, y);
|
|
|
|
|
|
pop->addParamLineEdit(DMDevice::TEL, "厂家电话", x, y += h);
|
|
|
|
|
|
pop->addParamCombox(DMDevice::IS_OPEN, "是否启用", x+w, y, {"启用", "禁用"});
|
|
|
|
|
|
pop->addParamLineEdit(DMDevice::ATTRS, "设备参数", x, y += h);
|
|
|
|
|
|
}
|
|
|
|
|
|
void PageDevice::onQueryTable(PageInfo& pageInfo, std::vector<Fields>& result)
|
|
|
|
|
|
{
|
|
|
|
|
|
DAO::queryDeviceList(pageInfo, result);
|
|
|
|
|
|
}
|
|
|
|
|
|
void PageDevice::onOperate(int row, int col, std::string oper)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (oper == POP_OPER_NEW)
|
|
|
|
|
|
{
|
|
|
|
|
|
Fields fields;
|
|
|
|
|
|
fields.set(DMUser::USER_ID, Snowflake::instance().getIdStr());
|
|
|
|
|
|
this->showPop(0, oper, fields);
|
|
|
|
|
|
}
|
|
|
|
|
|
else if (oper == POP_OPER_EDIT)
|
|
|
|
|
|
{
|
|
|
|
|
|
this->showPop(0, oper, table->getRowData(row));
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
std::string PageDevice::onValidation(std::shared_ptr<PvPopWidget> pop, Fields& fields)
|
|
|
|
|
|
{
|
|
|
|
|
|
return "";
|
|
|
|
|
|
};
|
|
|
|
|
|
std::string PageDevice::onPopConfirm(std::shared_ptr<PvPopWidget> pop, Fields& fields)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (pop->status == POP_OPER_NEW)
|
|
|
|
|
|
{
|
|
|
|
|
|
Errcode err = DAO::insertDevice(fields);
|
|
|
|
|
|
if (err == Errcode::OK) { return ""; }
|
|
|
|
|
|
else { return "系统错误"; }
|
|
|
|
|
|
}
|
|
|
|
|
|
else if (pop->status == POP_OPER_EDIT)
|
|
|
|
|
|
{
|
|
|
|
|
|
Errcode err = DAO::updateDeviceById(fields);
|
|
|
|
|
|
if (err == Errcode::OK) { return ""; }
|
|
|
|
|
|
else { return "系统错误"; }
|
|
|
|
|
|
}
|
|
|
|
|
|
return "";
|
|
|
|
|
|
}
|
2025-08-26 18:36:25 +08:00
|
|
|
|
|
2025-08-22 19:06:50 +08:00
|
|
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
// === PagePolicy ===
|
2025-08-26 18:36:25 +08:00
|
|
|
|
|
|
|
|
|
|
|
2025-08-22 19:06:50 +08:00
|
|
|
|
PagePolicy::PagePolicy(PARAM* p, EPvCode pvcode) : PageTable(p)
|
|
|
|
|
|
{
|
|
|
|
|
|
auto& appdata = Application::data();
|
|
|
|
|
|
table->addHead(DMPolicy::POLICY_ID, "策略编号", 200, {});
|
|
|
|
|
|
table->addHead(DMPolicy::TYPE, "策略类型", 200, {});
|
|
|
|
|
|
table->addHead(DMPolicy::NAME, "策略名称", 200, {});
|
|
|
|
|
|
table->addHead(DMPolicy::DESCRIBE, "策略描述", 400, {});
|
|
|
|
|
|
table->addHead(DMPolicy::VALUE, "策略参数", 400, {});
|
|
|
|
|
|
table->addHead(DMPolicy::IS_OPEN, "是否启用", 200, appdata.mapping.isopen);
|
|
|
|
|
|
table->addOperate({ "编辑"});
|
|
|
|
|
|
|
|
|
|
|
|
int btnNew = PvApp::button(p, PV_ID_MAIN, 20, 160, 80, 35, POP_OPER_NEW);
|
|
|
|
|
|
PvApp::bind(p, PvEvent::BUTTON_EVENT, btnNew, [=](std::string) { this->onOperate(-1, -1, POP_OPER_NEW); });
|
|
|
|
|
|
|
2025-08-26 18:36:25 +08:00
|
|
|
|
int x = 50, y = 80, w = 280;
|
|
|
|
|
|
auto pop = this->addPop(1620, 800, 180, "策略信息", {DMPolicy::POLICY_ID});
|
|
|
|
|
|
//pop->addParamLineEdit(DMPolicy::POLICY_ID, "编号", x, y, false);
|
|
|
|
|
|
{
|
|
|
|
|
|
pop->addParamLineEdit("1", "策略名称", x, y);
|
|
|
|
|
|
pop->addParamCombox("2", "策略类型", x+w, y, {"峰谷套利"});
|
|
|
|
|
|
pop->addParamLineEdit("3", "尖峰电价", x, y += 50);
|
|
|
|
|
|
pop->addParamLineEdit("4", "高峰电价", x+w, y);
|
|
|
|
|
|
pop->addParamLineEdit("5", "平段电价", x+w*2, y);
|
|
|
|
|
|
pop->addParamLineEdit("6", "低谷电价", x+w*3, y);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2025-08-22 19:06:50 +08:00
|
|
|
|
}
|
|
|
|
|
|
void PagePolicy::onQueryTable(PageInfo& pageInfo, std::vector<Fields>& result)
|
|
|
|
|
|
{
|
|
|
|
|
|
DAO::queryPolicyList(pageInfo, result);
|
|
|
|
|
|
}
|
|
|
|
|
|
void PagePolicy::onOperate(int row, int col, std::string oper)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (oper == POP_OPER_NEW)
|
|
|
|
|
|
{
|
|
|
|
|
|
Fields fields;
|
|
|
|
|
|
this->showPop(0, oper, fields);
|
|
|
|
|
|
}
|
|
|
|
|
|
else if (oper == POP_OPER_EDIT)
|
|
|
|
|
|
{
|
2025-08-26 18:36:25 +08:00
|
|
|
|
table->getRowData(row);
|
|
|
|
|
|
auto& appdata = Application::data();
|
|
|
|
|
|
Fields fields;
|
|
|
|
|
|
fields.set("3", appdata.electPriceSuperPeak);
|
|
|
|
|
|
fields.set("4", appdata.electPricePeak);
|
|
|
|
|
|
fields.set("5", appdata.electPriceShoulder);
|
|
|
|
|
|
fields.set("6", appdata.electPriceOffPeak);
|
|
|
|
|
|
this->showPop(0, oper, fields);
|
2025-08-22 19:06:50 +08:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
std::string PagePolicy::onValidation(std::shared_ptr<PvPopWidget> pop, Fields& fields)
|
|
|
|
|
|
{
|
|
|
|
|
|
return "";
|
|
|
|
|
|
};
|
|
|
|
|
|
std::string PagePolicy::onPopConfirm(std::shared_ptr<PvPopWidget> pop, Fields& fields)
|
|
|
|
|
|
{
|
|
|
|
|
|
|
2025-08-26 18:36:25 +08:00
|
|
|
|
|
|
|
|
|
|
|
2025-08-22 19:06:50 +08:00
|
|
|
|
return "";
|
|
|
|
|
|
}
|
|
|
|
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
// === PageSyslog ===
|
|
|
|
|
|
PageSyslog::PageSyslog(PARAM* p, EPvCode pvcode) : PageTable(p)
|
|
|
|
|
|
{
|
|
|
|
|
|
table->addHead(DMSystemLog::LOG_ID, "日志编号", 160, {});
|
|
|
|
|
|
table->addHead(DMSystemLog::TYPE, "日志类型", 160, {});
|
|
|
|
|
|
table->addHead(DMSystemLog::USER_ACCOUNT, "用户", 160, {});
|
|
|
|
|
|
table->addHead(DMSystemLog::CONTENT, "日志详情", 800, {});
|
|
|
|
|
|
table->addHead(DMSystemLog::STATUS, "状态", 160, {});
|
|
|
|
|
|
table->addHead(DMSystemLog::CREATE_TIME, "记录时间", 200, {});
|
|
|
|
|
|
table->addOperate({"查看"});
|
|
|
|
|
|
}
|
|
|
|
|
|
void PageSyslog::onQueryTable(PageInfo& pageInfo, std::vector<Fields>& result)
|
|
|
|
|
|
{
|
|
|
|
|
|
DAO::querySystemLogList(pageInfo, result);
|
|
|
|
|
|
}
|
|
|
|
|
|
void PageSyslog::onOperate(int row, int col, std::string oper)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (oper == POP_OPER_NEW)
|
|
|
|
|
|
{
|
|
|
|
|
|
Fields fields;
|
|
|
|
|
|
fields.set(DMUser::USER_ID, Snowflake::instance().getIdStr());
|
|
|
|
|
|
this->showPop(0, oper, fields);
|
|
|
|
|
|
}
|
|
|
|
|
|
else if (oper == POP_OPER_EDIT)
|
|
|
|
|
|
{
|
|
|
|
|
|
this->showPop(0, oper, table->getRowData(row));
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
std::string PageSyslog::onValidation(std::shared_ptr<PvPopWidget> pop, Fields& fields)
|
|
|
|
|
|
{
|
|
|
|
|
|
return "";
|
|
|
|
|
|
};
|
|
|
|
|
|
std::string PageSyslog::onPopConfirm(std::shared_ptr<PvPopWidget> pop, Fields& fields)
|
|
|
|
|
|
{
|
|
|
|
|
|
return "";
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
// === PageAlertlog ===
|
|
|
|
|
|
PageAlertlog::PageAlertlog(PARAM* p, EPvCode pvcode) : PageTable(p)
|
|
|
|
|
|
{
|
|
|
|
|
|
table->addHead(DMAlertLog::LOG_ID, "日志编号", 160, {});
|
|
|
|
|
|
table->addHead(DMAlertLog::TYPE, "日志类型", 160, {});
|
|
|
|
|
|
table->addHead(DMAlertLog::DEVICE_ID, "设备ID", 160, {});
|
|
|
|
|
|
table->addHead(DMAlertLog::CONTENT, "日志详情", 800, {});
|
|
|
|
|
|
table->addHead(DMAlertLog::STATUS, "状态", 160, {});
|
|
|
|
|
|
table->addHead(DMAlertLog::CREATE_TIME, "记录时间", 200, {});
|
|
|
|
|
|
table->addOperate({"查看"});
|
|
|
|
|
|
}
|
|
|
|
|
|
void PageAlertlog::onQueryTable(PageInfo& pageInfo, std::vector<Fields>& result)
|
|
|
|
|
|
{
|
|
|
|
|
|
//DAO::queryAlertLogList(pageInfo, result);
|
|
|
|
|
|
}
|
|
|
|
|
|
void PageAlertlog::onOperate(int row, int col, std::string oper)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (oper == POP_OPER_NEW)
|
|
|
|
|
|
{
|
|
|
|
|
|
Fields fields;
|
|
|
|
|
|
fields.set(DMUser::USER_ID, Snowflake::instance().getIdStr());
|
|
|
|
|
|
this->showPop(0, oper, fields);
|
|
|
|
|
|
}
|
|
|
|
|
|
else if (oper == POP_OPER_EDIT)
|
|
|
|
|
|
{
|
|
|
|
|
|
this->showPop(0, oper, table->getRowData(row));
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
std::string PageAlertlog::onValidation(std::shared_ptr<PvPopWidget> pop, Fields& fields)
|
|
|
|
|
|
{
|
|
|
|
|
|
return "";
|
|
|
|
|
|
};
|
|
|
|
|
|
std::string PageAlertlog::onPopConfirm(std::shared_ptr<PvPopWidget> pop, Fields& fields)
|
|
|
|
|
|
{
|
|
|
|
|
|
return "";
|
|
|
|
|
|
}
|