wumu
2024-11-01 71c27f9ead97e52e50a59495c6955756e21004cf
internal_system_v1/threemergeproblemlist.cpp
@@ -7,6 +7,8 @@
#include <QDir>
#include <QFileDevice>
#pragma execution_character_set("utf-8")
ThreeMergeProblemList::ThreeMergeProblemList(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::ThreeMergeProblemList)
@@ -39,6 +41,10 @@
    ui->line_2->hide();
    ui->groupBox->hide(); // 首次先隐藏
    // pdf文件相关
    //m_pdfView = new QWebEngineView();
}
@@ -95,6 +101,15 @@
        qDebug()<<"当前行首为空"<<row;
        return 0;
    }
    // 处理为空的非首列单元,自动补零
    for(int i=1;i<ui->tableWidget->columnCount();++i){
        if(ui->tableWidget->item(row,i) == nullptr){
            qDebug()<<"发现空项:"<<row<<i;
            ui->tableWidget->setItem(row,i,new QTableWidgetItem(" "));
        }
    }
    // 取出索引号来判断一下
    QString sql = QString("select id from standing_book_info where id=%1").arg(ui->tableWidget->item(row,0)->text());
    qDebug()<<"id sql:"<<sql;
@@ -157,7 +172,7 @@
// path 为文件完整路径
// id为子目录名字
int ThreeMergeProblemList::saveFile(QString path, QString id,QString &absSavePath)
int ThreeMergeProblemList::saveFile(QString path, QString id,QString &absSavePath,QString proName)
{
    // 根据id来指定子目录进行文件的拷贝和存储
    // 默认保存到当前evidence目录下的id子目录中
@@ -167,7 +182,7 @@
        return -1;
    }
    QString curPath = QString("./evidence/%1/").arg(id);
    QString curPath = QString("./evidence/%1_%2/").arg(id).arg(proName);
    QDir dir;
    if(!dir.exists(curPath)){
        // 则直接创建
@@ -189,6 +204,22 @@
        return -2;
    }
}
// 使用web技术 加载pdf文件
int ThreeMergeProblemList::loadPdfFile(QString path)
{
//    QString dirPath = QApplication::applicationDirPath();
//    qDebug()<<"pdf:"<<path<<dirPath;
//    qDebug()<<QDir::currentPath();
//    qDebug()<<path.mid(1);
//    QString pdfJS = "file://"+QDir::currentPath()+"/web/viewer.html";
//    QString link = "?file=";
//    QString fullPath = pdfJS+link+QDir::currentPath()+path.mid(1);
//    qDebug()<<"fullPath"<<fullPath;
//    m_pdfView->page()->load(QUrl::fromUserInput(fullPath));
    return 0;
}
void ThreeMergeProblemList::initUi()
{
@@ -433,12 +464,14 @@
    m_menuRectBook = new QMenu(this);
    m_menuRectBook->addAction("删除当前行");
    m_menuRectBook->addAction("保存当前行");
    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()));
    connect(m_menuRectBook->actions().at(1),SIGNAL(triggered(bool)),this,SLOT(saveActionRectBook()));
    connect(m_menuRectBook->actions().at(2),SIGNAL(triggered(bool)),this,SLOT(showSaveFile()));
}
@@ -587,19 +620,20 @@
            QString spath = ui->tableWidget->item(row,17)->text();
            QString tpath = ui->tableWidget->item(row,23)->text();
            QString fid = ui->tableWidget->item(row,0)->text();
            qDebug()<<"拷贝文件:"<<fid<<fpath;
            QString proName = ui->tableWidget->item(row,7)->text(); // 项目名称
            qDebug()<<"拷贝文件:"<<fid<<proName<<fpath;
            QString absSavePath1,absSavePath2,absSavePath3;
            int sflag1 = saveFile(fpath,fid,absSavePath1); // 保存第一个
            int sflag1 = saveFile(fpath,fid,absSavePath1,proName); // 保存第一个
            if(sflag1==1){
                ui->tableWidget->setItem(row,13,new QTableWidgetItem(absSavePath1));
            }
            int sflag2 = saveFile(spath,fid,absSavePath2); // 保存第二个
            int sflag2 = saveFile(spath,fid,absSavePath2,proName); // 保存第二个
            if(sflag2==1){
                ui->tableWidget->setItem(row,17,new QTableWidgetItem(absSavePath2));
            }
            int sflag3 = saveFile(tpath,fid,absSavePath3); // 保存第三个
            int sflag3 = saveFile(tpath,fid,absSavePath3,proName); // 保存第三个
            if(sflag3==1){
                ui->tableWidget->setItem(row,23,new QTableWidgetItem(absSavePath3));
            }
