mirror of
https://gitee.com/js-yhsec/energy_storage.git
synced 2026-05-28 11:19:24 +08:00
实现系统管理表格操作接口、分页操作
This commit is contained in:
@@ -4,7 +4,7 @@
|
||||
#include <functional>
|
||||
|
||||
#include "PvApp.h"
|
||||
#include "DataFields.h"
|
||||
#include "Fields.h"
|
||||
|
||||
using CallbackTableOpt = std::function<void(int row, int col, std::string text)>;
|
||||
|
||||
@@ -66,10 +66,11 @@ public:
|
||||
|
||||
void set_text(PARAM* p, int row, int col, std::string text, std::string style = "");
|
||||
|
||||
void setRowData(int row, DataFields& d);
|
||||
void setRowData(int row, Fields& d);
|
||||
void setRowData(int row, std::vector<std::string> vd);
|
||||
|
||||
DataFields& getRowdata(int row);
|
||||
Fields getRowData(int row);
|
||||
void mappingData(Fields& fields);
|
||||
|
||||
void set_border_visible(PARAM* p, bool v);
|
||||
|
||||
@@ -85,7 +86,7 @@ public:
|
||||
|
||||
int colums();
|
||||
|
||||
std::vector<DataFields> data();
|
||||
std::vector<Fields> data();
|
||||
|
||||
PvTable::Head& header(int col);
|
||||
|
||||
@@ -98,7 +99,7 @@ private:
|
||||
std::vector<PvTable::Head> vecHead_;
|
||||
std::vector<PvTable::Row> vecRows_;
|
||||
|
||||
std::vector<DataFields> vecData_;
|
||||
std::vector<Fields> vecData_;
|
||||
|
||||
vector<pair<int, vector<int>>> vecOpt_;
|
||||
int nRow_;
|
||||
@@ -119,43 +120,41 @@ private:
|
||||
class PvPagination : public PvObject
|
||||
{
|
||||
public:
|
||||
PvPagination(PARAM* p, int parent, const PvRect& rt);
|
||||
PvPagination(PARAM* p, int parent, int x, int y, int n);
|
||||
|
||||
void set_page(int page_id, int max_page);
|
||||
void setPage(int index, int count);
|
||||
|
||||
int pageid();
|
||||
int page();
|
||||
|
||||
void set_goto_page_callback(std::function<void(int pageid)> cb);
|
||||
void setCallback(std::function<void(int index)> func);
|
||||
|
||||
private:
|
||||
void on_click_page(int btnid);
|
||||
void on_click_prev();
|
||||
void on_click_next();
|
||||
|
||||
void active_page_button(PARAM* p, int new_pageid, int old_pageid);
|
||||
void activePage(int index, bool invoke=false);
|
||||
|
||||
private:
|
||||
int pvid_ = PV_ID_NUL;
|
||||
|
||||
// 当前显示的页码索引, 从1开始
|
||||
int page_id_ = 1;
|
||||
int pageIndex = 1;
|
||||
|
||||
// 总页数
|
||||
int page_count_ = 0;
|
||||
int pageCount = 0;
|
||||
|
||||
// 上一页按钮
|
||||
int btn_prev_ = PV_ID_NUL;
|
||||
int btnPrev = PV_ID_NUL;
|
||||
|
||||
// 下一页按钮
|
||||
int btn_next_ = PV_ID_NUL;
|
||||
int btnNext = PV_ID_NUL;
|
||||
|
||||
// 页面跳转按钮
|
||||
int btn_gopage_ = PV_ID_NUL;
|
||||
|
||||
// 页码列表(最多显示6个页码按钮,前3页和后3页) <按钮ID, 页码>
|
||||
std::vector<pair<int, int>> vec_btn_page_;
|
||||
int btnActive = PV_ID_NUL;
|
||||
|
||||
function<void(int)> cb_goto_ = nullptr;
|
||||
int labelInfo = PV_ID_NUL;
|
||||
|
||||
// 页码列表(最多显示6个页码按钮,前3页和后3页) <按钮ID, 页码>
|
||||
std::vector<pair<int, int>> vecBtn;
|
||||
|
||||
function<void(int)> callback = nullptr;
|
||||
};
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user