Browse Source

1. 专家选择权重数据弹框显示分数;
2. 修正权重计算错误;
3. 修正方案图片显示不全;
4. 修改能力重要度报告表达错误;
5. 增加导入指标体系功能;

Ulricy 1 year ago
parent
commit
6f00b672e2

+ 2 - 1
ExpertClient/EXDataViewDelegate.cpp

@@ -23,7 +23,7 @@ SchemeBar::SchemeBar(const QString &lLabel, const QString &rLabel, const QString
 
 
     for (QString &v : barValueList) {
     for (QString &v : barValueList) {
         QPushButton *btn = new QPushButton(v);
         QPushButton *btn = new QPushButton(v);
-        btn->setMaximumWidth(30);
+        btn->setMaximumWidth(40);
         centerLay->addWidget(btn);
         centerLay->addWidget(btn);
         btnGroup->addButton(btn);
         btnGroup->addButton(btn);
         if (v.startsWith("1/")) {
         if (v.startsWith("1/")) {
@@ -31,6 +31,7 @@ SchemeBar::SchemeBar(const QString &lLabel, const QString &rLabel, const QString
         } else {
         } else {
             btn->setText(v);
             btn->setText(v);
         }
         }
+        btn->setText(v);
         btn->setProperty("number", v);
         btn->setProperty("number", v);
     }
     }
 
 

+ 2 - 0
QFD/QFD.pro

@@ -119,6 +119,7 @@ SOURCES += \
     widgets/GreyClusteringConfigWidget.cpp \
     widgets/GreyClusteringConfigWidget.cpp \
     widgets/GreyClusteringItemDelegate.cpp \
     widgets/GreyClusteringItemDelegate.cpp \
     widgets/GreyClusteringSampleTable.cpp \
     widgets/GreyClusteringSampleTable.cpp \
+    widgets/ImportIndexWidget.cpp \
     widgets/IndexSystemWidget.cpp \
     widgets/IndexSystemWidget.cpp \
     widgets/LoginWidget.cpp \
     widgets/LoginWidget.cpp \
     widgets/MatterElementConfigWidget.cpp \
     widgets/MatterElementConfigWidget.cpp \
@@ -190,6 +191,7 @@ HEADERS += \
     widgets/GreyClusteringConfigWidget.h \
     widgets/GreyClusteringConfigWidget.h \
     widgets/GreyClusteringItemDelegate.h \
     widgets/GreyClusteringItemDelegate.h \
     widgets/GreyClusteringSampleTable.h \
     widgets/GreyClusteringSampleTable.h \
+    widgets/ImportIndexWidget.h \
     widgets/IndexSystemWidget.h \
     widgets/IndexSystemWidget.h \
     widgets/LoginWidget.h \
     widgets/LoginWidget.h \
     widgets/MatterElementConfigWidget.h \
     widgets/MatterElementConfigWidget.h \

+ 4 - 2
QFD/common/DataEvaluator.cpp

@@ -107,9 +107,11 @@ bool DataEvaluator::evaluateWeightFromExpert()
                             double v;
                             double v;
                             QStringList nodeValue = nodeData[expertId][key]->nodeValue.split("/");
                             QStringList nodeValue = nodeData[expertId][key]->nodeValue.split("/");
                             if (nodeValue.size() == 1) {
                             if (nodeValue.size() == 1) {
-                                v = nodeValue[0].toDouble();
+                                //                                v = nodeValue[0].toDouble();
+                                v = 1.0 / nodeValue[0].toDouble();
                             } else {
                             } else {
-                                v = nodeValue[0].toDouble() / nodeValue[1].toDouble();
+                                //                                v = nodeValue[0].toDouble() / nodeValue[1].toDouble();
+                                v = nodeValue[1].toDouble();
                             }
                             }
                             nxnValus.append(v);
                             nxnValus.append(v);
                         }
                         }

+ 1 - 1
QFD/view/AboutView.cpp

@@ -24,7 +24,7 @@ void AboutView::showEvent(QShowEvent *event)
 
 
 void AboutView::hideEvent(QHideEvent *event)
 void AboutView::hideEvent(QHideEvent *event)
 {
 {
-    qDebug() << __FUNCTION__;
+    qDebug() << __FUNCTION__ << __LINE__ << endl;
     QWidget::hideEvent(event);
     QWidget::hideEvent(event);
 }
 }
 
 

