wumu
2024-04-29 20a43d0e0ff9e9f6ee5349373fd810c6597abf00
0429
6个文件已修改
1个文件已添加
264 ■■■■■ 已修改文件
internal_system_v1/problemlist.cpp 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
internal_system_v1/problemrectificationresult.cpp 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
internal_system_v1/problemrectstandingbook.cpp 12 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
internal_system_v1/problemrectstandingbook.h.autosave 30 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
internal_system_v1/threemergeproblemlist.cpp 188 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
internal_system_v1/threemergeproblemlist.h 20 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
internal_system_v1/threemergeproblemlist.ui 6 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
internal_system_v1/problemlist.cpp
@@ -157,9 +157,9 @@
        for(int k=0;k<labels.size()-1;++k){
            sql += QString("'%1',").arg(labels[k]);
        }
        sql += QString("'%1')").arg(labels.back());
        sql += QString("'%1'),").arg(labels.back());
    }
    sql = sql.left(sql.size()-1); // 去掉最后一个逗号
    qDebug()<<"sql="<<sql;
    QSqlQuery query;
    if(query.exec(sql))
internal_system_v1/problemrectificationresult.cpp
@@ -133,9 +133,9 @@
        for(int k=0;k<labels.size()-1;++k){
            sql += QString("'%1',").arg(labels[k]);
        }
        sql += QString("'%1')").arg(labels.back());
        sql += QString("'%1'),").arg(labels.back());
    }
    sql = sql.left(sql.size()-1); // 去掉最后一个逗号
    qDebug()<<"sql="<<sql;
    QSqlQuery query;
    if(query.exec(sql))
internal_system_v1/problemrectstandingbook.cpp
@@ -34,3 +34,15 @@
        }
    }
}
void ProblemRectStandingBook::on_pushButton_4_clicked()
{
    // 添加到表格中
    qDebug()<<"添加数据";
}
void ProblemRectStandingBook::on_pushButton_5_clicked()
{
    // 写到数据库
    qDebug()<<"保存数据";
}
internal_system_v1/problemrectstandingbook.h.autosave
New file
@@ -0,0 +1,30 @@
#ifndef PROBLEMRECTSTANDINGBOOK_H
#define PROBLEMRECTSTANDINGBOOK_H
#include <QMainWindow>
#include <QMap>
namespace Ui {
class ProblemRectStandingBook;
}
class ProblemRectStandingBook : public QMainWindow
{
    Q_OBJECT
public:
    explicit ProblemRectStandingBook(QWidget *parent = 0);
    ~ProblemRectStandingBook();
    void searchComName();
private slots:
    void on_pushButton_4_clicked();
    void on_pushButton_5_clicked();
private:
    Ui::ProblemRectStandingBook *ui;
    QMap<QString,int> m_comInfo;
};
#endif // PROBLEMRECTSTANDINGBOOK_H
internal_system_v1/threemergeproblemlist.cpp
@@ -23,9 +23,13 @@
void ThreeMergeProblemList::initUi()
{
    initProblemRectBookUi(); // 初始化整改台账
    initProblemListUi(); // 初始化问题清单界面
    initProblemResultUi(); // 初始化问题处理结果界面
    ui->tableWidget->setMinimumHeight(500);  // 整改台账
    ui->tableWidget_2->setMinimumHeight(500); // 整改结果
    ui->tableWidget_3->setMinimumHeight(500); // 问题清单
    // 加载公司名
    readCompanyFromSQL();
}
@@ -135,6 +139,7 @@
        ui->tableWidget_2->setItemDelegateForRow(i,new TableItemDelegate());
    }
    // 右键菜单
    m_menuResult = new QMenu(this);
    m_menuResult->addAction("删除当前行");