@@ -767,11 +801,11 @@
    }else if(curText == "涉及金额" || strcmp(curText.toLocal8Bit().data(),"涉及金额")==0){
        qDebug()<<"涉及金额";
        condition = QString(" where 涉及金额='%1'").arg(ui->lineEdit_sbook_condition->text());
        condition = QString(" where 涉及金额 <=%1").arg(ui->lineEdit_sbook_condition->text());
    }else if(curText == "整顿金额" || strcmp(curText.toLocal8Bit().data(),"整顿金额")==0){
        qDebug()<<"整顿金额";
        condition = QString(" where 整顿金额='%1'").arg(ui->lineEdit_sbook_condition->text());
        condition = QString(" where 整顿金额 <=%1").arg(ui->lineEdit_sbook_condition->text());
    }
@@ -806,19 +840,20 @@
            QString spath = ui->tableWidget->item(i,17)->text();
            QString tpath = ui->tableWidget->item(i,23)->text();
            QString fid = ui->tableWidget->item(i,0)->text();
            qDebug()<<"拷贝文件:"<<fid<<fpath;
            QString proName = ui->tableWidget->item(i,7)->text(); // 项目名称
            qDebug()<<"拷贝文件:"<<fid<<proName<<fpath;
            QString absSavePath1,absSavePath2,absSavePath3;
            int sflag1 = saveFile(fpath,fid,absSavePath1); // 保存第一个
            int sflag1 = saveFile(fpath,fid,absSavePath1,proName); // 保存第一个
            if(sflag1==1){
                ui->tableWidget->setItem(i,13,new QTableWidgetItem(absSavePath1));
            }
            int sflag2 = saveFile(spath,fid,absSavePath2); // 保存第二个
            int sflag2 = saveFile(spath,fid,absSavePath2,proName); // 保存第二个
            if(sflag2==1){
                ui->tableWidget->setItem(i,17,new QTableWidgetItem(absSavePath2));
            }
            int sflag3 = saveFile(tpath,fid,absSavePath3); // 保存第三个
            int sflag3 = saveFile(tpath,fid,absSavePath3,proName); // 保存第三个
            if(sflag3==1){
                ui->tableWidget->setItem(i,23,new QTableWidgetItem(absSavePath3));
            }
@@ -872,15 +907,15 @@
        vecCon.append(condition);
    }
    if(ui->checkBox_qdx->isChecked()){
        QString condition= QString(" 问题定性='%1' ").arg(ui->comboBox_qdx->currentText());
        QString condition= QString(" 问题定性='%1'").arg(ui->comboBox_qdx->currentText());
        vecCon.append(condition);
    }
    if(ui->checkBox_about_money->isChecked()){
        QString condition= QString(" 涉及金额>='%1' and 涉及金额<='%2' ").arg(ui->comboBox_about_bgMonney->currentText()).arg(ui->comboBox_about_edMoney->currentText());
        QString condition= QString(" 涉及金额 >= %1 and 涉及金额 <= %2").arg(ui->comboBox_about_bgMonney->currentText()).arg(ui->comboBox_about_edMoney->currentText());
        vecCon.append(condition);
    }
    if(ui->checkBox_changeMoney->isChecked()){
        QString condition= QString(" 整改金额>='%1' and 整改金额<='%2' ").arg(ui->comboBox_change_bgMoney->currentText()).arg(ui->comboBox_change_edMoney->currentText());
        QString condition= QString(" 整改金额>=%1 and 整改金额<=%2").arg(ui->comboBox_change_bgMoney->currentText()).arg(ui->comboBox_change_edMoney->currentText());
        vecCon.append(condition);
    }
    if(ui->checkBox_change_over_time->isChecked()){
@@ -930,3 +965,44 @@
    }
    cnt++;
}
void ThreeMergeProblemList::showSaveFile()
{
    int row = ui->tableWidget->currentRow();
    auto item = ui->tableWidget->currentItem();
    if(row>=0 && item){
        qDebug()<<"row"<<row;
        // 取下标  13  17  23
        auto item_13 = ui->tableWidget->item(row,13);
        auto item_17 = ui->tableWidget->item(row,17);
        auto item_23 = ui->tableWidget->item(row,23);
        if(item_13){
            qDebug()<<item_13->text();
            QString text = item_13->text();
            QStringList listPath = text.split("/");
            if(listPath.size() > 2){
                qDebug()<<"发现文件"<<listPath.back();
                QString type = listPath.back().split(".").back();
                qDebug()<<"type"<<type;
                if(type == "pdf"){
                    loadPdfFile(text);
                }
            }
        }
        if(item_17){
            qDebug()<<item_17->text();
        }
        if(item_23){
            qDebug()<<item_23->text();
        }
    }
}
void ThreeMergeProblemList::updateComboList(QMap<QString, ComInfo> & nameAndComInfos)
{
    ui->comboBox_company->clear();
    for(auto it = nameAndComInfos.begin();it != nameAndComInfos.end();++it){
        ui->comboBox_company->addItem(it.key());
    }
}