+ 24 - 6
QFD/widgets/ConfigSchemeDataWidget.cpp

@@ -33,9 +33,7 @@ void ConfigSchemeDataWidget::setProcess(SchemePlanManager::SchemeProcessInfo pro
 
 
 void ConfigSchemeDataWidget::loadData()
 void ConfigSchemeDataWidget::loadData()
 {
 {
-    m_schemeList.clear();
-    m_remark->clear();
-    m_pic->clear();
+    clearInfo();
     if (m_process.type == SchemePlanManager::ImportEvalData) {
     if (m_process.type == SchemePlanManager::ImportEvalData) {
         if (m_process.indexType == ProjectManager::EfficiencyIndex) {
         if (m_process.indexType == ProjectManager::EfficiencyIndex) {
             SchemeInfoService().QuerySchemeInfoByEngineerId(&m_schemeList, m_process.projectId, 1);
             SchemeInfoService().QuerySchemeInfoByEngineerId(&m_schemeList, m_process.projectId, 1);
@@ -88,7 +86,8 @@ void ConfigSchemeDataWidget::initWidget()
     m_remark->setMinimumHeight(150);
     m_remark->setMinimumHeight(150);
     m_remark->setReadOnly(true);
     m_remark->setReadOnly(true);
     m_pic = new QLabel(this);
     m_pic = new QLabel(this);
-    m_pic->setFixedHeight(260);
+    m_pic->setFixedHeight(300);
+    m_pic->setAlignment(Qt::AlignCenter);
 
 
     setStyleSheet("#titleLabel {color:#333333; font-size:16px}"
     setStyleSheet("#titleLabel {color:#333333; font-size:16px}"
                   "#listTitleLabel {color:#333333; font-size:12px}"
                   "#listTitleLabel {color:#333333; font-size:12px}"
@@ -156,9 +155,26 @@ void ConfigSchemeDataWidget::refreshList()
     }
     }
 }
 }
 
 
+void ConfigSchemeDataWidget::clearInfo()
+{
+    m_schemeList.clear();
+    m_remark->clear();
+    m_pic->clear();
+}
+
+void ConfigSchemeDataWidget::resizeEvent(QResizeEvent *event)
+{
+    Q_UNUSED(event)
+    slotSelectedChanged();
+}
+
+void ConfigSchemeDataWidget::showEvent(QShowEvent *event)
+{
+    QWidget::showEvent(event);
+}
+
 void ConfigSchemeDataWidget::slotAddDataClicked()
 void ConfigSchemeDataWidget::slotAddDataClicked()
 {
 {
-    qDebug() << __FUNCTION__ << __LINE__ << endl;
     emit sigAddScheme();
     emit sigAddScheme();
 }
 }
 
 
@@ -178,7 +194,7 @@ void ConfigSchemeDataWidget::slotSelectedChanged()
     QPixmap pixmap;
     QPixmap pixmap;
     pixmap.loadFromData(data);
     pixmap.loadFromData(data);
 
 
-    pixmap = pixmap.scaled(m_pic->width(), m_pic->height(), Qt::KeepAspectRatioByExpanding, Qt::SmoothTransformation);
+    pixmap = pixmap.scaled(m_pic->width(), m_pic->height(), Qt::KeepAspectRatio, Qt::SmoothTransformation);
     m_pic->setPixmap(pixmap);
     m_pic->setPixmap(pixmap);
 }
 }
 
 
@@ -192,6 +208,8 @@ void ConfigSchemeDataWidget::slotRemoveDataClicked(int index)
 
 
         if (m_schemeList.size() > 0) {
         if (m_schemeList.size() > 0) {
             selectFirst();
             selectFirst();
+        } else {
+            clearInfo();
         }
         }
     }
     }
 }
 }

+ 4 - 0
QFD/widgets/ConfigSchemeDataWidget.h

@@ -39,6 +39,10 @@ private:
     void connectSignalsAndSlots();
     void connectSignalsAndSlots();
 
 
     void refreshList();
     void refreshList();