@@ -144,6 +149,17 @@
    // 加载下拉框的公司名
    //readCompanyFromSQL();
}
void ThreeMergeProblemList::initProblemRectBookUi()
{
    // 右键菜单
    m_menuRectBook = new QMenu(this);
    m_menuRectBook->addAction("删除当前行");
    ui->tableWidget->setContextMenuPolicy(Qt::CustomContextMenu);
    connect(ui->tableWidget,SIGNAL(customContextMenuRequested(QPoint)),this,SLOT(showMenuSlotRectBook(QPoint)));
    connect(m_menuRectBook->actions().at(0),SIGNAL(triggered(bool)),this,SLOT(deleteActionRectBook()));
}
void ThreeMergeProblemList::readCompanyFromSQL()
@@ -164,6 +180,66 @@
        qDebug()<<QString("select all_company_info fail...")<<query.lastError().text();
    }
}
void ThreeMergeProblemList::loadDataFromSQL(const QString &arg1)
{
    // 问题台账
    // 问题清单
    // 要清除上一家公司的数据
    ui->tableWidget_3->setRowCount(4);
    ui->tableWidget_3->setRowCount(7);
    // 加载表格信息
    qDebug()<<"current :"<<arg1;
    QString sql = QString("select * from problem_list_info where name='%1'").arg(arg1);
    QSqlQuery query;
    if(query.exec(sql)){
        qDebug()<<QString("select problem_list_info ok");
        int row=0;
        while(query.next()){ // 添加行数据
            for(int i=0;i<14;++i){
                ui->tableWidget_3->setItem(row+4,i,new QTableWidgetItem(query.value(2+i).toString()));
            }
            row++;
            ui->tableWidget_3->setRowCount(ui->tableWidget_3->rowCount()+1); // 增加一个新的行
        }
        qDebug()<<"row:"<<row;
    }else{
        qDebug()<<QString("select problem_list_info fail...")<<query.lastError().text();
    }
    // 问题整改结果
    // 要清除上一家公司的数据
    ui->tableWidget_2->setRowCount(3);
    ui->tableWidget_2->setRowCount(6);
    // 加载表格信息
    //qDebug()<<"current :"<<arg1;
    sql = QString("select * from rectify_result_info where name='%1'").arg(arg1);
    //QString sql = QString("select * from rectify_result_info where name='%1'").arg(arg1);
    //QSqlQuery query;
    if(query.exec(sql)){
        qDebug()<<QString("select rectify_result_info ok");
        int row=0;
        while(query.next()){ // 添加行数据
            for(int i=0;i<10;++i){
                ui->tableWidget_2->setItem(row+3,i,new QTableWidgetItem(query.value(2+i).toString()));
            }
            row++;
            ui->tableWidget_2->setRowCount(ui->tableWidget_2->rowCount()+1); // 增加一个新的行
        }
        qDebug()<<"row:"<<row;
    }else{
        qDebug()<<QString("select rectify_result_info fail...")<<query.lastError().text();
    }
}
void ThreeMergeProblemList::showMenuSlot(QPoint)
@@ -198,6 +274,22 @@
    }
}
void ThreeMergeProblemList::showMenuSlotRectBook(QPoint)
{
    m_menuRectBook->exec(QCursor::pos());
}
void ThreeMergeProblemList::deleteActionRectBook()
{
    int row = ui->tableWidget->currentRow();
    if(row>=0){
        qDebug()<<"ok";
        ui->tableWidget->removeRow(row);
    }else{
        qDebug()<<"fail";
    }
}
// 增加到第一个表格的行
void ThreeMergeProblemList::on_pushButton_addRow_3_clicked()
{
@@ -213,3 +305,99 @@
{
    ui->tableWidget_2->insertRow(ui->tableWidget_2->rowCount());
}
void ThreeMergeProblemList::on_comboBox_company_currentIndexChanged(const QString &arg1)
{
    loadDataFromSQL(arg1);
}
void ThreeMergeProblemList::on_pushButton_save_2_clicked()
{
    // 问题清单保存
    QString sql = QString("insert into problem_list_info (name,序号,摘要,检查时间,检查方式,纠正问题,完善制度\
,完成时间,主要原因,完成时限,主要原因1,责任部门或责任人,完成时限1,是否销号,销号时间) values ");
    QString name = ui->comboBox_company->currentText();
    for(int i=4;i<ui->tableWidget_3->rowCount();++i){
        QStringList labels;
        for(int j=0;j<ui->tableWidget_3->columnCount();++j){
            QTableWidgetItem *item = ui->tableWidget_3->item(i,j);;
            qDebug() <<i<<j <<item;
            if(item){
                qDebug()<<"OK";
                labels<<item->data(Qt::EditRole).toString();
            }else{
                labels<<" ";
            }
        }
        qDebug()<<labels;
        if(labels.at(0)==" ")continue;
        if(name.size()==0){
            QMessageBox::information(this,"单位信息为空 ","请输入单位名称");
            continue;
        }
        sql += QString("('%1',").arg(name);
        for(int k=0;k<labels.size()-1;++k){
            sql += QString("'%1',").arg(labels[k]);
        }
        sql += QString("'%1'),").arg(labels.back());
    }
    sql = sql.left(sql.size()-1); // 去掉最后一个逗号
    qDebug()<<"sql="<<sql;
    QSqlQuery query;
    if(query.exec(sql))
    {
      qDebug()<<QString("insert  problem_list_info ok...");
      QMessageBox::information(this,"OK","添加成功");
    }else{
      qDebug()<<QString("insert problem_list_info fail...")<<query.lastError().text();
      QMessageBox::information(this,"添加失败","可能添加的数据不全导致的,得确认每行的首项有数据");
    }
}
void ThreeMergeProblemList::on_pushButton_save_clicked()
{
    // 问题整改保存
    QString sql = QString("insert into rectify_result_info (name,修订制度,新增制度,挽回损失,剔除,审减,处理人,宣贯培训,其他,审核结果,注销) values ");
    QString name = ui->comboBox_company->currentText();
    for(int i=3;i<ui->tableWidget_2->rowCount();++i){
        QStringList labels;
        for(int j=0;j<ui->tableWidget_2->columnCount();++j){
            QTableWidgetItem *item = ui->tableWidget_2->item(i,j);;
            qDebug() <<i<<j <<item;
            if(item){
                qDebug()<<"OK";
                labels<<item->data(Qt::EditRole).toString();
            }else{
                labels<<" ";
            }
        }
        qDebug()<<labels;
        if(labels.at(0)==" ")continue;
        if(name.size()==0){
            QMessageBox::information(this,"单位信息为空 ","请输入单位名称");
            continue;
        }
        sql += QString("('%1',").arg(name);
        for(int k=0;k<labels.size()-1;++k){
            sql += QString("'%1',").arg(labels[k]);
        }
        sql += QString("'%1'),").arg(labels.back());
    }
    sql = sql.left(sql.size()-1); // 去掉最后一个逗号
    qDebug()<<"sql="<<sql;
    QSqlQuery query;
    if(query.exec(sql))
    {
      qDebug()<<QString("insert  rectify_result_info ok...");
      QMessageBox::information(this,"OK","添加成功");
    }else{
      qDebug()<<QString("insert rectify_result_info fail...")<<query.lastError().text();
      QMessageBox::information(this,"添加失败","可能添加的数据不全导致的,得确认每行的首项有数据");
    }
}
internal_system_v1/threemergeproblemlist.h
@@ -21,9 +21,13 @@
    void initUi();
    void initProblemListUi();
    void initProblemResultUi();
    void initProblemRectBookUi();
    void readCompanyFromSQL();
    void loadDataFromSQL(const QString &arg1);
private slots:
    // 问题清单
    void showMenuSlot(QPoint);
    void deleteAction();
@@ -31,17 +35,27 @@
    void showMenuSlotResult(QPoint);
    void deleteActionResult();
    // 整改台账
    void showMenuSlotRectBook(QPoint);
    void deleteActionRectBook();
    void on_pushButton_addRow_3_clicked();
    void on_pushButton_addRow_2_clicked();
    void on_pushButton_addRow_clicked();
    void on_comboBox_company_currentIndexChanged(const QString &arg1);
    void on_pushButton_save_2_clicked();
    void on_pushButton_save_clicked();
private:
    Ui::ThreeMergeProblemList *ui;
    QMenu *m_menu;
    QMenu *m_menuResult;
    QMenu *m_menuResult_;
    QMenu *m_menu; // 问题清单菜单
    QMenu *m_menuResult; // 整改成果
    QMenu *m_menuRectBook; // 整改台账
};
#endif // THREEMERGEPROBLEMLIST_H
internal_system_v1/threemergeproblemlist.ui
@@ -18,15 +18,15 @@
    <item row="0" column="0">
     <widget class="QScrollArea" name="scrollArea">
      <property name="widgetResizable">
       <bool>false</bool>
       <bool>true</bool>
      </property>
      <widget class="QWidget" name="scrollAreaWidgetContents">
       <property name="geometry">
        <rect>
         <x>0</x>
         <y>0</y>
         <width>1500</width>
         <height>944</height>
         <width>1459</width>
         <height>956</height>
        </rect>
       </property>
       <layout class="QGridLayout" name="gridLayout_5">