EXDataTableView.h 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124
  1. #ifndef EXDATATABLEVIEW_H
  2. #define EXDATATABLEVIEW_H
  3. #include <QWidget>
  4. #include "SchemePlanManager.h"
  5. #include "CNode.h"
  6. #include <dbService/ClassSet.h>
  7. #include <xlsxdocument.h>
  8. #include <QStandardItemModel>
  9. class QFUser;
  10. class CMind;
  11. class ProjectInfo;
  12. class PushButton;
  13. class QLabel;
  14. class QTabWidget;
  15. class QVBoxLayout;
  16. class QHBoxLayout;
  17. class EXDataTableComboDelegate;
  18. class QStandardItemModel;
  19. class EXDataItemModel : public QStandardItemModel
  20. {
  21. public:
  22. explicit EXDataItemModel(QObject *parent = nullptr);
  23. QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override;
  24. };
  25. /**
  26. * @brief The DataTableWidget class
  27. * 数据表, 整体上是包含多个 QTableView 的 QTabWidget
  28. * 显示以下数据:
  29. * 能力重要度评估, 技术措施重要度, 方案优选评估: 权重分析数据和评估数据
  30. * 综合效能评估: 权重分析数据
  31. * 综合效能评估-物元分析法: 评估数据
  32. */
  33. class EXDataTableView : public QWidget
  34. {
  35. Q_OBJECT
  36. public:
  37. explicit EXDataTableView(SchemePlanManager::SchemeProcessInfo process, QWidget *parent = nullptr);
  38. SchemePlanManager::SchemeProcessInfo process() const;
  39. void setProjectInfo(ProjectInfo *proj);
  40. void initWidget();
  41. void initLayout();
  42. void connectSignalsAndSlots();
  43. void setupModels();
  44. void setupTabWidget();
  45. int currentPage() const;
  46. void setCurrentPage(int p);
  47. CMind *mind1() const;
  48. CMind *mind2() const;
  49. bool checkDataComplete() const;
  50. void exportData(const QString &path);
  51. signals:
  52. void signalItemEdited();
  53. private:
  54. void editItemData(const QModelIndex &index, const QString &val);
  55. void updateModel(EXDataItemModel *model, QList<CNodeData> &hHeaders, QList<CNodeData> &vHeaders);
  56. private slots:
  57. void slotPrevious();
  58. void slotNext();
  59. void slotTabCurrentChanged(int c);
  60. void slotItemClicked(const QModelIndex &index);
  61. void slotSave();
  62. void itemChanged(QStandardItem *item);
  63. private:
  64. SchemePlanManager::SchemeProcessInfo m_process;
  65. QMap<int, QList<EXDataItemModel *>> m_models;
  66. QXlsx::Document *m_export;
  67. ProjectInfo *m_proj = nullptr;
  68. QFUser *m_user;
  69. int m_currentPage = 0;
  70. CMind *m_mind1 = nullptr;
  71. CMind *m_mind2 = nullptr;
  72. QTabWidget *m_dataTab = nullptr;
  73. QLabel *m_pageLab = nullptr; // 共4页, 当前第2页
  74. PushButton *m_previous = nullptr; // 上一级指标
  75. PushButton *m_next = nullptr; // 下一级指标
  76. QVBoxLayout *m_layout = nullptr;
  77. QHBoxLayout *m_pageLayout = nullptr;
  78. EXDataTableComboDelegate *m_comboDelegate;
  79. PushButton *m_save = nullptr;
  80. };
  81. #endif // EXDATATABLEVIEW_H