chengxr 1 жил өмнө
parent
commit
5c40f014ca

+ 56 - 0
QFD/common/ProjectManager.cpp

@@ -4,6 +4,62 @@
 #include <dbService/UserConfigService.h>
 #include <dbService/EngineerService.h>
 
+QString ProjectManager::nameOFIndexType(ProjectManager::IndexType t)
+{
+    switch (t) {
+    case Capability:
+        return "能力重要度评估指标体系";
+    case TechMessaures:
+        return "技术措施重要度评估对象";
+    case SchemaEval:
+        return "方案评估指标体系";
+    }
+}
+
+QString ProjectManager::nameOfEvalType(ProjectManager::EvalType t)
+{
+    switch (t) {
+    case None:
+        return "无";
+    case Importance:
+        return "能力与技术重要度评估";
+    case TechSchema:
+        return "技术方案评估";
+    case Requirements:
+        return "需求分析评估";
+    case SchemeOptimization:
+        return "方案优选评估";
+    case OverallEfficiency:
+        return "综合效能评估";
+    }
+}
+
+QList<ProjectManager::IndexType> ProjectManager::indexListOfEvalFlags(EvalTypes flags)
+{
+    QList<IndexType> list;
+
+    if ((flags & EngineerInfo::Importance) == EngineerInfo::Importance) {
+        list.append(Capability);
+        list.append(TechMessaures);
+    }
+    if ((flags & EngineerInfo::TechSchema) == EngineerInfo::TechSchema) {
+        list.append(SchemaEval);
+    }
+
+    return list;
+}
+
+ProjectManager::EvalTypes ProjectManager::evalFlags(ProjectInfo proj) const
+{
+    EvalTypes flags = EvalTypes(proj.estimateType.toInt());
+    return flags;
+}
+
+QList<ProjectManager::IndexType> ProjectManager::indexList(ProjectInfo proj) const
+{
+    return indexListOfEvalFlags(evalFlags(proj));
+}
+
 int ProjectManager::queryProjects(QList<EngineerInfo *> *projList)
 {
     bool ret = EngineerService().QueryEngineerList(projList);

+ 32 - 0
QFD/common/ProjectManager.h

@@ -4,10 +4,42 @@
 #include <QObject>
 
 class EngineerInfo;
+class ProjectInfo;
 
 class ProjectManager
 {
 public:
+    /// 指标体系类型
+    enum IndexType
+    {
+        Capability    = 0b1,       // 能力重要度评估指标体系
+        TechMessaures = 0b1 << 1,  // 技术措施重要度评估对象
+        SchemaEval    = 0b1 << 2,  // 方案评估指标体系
+    };
+
+    static QString nameOFIndexType(IndexType t);
+
+    /// 评估方案类型
+    enum EvalType
+    {
+        None       = 0,
+        Importance = Capability | TechMessaures,  // 能力与技术重要度评估
+        TechSchema = SchemaEval,                  // 技术方案评估
+
+        // QFD2 新增
+        Requirements       = 0b1 << 5,  // 需求分析评估
+        SchemeOptimization = 0b1 << 6,  // 方案优选评估
+        OverallEfficiency  = 0b1 << 7,  // 综合效能评估
+    };
+
+    Q_DECLARE_FLAGS(EvalTypes, EvalType)
+
+    static QString nameOfEvalType(EvalType t);
+    static QList<IndexType> indexListOfEvalFlags(EvalTypes flags);
+
+    EvalTypes evalFlags(ProjectInfo proj) const;
+    QList<IndexType> indexList(ProjectInfo proj) const;
+
     static int queryProjects(QList<EngineerInfo *> *projList);
 };
 

+ 0 - 8
QFD/dbService/ClassSet.h

@@ -266,14 +266,6 @@ public:
 class ProjectInfo
 {
 public:
-    // 评估类型
-    enum estimateType
-    {
-        demand    = 0,  // 需求分享评估
-        programme = 1,  // 方案优选评估脑图
-        general   = 2,  // 综合效能评估
-    };
-
     int id = -1;                //项目id
     QString projectName;        //项目名称
     int demandMindId    = -1;   //需求分享评估脑图ID

+ 57 - 5
QFD/widgets/CreateProjWidget.cpp

@@ -1,5 +1,7 @@
 #include "CreateProjWidget.h"
 
+#include <common/ProjectManager.h>
+
 #include <dbService/ClassSet.h>
 
 #include <Widgets/LineEdit.h>
@@ -33,6 +35,28 @@ void CreateProjWidget::clearInputs()
     m_type3->setChecked(false);
 }
 
+ProjectInfo CreateProjWidget::projectInfo() const
+{
+    ProjectInfo proj;
+    proj.taskName          = m_taskName->text();
+    proj.estimateTime      = QString::number(m_evalTime->dateTime().toTime_t());
+    proj.estimateObjective = m_evalPurpose->text();
+    proj.estimateDept      = m_evalUnit->text();
+    proj.estimatePerson    = m_evalCrew->text();
+    proj.positionalTitles  = m_rank->text();
+    proj.remark            = m_note->toPlainText();
+
+    proj.projectName = m_name->text();
+
+    ProjectManager::EvalTypes t;
+    t |= (m_type1->isChecked() ? ProjectManager::Requirements : ProjectManager::None);
+    t |= (m_type2->isChecked() ? ProjectManager::SchemeOptimization : ProjectManager::None);
+    t |= (m_type3->isChecked() ? ProjectManager::OverallEfficiency : ProjectManager::None);
+    proj.estimateType = QString::number(t);
+
+    return proj;
+}
+
 void CreateProjWidget::initWindow()
 {
     setWindowTitle("新建工程");
@@ -122,28 +146,56 @@ void CreateProjWidget::initLayout()
 
 void CreateProjWidget::connectSignalsAndSlots()
 {
-    connect(m_name, &LineEdit::textChanged, this, &CreateProjWidget::slotProjNameChanged);
+    connect(m_taskName, &LineEdit::textChanged, this, &CreateProjWidget::slotTextChanged);
+    connect(m_evalPurpose, &LineEdit::textChanged, this, &CreateProjWidget::slotTextChanged);
+    connect(m_evalUnit, &LineEdit::textChanged, this, &CreateProjWidget::slotTextChanged);
+    connect(m_evalCrew, &LineEdit::textChanged, this, &CreateProjWidget::slotTextChanged);
+    connect(m_rank, &LineEdit::textChanged, this, &CreateProjWidget::slotTextChanged);
+    connect(m_note, &TextEdit::textChanged, this, &CreateProjWidget::slotTextChanged);
+    connect(m_name, &LineEdit::textChanged, this, &CreateProjWidget::slotTextChanged);
+    connect(m_type1, &CheckBox::stateChanged, this, &CreateProjWidget::slotCheckBoxChanged);
+    connect(m_type2, &CheckBox::stateChanged, this, &CreateProjWidget::slotCheckBoxChanged);
+    connect(m_type3, &CheckBox::stateChanged, this, &CreateProjWidget::slotCheckBoxChanged);
     connect(m_confirm, &PushButton::clicked, this, &CreateProjWidget::slotCreateClicked);
     connect(m_cancel, &PushButton::clicked, this, &CreateProjWidget::slotCancelClicked);
 }
 
 void CreateProjWidget::updateCreateButtonState()
 {
-    bool summaryValid;
+    bool summaryValid = false;
     bool nameValid;
     bool typeValid;
 
     m_confirm->setEnabled(summaryValid && nameValid && typeValid);
 }
 
-void CreateProjWidget::slotProjNameChanged(const QString &text)
+void CreateProjWidget::slotTextChanged()
 {
-    m_name->setText(text.trimmed());
-    updateCreateButtonState();
+    LineEdit *lineEdit = dynamic_cast<LineEdit *>(sender());
+    if (lineEdit) {
+        lineEdit->setText(lineEdit->text().trimmed());
+    }
+    //    qDebug() << __FUNCTION__ << __LINE__ << sender();
+
+    //    TextEdit *textEdit = dynamic_cast<TextEdit *>(sender());
+
+    //    qDebug() << __FUNCTION__ << __LINE__ << (textEdit == nullptr);
+
+    //    if (textEdit != nullptr) {
+    //        qDebug() << __FUNCTION__ << __LINE__ << textEdit->toPlainText();
+    //        textEdit->setPlainText(textEdit->toPlainText().trimmed());
+    //    }
 }
 
+void CreateProjWidget::slotCheckBoxChanged() { }
+
 void CreateProjWidget::slotCreateClicked()
 {
+    ProjectInfo p = projectInfo();
+    qDebug() << __FUNCTION__ << p.taskName << p.estimateTime << p.estimateObjective << p.estimateDept
+             << p.estimatePerson << p.positionalTitles << p.remark << p.projectName << p.estimateType;
+
+    return;
     emit signalCreate();
     close();
 }

+ 12 - 6
QFD/widgets/CreateProjWidget.h

@@ -3,16 +3,19 @@
 
 #include <QDialog>
 
-class QVBoxLayout;
-class QHBoxLayout;
-class QGridLayout;
-class QLabel;
+class ProjectInfo;
+
 class LineEdit;
 class CheckBox;
 class PushButton;
 class DateTimeEdit;
 class TextEdit;
 
+class QVBoxLayout;
+class QHBoxLayout;
+class QGridLayout;
+class QLabel;
+
 /// 创建工程页面
 class CreateProjWidget : public QDialog
 {
@@ -24,6 +27,8 @@ public:
 
     void clearInputs();
 
+    ProjectInfo projectInfo() const;
+
 signals:
     void signalCreate();
 
@@ -35,7 +40,8 @@ private:
     void updateCreateButtonState();
 
 private slots:
-    void slotProjNameChanged(const QString &text);
+    void slotTextChanged();
+    void slotCheckBoxChanged();
     void slotCreateClicked();
     void slotCancelClicked();
 
@@ -50,7 +56,7 @@ private:
     LineEdit *m_rank         = nullptr;  // 职称
     TextEdit *m_note         = nullptr;  // 备注
 
-    QWidget *m_separator = nullptr;  // 分隔
+    QWidget *m_separator = nullptr;  // 分隔线
 
     // 项目信息
     QLabel *m_nameLabel = nullptr;