DataCollectionWidget.cpp 5.5 KB

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