+    void clearInfo();
+
+    virtual void resizeEvent(QResizeEvent *event) override;
+    virtual void showEvent(QShowEvent *event) override;
 
 
 private slots:
 private slots:
     void slotAddDataClicked();
     void slotAddDataClicked();

+ 1 - 1
QFD/widgets/DataCollectionWidget.cpp

@@ -46,7 +46,7 @@ DataCollectionWidget::DataCollectionWidget(ProjectInfo *proj, QWidget *parent) :
     m_configScheme  = new ConfigSchemeDataWidget(this);
     m_configScheme  = new ConfigSchemeDataWidget(this);
 
 
     m_configMeasure->setFixedWidth(256);
     m_configMeasure->setFixedWidth(256);
-    m_configScheme->setFixedWidth(350);
+    m_configScheme->setFixedWidth(300);
     m_contentLayout->addWidget(m_configExpert);
     m_contentLayout->addWidget(m_configExpert);
     m_contentLayout->addWidget(m_configMeasure);
     m_contentLayout->addWidget(m_configMeasure);
     m_contentLayout->addWidget(m_configScheme);
     m_contentLayout->addWidget(m_configScheme);

+ 4 - 4
QFD/widgets/EvalReportWidget.cpp

@@ -22,7 +22,7 @@
 #include <QGridLayout>
 #include <QGridLayout>
 #include <QComboBox>
 #include <QComboBox>
 
 
-static QSize kFigureSize = QSize(750, 750);
+static QSize kFigureSize = QSize(600, 600);
 
 
 EvalReportWidget::EvalReportWidget(ProjectInfo *proj, int indexType, QWidget *parent)
 EvalReportWidget::EvalReportWidget(ProjectInfo *proj, int indexType, QWidget *parent)
     : QWidget(parent), m_proj(proj), m_indexType(indexType)
     : QWidget(parent), m_proj(proj), m_indexType(indexType)
@@ -134,7 +134,7 @@ void EvalReportWidget::initLayouts()
         m_gridLayout->addWidget(m_indexPlot, 1, 1);
         m_gridLayout->addWidget(m_indexPlot, 1, 1);
     } else {
     } else {
         m_techTitle = new QLabel(this);
         m_techTitle = new QLabel(this);
-        m_techTitle->setText("指标得分");
+        m_techTitle->setText("技术措施重要度");
         m_techTitle->setFont(ft);
         m_techTitle->setFont(ft);
         m_techTitle->setContentsMargins(0, 10, 0, 10);
         m_techTitle->setContentsMargins(0, 10, 0, 10);
         m_gridLayout->addWidget(m_techTitle, 0, 0);
         m_gridLayout->addWidget(m_techTitle, 0, 0);
@@ -182,7 +182,7 @@ void EvalReportWidget::loadAlgs()
             m_indexTitle->setText(m_indexTitle->text() + " (" + algName + ") ");
             m_indexTitle->setText(m_indexTitle->text() + " (" + algName + ") ");
         } else if (process.type == SchemePlanManager::RunEvaluate) {
         } else if (process.type == SchemePlanManager::RunEvaluate) {
             m_evalAlg = process.algorithm;
             m_evalAlg = process.algorithm;
-            m_techTitle->setText(m_techTitle->text() + " (" + algName + ") ");
+            //            m_techTitle->setText(m_techTitle->text() + " (" + algName + ") ");
             m_schemeTitle->setText(m_schemeTitle->text() + " (" + algName + ") ");
             m_schemeTitle->setText(m_schemeTitle->text() + " (" + algName + ") ");
         }
         }
     }
     }
@@ -385,7 +385,7 @@ void EvalReportWidget::showTechScore()
         }
         }
     }
     }
 
 
-    QStandardItem *hHeader = new QStandardItem("得分");
+    QStandardItem *hHeader = new QStandardItem("重要度");
     model->setHorizontalHeaderItem(0, hHeader);
     model->setHorizontalHeaderItem(0, hHeader);
 
 
     QList<CNodeData> nodeList = m_mind->leaves();
     QList<CNodeData> nodeList = m_mind->leaves();

+ 129 - 0
QFD/widgets/ImportIndexWidget.cpp

