EXDataView.cpp 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133
  1. #include "EXDataView.h"
  2. #include "EXDataTableView.h"
  3. #include "dbService/SchemeProcessService.h"
  4. #include "dbService/ClassSet.h"
  5. #include "dbService/CNodeDataService.h"
  6. #include "dbService/NodeMatrixService.h"
  7. #include <CNode.h>
  8. #include <Widgets/Button.h>
  9. #include <QTabWidget>
  10. #include <QBoxLayout>
  11. #include <QMap>
  12. #include <QDebug>
  13. EXDataView::EXDataView(ProjectInfo *proj, QWidget *parent) : EXEvalView(proj, parent)
  14. {
  15. setTitle("数据采集");
  16. connect(m_tab, &QTabWidget::currentChanged, this, &EXDataView::slotTabCurrentChanged);
  17. }
  18. void EXDataView::setType(int type)
  19. {
  20. EXEvalView::setType(type);
  21. setupTabWidget();
  22. }
  23. ///
  24. /// \brief EXDataView::setupTabWidget
  25. /// 根据评估类型, 评估方案, 评估算法, 加载合适的数据导入界面
  26. void EXDataView::setupTabWidget()
  27. {
  28. m_tab->clear();
  29. QMap<int, QList<CNodeData>> nodeListMap;
  30. for (int i : indexList()) {
  31. // 获取指标体系数据
  32. QList<CNodeData> nodeList;
  33. bool ret = CNodeDataService().QueryAll(nodeList, m_proj->id, i);
  34. if (ret) {
  35. nodeListMap[i] = nodeList;
  36. } else {
  37. return;
  38. }
  39. // 获取方案规划数据
  40. QList<SchemePlanManager::SchemeProcessInfo> processList;
  41. ret = SchemeProcessService().QueryAllByProjectIdAndIndexType(processList, m_proj->id, i);
  42. if (ret == false) {
  43. return;
  44. }
  45. ProjectManager::IndexType t = (ProjectManager::IndexType)i;
  46. QString indexName = ProjectManager::nameOfIndexType(t);
  47. // 效能评估方案中导入评估数据的步骤, 选择物元分析法时使用
  48. SchemePlanManager::SchemeProcessInfo importEffiEvalDataProcess;
  49. for (SchemePlanManager::SchemeProcessInfo process : processList) {
  50. // // 综合效能评估 - 灰色聚类法: 效能等级配置页面, 导入评估数据页面
  51. // if (process.algorithm == SchemePlanManager::GCE && process.indexType ==
  52. // ProjectManager::EfficiencyIndex) {
  53. // GreyClusteringConfigWidget *gc = new GreyClusteringConfigWidget(process.efficiencyGrades);
  54. // m_tab->addTab(gc, indexName + " - " + "灰色聚类法效能等级配置");
  55. // QVector<GreyClusteringItem> items;
  56. // GreyClusteringSampleTable *gs = new GreyClusteringSampleTable(items, 2, 10);
  57. // m_tab->addTab(gs, indexName + " - " + "收集效能评估数据");
  58. // }
  59. // // 综合效能评估 - 物元分析法: 效能等级配置页面, 导入评估数据页面
  60. // if (process.algorithm == SchemePlanManager::MEA && process.indexType ==
  61. // ProjectManager::EfficiencyIndex) {
  62. // QList<MEConfigItem> items;
  63. // CMind *mind = new CMind();
  64. // mind->setNodeList(nodeListMap[i]);
  65. // MatterElementConfigWidget *mec = new MatterElementConfigWidget(mind,
  66. // process.efficiencyGrades); m_tab->addTab(mec, indexName + "-" + "物元分析法效能等级配置");
  67. // DataTableWidget *table = new DataTableWidget(importEffiEvalDataProcess, this);
  68. // table->mind1()->setNodeList(nodeListMap[i]);
  69. // table->setCurrentPage(1);
  70. // m_tab->addTab(table, indexName + " - " + "收集效能评估数据");
  71. // }
  72. // 导入效能评估的权重分析数据
  73. // 导入其他评估的权重分析数据和评估数据
  74. if (process.dSource == SchemePlanManager::FromExpert) {
  75. if (process.type == SchemePlanManager::ImportEvalData
  76. && process.indexType == ProjectManager::EfficiencyIndex) {
  77. importEffiEvalDataProcess = process;
  78. continue;
  79. }
  80. EXDataTableView *table = new EXDataTableView(process, this);
  81. table->setProjectInfo(m_proj);
  82. table->mind1()->setNodeList(nodeListMap[i]);
  83. if (i == ProjectManager::TechIndex) {
  84. table->mind2()->setNodeList(nodeListMap[ProjectManager::AbilityIndex]);
  85. }
  86. table->setCurrentPage(1);
  87. QString processName = SchemePlanManager::processName(process);
  88. m_tab->addTab(table, indexName + " - " + processName);
  89. }
  90. }
  91. }
  92. }
  93. void EXDataView::slotTabCurrentChanged(int index) { }
  94. void EXDataView::slotExportData()
  95. {
  96. EXDataTableView *table = dynamic_cast<EXDataTableView *>(m_tab->currentWidget());
  97. if (table == nullptr) {
  98. return;
  99. }
  100. table->exportData();
  101. SchemePlanManager::SchemeProcessInfo process = table->process();
  102. qDebug() << __FUNCTION__ << __LINE__
  103. << ProjectManager::nameOfIndexType((ProjectManager::IndexType)process.indexType) << endl;
  104. QList<NodeMatrixInfo *> values;
  105. NodeMatrixService().QueryNodeMatrixListByExpertIdAndEngineerId2(&values, 62, 110,
  106. QString("%1").arg(process.indexType));
  107. }