Browse Source

查询项目

chengxr 1 year ago
parent
commit
0f6b29eed7

+ 13 - 3
QFD/common/ProjectManager.cpp

@@ -5,6 +5,7 @@
 #include <dbService/ProjectService.h>
 
 #include <QMetaEnum>
+#include <QDebug>
 
 QString ProjectManager::nameOFIndexType(ProjectManager::IndexType t)
 {
@@ -51,9 +52,11 @@ QList<ProjectManager::IndexType> ProjectManager::indexListOfEvalFlags(EvalTypes
     return list;
 }
 
-ProjectManager::EvalTypes ProjectManager::evalFlags(ProjectInfo proj)
+ProjectManager::EvalTypes ProjectManager::evalTypes(ProjectInfo proj)
 {
-    EvalTypes flags = EvalTypes(proj.estimateType.toInt());
+    int t           = proj.estimateType.toInt();
+    t               = 96;
+    EvalTypes flags = EvalTypes(t);
     return flags;
 }
 
@@ -73,9 +76,16 @@ QList<ProjectManager::EvalType> ProjectManager::evalTypeList(EvalTypes types)
     return list;
 }
 
+QList<ProjectManager::EvalType> ProjectManager::evalTypeList(ProjectInfo proj)
+{
+    EvalTypes types                      = evalTypes(proj);
+    QList<ProjectManager::EvalType> list = evalTypeList(types);
+    return list;
+}
+
 QList<ProjectManager::IndexType> ProjectManager::indexList(ProjectInfo proj)
 {
-    return indexListOfEvalFlags(evalFlags(proj));
+    return indexListOfEvalFlags(evalTypes(proj));
 }
 
 int ProjectManager::queryProjects(QList<ProjectInfo *> *projList)

+ 2 - 1
QFD/common/ProjectManager.h

@@ -38,8 +38,9 @@ public:
     static QString nameOfEvalType(EvalType t);
     static QList<IndexType> indexListOfEvalFlags(EvalTypes flags);
 
-    static EvalTypes evalFlags(ProjectInfo proj);
+    static EvalTypes evalTypes(ProjectInfo proj);
     static QList<EvalType> evalTypeList(EvalTypes types);
+    static QList<EvalType> evalTypeList(ProjectInfo proj);
     static QList<IndexType> indexList(ProjectInfo proj);
 
     static int queryProjects(QList<ProjectInfo *> *projList);

+ 1 - 0
QFD/view/HomeView.cpp

@@ -79,6 +79,7 @@ void HomeView::refreshTable()
     qDeleteAll(m_projList);
     m_projList.clear();
     int code = ProjectManager::queryProjects(&m_projList);
+
     if (code != QF_CODE_SUCCEEDED) {
         QFDAlert::showAlertWithCode(code, this);
         return;

+ 13 - 19
QFD/widgets/ProjectStateWidget.cpp

@@ -12,13 +12,6 @@
 
 #include <QDebug>
 
-int ProjectStateWidget::rowCount(ProjectInfo *proj)
-{
-    int evalCount = ProjectManager::evalTypeList(ProjectManager::evalFlags(*proj)).count();
-
-    return evalCount;
-}
-
 ProjectStateWidget::ProjectStateWidget(QWidget *parent) : QWidget(parent)
 {
     initialize();
@@ -40,20 +33,22 @@ void ProjectStateWidget::showProjects(QList<ProjectInfo *> proList)
         ProjectInfo *proj      = proList[i];
         QTableWidgetItem *item = new QTableWidgetItem(proj->projectName);
         setItem(row, 0, item, color);
-        int rowProj = rowCount(proj);
-        if (rowProj > 1) {
-            m_projTableWidget->setSpan(row, 0, rowProj, 1);
+
+        QList<ProjectManager::EvalType> typeList = ProjectManager::evalTypeList(*proj);
+
+        if (typeList.count() > 1) {
+            m_projTableWidget->setSpan(row, 0, typeList.count(), 1);
         }
 
         // 指标体系,第1列
-        for (int j = 0; j < rowCount(proj); j++) {
-            ProjectManager::EvalType indexType = ProjectManager::evalTypeList(ProjectManager::evalFlags(*proj))[j];
-            QString indexName                  = ProjectManager::nameOfEvalType(indexType);
-            QTableWidgetItem *item             = new QTableWidgetItem(indexName);
-            setItem(row, 1, item, color);
+        for (int j = 0; j < typeList.count(); j++) {
+            ProjectManager::EvalType indexType = typeList[j];
+            QString typeName                   = ProjectManager::nameOfEvalType(indexType);
+            QTableWidgetItem *item             = new QTableWidgetItem(typeName);
+            setItem(row + j, 1, item, color);
         }
 
-        row += rowCount(proj);
+        row += typeList.count();
     }
 }
 
@@ -67,7 +62,7 @@ void ProjectStateWidget::initialize()
     m_projTableWidget->setSelectionMode(QAbstractItemView::NoSelection);
     m_projTableWidget->horizontalHeader()->setSectionResizeMode(QHeaderView::Stretch);
     m_projTableWidget->verticalHeader()->setVisible(false);
-    const QStringList headers = { "工程名", "工程类型", "专家信息", "评估状态" };
+    const QStringList headers = { "项目名", "项目类型" };
     m_projTableWidget->setColumnCount(headers.count());
     m_projTableWidget->setHorizontalHeaderLabels(headers);
     //    m_projTableWidget->setAlternatingRowColors(true);
@@ -95,8 +90,7 @@ void ProjectStateWidget::setRowCount(QList<ProjectInfo *> list)
 {
     int count = 0;
     for (ProjectInfo *proj : list) {
-        int rowProj = rowCount(proj);
-        count += rowProj;
+        count += ProjectManager::evalTypeList(*proj).count();
     }
 
     m_projTableWidget->setRowCount(count);

+ 0 - 2
QFD/widgets/ProjectStateWidget.h

@@ -16,8 +16,6 @@ class ProjectStateWidget : public QWidget
 {
     Q_OBJECT
 public:
-    static int rowCount(ProjectInfo *proj);
-
     explicit ProjectStateWidget(QWidget *parent = nullptr);
 
     void showProjects(QList<ProjectInfo *> list);