#include "DataCollectionWidget.h" #include "DataTableWidget.h" #include "ConfigExpertDataWidget.h" #include "ConfigMeasureDataWidget.h" #include "EvalDataManager.h" #include "algorithm/HierarchicalAnalysis.h" #include "GreyClusteringConfigWidget.h" // 灰色聚类配置 #include "GreyClusteringSampleTable.h" // 灰色聚类评估 #include "MatterElementConfigWidget.h" // 物元分析配置 #include "dbService/SchemeProcessService.h" #include "dbService/ClassSet.h" #include "dbService/CNodeDataService.h" #include #include #include #include #include #include DataCollectionWidget::DataCollectionWidget(ProjectInfo *proj, QWidget *parent) : EvalWidget(proj, parent) { setTitle("评估数据采集"); m_configExpert = new ConfigExpertDataWidget(this); m_configMeasure = new ConfigMeasureDataWidget(this); m_configMeasure->setFixedWidth(256); m_contentLayout->addWidget(m_configExpert); m_contentLayout->addWidget(m_configMeasure); m_configExpert->setHidden(true); m_configMeasure->setHidden(true); m_calcBtn = new PushButton("更新数据"); m_topLayout->addStretch(); m_topLayout->addWidget(m_calcBtn); connect(m_calcBtn, &PushButton::clicked, this, &DataCollectionWidget::slotCalc); connect(m_tab, &QTabWidget::currentChanged, this, &DataCollectionWidget::slotTabCurrentChanged); } void DataCollectionWidget::setType(int type) { EvalWidget::setType(type); setupTabWidget(); } /// /// \brief DataCollectionWidget::setupTabWidget /// 根据评估类型, 评估方案, 评估算法, 加载合适的数据导入界面 void DataCollectionWidget::setupTabWidget() { m_tab->clear(); QMap> nodeListMap; for (int i : indexList()) { // 获取指标体系数据 QList nodeList; bool ret = CNodeDataService().QueryAll(nodeList, m_proj->id, i); if (ret) { nodeListMap[i] = nodeList; } else { return; } // 获取方案规划数据 QList processList; ret = SchemeProcessService().QueryAllByProjectIdAndIndexType(processList, m_proj->id, i); if (ret == false) { return; } ProjectManager::IndexType t = (ProjectManager::IndexType)i; QString indexName = ProjectManager::nameOfIndexType(t); // 效能评估方案中导入评估数据的步骤, 选择物元分析法时使用 SchemePlanManager::SchemeProcessInfo importEffiEvalDataProcess; for (SchemePlanManager::SchemeProcessInfo process : processList) { // 综合效能评估 - 灰色聚类法: 效能等级配置页面, 导入评估数据页面 if (process.algorithm == SchemePlanManager::GCE && process.indexType == ProjectManager::EfficiencyIndex) { GreyClusteringConfigWidget *gc = new GreyClusteringConfigWidget(process.efficiencyGrades); m_tab->addTab(gc, indexName + " - " + "灰色聚类法效能等级配置"); QVector items; GreyClusteringSampleTable *gs = new GreyClusteringSampleTable(items, 2, 10); m_tab->addTab(gs, indexName + " - " + "收集效能评估数据"); } // 综合效能评估 - 物元分析法: 效能等级配置页面, 导入评估数据页面 if (process.algorithm == SchemePlanManager::MEA && process.indexType == ProjectManager::EfficiencyIndex) { QList items; CMind *mind = new CMind(); mind->setNodeList(nodeListMap[i]); MatterElementConfigWidget *mec = new MatterElementConfigWidget(mind, process.efficiencyGrades); m_tab->addTab(mec, indexName + "-" + "物元分析法效能等级配置"); DataTableWidget *table = new DataTableWidget(importEffiEvalDataProcess, this); table->mind1()->setNodeList(nodeListMap[i]); table->setCurrentPage(1); m_tab->addTab(table, indexName + " - " + "收集效能评估数据"); } // 导入效能评估的权重分析数据 // 导入其他评估的权重分析数据和评估数据 if (process.dSource >= 0) { if (process.type == SchemePlanManager::ImportEvalData && process.indexType == ProjectManager::EfficiencyIndex) { importEffiEvalDataProcess = process; continue; } DataTableWidget *table = new DataTableWidget(process, this); table->mind1()->setNodeList(nodeListMap[i]); if (i == ProjectManager::TechIndex) { table->mind2()->setNodeList(nodeListMap[ProjectManager::AbilityIndex]); } QList list = EvalDataManager::dataSample(process, table->mind1(), table->mind2()); table->setData(list); table->setCurrentPage(1); QString processName = SchemePlanManager::processName(process); m_tab->addTab(table, indexName + " - " + processName); } } } } void DataCollectionWidget::slotTabCurrentChanged(int index) { DataTableWidget *table = dynamic_cast(m_tab->widget(index)); if (index >= 0 && table != nullptr) { bool expert = (table->process().dSource == SchemePlanManager::FromExpert); if (expert) { m_configExpert->setProcess(table->process()); } m_configExpert->setVisible(expert); bool meaure = (table->process().dSource == SchemePlanManager::FromMeasurement); if (meaure) { m_configMeasure->setProcess(table->process()); } m_configMeasure->setVisible(meaure); } if (table == nullptr) { m_configExpert->setHidden(true); m_configMeasure->setHidden(true); } } void DataCollectionWidget::slotCalc() { DataTableWidget *table = dynamic_cast(m_tab->currentWidget()); if (table == nullptr) { return; } QStringList nodes = table->hNodes(); QVector values = table->values(); qDebug() << __FUNCTION__ << __LINE__ << nodes << endl; qDebug() << __FUNCTION__ << __LINE__ << values << endl; if (values.count() != nodes.count() * nodes.count()) { return; } HierarchicalAnalysis *a = new HierarchicalAnalysis(nodes, values); qDebug() << __FUNCTION__ << __LINE__ << a->getWeights() << endl; }