MatrixPanelWidget.h 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122
  1. #ifndef MATRIXPANELWIDGET_H
  2. #define MATRIXPANELWIDGET_H
  3. #include <QGridLayout>
  4. #include <QStandardItemModel>
  5. #include <QTabWidget>
  6. #include <QWidget>
  7. #include "dbService/ClassSet.h"
  8. namespace Ui {
  9. class MatrixPanelWidget;
  10. }
  11. struct ProfessorInfo
  12. {
  13. int id = -1;
  14. QString name;
  15. QString job;
  16. QString major;
  17. QString department;
  18. QString education;
  19. QString phone;
  20. QDateTime createDataTime;
  21. QString remark;
  22. QString tableMsg;
  23. EngineerInfo engineer; // 当前的工程
  24. };
  25. class MindNodeManager
  26. {
  27. public:
  28. struct NodeMessage
  29. {
  30. QString node;
  31. QString name;
  32. QString remark;
  33. };
  34. explicit MindNodeManager() { }
  35. void pushNewMind(NodeMessage node) { mindNodes << node; }
  36. QList<NodeMessage> getMindNodes() const { return mindNodes; }
  37. void clear() { mindNodes.clear(); };
  38. QString getMindName() const { return mindName; }
  39. void setMindName(QString name) { mindName = name; }
  40. private:
  41. QString mindName;
  42. QList<NodeMessage> mindNodes;
  43. };
  44. class MatrixPanelWidget : public QWidget
  45. {
  46. Q_OBJECT
  47. public:
  48. explicit MatrixPanelWidget(QWidget *parent = nullptr);
  49. explicit MatrixPanelWidget(QWidget *parent, ProfessorInfo professor);
  50. void setTableMsg(QString tableMsg);
  51. ~MatrixPanelWidget();
  52. /**
  53. * @brief 绘制脑图
  54. * @param 横坐标参考脑图节点
  55. * @param 纵坐标参考脑图节点
  56. */
  57. void init(const QStringList indexsRef, const QStringList indexs);
  58. void initImportData(const QStringList indexsRef, const QStringList indexs,
  59. QList<NodeMatrixInfo *> nodeValueInfoList);
  60. void saveNodes();
  61. private slots:
  62. void on_prePageBtn_clicked();
  63. void on_nextPageBtn_clicked();
  64. void on_saveBtn_clicked();
  65. void oneTableDataReady(bool status);
  66. void oneTechMeasureTableDataReady(bool status);
  67. void oneTableDataSave();
  68. void getTableModel(QStandardItemModel *item);
  69. void getTableModelName(QString itemName);
  70. void on_importBtn_clicked();
  71. public slots:
  72. void on_exportBtn_clicked();
  73. private:
  74. Ui::MatrixPanelWidget *ui;
  75. ProfessorInfo m_professor;
  76. QGridLayout *firstLayout = nullptr;
  77. QWidget *firstPlainWidget = nullptr;
  78. QGridLayout *secondLayout = nullptr;
  79. QWidget *secondPlainWidget = nullptr;
  80. MindNodeManager *currentMindNodes = nullptr;
  81. QList<QList<MindNodeManager::NodeMessage>> *classifiedNodes = nullptr;
  82. QList<QList<MindNodeManager::NodeMessage>> *indexsRefClassifiedNodes = nullptr; // 是否参考指标体系
  83. QList<MindNodeManager::NodeMessage> technicalCols;
  84. int currentPage = 0;
  85. bool isAutoSave = false;
  86. QString currentTab = "";
  87. QString m_table_msg;
  88. QList<QTabWidget *> tabWidgets;
  89. QList<QStandardItemModel *> modelList; // 存储专家tab数据
  90. QList<QString> modelName; // 存储专家tab名称
  91. void sortMindNodes(const MindNodeManager &manager, QList<QList<MindNodeManager::NodeMessage>> *classify);
  92. void getMindNodes(MindNodeManager *manager, QStringList listNodes);
  93. QStringList getFirstIndexNodes(const MindNodeManager &manager);
  94. QStringList getLastIndexNodes(const MindNodeManager &manager);
  95. int getPages();
  96. void setPage(int page);
  97. void initPlainWidget(QList<NodeMatrixInfo *> nodeValueInfoList);
  98. void initPlainTechMeasuresWidget(QList<NodeMatrixInfo *> nodeValueInfoList);
  99. void paintPlainWidget();
  100. bool checkTableDateReady();
  101. signals:
  102. void importData(QList<NodeMatrixInfo *> nodeValueInfoList);
  103. };
  104. #endif // MATRIXPANELWIDGET_H