2025-03-17 15:06:54 +08:00
|
|
|
|
#ifndef CEVENTHISTORYMODEL_H
|
2025-03-14 17:05:48 +08:00
|
|
|
|
#define CEVENTHISTORYMODEL_H
|
|
|
|
|
|
|
|
|
|
|
|
#include <QAbstractTableModel>
|
|
|
|
|
|
#include "CEventMsgInfo.h"
|
|
|
|
|
|
#include "CEventDataCollect.h"
|
|
|
|
|
|
#include <QDateTime>
|
|
|
|
|
|
|
|
|
|
|
|
#define Row_Full (15000)
|
|
|
|
|
|
#define MAX_HIS_ROWCOUNT (10000)
|
|
|
|
|
|
|
|
|
|
|
|
class CEventMsgInfo;
|
|
|
|
|
|
|
|
|
|
|
|
class CEventHistoryModel : public QAbstractTableModel
|
|
|
|
|
|
{
|
|
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
public:
|
|
|
|
|
|
CEventHistoryModel(QObject *parent = Q_NULLPTR);
|
|
|
|
|
|
~CEventHistoryModel();
|
|
|
|
|
|
|
|
|
|
|
|
void initialize();
|
|
|
|
|
|
void initFilter();
|
|
|
|
|
|
|
|
|
|
|
|
void loadEventHistoryData();
|
|
|
|
|
|
|
|
|
|
|
|
QString bulidCondition();
|
|
|
|
|
|
QString bulidConditionPartPriority();
|
|
|
|
|
|
QString bulidConditionPartType();
|
|
|
|
|
|
QString bulidConditionPartLocation();
|
|
|
|
|
|
QString bulidConditionPartRegion();
|
|
|
|
|
|
QString bulidConditionPartDeviceType();
|
|
|
|
|
|
QString bulidConditionPartContent();
|
|
|
|
|
|
QString bulidConditionPartDateTime();
|
|
|
|
|
|
|
|
|
|
|
|
EventMsgPtr getAlarmInfo(const QModelIndex &index) const;
|
|
|
|
|
|
|
|
|
|
|
|
virtual QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const;
|
|
|
|
|
|
virtual QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const;
|
|
|
|
|
|
virtual int columnCount(const QModelIndex &index = QModelIndex()) const;
|
|
|
|
|
|
virtual int rowCount(const QModelIndex &index = QModelIndex()) const;
|
|
|
|
|
|
virtual Qt::ItemFlags flags(const QModelIndex &index) const;
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
* 设置模型数据过滤条件,过滤显示数据
|
|
|
|
|
|
*/
|
|
|
|
|
|
void setFilter(const bool &isLevelFilterEnable, const QList<int> &levelFilter,
|
|
|
|
|
|
const bool &isStationFilterEnable, const QList<int> &stationFilter,
|
|
|
|
|
|
const bool &isRegionFilterEnable, const QList<int> ®ionFilter,
|
|
|
|
|
|
const bool &isTypeFilterEnable, const QList<int> &typeFilter,
|
|
|
|
|
|
const bool &isDeviceTypeFilter = false, const QString &subSystem = QString(), const QString &deviceType = QString(),
|
|
|
|
|
|
const bool &isKeywordFilterEnable = false, const QString &keyword = QString(),
|
|
|
|
|
|
const bool &timeFilterEnable = false, const QDateTime &startTime = QDateTime(),
|
|
|
|
|
|
const QDateTime &endTime = QDateTime());
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
* 获取模型数据过滤条件,用于初始化过滤对话框
|
|
|
|
|
|
*/
|
|
|
|
|
|
void getFilter(bool &isLevelFilterEnable, QList<int> &levelFilter,
|
|
|
|
|
|
bool &isLocationFilterEnable, QList<int> &locationFilter,
|
|
|
|
|
|
bool &isRegionFilterEnable, QList<int> ®ionFilter,
|
|
|
|
|
|
bool &isTypeFilterEnable, QList<int> &alarmTypeFilter,
|
|
|
|
|
|
bool &deviceTypeFilter, QString &subSystem, QString &deviceType,
|
|
|
|
|
|
bool &keywordFilterEnable, QString &keyword,
|
|
|
|
|
|
bool &timeFilterEnable, QDateTime &startTime, QDateTime &endTime);
|
|
|
|
|
|
|
|
|
|
|
|
bool conditionFilter(EventMsgPtr info);
|
|
|
|
|
|
|
|
|
|
|
|
void setPriorityFilter(bool &isCheck, QList<int> &priorityFilter);
|
|
|
|
|
|
void setLocationFilter(bool &isCheck, QList<int> &locationFilter);
|
|
|
|
|
|
void setEventTypeFilter(bool &isCheck, QList<int> &eventTypeFilter);
|
|
|
|
|
|
void setEventTimeFilter(bool &isCheck,QDate &startTime,QDate &endTime);
|
|
|
|
|
|
void setEventTimeFilter(bool &isCheck);
|
|
|
|
|
|
signals:
|
|
|
|
|
|
//void requestHistoryEvents(const QStringList &listHistoryEventTableName,QList<int> typeFilter, const QString &conditionFilter);
|
|
|
|
|
|
void requestHistoryEvents(const QStringList &listHistoryEventTableName, const QString &conditionFilter);
|
|
|
|
|
|
void sigPermInvalid();
|
|
|
|
|
|
void sigHisEventRequesting();
|
|
|
|
|
|
void sigHisEventSizeChanged();
|
|
|
|
|
|
void sigHISRecordOutOfRangeTips(QStringList stDescList);
|
|
|
|
|
|
|
|
|
|
|
|
public slots:
|
|
|
|
|
|
void updateListEvents(const QList<EventMsgPtr> &listEvents, QStringList stDescList);
|
|
|
|
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
|
QStringList header;
|
|
|
|
|
|
QList<EventMsgPtr> m_listShowEventInfo;
|
|
|
|
|
|
|
|
|
|
|
|
QList<int> m_listPermLocationId;
|
|
|
|
|
|
QList<int> m_listPermRegionId;
|
|
|
|
|
|
|
|
|
|
|
|
E_ALARM_SORTKEY m_sortKey; //排序规则
|
|
|
|
|
|
Qt::SortOrder m_order;
|
|
|
|
|
|
|
|
|
|
|
|
//Filter
|
|
|
|
|
|
bool m_isLevelFilterEnable; //是否按报警级别过滤
|
|
|
|
|
|
QList<int> m_levelFilter; //报警级别过滤
|
|
|
|
|
|
bool m_isLocationFilterEnable; //是否按车站过滤
|
|
|
|
|
|
QList<int> m_locationFilter; //车站过滤
|
|
|
|
|
|
bool m_isRegionFilterEnable; //是否按责任区过滤
|
|
|
|
|
|
QList<int> m_regionFilter; //责任区过滤
|
|
|
|
|
|
bool m_isTypeFilterEnable;
|
|
|
|
|
|
QList<int> m_typeFilter;
|
|
|
|
|
|
// bool m_isStatusFilterEnable; //是否按报警类型过滤
|
|
|
|
|
|
// QList<int> m_statusFilter; //事件状态过滤(所有的要过滤事件状态--如果其他状态没有被勾选,则与下面的内容相同)
|
|
|
|
|
|
// QList<int> m_statusFilter2; //事件状态过滤(显示在过滤窗中的事件状态)
|
|
|
|
|
|
bool m_isDeviceTypeFileter; //设备类型过滤
|
|
|
|
|
|
QString m_subSystem; //子系统
|
|
|
|
|
|
QString m_deviceType; //设备类型
|
|
|
|
|
|
bool m_isKeywordEnable; //关键字过滤
|
|
|
|
|
|
QString m_keyword; //关键字
|
|
|
|
|
|
bool m_timeFilterEnable; //是否根据时间过滤
|
|
|
|
|
|
QDateTime m_startTime; //起始时间
|
|
|
|
|
|
QDateTime m_endTime; //终止时间
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
#endif // CEVENTHISTORYMODEL_H
|