@@ -0,0 +1,129 @@
+#include "ImportIndexWidget.h"
+
+#include <common/ProjectManager.h>
+#include <dbService/ClassSet.h>
+#include <dbService/CNodeDataService.h>
+
+#include <Widgets/Button.h>
+#include <QLabel>
+#include <QListWidget>
+#include <QBoxLayout>
+
+#include <QDebug>
+
+ImportIndexWidget::ImportIndexWidget(QWidget *parent) : QDialog(parent)
+{
+    initWindow();
+    initWidgets();
+    initLayout();
+    connectSignalsAndSlots();
+    loadIndex();
+}
+
+void ImportIndexWidget::initWindow()
+{
+    setWindowTitle("导入指标体系");
+    //    setWindowFlags(Qt::Window);
+    //    setWindowFlag(Qt::WindowMinMaxButtonsHint, false);
+
+    setModal(true);
+    setWindowFlags(Qt::Dialog);
+    setWindowFlag(Qt::WindowContextHelpButtonHint, false);
+    setFixedSize(400, 600);
+}
+
+void ImportIndexWidget::initWidgets()
+{
+    m_title = new QLabel("选择已有项目的指标体系");
+    m_tips  = new QLabel("未找到指标体系!\n请重新创建");
+    m_tips->setHidden(true);
+    m_listWidget = new QListWidget();
+    m_listWidget->setMinimumHeight(450);
+    m_listWidget->setHidden(true);
+    m_confirm = new PushButton("导入");
+    m_cancel  = new PushButton("取消");
+}
+
+void ImportIndexWidget::initLayout()
+{
+    m_layout = new QVBoxLayout(this);
+    m_layout->setMargin(20);
+    m_layout->setAlignment(Qt::AlignTop);
+    m_layout->addWidget(m_title);
+    m_layout->addSpacing(10);
+    m_layout->addWidget(m_tips);
+    m_layout->addWidget(m_listWidget);
+    m_layout->addSpacing(10);
+    m_layout->addStretch();
+
+    m_buttonLayout = new QHBoxLayout();
+    m_layout->addLayout(m_buttonLayout);
+
+    m_buttonLayout->addStretch();
+    m_buttonLayout->addWidget(m_confirm);
+    m_buttonLayout->addSpacing(10);
+    m_buttonLayout->addWidget(m_cancel);
+}
+
+void ImportIndexWidget::connectSignalsAndSlots()
+{
+    connect(m_confirm, &PushButton::clicked, this, &ImportIndexWidget::slotConfirm);
+    connect(m_cancel, &PushButton::clicked, this, &ImportIndexWidget::slotCancel);
+    connect(m_listWidget, &QListWidget::itemSelectionChanged, this, &ImportIndexWidget::slotCurrentChanged);
+}
+
+void ImportIndexWidget::showEvent(QShowEvent *)
+{
+    loadIndex();
+}
+
+void ImportIndexWidget::loadIndex()
+{
+    QList<ProjectInfo *> list;
+    bool ret     = ProjectManager::queryProjects(&list);
+    bool hasProj = ret && list.size() > 0;
+    m_tips->setHidden(hasProj);
+    m_listWidget->setHidden(!hasProj);
+
+    m_indexSysList.clear();
+    for (ProjectInfo *proj : list) {
+        QList<ProjectManager::IndexType> indexList = ProjectManager::indexList(*proj);
+        for (ProjectManager::IndexType i : indexList) {
+            QList<CNodeData> nodeList;
+            bool indexRet = CNodeDataService().QueryAll(nodeList, proj->id, i);
+            if (indexRet && nodeList.size() > 0) {
+                IndexSystemInfo info = IndexSystemInfo { proj->id, i, proj->projectName };
+                m_indexSysList.append(info);
+            }
+        }
+    }
+
+    showIndex();
+}
+
+void ImportIndexWidget::showIndex()
+{
+    m_listWidget->clear();
+    m_confirm->setEnabled(false);
+    for (IndexSystemInfo info : m_indexSysList) {
+        QListWidgetItem *item = new QListWidgetItem();
+        item->setText(info.projName);
+        m_listWidget->addItem(item);
+    }
+}
+
+void ImportIndexWidget::slotConfirm()
+{
+    IndexSystemInfo info = m_indexSysList[m_listWidget->currentRow()];
+    emit sigImport(info.projId, info.indexType);
+}
+
+void ImportIndexWidget::slotCancel()
+{
+    close();
+}
+
+void ImportIndexWidget::slotCurrentChanged()
+{
+    m_confirm->setEnabled(m_indexSysList.size() > 0 && m_listWidget->selectedItems().size() >= 0);
+}

