|
@@ -6,9 +6,12 @@
|
|
|
#include "ExpertInfoWidget.h"
|
|
|
#include "ExpertListWidget.h"
|
|
|
|
|
|
+#include <dbService/DBServiceSet.h>
|
|
|
+
|
|
|
#include <Widgets/Button.h>
|
|
|
#include <Widgets/LineEdit.h>
|
|
|
#include <DialogBox/Dialog.h>
|
|
|
+#include <QFDAlert.h>
|
|
|
|
|
|
#include <QBoxLayout>
|
|
|
#include <QLabel>
|
|
@@ -19,16 +22,14 @@ ExpertManageView::ExpertManageView(QWidget *parent) : QWidget(parent) { }
|
|
|
|
|
|
void ExpertManageView::showEvent(QShowEvent *event)
|
|
|
{
|
|
|
-
|
|
|
QWidget::showEvent(event);
|
|
|
-
|
|
|
init();
|
|
|
}
|
|
|
|
|
|
void ExpertManageView::hideEvent(QHideEvent *event)
|
|
|
{
|
|
|
QWidget::hideEvent(event);
|
|
|
- hideExpertInfo();
|
|
|
+ hideExpertInfoWidget();
|
|
|
}
|
|
|
|
|
|
void ExpertManageView::init()
|
|
@@ -39,6 +40,7 @@ void ExpertManageView::init()
|
|
|
connectSignalsAndSlots();
|
|
|
m_initilized = true;
|
|
|
}
|
|
|
+ refreshList();
|
|
|
}
|
|
|
|
|
|
void ExpertManageView::initialize()
|
|
@@ -98,7 +100,7 @@ void ExpertManageView::setListButtonHidden(bool hidden)
|
|
|
m_deleteButton->setHidden(hidden);
|
|
|
}
|
|
|
|
|
|
-void ExpertManageView::showExpertInfo(ExpertInfoWidget::Mode mode)
|
|
|
+void ExpertManageView::showExpertInfoWidget(ExpertInfoWidget::Mode mode)
|
|
|
{
|
|
|
if (m_expertInfoWidget == nullptr) {
|
|
|
m_expertInfoWidget = new ExpertInfoWidget(this);
|
|
@@ -106,33 +108,49 @@ void ExpertManageView::showExpertInfo(ExpertInfoWidget::Mode mode)
|
|
|
|
|
|
if (m_expertInfoWidget->isVisible() == false) {
|
|
|
m_expertInfoWidget->clearInputs();
|
|
|
-
|
|
|
m_expertInfoWidget->show();
|
|
|
+ m_expertInfoWidget->setFocus(Qt::NoFocusReason);
|
|
|
}
|
|
|
|
|
|
m_expertInfoWidget->setMode(mode);
|
|
|
}
|
|
|
|
|
|
-void ExpertManageView::hideExpertInfo()
|
|
|
+void ExpertManageView::hideExpertInfoWidget()
|
|
|
{
|
|
|
if (m_expertInfoWidget && m_expertInfoWidget->isVisible()) {
|
|
|
m_expertInfoWidget->close();
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+void ExpertManageView::showExpertInfo(QFUser *user)
|
|
|
+{
|
|
|
+ showExpertInfoWidget();
|
|
|
+ m_expertInfoWidget->setUser(user);
|
|
|
+}
|
|
|
+
|
|
|
+void ExpertManageView::refreshList()
|
|
|
+{
|
|
|
+ if (!DBServiceSet().QueryUserListNotAdmin(&m_userList)) {
|
|
|
+ QFDAlert::showAlertWithCode(QF_CODE_DATA_ERROR, this);
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ m_expertListWidget->showUsers(m_userList);
|
|
|
+}
|
|
|
+
|
|
|
void ExpertManageView::slotAddExpertClicked()
|
|
|
{
|
|
|
- showExpertInfo(ExpertInfoWidget::Add);
|
|
|
+ showExpertInfoWidget(ExpertInfoWidget::Create);
|
|
|
}
|
|
|
|
|
|
void ExpertManageView::slotDetailClicked()
|
|
|
{
|
|
|
- showExpertInfo();
|
|
|
+ showExpertInfoWidget();
|
|
|
}
|
|
|
|
|
|
void ExpertManageView::slotDeleteClicked()
|
|
|
{
|
|
|
- hideExpertInfo();
|
|
|
+ hideExpertInfoWidget();
|
|
|
MessageBox *m = new MessageBox("删除专家信息", "删除后不可恢复,确认删除?", topLevelWidget());
|
|
|
m->exec();
|
|
|
}
|
|
@@ -142,7 +160,11 @@ void ExpertManageView::slotListSelectionChanged()
|
|
|
setListButtonHidden(!m_expertListWidget->isItemSelected());
|
|
|
}
|
|
|
|
|
|
-void ExpertManageView::slotListItemDoubleClicked()
|
|
|
+void ExpertManageView::slotListItemDoubleClicked(int row)
|
|
|
{
|
|
|
- showExpertInfo();
|
|
|
+ if (row < 0 || row >= m_userList.count()) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ QFUser *user = m_userList[row];
|
|
|
+ showExpertInfo(user);
|
|
|
}
|