|
@@ -12,7 +12,7 @@
|
|
|
int ProjectStateWidget::rowCount(EngineerInfo *proj)
|
|
|
{
|
|
|
int expertCount = proj->configs.count();
|
|
|
- int rowProj = std::max(proj->indexCount(), proj->indexCount() * expertCount);
|
|
|
+ int rowProj = std::max(proj->indexList().count(), proj->indexList().count() * expertCount);
|
|
|
return rowProj;
|
|
|
}
|
|
|
|
|
@@ -33,42 +33,44 @@ void ProjectStateWidget::showProjects(QList<EngineerInfo *> proList)
|
|
|
for (int i = 0; i < proList.count(); i++) {
|
|
|
QColor color = i % 2 ? QColor(244, 244, 255) : QColor(255, 255, 255);
|
|
|
|
|
|
- EngineerInfo *proj = proList[i];
|
|
|
- int rowProj = rowCount(proj);
|
|
|
-
|
|
|
+ // 工程名,第0列
|
|
|
+ EngineerInfo *proj = proList[i];
|
|
|
QTableWidgetItem *item = new QTableWidgetItem(proj->engineerName);
|
|
|
setItem(row, 0, item, color);
|
|
|
- m_projTableWidget->setSpan(row, 0, rowProj, 1);
|
|
|
-
|
|
|
- for (int j = 0; j < proj->indexCount(); j++) {
|
|
|
+ int rowProj = rowCount(proj);
|
|
|
+ if (rowProj > 1) {
|
|
|
+ m_projTableWidget->setSpan(row, 0, rowProj, 1);
|
|
|
+ }
|
|
|
|
|
|
- EngineerInfo::IndexType indexType = proj->indexType(j);
|
|
|
+ // 指标体系,第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);
|
|
|
setItem(row, 1, item, color);
|
|
|
- m_projTableWidget->setSpan(row, 1, proj->configs.count(), 1);
|
|
|
+ if (proj->configs.count() > 1) {
|
|
|
+ m_projTableWidget->setSpan(row, 1, proj->configs.count(), 1);
|
|
|
+ }
|
|
|
|
|
|
- for (int k = 0; k < proj->configs.count(); k++) {
|
|
|
- UserConfig *config = proj->configs[k];
|
|
|
- QTableWidgetItem *expItem = new QTableWidgetItem(config->userName);
|
|
|
+ // 专家数据,第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 ? "已录入" : "未录入");
|
|
|
+ QTableWidgetItem *loadItem = new QTableWidgetItem(loaded && config->id >= 0 ? "已录入" : "未录入");
|
|
|
setItem(row + k, 3, loadItem, color);
|
|
|
}
|
|
|
|
|
|
- if (proj->configs.count() <= 0) {
|
|
|
- QTableWidgetItem *item = new QTableWidgetItem("无");
|
|
|
- setItem(row, 2, item, color);
|
|
|
- item = new QTableWidgetItem("无");
|
|
|
- setItem(row, 3, item, color);
|
|
|
- }
|
|
|
-
|
|
|
- int rowIndex = std::max(1, proj->configs.count());
|
|
|
- row += rowIndex;
|
|
|
+ row += std::max(1, proj->configs.count());
|
|
|
}
|
|
|
}
|
|
|
}
|