#ifndef SYSROLEMGT_H
#define SYSROLEMGT_H

#include <tbaseutil/tdataresponse.h>
#include <tdatabaseutil/tsqlselectorv2.h>
#include <topcore/topclassabs.h>
#include "sysrole.h"

class TTableView;
class TSearchEntry;
class TPageTool;
class TSplitter;

class SysRoleMgt : public TopClassAbs
{
    Q_OBJECT
public:
    explicit SysRoleMgt(const QString &iModuleNameStr = QString(""),
                        const QVariantMap iUrlPars = QVariantMap(),
                        QWidget *iParent = nullptr);
    ~SysRoleMgt();

public slots:
    void refresh(bool iResetPageBol = true);
    void deleteItem(const QVariantList &iIdLst);
    QVariantList selectedItems();
    TopClassAbs *openItem(int iRoleIdInt);
    void newItem();
    void clearUnusedRgts();
    void onSelectionChanged();

private slots:
    void onPageChanged();
    void onDetailSaved(const QVariant &iUidStr);
    void onDetailChanged();

private:
    TSqlSelectorV2 getSqlSelector(bool iResetPageBol = true);
    void initTableView();
    void fillTableData(const TDataResponse &iDataRes);

protected:
    void keyPressEvent(QKeyEvent *iEvent) override;

private:
    TSplitter *mBodySplitter = nullptr;
    QWidget *mBodyWidget = nullptr;
    TTableView *mTableView = nullptr;
    TSearchEntry *mSearchEntry = nullptr;
    TPageTool *mPageTool = nullptr;
    QVariantList mSelectedLst;
    SysRole *mDetailView = nullptr;
    QVariantMap mDataMap; //数据
    QStringList mProductCategoryLst;
};

#endif // SYSROLEMGT_H