Prechádzať zdrojové kódy

编辑方案时, 更新方案说明

chengxr 1 rok pred
rodič
commit
f96c62895d

+ 49 - 0
QFD/common/SchemePlanManager.cpp

@@ -88,6 +88,55 @@ QString SchemePlanManager::processName(const SchemeProcessInfo &process)
     return "";
 }
 
+QString SchemePlanManager::processDescription(const SchemePlanManager::SchemeProcessInfo &process)
+{
+    switch (process.type) {
+    case IndexSystem:
+        return "在指标体系设计页面,录入项目包含的指标,注意指标名称不能重复。";
+    case ImportWeightData:
+    case ImportEvalData: {
+        if (process.dSource == FromExpert) {
+            return "在评估数据采集页面给项目配置专家和权重。从评估项目管理页面找到对应的项目,导出资源包分发给专家。收"
+                   "集到专家填写的数据后,在评估数据采集页面导入专家数据。";
+        } else if (process.dSource == FromMeasurement) {
+            return "在评估数据采集页面添加实测数据。";
+        } else if (process.dSource == FromScheme) {
+            return "在评估数据采集页面添加专家方案。";
+        }
+        break;
+    }
+    case OptimizeIndex:
+        return "";
+    case CalculateWeight: {
+        QString algName = stringFromAlgorithm(process.algorithm);
+        return QString("使用%1计算各个指标的权重。").arg(algName);
+    }
+
+    case RunEvaluate: {
+        QString algName = stringFromAlgorithm(process.algorithm);
+        if (process.indexType == ProjectManager::TechIndex) {
+            return QString("使用%1进行技术措施重要度评估。").arg(algName);
+        } else if (process.indexType == ProjectManager::OptimalIndex) {
+            return QString("使用%1进行方案优选评估。").arg(algName);
+        } else if (process.indexType == ProjectManager::EfficiencyIndex) {
+            return QString("使用%1进行综合效能评估。").arg(algName);
+        }
+    }
+    case ShowEvalResult: {
+        if (process.indexType == ProjectManager::AbilityIndex) {
+            return "在评估数据处理页面查看权重分析结果";
+        } else {
+            return "在评估数据处理页面查看评估结果";
+        }
+    case GenerateReport:
+        return "";
+    default:
+        break;
+    }
+    }
+    return "";
+}
+
 QList<SchemePlanManager::SchemeDataSource>
 SchemePlanManager::processOptionalDataSource(const SchemeProcessInfo &process)
 {

+ 2 - 0
QFD/common/SchemePlanManager.h

@@ -117,6 +117,8 @@ public:
     /// 方案步骤的名称
     static QString processName(const SchemeProcessInfo &process);
 
+    static QString processDescription(const SchemeProcessInfo &process);
+
     /// 给定方案步骤中可选的数据来源
     static QList<SchemeDataSource> processOptionalDataSource(const SchemeProcessInfo &process);
 

+ 1 - 0
QFD/widgets/SchemeFlowWidget.cpp

@@ -109,6 +109,7 @@ QList<SchemePlanManager::SchemeProcessInfo> SchemeFlowWidget::schemes() const
         auto v                                       = m_graphModel->nodeData(id, NodeRole::Widget);
         FlowGraphCommonNodeWidget *w                 = v.value<FlowGraphCommonNodeWidget *>();
         SchemePlanManager::SchemeProcessInfo process = w->process();
+        schemes.append(process);
     }
 
     return schemes;

+ 35 - 8
QFD/widgets/SchemePlanWidget.cpp

@@ -39,10 +39,10 @@ void SchemePlanWidget::setupUI()
     m_topLayout->addSpacing(10);
     m_export->setHidden(true);
 
-    //    m_description = new QTextEdit(this);
-    //    m_description->setPlainText("方案说明");
-    //    m_description->setFixedWidth(240);
-    //    m_contentLayout->addWidget(m_description);
+    m_description = new QTextEdit(this);
+    m_description->setReadOnly(true);
+    m_description->setFixedWidth(240);
+    m_contentLayout->addWidget(m_description);
 
     connect(m_export, &PushButton::clicked, this, &SchemePlanWidget::slotExportClicked);
     connect(m_tab, &QTabWidget::currentChanged, this, &SchemePlanWidget::slotTabCurrentChanged);
@@ -146,6 +146,28 @@ bool SchemePlanWidget::hasData(QString indexName) const
     return false;
 }
 
+void SchemePlanWidget::updateDescription()
+{
+    SchemeFlowWidget *m = (SchemeFlowWidget *)m_tab->currentWidget();
+    if (m == nullptr) {
+        return;
+    }
+
+    QList<SchemePlanManager::SchemeProcessInfo> schemes = m->schemes();
+
+    QString text = "方案说明\n";
+    for (int i = 0; i < schemes.size(); ++i) {
+        text.append("\n");
+        text.append(QString("第 %1 步:\n").arg(i + 1));
+        text.append(SchemePlanManager::processName(schemes[i]));
+        text.append("\n");
+        text.append(SchemePlanManager::processDescription(schemes[i]));
+        text.append("\n");
+    }
+
+    m_description->setText(text);
+}
+
 void SchemePlanWidget::slotExportClicked()
 {
 
@@ -159,14 +181,19 @@ void SchemePlanWidget::slotSchemeProcessEdited(const SchemePlanManager::SchemePr
 {
     qDebug() << __FUNCTION__ << __LINE__ << process.algorithm << endl;
     SchemeProcessService().UpdateSchemeProcess(process);
+    updateDescription();
 }
 
 void SchemePlanWidget::slotTabCurrentChanged(int c)
 {
-    bool ret            = hasData(m_tab->tabText(c));
     SchemeFlowWidget *m = (SchemeFlowWidget *)m_tab->currentWidget();
-
-    if (m != nullptr) {
-        m->setAllowEdit(!ret);
+    if (m == nullptr) {
+        return;
     }
+
+    /// 有数据时禁止编辑
+    bool ret = hasData(m_tab->tabText(c));
+    m->setAllowEdit(!ret);
+
+    updateDescription();
 }

+ 4 - 2
QFD/widgets/SchemePlanWidget.h

@@ -7,7 +7,7 @@
 
 class PushButton;
 
-// class QTextEdit;
+class QTextEdit;
 
 /**
  * @brief The SchemePlanWidget class
@@ -32,6 +32,8 @@ private:
 
     bool hasData(QString indexName) const;
 
+    void updateDescription();
+
 private slots:
     void slotExportClicked();
 
@@ -42,7 +44,7 @@ private slots:
 private:
     PushButton *m_export = nullptr;
 
-    //    QTextEdit *m_description = nullptr;
+    QTextEdit *m_description = nullptr;
 };
 
 #endif  // SCHEMEPLANWIDGET_H