|
@@ -16,6 +16,7 @@
|
|
|
#include <QSplitter>
|
|
|
#include <QLabel>
|
|
|
#include <QListWidget>
|
|
|
+#include <QGridLayout>
|
|
|
|
|
|
#include <QDebug>
|
|
|
|
|
@@ -129,7 +130,11 @@ void ConfigExpertDataWidget::initLayout()
|
|
|
"#expListTitleLabel {font:bold; font-size:12px;}");
|
|
|
}
|
|
|
|
|
|
-void ConfigExpertDataWidget::connectSignalsAndSlots() { }
|
|
|
+void ConfigExpertDataWidget::connectSignalsAndSlots()
|
|
|
+{
|
|
|
+ connect(m_saveButton, &QPushButton::clicked, this, &ConfigExpertDataWidget::slotSave);
|
|
|
+ connect(m_refreshButton, &QPushButton::clicked, this, &ConfigExpertDataWidget::slotRefresh);
|
|
|
+}
|
|
|
|
|
|
void ConfigExpertDataWidget::setProcess(SchemePlanManager::SchemeProcessInfo process)
|
|
|
{
|
|
@@ -147,7 +152,7 @@ void ConfigExpertDataWidget::loadData()
|
|
|
|
|
|
qDeleteAll(m_configList);
|
|
|
m_configList.clear();
|
|
|
- if (!UserConfigService().QueryUserConfigListInfoByEngineerId(&m_configList, m_process.projectId)) {
|
|
|
+ if (!UserConfigService().QueryAllUserConfig(&m_configList)) {
|
|
|
QFDAlert::showAlertWithCode(QF_CODE_DATA_ERROR, this);
|
|
|
return;
|
|
|
}
|
|
@@ -172,45 +177,13 @@ void ConfigExpertDataWidget::refreshAddedList()
|
|
|
m_configListWidget->clear();
|
|
|
|
|
|
for (int i = 0; i < m_configList.count(); i++) {
|
|
|
- UserConfig *config = m_configList[i];
|
|
|
-
|
|
|
QListWidgetItem *item = new QListWidgetItem;
|
|
|
- QWidget *w = new QWidget();
|
|
|
- QHBoxLayout *hBox = new QHBoxLayout(w);
|
|
|
- QLabel *idx = new QLabel(QString::number(i + 1));
|
|
|
- idx->setFixedWidth(25);
|
|
|
- QLabel *name = new QLabel(config->userName);
|
|
|
-
|
|
|
- QDoubleSpinBox *spin = new QDoubleSpinBox(w);
|
|
|
- spin->setRange(0, 1);
|
|
|
- spin->setSingleStep(0.01);
|
|
|
- spin->setFixedSize(QSize(60, 25));
|
|
|
- spin->setValue(config->weight / 100);
|
|
|
-
|
|
|
- QPushButton *import = new QPushButton(NEWFLICON(FluentIcon, DOWNLOAD)->icon(), "", w);
|
|
|
- import->setFixedSize(QSize(25, 25));
|
|
|
- import->setIconSize(QSize(15, 15));
|
|
|
- import->setToolTip("导入专家数据");
|
|
|
-
|
|
|
- QPushButton *remove = new QPushButton(NEWFLICON(QFDIcon, Minus)->icon(), "", w);
|
|
|
- remove->setFixedSize(QSize(25, 25));
|
|
|
- remove->setIconSize(QSize(10, 10));
|
|
|
- remove->setToolTip("移除");
|
|
|
-
|
|
|
- hBox->setSpacing(0);
|
|
|
- hBox->setMargin(10);
|
|
|
- hBox->addWidget(idx);
|
|
|
- hBox->addWidget(name);
|
|
|
- hBox->addSpacing(20);
|
|
|
- hBox->addWidget(spin, Qt::AlignCenter);
|
|
|
- hBox->addStretch();
|
|
|
- hBox->addWidget(import);
|
|
|
- hBox->addWidget(remove, Qt::AlignRight);
|
|
|
-
|
|
|
m_configListWidget->addItem(item);
|
|
|
- m_configListWidget->setItemWidget(item, w);
|
|
|
|
|
|
- idx->setStyleSheet("font-size:14px; color:#aaaaaa");
|
|
|
+ UserConfig *config = m_configList[i];
|
|
|
+ ConfigListItemWidget *widget = new ConfigListItemWidget();
|
|
|
+ widget->setUserConfig(config);
|
|
|
+ m_configListWidget->setItemWidget(item, widget);
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -219,29 +192,141 @@ void ConfigExpertDataWidget::refreshExpList()
|
|
|
m_expListWidget->clear();
|
|
|
|
|
|
for (int i = 0; i < m_expertList.count(); i++) {
|
|
|
- QFUser *expert = m_expertList[i];
|
|
|
-
|
|
|
QListWidgetItem *item = new QListWidgetItem;
|
|
|
- QWidget *w = new QWidget();
|
|
|
- QHBoxLayout *hBox = new QHBoxLayout(w);
|
|
|
- QLabel *idx = new QLabel(QString::number(i + 1));
|
|
|
- idx->setFixedWidth(25);
|
|
|
- QLabel *name = new QLabel(expert->userName);
|
|
|
- QPushButton *button = new QPushButton(NEWFLICON(FluentIcon, ADD)->icon(), "", w);
|
|
|
- button->setFixedSize(QSize(25, 25));
|
|
|
- button->setIconSize(QSize(10, 10));
|
|
|
- button->setToolTip("添加");
|
|
|
-
|
|
|
- hBox->setSpacing(0);
|
|
|
- hBox->setMargin(10);
|
|
|
- hBox->addWidget(idx);
|
|
|
- hBox->addWidget(name);
|
|
|
- hBox->addStretch();
|
|
|
- hBox->addWidget(button, Qt::AlignRight);
|
|
|
-
|
|
|
m_expListWidget->addItem(item);
|
|
|
- m_expListWidget->setItemWidget(item, w);
|
|
|
|
|
|
- idx->setStyleSheet("font-size:14px; color:#aaaaaa");
|
|
|
+ ExpertListItemWidget *widget = new ExpertListItemWidget();
|
|
|
+ QFUser *expert = m_expertList[i];
|
|
|
+ widget->setUser(expert);
|
|
|
+ widget->setIndex(i + 1);
|
|
|
+ m_expListWidget->setItemWidget(item, widget);
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+void ConfigExpertDataWidget::slotSave() { }
|
|
|
+
|
|
|
+void ConfigExpertDataWidget::slotRefresh()
|
|
|
+{
|
|
|
+ loadData();
|
|
|
+}
|
|
|
+
|
|
|
+void ConfigExpertDataWidget::slotAddUser(QFUser *user) { }
|
|
|
+
|
|
|
+void ConfigExpertDataWidget::slotRemoveConfig(UserConfig *config) { }
|
|
|
+
|
|
|
+void ConfigExpertDataWidget::slotImportData(UserConfig *config) { }
|
|
|
+
|
|
|
+ConfigListItemWidget::ConfigListItemWidget(QWidget *parent) : QWidget(parent)
|
|
|
+{
|
|
|
+ initWidget();
|
|
|
+ initLayouts();
|
|
|
+ connectSignalsAndSlots();
|
|
|
+}
|
|
|
+
|
|
|
+UserConfig *ConfigListItemWidget::userConfig() const
|
|
|
+{
|
|
|
+ return m_config;
|
|
|
+}
|
|
|
+
|
|
|
+void ConfigListItemWidget::setUserConfig(UserConfig *config)
|
|
|
+{
|
|
|
+ m_config = config;
|
|
|
+ m_name->setText(m_config->userName);
|
|
|
+ m_weight->setValue(m_config->weight);
|
|
|
+}
|
|
|
+
|
|
|
+void ConfigListItemWidget::initWidget()
|
|
|
+{
|
|
|
+ m_name = new QLabel(this);
|
|
|
+ m_weight = new QSpinBox(this);
|
|
|
+ m_weight->setSuffix("%");
|
|
|
+ m_import = new QPushButton(NEWFLICON(FluentIcon, DOWNLOAD)->icon(), "", this);
|
|
|
+ m_import->setFixedSize(QSize(25, 25));
|
|
|
+ m_import->setIconSize(QSize(15, 15));
|
|
|
+ m_import->setToolTip("导入专家数据");
|
|
|
+ m_remove = new QPushButton(NEWFLICON(QFDIcon, Minus)->icon(), "", this);
|
|
|
+ m_remove->setFixedSize(QSize(25, 25));
|
|
|
+ m_remove->setIconSize(QSize(10, 10));
|
|
|
+ m_remove->setToolTip("移除");
|
|
|
+}
|
|
|
+
|
|
|
+void ConfigListItemWidget::initLayouts()
|
|
|
+{
|
|
|
+ m_layout = new QHBoxLayout(this);
|
|
|
+ m_layout->addWidget(m_name);
|
|
|
+ m_layout->addStretch();
|
|
|
+ m_layout->addWidget(m_weight);
|
|
|
+ m_layout->addSpacing(10);
|
|
|
+ m_layout->addWidget(m_import);
|
|
|
+ m_layout->addWidget(m_remove);
|
|
|
+}
|
|
|
+
|
|
|
+void ConfigListItemWidget::connectSignalsAndSlots()
|
|
|
+{
|
|
|
+ connect(m_import, &QPushButton::clicked, this, &ConfigListItemWidget::slotImport);
|
|
|
+ connect(m_remove, &QPushButton::clicked, this, &ConfigListItemWidget::slotRemove);
|
|
|
+}
|
|
|
+
|
|
|
+void ConfigListItemWidget::slotImport()
|
|
|
+{
|
|
|
+ emit sigImport(m_config);
|
|
|
+}
|
|
|
+
|
|
|
+void ConfigListItemWidget::slotRemove()
|
|
|
+{
|
|
|
+ emit sigRemove(m_config);
|
|
|
+}
|
|
|
+
|
|
|
+ExpertListItemWidget::ExpertListItemWidget(QWidget *parent) : QWidget(parent)
|
|
|
+{
|
|
|
+ initWidget();
|
|
|
+ initLayout();
|
|
|
+ connectSignalsAndSlots();
|
|
|
+}
|
|
|
+
|
|
|
+QFUser *ExpertListItemWidget::user() const
|
|
|
+{
|
|
|
+ return m_user;
|
|
|
+}
|
|
|
+
|
|
|
+void ExpertListItemWidget::setUser(QFUser *user)
|
|
|
+{
|
|
|
+ m_user = user;
|
|
|
+ m_name->setText(user->userName);
|
|
|
+}
|
|
|
+
|
|
|
+void ExpertListItemWidget::setIndex(int index)
|
|
|
+{
|
|
|
+ m_index->setText(QString("%1").arg(index));
|
|
|
+}
|
|
|
+
|
|
|
+void ExpertListItemWidget::initWidget()
|
|
|
+{
|
|
|
+ m_index = new QLabel(this);
|
|
|
+ m_name = new QLabel(this);
|
|
|
+ m_add = new QPushButton(NEWFLICON(FluentIcon, ADD)->icon(), "", this);
|
|
|
+ m_add->setFixedSize(QSize(25, 25));
|
|
|
+ m_add->setIconSize(QSize(10, 10));
|
|
|
+ m_add->setToolTip("移除");
|
|
|
+}
|
|
|
+
|
|
|
+void ExpertListItemWidget::initLayout()
|
|
|
+{
|
|
|
+ m_layout = new QHBoxLayout(this);
|
|
|
+ m_layout->addWidget(m_index);
|
|
|
+ m_index->setFixedWidth(25);
|
|
|
+ m_layout->addSpacing(10);
|
|
|
+ m_layout->addWidget(m_name);
|
|
|
+ m_layout->addStretch();
|
|
|
+ m_layout->addWidget(m_add);
|
|
|
+}
|
|
|
+
|
|
|
+void ExpertListItemWidget::connectSignalsAndSlots()
|
|
|
+{
|
|
|
+ connect(m_add, &QPushButton::clicked, this, &ExpertListItemWidget::slotAdd);
|
|
|
+}
|
|
|
+
|
|
|
+void ExpertListItemWidget::slotAdd()
|
|
|
+{
|
|
|
+ emit sigAddUser(m_user);
|
|
|
+}
|