+ 59 - 0
QFD/widgets/ImportIndexWidget.h

@@ -0,0 +1,59 @@
+#ifndef IMPORTINDEXWIDGET_H
+#define IMPORTINDEXWIDGET_H
+
+#include <QDialog>
+
+class QLabel;
+class QListWidget;
+class PushButton;
+
+class QVBoxLayout;
+class QHBoxLayout;
+
+struct IndexSystemInfo
+{
+    int projId       = -1;
+    int indexType    = -1;
+    QString projName = "";
+};
+
+class ImportIndexWidget : public QDialog
+{
+    Q_OBJECT
+
+public:
+    ImportIndexWidget(QWidget *parent = nullptr);
+
+signals:
+    void sigImport(int projId, int indexType);
+
+private:
+    void initWindow();
+    void initWidgets();
+    void initLayout();
+    void connectSignalsAndSlots();
+
+    void showEvent(QShowEvent *) override;
+
+    void loadIndex();
+    void showIndex();
+
+private slots:
+    void slotConfirm();
+    void slotCancel();
+    void slotCurrentChanged();
+
+private:
+    QLabel *m_title           = nullptr;
+    QLabel *m_tips            = nullptr;
+    QListWidget *m_listWidget = nullptr;
+    PushButton *m_confirm     = nullptr;
+    PushButton *m_cancel      = nullptr;
+
+    QVBoxLayout *m_layout       = nullptr;
+    QHBoxLayout *m_buttonLayout = nullptr;
+
+    QList<IndexSystemInfo> m_indexSysList;
+};
+
+#endif  // IMPORTINDEXWIDGET_H

+ 42 - 2
QFD/widgets/IndexSystemWidget.cpp

@@ -1,6 +1,7 @@
 #include "IndexSystemWidget.h"
 #include "IndexSystemWidget.h"
 
 
 #include "EditNodeWidget.h"
 #include "EditNodeWidget.h"
+#include "ImportIndexWidget.h"
 
 
 #include <dbService/ClassSet.h>
 #include <dbService/ClassSet.h>
 #include <dbService/CNodeDataService.h>
 #include <dbService/CNodeDataService.h>
@@ -41,10 +42,14 @@ void IndexSystemWidget::contextMenuEvent(QContextMenuEvent *event)
     CMindView *m = (CMindView *)m_tab->currentWidget();
     CMindView *m = (CMindView *)m_tab->currentWidget();
 
 
     if (m->root() == nullptr) {
     if (m->root() == nullptr) {
-        QAction *act3 = new QAction("创建根节点");
+        QAction *act3 = new QAction("创建指标体系");
         menu->addAction(act3);
         menu->addAction(act3);
         connect(act3, &QAction::triggered, this, &IndexSystemWidget::slotCreateRootNode);
         connect(act3, &QAction::triggered, this, &IndexSystemWidget::slotCreateRootNode);
 
 
+        QAction *act4 = new QAction("导入指标体系");
+        menu->addAction(act4);
+        connect(act4, &QAction::triggered, this, &IndexSystemWidget::slotImportIndex);
+
         menu->exec(event->globalPos() + QPoint(-40, -20));
         menu->exec(event->globalPos() + QPoint(-40, -20));
     } else {
     } else {
         //        QAction *act2 = new QAction("清空");
         //        QAction *act2 = new QAction("清空");
@@ -68,6 +73,7 @@ void IndexSystemWidget::setupTabWidget()
         bool ret = CNodeDataService().QueryAll(list, proj()->id, t);
         bool ret = CNodeDataService().QueryAll(list, proj()->id, t);
         if (ret) {
         if (ret) {
             m->setNodeList(list);
             m->setNodeList(list);
+            m->refreshItems();
         }
         }
 
 
         connect(m, &CMindView::sigEditNode, this, &IndexSystemWidget::slotEditNode);
         connect(m, &CMindView::sigEditNode, this, &IndexSystemWidget::slotEditNode);
@@ -79,7 +85,8 @@ void IndexSystemWidget::setupTabWidget()
 
 
 void IndexSystemWidget::initWidgets()
 void IndexSystemWidget::initWidgets()
 {
 {
-    m_editNode = new EditNodeWidget(this);
+    m_editNode    = new EditNodeWidget(this);
+    m_importIndex = new ImportIndexWidget(this);
 }
 }
 
 
 void IndexSystemWidget::initLayout() { }
 void IndexSystemWidget::initLayout() { }
@@ -88,6 +95,7 @@ void IndexSystemWidget::connectSignalsAndSlots()
 {
 {
     connect(m_tab, &QTabWidget::currentChanged, this, &IndexSystemWidget::slotTabCurrentChanged);
     connect(m_tab, &QTabWidget::currentChanged, this, &IndexSystemWidget::slotTabCurrentChanged);
     connect(m_editNode, &EditNodeWidget::sigSaveNode, this, &IndexSystemWidget::slotNodeEdited);
     connect(m_editNode, &EditNodeWidget::sigSaveNode, this, &IndexSystemWidget::slotNodeEdited);
+    connect(m_importIndex, &ImportIndexWidget::sigImport, this, &IndexSystemWidget::slotImportIndexConfirmed);
 }
 }
 
 
 void IndexSystemWidget::addNode(CNodeData node)
 void IndexSystemWidget::addNode(CNodeData node)
@@ -154,6 +162,11 @@ void IndexSystemWidget::slotCreateRootNode()
     addNode(n);
     addNode(n);
 }
 }
 
 
