实现系统管理表格操作接口、分页操作

This commit is contained in:
lixiaoyuan
2025-08-22 19:06:50 +08:00
parent 7e965b6fb4
commit 7fe51ea362
56 changed files with 2234 additions and 1304 deletions

View File

@@ -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;
};