mirror of
https://gitee.com/js-yhsec/energy_storage.git
synced 2026-05-28 03:09:24 +08:00
实现系统管理表格操作接口、分页操作
This commit is contained in:
@@ -9,20 +9,51 @@
|
||||
class Station;
|
||||
class Device;
|
||||
|
||||
using VecPairSS = std::vector<std::pair<std::string, std::string>>;
|
||||
|
||||
struct DeviceType
|
||||
{
|
||||
int typeId {};
|
||||
std::string name;
|
||||
std::string attrs;
|
||||
};
|
||||
|
||||
struct Role
|
||||
{
|
||||
int roleId {};
|
||||
std::string name;
|
||||
bool isOpen {false};
|
||||
};
|
||||
|
||||
class AppData
|
||||
{
|
||||
public:
|
||||
void init();
|
||||
|
||||
|
||||
std::shared_ptr<Station> getStation(int stationId);
|
||||
|
||||
std::shared_ptr<Station> getStationByName(std::string name);
|
||||
|
||||
void getStationNames(std::vector<std::string>& vecNames);
|
||||
|
||||
|
||||
std::shared_ptr<Device> getDevice(int stationId, int deviceId);
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// 获取角色名称列表
|
||||
std::vector<std::string> getRoleNames();
|
||||
// 获取场站名称列表
|
||||
std::vector<std::string> getStationNames();
|
||||
// 获取设备类型
|
||||
std::vector<std::string> getDeviceTypes();
|
||||
|
||||
// 获取设备类型定义
|
||||
std::unordered_map<int, std::shared_ptr<DeviceType>>& getDeviceTypeDef();
|
||||
|
||||
// 读取统计数据: 今日统计数据,累计统计数据
|
||||
void loadStatData();
|
||||
|
||||
void initUser();
|
||||
|
||||
public:
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////
|
||||
@@ -38,11 +69,26 @@ public:
|
||||
std::string passwd;
|
||||
} db;
|
||||
|
||||
struct {
|
||||
VecPairSS isopen {{"0", "禁用"}, {"1", "启用"}};
|
||||
VecPairSS gender {{"0", "女"}, {"1", "男"}};
|
||||
// 角色 Mapping (id->name)
|
||||
VecPairSS role;
|
||||
|
||||
VecPairSS deviceType;
|
||||
|
||||
} mapping;
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// === 场站信息 ===
|
||||
std::unordered_map<int, std::shared_ptr<Station>> mapStation;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// === 角色定义 ===
|
||||
std::unordered_map<int, std::shared_ptr<Role>> mapRole;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// === 设备类型定义 ===
|
||||
std::unordered_map<int, std::shared_ptr<DeviceType>> mapDeviceType;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user