|
@@ -1,6 +1,7 @@
|
|
#include "IndexSystemWidget.h"
|
|
#include "IndexSystemWidget.h"
|
|
|
|
|
|
#include "EditNodeWidget.h"
|
|
#include "EditNodeWidget.h"
|
|
|
|
+#include "ImportIndexWidget.h"
|
|
|
|
|
|
#include <dbService/ClassSet.h>
|
|
#include <dbService/ClassSet.h>
|
|
#include <dbService/CNodeDataService.h>
|
|
#include <dbService/CNodeDataService.h>
|
|
@@ -41,10 +42,14 @@ void IndexSystemWidget::contextMenuEvent(QContextMenuEvent *event)
|
|
CMindView *m = (CMindView *)m_tab->currentWidget();
|
|
CMindView *m = (CMindView *)m_tab->currentWidget();
|
|
|
|
|
|
if (m->root() == nullptr) {
|
|
if (m->root() == nullptr) {
|
|
- QAction *act3 = new QAction("创建根节点");
|
|
|
|
|
|
+ QAction *act3 = new QAction("创建指标体系");
|
|
menu->addAction(act3);
|
|
menu->addAction(act3);
|
|
connect(act3, &QAction::triggered, this, &IndexSystemWidget::slotCreateRootNode);
|
|
connect(act3, &QAction::triggered, this, &IndexSystemWidget::slotCreateRootNode);
|
|
|
|
|
|
|
|
+ QAction *act4 = new QAction("导入指标体系");
|
|
|
|
+ menu->addAction(act4);
|
|
|
|
+ connect(act4, &QAction::triggered, this, &IndexSystemWidget::slotImportIndex);
|
|
|
|
+
|
|
menu->exec(event->globalPos() + QPoint(-40, -20));
|
|
menu->exec(event->globalPos() + QPoint(-40, -20));
|
|
} else {
|
|
} else {
|
|
// QAction *act2 = new QAction("清空");
|
|
// QAction *act2 = new QAction("清空");
|
|
@@ -68,6 +73,7 @@ void IndexSystemWidget::setupTabWidget()
|
|
bool ret = CNodeDataService().QueryAll(list, proj()->id, t);
|
|
bool ret = CNodeDataService().QueryAll(list, proj()->id, t);
|
|
if (ret) {
|
|
if (ret) {
|
|
m->setNodeList(list);
|
|
m->setNodeList(list);
|
|
|
|
+ m->refreshItems();
|
|
}
|
|
}
|
|
|
|
|
|
connect(m, &CMindView::sigEditNode, this, &IndexSystemWidget::slotEditNode);
|
|
connect(m, &CMindView::sigEditNode, this, &IndexSystemWidget::slotEditNode);
|
|
@@ -79,7 +85,8 @@ void IndexSystemWidget::setupTabWidget()
|
|
|
|
|
|
void IndexSystemWidget::initWidgets()
|
|
void IndexSystemWidget::initWidgets()
|
|
{
|
|
{
|
|
- m_editNode = new EditNodeWidget(this);
|
|
|
|
|
|
+ m_editNode = new EditNodeWidget(this);
|
|
|
|
+ m_importIndex = new ImportIndexWidget(this);
|
|
}
|
|
}
|
|
|
|
|
|
void IndexSystemWidget::initLayout() { }
|
|
void IndexSystemWidget::initLayout() { }
|
|
@@ -88,6 +95,7 @@ void IndexSystemWidget::connectSignalsAndSlots()
|
|
{
|
|
{
|
|
connect(m_tab, &QTabWidget::currentChanged, this, &IndexSystemWidget::slotTabCurrentChanged);
|
|
connect(m_tab, &QTabWidget::currentChanged, this, &IndexSystemWidget::slotTabCurrentChanged);
|
|
connect(m_editNode, &EditNodeWidget::sigSaveNode, this, &IndexSystemWidget::slotNodeEdited);
|
|
connect(m_editNode, &EditNodeWidget::sigSaveNode, this, &IndexSystemWidget::slotNodeEdited);
|
|
|
|
+ connect(m_importIndex, &ImportIndexWidget::sigImport, this, &IndexSystemWidget::slotImportIndexConfirmed);
|
|
}
|
|
}
|
|
|
|
|
|
void IndexSystemWidget::addNode(CNodeData node)
|
|
void IndexSystemWidget::addNode(CNodeData node)
|
|
@@ -154,6 +162,11 @@ void IndexSystemWidget::slotCreateRootNode()
|
|
addNode(n);
|
|
addNode(n);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+void IndexSystemWidget::slotImportIndex()
|
|
|
|
+{
|
|
|
|
+ m_importIndex->show();
|
|
|
|
+}
|
|
|
|
+
|
|
void IndexSystemWidget::slotEditNode(CNodeData n)
|
|
void IndexSystemWidget::slotEditNode(CNodeData n)
|
|
{
|
|
{
|
|
m_editNode->setNode(n);
|
|
m_editNode->setNode(n);
|
|
@@ -191,3 +204,30 @@ void IndexSystemWidget::slotNodeEdited(CNodeData node)
|
|
m->updateNode(node);
|
|
m->updateNode(node);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+void IndexSystemWidget::slotImportIndexConfirmed(int projId, int indexType)
|
|
|
|
+{
|
|
|
|
+ m_importIndex->close();
|
|
|
|
+
|
|
|
|
+ QList<CNodeData> list;
|
|
|
|
+ bool ret = CNodeDataService().QueryAll(list, projId, indexType);
|
|
|
|
+ if (ret == false) {
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ CMindView *m = (CMindView *)m_tab->currentWidget();
|
|
|
|
+ int t = indexList()[m_tab->currentIndex()];
|
|
|
|
+ for (int i = 0; i < list.size(); i++) {
|
|
|
|
+ list[i].projectId = m_proj->id;
|
|
|
|
+ list[i].indexType = t;
|
|
|
|
+ list[i].isEffective = 0;
|
|
|
|
+
|
|
|
|
+ int id = CNodeDataService().AddCNodeData(list[i]);
|
|
|
|
+ if (id >= 0) {
|
|
|
|
+ list[i].id = id;
|
|
|
|
+ m->addNode(list[i]);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ m->refreshItems();
|
|
|
|
+}
|