|
@@ -245,11 +245,8 @@ void ExportReportManager::insertSchemeData()
|
|
|
QMap<int, QString> schemeNames;
|
|
|
QList<SchemaEval *> schemeList;
|
|
|
ret = SchemeInfoService().QuerySchemeInfoByEngineerId(&schemeList, m_proj->id, 0);
|
|
|
- if (ret == false) {
|
|
|
- return;
|
|
|
- }
|
|
|
-
|
|
|
- if (schemeList.size() <= 0) {
|
|
|
+ if (ret == false || schemeList.size() <= 0) {
|
|
|
+ delete mind;
|
|
|
return;
|
|
|
}
|
|
|
|
|
@@ -270,6 +267,7 @@ void ExportReportManager::insertSchemeData()
|
|
|
QList<CNodeData> leaveNodes = mind->leaves();
|
|
|
int rowCount = leaveNodes.size() + 1;
|
|
|
int columnCount = schemeNames.keys().size() + 1;
|
|
|
+ delete mind;
|
|
|
|
|
|
// bmSchemeDataTable
|
|
|
QAxObject *table = insertTable("bmSchemeDataTable", rowCount, columnCount);
|
|
@@ -296,7 +294,64 @@ void ExportReportManager::insertSchemeData()
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- delete mind;
|
|
|
+ // 指标权重表:bmEvalTable,指标权重图:bmEvalPic
|
|
|
+ QAxObject *scoreTable = insertTable("bmEvalTable", schemeList.size() + 1, 2);
|
|
|
+ if (scoreTable == nullptr) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ QVector<PlotView::Data> values;
|
|
|
+ setCellString(scoreTable, 1, 2, "得分");
|
|
|
+ for (int i = 0; i < schemeList.size(); ++i) {
|
|
|
+ setCellString(scoreTable, i + 2, 1, schemeList[i]->name);
|
|
|
+ QString str = QString::number(schemeList[i]->score, 'f', 2);
|
|
|
+ setCellString(scoreTable, i + 2, 2, str);
|
|
|
+
|
|
|
+ PlotView::Data data { schemeList[i]->name, schemeList[i]->score };
|
|
|
+ values.append(data);
|
|
|
+ }
|
|
|
+
|
|
|
+ PlotView *plot = new PlotView(PlotView::HistogramHorizontal, values, "");
|
|
|
+ plot->setFixedSize(QSize(600, 600));
|
|
|
+ plot->plot();
|
|
|
+ QPixmap pixmap = plot->grab();
|
|
|
+ plot->deleteLater();
|
|
|
+ if (pixmap.isNull()) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ QString imgName = QString("%1_%2_eval").arg(m_proj->id).arg(4);
|
|
|
+ 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);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ // bmSchemeConclusion
|
|
|
+ QString scores;
|
|
|
+ int bestIndex = 0;
|
|
|
+ for (int i = 0; i < schemeList.size(); ++i) {
|
|
|
+ QString str = QString::number(schemeList[i]->score, 'f', 2);
|
|
|
+ scores += QString("%1%2,").arg(schemeList[i]->name).arg(str);
|
|
|
+
|
|
|
+ if (schemeList[i]->score > schemeList[bestIndex]->score) {
|
|
|
+ bestIndex = i;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ QString conclusion = QString("经评估分析,%1个方案得分分别为:%2%3为最优方案。")
|
|
|
+ .arg(schemeList.size())
|
|
|
+ .arg(scores)
|
|
|
+ .arg(schemeList[bestIndex]->name);
|
|
|
+ insertText("bmSchemeConclusion", conclusion);
|
|
|
}
|
|
|
|
|
|
void ExportReportManager::insertSchemeAlgInfo()
|