+void IndexSystemWidget::slotImportIndex()
+{
+    m_importIndex->show();
+}
+
 void IndexSystemWidget::slotEditNode(CNodeData n)
 void IndexSystemWidget::slotEditNode(CNodeData n)
 {
 {
     m_editNode->setNode(n);
     m_editNode->setNode(n);
@@ -191,3 +204,30 @@ void IndexSystemWidget::slotNodeEdited(CNodeData node)
         m->updateNode(node);
         m->updateNode(node);
     }
     }
 }
 }
+
+void IndexSystemWidget::slotImportIndexConfirmed(int projId, int indexType)
+{
+    m_importIndex->close();
+
+    QList<CNodeData> list;
+    bool ret = CNodeDataService().QueryAll(list, projId, indexType);
+    if (ret == false) {
+        return;
+    }
+
+    CMindView *m = (CMindView *)m_tab->currentWidget();
+    int t        = indexList()[m_tab->currentIndex()];
+    for (int i = 0; i < list.size(); i++) {
+        list[i].projectId   = m_proj->id;
+        list[i].indexType   = t;
+        list[i].isEffective = 0;
+
+        int id = CNodeDataService().AddCNodeData(list[i]);
+        if (id >= 0) {
+            list[i].id = id;
+            m->addNode(list[i]);
+        }
+    }
+
+    m->refreshItems();
+}

+ 8 - 1
QFD/widgets/IndexSystemWidget.h

@@ -9,6 +9,8 @@ class CMindView;
 
 
 class EditNodeWidget;
 class EditNodeWidget;
 
 
+class ImportIndexWidget;
+
 /**
 /**
  * @brief The IndexSystemWidget class
  * @brief The IndexSystemWidget class
  * 指标体系
  * 指标体系
@@ -45,6 +47,8 @@ public slots:
 
 
     void slotCreateRootNode();
     void slotCreateRootNode();
 
 
+    void slotImportIndex();
+
     void slotEditNode(CNodeData n);
     void slotEditNode(CNodeData n);
 
 
     void slotAddSubNode(int pNumber);
     void slotAddSubNode(int pNumber);
@@ -55,8 +59,11 @@ public slots:
 
 
     void slotNodeEdited(CNodeData node);
     void slotNodeEdited(CNodeData node);
 
 
+    void slotImportIndexConfirmed(int projId, int indexType);
+
 private:
 private:
-    EditNodeWidget *m_editNode = nullptr;
+    EditNodeWidget *m_editNode       = nullptr;
+    ImportIndexWidget *m_importIndex = nullptr;
 };
 };
 
 
 #endif  // INDEXSYSTEMWIDGET_H
 #endif  // INDEXSYSTEMWIDGET_H