|
@@ -7,15 +7,23 @@
|
|
|
#include "QFDIcon.h"
|
|
|
#include "ProjectListWidget.h"
|
|
|
#include "QFDConfig.h"
|
|
|
-
|
|
|
+#include "FileUtil.h"
|
|
|
#include <Widgets/Button.h>
|
|
|
#include <Widgets/LineEdit.h>
|
|
|
#include <DialogBox/Dialog.h>
|
|
|
+#include <QFileDialog>
|
|
|
+#include <QPushButton>
|
|
|
+#include <QMessageBox>
|
|
|
|
|
|
#include <QBoxLayout>
|
|
|
#include <QLabel>
|
|
|
-
|
|
|
+#include <QApplication>
|
|
|
#include <QDebug>
|
|
|
+#include <QSettings>
|
|
|
+#include "dbService/ClassSet.h"
|
|
|
+#include "dbService/CNodeDataService.h"
|
|
|
+#include "dbService/UserService.h"
|
|
|
+#include "dbService/ClassSet.h"
|
|
|
|
|
|
HomeView::HomeView(QWidget *parent) : QWidget(parent) { }
|
|
|
|
|
@@ -218,17 +226,114 @@ void HomeView::slotDeleteProject(ProjectInfo *proj)
|
|
|
|
|
|
void HomeView::slotExportProject(ProjectInfo *proj)
|
|
|
{
|
|
|
- QString title = "删除工程 “" + proj->projectName + "” ?";
|
|
|
- MessageBox *m = new MessageBox(title, "删除后无法恢复", this);
|
|
|
-
|
|
|
- if (m->exec()) {
|
|
|
- int code = ProjectManager::deleteProject(proj->id);
|
|
|
- QFDAlert::showAlertWithCode(code, this);
|
|
|
- if (code == QF_CODE_SUCCEEDED) {
|
|
|
- m_projList.removeOne(proj);
|
|
|
- m_projListWidget->removeProject(proj);
|
|
|
+ //判断方案是否填写完整TODO
|
|
|
+ //判断是否配置过专家TODO
|
|
|
+
|
|
|
+ QFileDialog::Options options;
|
|
|
+ options |= QFileDialog::DontUseNativeDialog;
|
|
|
+ //文件夹路径
|
|
|
+ QString srcDirPath = QFileDialog::getExistingDirectory(nullptr, "导出资源包", "/", options);
|
|
|
+ if (srcDirPath.isEmpty()) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ srcDirPath += "/";
|
|
|
+ srcDirPath.append(proj->projectName).append(".ini");
|
|
|
+ qDebug() << "srcDirPath---" << srcDirPath;
|
|
|
+ QSettings exportData("exportData.ini", QSettings::IniFormat);
|
|
|
+ exportData.setIniCodec("UTF-8");
|
|
|
+ //获取到需要导出数据
|
|
|
+ QString projectInfo = "";
|
|
|
+ QString nodeDate = "";
|
|
|
+ QString userInfo = "";
|
|
|
+ projectInfo.append(QString::number(proj->id))
|
|
|
+ .append(",")
|
|
|
+ .append(proj->remark)
|
|
|
+ .append(",")
|
|
|
+ .append(proj->estimateTime)
|
|
|
+ .append(",")
|
|
|
+ .append(proj->estimateObjective)
|
|
|
+ .append(",")
|
|
|
+ .append(proj->estimateDept)
|
|
|
+ .append(",")
|
|
|
+ .append(proj->estimatePerson)
|
|
|
+ .append(",")
|
|
|
+ .append(proj->estimateType)
|
|
|
+ .append(",")
|
|
|
+ .append(proj->positionalTitles)
|
|
|
+ .append(",")
|
|
|
+ .append(proj->createTime)
|
|
|
+ .append(",")
|
|
|
+ .append(proj->updateTime);
|
|
|
+ //节点
|
|
|
+ QList<CNodeData> nodeList;
|
|
|
+ bool nodeRet = CNodeDataService().QueryAllByProjectId(nodeList, proj->id);
|
|
|
+ if (nodeRet && nodeList.size() > 0) {
|
|
|
+ foreach (CNodeData node, nodeList) {
|
|
|
+ QString nodeValue = QString::number(node.id)
|
|
|
+ .append(",")
|
|
|
+ .append(QString::number(node.projectId))
|
|
|
+ .append(",")
|
|
|
+ .append(QString::number(node.indexType))
|
|
|
+ .append(",")
|
|
|
+ .append(QString::number(node.number))
|
|
|
+ .append(",")
|
|
|
+ .append(QString::number(node.pNumber))
|
|
|
+ .append(",")
|
|
|
+ .append(node.name)
|
|
|
+ .append(",")
|
|
|
+ .append(node.remark)
|
|
|
+ .append(",")
|
|
|
+ .append(node.dimension);
|
|
|
+ nodeDate.append(nodeValue).append(";");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ //获取人员信息
|
|
|
+ QList<QFUser> userInfoList;
|
|
|
+ bool retUser = UserService().QueryUserListByEngineerId(userInfoList, proj->id);
|
|
|
+ if (retUser && userInfoList.size() > 0) {
|
|
|
+ foreach (QFUser user, userInfoList) {
|
|
|
+ QString userValue = QString::number(user.id)
|
|
|
+ .append(",")
|
|
|
+ .append(user.userName)
|
|
|
+ .append(",")
|
|
|
+ .append(user.userNo)
|
|
|
+ .append(",")
|
|
|
+ .append(user.password)
|
|
|
+ .append(",")
|
|
|
+ .append(QString::number(user.role))
|
|
|
+ .append(",")
|
|
|
+ .append(user.post)
|
|
|
+ .append(",")
|
|
|
+ .append(user.major)
|
|
|
+ .append(",")
|
|
|
+ .append(user.workPosition)
|
|
|
+ .append(",")
|
|
|
+ .append(user.educationDegree)
|
|
|
+ .append(",")
|
|
|
+ .append(user.phone)
|
|
|
+ .append(",")
|
|
|
+ .append(user.remark)
|
|
|
+ .append(",")
|
|
|
+ .append(user.projectId)
|
|
|
+ .append(",")
|
|
|
+ .append(user.writeTime);
|
|
|
+ userInfo.append(userValue).append(";");
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+ exportData.setValue("EXPORTDATA/projectInfo", projectInfo);
|
|
|
+ exportData.setValue("EXPORTDATA/nodeDate", nodeDate);
|
|
|
+ exportData.setValue("EXPORTDATA/userInfo", userInfo);
|
|
|
+
|
|
|
+ QString sysDbPath = QCoreApplication::applicationDirPath();
|
|
|
+ sysDbPath += "/exportData.ini";
|
|
|
+ qDebug() << "filePath---" << sysDbPath;
|
|
|
+ bool result = FileUtil().copyFileToPath(sysDbPath, srcDirPath, false);
|
|
|
+ if (result) {
|
|
|
+ QMessageBox::information(this, "成功", tr("导出成功"));
|
|
|
+ } else {
|
|
|
+ QMessageBox::warning(this, "失败", tr("导出失败"));
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
void HomeView::slotPreviousClicked()
|