|
@@ -1,5 +1,7 @@
|
|
|
#include "ProjectStateWidget.h"
|
|
|
|
|
|
+#include "common/ProjectManager.h"
|
|
|
+
|
|
|
#include <dbService/ClassSet.h>
|
|
|
|
|
|
#include <QTableWidget>
|
|
@@ -10,11 +12,11 @@
|
|
|
|
|
|
#include <QDebug>
|
|
|
|
|
|
-int ProjectStateWidget::rowCount(EngineerInfo *proj)
|
|
|
+int ProjectStateWidget::rowCount(ProjectInfo *proj)
|
|
|
{
|
|
|
- int expertCount = proj->configs.count();
|
|
|
- int rowProj = std::max(proj->indexList().count(), proj->indexList().count() * expertCount);
|
|
|
- return rowProj;
|
|
|
+ int evalCount = ProjectManager::evalTypeList(ProjectManager::evalFlags(*proj)).count();
|
|
|
+
|
|
|
+ return evalCount;
|
|
|
}
|
|
|
|
|
|
ProjectStateWidget::ProjectStateWidget(QWidget *parent) : QWidget(parent)
|
|
@@ -23,7 +25,7 @@ ProjectStateWidget::ProjectStateWidget(QWidget *parent) : QWidget(parent)
|
|
|
initLayout();
|
|
|
}
|
|
|
|
|
|
-void ProjectStateWidget::showProjects(QList<EngineerInfo *> proList)
|
|
|
+void ProjectStateWidget::showProjects(QList<ProjectInfo *> proList)
|
|
|
{
|
|
|
m_projTableWidget->clearContents();
|
|
|
m_projTableWidget->clearSpans();
|
|
@@ -35,8 +37,8 @@ void ProjectStateWidget::showProjects(QList<EngineerInfo *> proList)
|
|
|
QColor color = i % 2 ? QColor(238, 238, 255) : QColor(255, 255, 255);
|
|
|
|
|
|
// 工程名,第0列
|
|
|
- EngineerInfo *proj = proList[i];
|
|
|
- QTableWidgetItem *item = new QTableWidgetItem(proj->engineerName);
|
|
|
+ ProjectInfo *proj = proList[i];
|
|
|
+ QTableWidgetItem *item = new QTableWidgetItem(proj->projectName);
|
|
|
setItem(row, 0, item, color);
|
|
|
int rowProj = rowCount(proj);
|
|
|
if (rowProj > 1) {
|
|
@@ -44,35 +46,14 @@ void ProjectStateWidget::showProjects(QList<EngineerInfo *> proList)
|
|
|
}
|
|
|
|
|
|
// 指标体系,第1列
|
|
|
- for (int j = 0; j < proj->indexList().count(); j++) {
|
|
|
- EngineerInfo::IndexType indexType = proj->indexList()[j];
|
|
|
- QString indexName = EngineerInfo::nameOFIndexType(indexType);
|
|
|
- QTableWidgetItem *item = new QTableWidgetItem(indexName);
|
|
|
+ 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);
|
|
|
- if (proj->configs.count() > 1) {
|
|
|
- m_projTableWidget->setSpan(row, 1, proj->configs.count(), 1);
|
|
|
- }
|
|
|
-
|
|
|
- // 专家数据,第2、3列
|
|
|
- // 未配置专家时,添加一个空的专家配置来填充表格
|
|
|
- QList<UserConfig *> configs = proj->configs;
|
|
|
- if (configs.count() <= 0) {
|
|
|
- configs.append(new UserConfig());
|
|
|
- }
|
|
|
- for (int k = 0; k < configs.count(); k++) {
|
|
|
- UserConfig *config = configs[k];
|
|
|
- QTableWidgetItem *expItem = new QTableWidgetItem(config->id >= 0 ? config->userName : "无");
|
|
|
- setItem(row + k, 2, expItem, color);
|
|
|
-
|
|
|
- unsigned seed = QDateTime::currentDateTime().toTime_t() + pow(row + k, 4);
|
|
|
- srand(seed);
|
|
|
- bool loaded = (rand() % 4) == 0;
|
|
|
- QTableWidgetItem *loadItem = new QTableWidgetItem(loaded && config->id >= 0 ? "已录入" : "未录入");
|
|
|
- setItem(row + k, 3, loadItem, color);
|
|
|
- }
|
|
|
-
|
|
|
- row += configs.count();
|
|
|
}
|
|
|
+
|
|
|
+ row += rowCount(proj);
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -110,10 +91,10 @@ void ProjectStateWidget::initLayout()
|
|
|
layout()->addWidget(m_projTableWidget);
|
|
|
}
|
|
|
|
|
|
-void ProjectStateWidget::setRowCount(QList<EngineerInfo *> list)
|
|
|
+void ProjectStateWidget::setRowCount(QList<ProjectInfo *> list)
|
|
|
{
|
|
|
int count = 0;
|
|
|
- for (EngineerInfo *proj : list) {
|
|
|
+ for (ProjectInfo *proj : list) {
|
|
|
int rowProj = rowCount(proj);
|
|
|
count += rowProj;
|
|
|
}
|