|
@@ -139,7 +139,8 @@ void ConfigExpertDataWidget::connectSignalsAndSlots()
|
|
|
{
|
|
|
connect(m_saveButton, &QPushButton::clicked, this, &ConfigExpertDataWidget::slotSave);
|
|
|
connect(m_refreshButton, &QPushButton::clicked, this, &ConfigExpertDataWidget::slotRefresh);
|
|
|
- connect(m_configListWidget, &QListWidget::itemClicked, this, &ConfigExpertDataWidget::slotUserConfigClicked);
|
|
|
+ connect(m_configListWidget, &QListWidget::itemSelectionChanged, this,
|
|
|
+ &ConfigExpertDataWidget::slotUserConfigCurrentChanged);
|
|
|
}
|
|
|
|
|
|
void ConfigExpertDataWidget::setProcess(SchemePlanManager::SchemeProcessInfo process)
|
|
@@ -149,6 +150,13 @@ void ConfigExpertDataWidget::setProcess(SchemePlanManager::SchemeProcessInfo pro
|
|
|
}
|
|
|
|
|
|
void ConfigExpertDataWidget::loadData()
|
|
|
+{
|
|
|
+ loadExpert();
|
|
|
+ loadConfig();
|
|
|
+ loadNodeData();
|
|
|
+}
|
|
|
+
|
|
|
+void ConfigExpertDataWidget::loadExpert()
|
|
|
{
|
|
|
// 获取专家列表数据
|
|
|
qDeleteAll(m_expertList);
|
|
@@ -157,6 +165,11 @@ void ConfigExpertDataWidget::loadData()
|
|
|
QFDAlert::showAlertWithCode(QF_CODE_DATA_ERROR, this);
|
|
|
}
|
|
|
|
|
|
+ refreshExpList();
|
|
|
+}
|
|
|
+
|
|
|
+void ConfigExpertDataWidget::loadConfig()
|
|
|
+{
|
|
|
// 获取项目专家配置
|
|
|
qDeleteAll(m_configList);
|
|
|
m_configList.clear();
|
|
@@ -164,6 +177,12 @@ void ConfigExpertDataWidget::loadData()
|
|
|
QFDAlert::showAlertWithCode(QF_CODE_DATA_ERROR, this);
|
|
|
}
|
|
|
|
|
|
+ refreshExpList();
|
|
|
+ refreshConfigList();
|
|
|
+}
|
|
|
+
|
|
|
+void ConfigExpertDataWidget::loadNodeData()
|
|
|
+{
|
|
|
// 获取专家录入数据
|
|
|
QString indexName = ProjectManager::nameOfIndexType((ProjectManager::IndexType)m_process.indexType);
|
|
|
QList<NodeMatrixInfo *> dataList;
|
|
@@ -175,11 +194,43 @@ void ConfigExpertDataWidget::loadData()
|
|
|
}
|
|
|
m_nodeData[info->expertId].append(info);
|
|
|
}
|
|
|
+ refreshConfigList();
|
|
|
+}
|
|
|
|
|
|
- qDebug() << __FUNCTION__ << __LINE__ << m_nodeData.size() << endl;
|
|
|
+void ConfigExpertDataWidget::selectFirstImported()
|
|
|
+{
|
|
|
+ int index = 0;
|
|
|
+ for (int i = 0; i < m_configList.count(); i++) {
|
|
|
+ UserConfig *config = m_configList[i];
|
|
|
+ bool imported = m_nodeData.keys().contains(QString("%1").arg(config->userId));
|
|
|
+ if (imported) {
|
|
|
+ index = i;
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ m_configListWidget->setCurrentRow(index);
|
|
|
+}
|
|
|
|
|
|
- refreshExpList();
|
|
|
- refreshConfigList();
|
|
|
+void ConfigExpertDataWidget::selectConfig(UserConfig *config)
|
|
|
+{
|
|
|
+ int index = m_configList.indexOf(config);
|
|
|
+ if (index >= 0 && index < m_configList.count()) {
|
|
|
+ m_configListWidget->setCurrentRow(index);
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+QList<NodeMatrixInfo *> ConfigExpertDataWidget::selectedData()
|
|
|
+{
|
|
|
+ QList<NodeMatrixInfo *> list;
|
|
|
+ if (m_nodeData.size() <= 0) {
|
|
|
+ return list;
|
|
|
+ }
|
|
|
+
|
|
|
+ int row = m_configListWidget->currentRow();
|
|
|
+ QString key = QString("%1").arg(m_configList[row]->userId);
|
|
|
+ list = m_nodeData[key];
|
|
|
+
|
|
|
+ return list;
|
|
|
}
|
|
|
|
|
|
void ConfigExpertDataWidget::showEvent(QShowEvent *event)
|
|
@@ -187,6 +238,7 @@ void ConfigExpertDataWidget::showEvent(QShowEvent *event)
|
|
|
Q_UNUSED(event)
|
|
|
if (m_isProcessChanged) {
|
|
|
loadData();
|
|
|
+ selectFirstImported();
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -208,6 +260,7 @@ void ConfigExpertDataWidget::refreshConfigList()
|
|
|
connect(widget, &ConfigListItemWidget::sigImport, this, &ConfigExpertDataWidget::slotImportData);
|
|
|
connect(widget, &ConfigListItemWidget::sigRemove, this, &ConfigExpertDataWidget::slotRemoveConfig);
|
|
|
widget->setUserConfig(config);
|
|
|
+ widget->setImported(m_nodeData.keys().contains(QString("%1").arg(config->userId)));
|
|
|
m_configListWidget->setItemWidget(item, widget);
|
|
|
}
|
|
|
}
|
|
@@ -291,15 +344,13 @@ void ConfigExpertDataWidget::slotRemoveConfig(UserConfig *config)
|
|
|
void ConfigExpertDataWidget::slotImportData(UserConfig *config)
|
|
|
{
|
|
|
int index = m_configList.indexOf(config);
|
|
|
- m_configListWidget->setItemSelected(m_configListWidget->item(index), true);
|
|
|
+ m_configListWidget->setCurrentRow(index);
|
|
|
emit sigImportData(config);
|
|
|
}
|
|
|
|
|
|
-void ConfigExpertDataWidget::slotUserConfigClicked()
|
|
|
+void ConfigExpertDataWidget::slotUserConfigCurrentChanged()
|
|
|
{
|
|
|
- int s = m_configListWidget->currentRow();
|
|
|
- UserConfig *config = m_configList[s];
|
|
|
- emit sigConfigSelected(config);
|
|
|
+ emit sigConfigCurrentChanged();
|
|
|
}
|
|
|
|
|
|
ConfigListItemWidget::ConfigListItemWidget(QWidget *parent) : QWidget(parent)
|
|
@@ -321,6 +372,13 @@ void ConfigListItemWidget::setUserConfig(UserConfig *config)
|
|
|
m_weight->setValue(m_config->weight);
|
|
|
}
|
|
|
|
|
|
+void ConfigListItemWidget::setImported(bool imported)
|
|
|
+{
|
|
|
+ m_import->setEnabled(!imported);
|
|
|
+ m_import->setToolTip(imported ? "已导入" : "导入专家数据");
|
|
|
+ m_import->setIcon(imported ? NEWFLICON(FluentIcon, ACCEPT)->icon() : NEWFLICON(FluentIcon, DOWNLOAD)->icon());
|
|
|
+}
|
|
|
+
|
|
|
int ConfigListItemWidget::spinValue() const
|
|
|
{
|
|
|
return m_weight->value();
|