Parcourir la source

导出效能分析结果柱状图

Ulricy il y a 1 an
Parent
commit
3e203c1658
2 fichiers modifiés avec 40 ajouts et 18 suppressions
  1. 39 0
      QFD/common/ExportReportManager.cpp
  2. 1 18
      QFD/common/ExportReportManager.h

+ 39 - 0
QFD/common/ExportReportManager.cpp

@@ -1263,6 +1263,9 @@ void ExportReportManager::insertEffiSchemeData()
     }
 
     for (SchemaEval *scheme : schemeList) {
+        if (m_schemeType == 2 && scheme->name != "建设前" && scheme->name != "建设后") {
+            continue;
+        }
         if (schemeData.keys().contains(scheme->id) == false) {
             schemeData[scheme->id] = QMap<QString, double>();
         }
@@ -1513,6 +1516,42 @@ void ExportReportManager::insertEffiResult()
         }
     }
 
+    // 指标权重图:bmEvalPic
+    for (int i = schemeNames.size() - 1; i >= 0; --i) {
+        QString schemeName   = schemeNames[schemeNames.keys()[i]];
+        QList<double> values = effData[schemeNames.keys()[i]]["综合"];
+
+        QVector<PlotView::Data> plotValues;
+        for (int j = 0; j < values.size(); ++j) {
+            PlotView::Data data { schemeName + "-" + gradeNames[j], values[j] };
+            plotValues.append(data);
+        }
+
+        PlotView *plot = new PlotView(PlotView::HistogramHorizontal, plotValues, "");
+        plot->setFixedSize(QSize(600, 600));
+        plot->plot();
+        QPixmap pixmap = plot->grab();
+        plot->deleteLater();
+        if (pixmap.isNull()) {
+            return;
+        }
+
+        QString imgName = QString("%1_%2_%3_eval").arg(m_proj->id).arg(8).arg(schemeName);
+        QString path    = saveImage(imgName, pixmap);
+
+        QAxObject *bmWeightPic = m_word->getDocument()->querySubObject("Bookmarks(QVariant)", "bmEvalPic");
+        if (bmWeightPic != nullptr) {
+            bmWeightPic->dynamicCall("Select(void)");
+            QAxObject *range        = bmWeightPic->querySubObject("Range");
+            QAxObject *inlineShapes = range->querySubObject("InlineShapes");
+            QAxObject *shape        = inlineShapes->querySubObject("AddPicture(const QString&)", path);
+            if (shape != nullptr) {
+                shape->setProperty("Width", 400);
+                shape->setProperty("Height", 400);
+            }
+        }
+    }
+
     QStringList retList;
     int bestGrade       = 0;
     int bestSchemeIndex = 0;

+ 1 - 18
QFD/common/ExportReportManager.h

@@ -87,24 +87,6 @@ private:
 
 #endif  // EXPORTREPORTMANAGER_H
 
-/*
-
-            bmSchemes->dynamicCall("Select(void)");
-            QAxObject *selection = m_word->getWordApp()->querySubObject("Selection");
-            if (!selection)
-                return;
-
-            selection->dynamicCall("InsertAfter(QString&)", "\n");
-            // selection->dynamicCall("MoveLeft(int)", 1);
-            selection->querySubObject("ParagraphFormat")->dynamicCall("Alignment", "wdAlignParagraphCenter");
-            // selection->dynamicCall("TypeText(QString&)", "Table Test");//设置标题
-
-            QAxObject *range1 = selection->querySubObject("Range");
-            QAxObject *tables = doc->querySubObject("Tables");
-            QAxObject *table  = tables->querySubObject("Add(QVariant,int,int)", range1->asVariant(), 2, 2);
-
-*/
-
 /**
  * 需求分析评估报告标签名称
  *
@@ -188,6 +170,7 @@ private:
  * 描述项目名称:bmProjName31
  * 表格项目名称:bmProjName32
  * 表格:bmConfigTable
+ * 图片:bmEvalPic
  *
  * 评估数据采集
  * 表格:bmEffiDataTable