| | |
| | | #include <QDir> |
| | | #include <QFileDevice> |
| | | |
| | | #pragma execution_character_set("utf-8") |
| | | |
| | | ThreeMergeProblemList::ThreeMergeProblemList(QWidget *parent) : |
| | | QMainWindow(parent), |
| | | ui(new Ui::ThreeMergeProblemList) |
| | |
| | | |
| | | ui->line->hide(); |
| | | ui->line_2->hide(); |
| | | |
| | | ui->groupBox->hide(); // 首次先隐藏 |
| | | |
| | | // pdf文件相关 |
| | | //m_pdfView = new QWebEngineView(); |
| | | |
| | | |
| | | } |
| | | |
| | |
| | | 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; |
| | |
| | | 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() |
| | | { |
| | |
| | | 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())); |
| | | |
| | | } |
| | | |
| | |
| | | |
| | | }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()); |
| | | |
| | | } |
| | | |
| | |
| | | QMessageBox::information(this,"保存提示",QString("总行数为%1,成功%2行,失败%3行。").arg(ui->tableWidget->rowCount()) |
| | | .arg(hasContentRow).arg(ui->tableWidget->rowCount()-hasContentRow)); |
| | | } |
| | | |
| | | void ThreeMergeProblemList::on_pushButton_moreSearch_clicked() |
| | | { |
| | | QString sql = "select * from standing_book_info "; |
| | | |
| | | QVector<QString> vecCon; // 保存所有条件 |
| | | |
| | | if(ui->checkBox_type->isChecked()){ |
| | | QString condition= QString(" 审计类别='%1' ").arg(ui->comboBox_type->currentText()); |
| | | vecCon.append(condition); |
| | | } |
| | | if(ui->checkBox_year->isChecked()){ |
| | | QString condition= QString(" 审计年度='%1' ").arg(ui->dateEdit_year->text()); |
| | | vecCon.append(condition); |
| | | } |
| | | if(ui->checkBox_com->isChecked()){ |
| | | QString condition= QString(" 审计单位='%1' ").arg(ui->comboBox_com->currentText()); |
| | | vecCon.append(condition); |
| | | } |
| | | if(ui->checkBox_way->isChecked()){ |
| | | QString condition= QString(" 审计方式='%1' ").arg(ui->comboBox_way->currentText()); |
| | | vecCon.append(condition); |
| | | } |
| | | if(ui->checkBox_mainCom->isChecked()){ |
| | | QString condition= QString(" 责任主体名称='%1' ").arg(ui->comboBox_mainCom->currentText()); |
| | | vecCon.append(condition); |
| | | } |
| | | if(ui->checkBox_pro->isChecked()){ |
| | | QString condition= QString(" 审计项目='%1' ").arg(ui->comboBox_pro->currentText()); |
| | | vecCon.append(condition); |
| | | } |
| | | if(ui->checkBox_proName->isChecked()){ |
| | | QString condition= QString(" 审计项目名称='%1' ").arg(ui->comboBox_proName->currentText()); |
| | | vecCon.append(condition); |
| | | } |
| | | if(ui->checkBox_qtype->isChecked()){ |
| | | QString condition= QString(" 问题类别='%1' ").arg(ui->comboBox_qtype->currentText()); |
| | | vecCon.append(condition); |
| | | } |
| | | if(ui->checkBox_qdx->isChecked()){ |
| | | 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()); |
| | | 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()); |
| | | vecCon.append(condition); |
| | | } |
| | | if(ui->checkBox_change_over_time->isChecked()){ |
| | | QString condition= QString(" 整改完成时间='%1' ").arg(ui->dateEdit_change_over_time->text()); |
| | | vecCon.append(condition); |
| | | } |
| | | if(ui->checkBox_change_expected_time->isChecked()){ |
| | | QString condition= QString(" 整改预计完成时间='%1' ").arg(ui->dateEdit_change_expected_time->text()); |
| | | vecCon.append(condition); |
| | | } |
| | | QString condition; |
| | | if(vecCon.size() == 1){ |
| | | condition += QString(" where %1").arg(vecCon.at(0)); |
| | | }else if(vecCon.size() > 1){ |
| | | condition += QString(" where %1").arg(vecCon.at(0)); |
| | | for(int i=1;i<vecCon.size();++i){ |
| | | condition += QString(" and %1 ").arg(vecCon.at(i)); |
| | | } |
| | | } |
| | | sql += condition; |
| | | qDebug()<<sql; |
| | | |
| | | QVector<QVector<QString>> res; |
| | | int rows = selectSQL(sql,res); |
| | | if(rows > 0){ |
| | | ui->tableWidget->setRowCount(rows); |
| | | for(int i=0;i<res.size();++i){ |
| | | for(int j=0;j<res.at(0).size()-1;++j){ // 去掉记录时间 |
| | | ui->tableWidget->setItem(i,j,new QTableWidgetItem(res[i][j])); |
| | | } |
| | | } |
| | | }else{ |
| | | QMessageBox::information(this,"查询失败","可能查询的内容不正确或者没有记录相应的数据"); |
| | | } |
| | | |
| | | } |
| | | |
| | | void ThreeMergeProblemList::on_pushButton_multiSearch_clicked() |
| | | { |
| | | static int cnt=0; |
| | | if(cnt%2 == 1){ |
| | | ui->groupBox->hide(); |
| | | ui->pushButton_multiSearch->setText("多维度数据查询👆"); |
| | | }else{ |
| | | ui->groupBox->show(); |
| | | ui->pushButton_multiSearch->setText("多维度数据查询👇"); |
| | | } |
| | | 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(); |
| | | } |
| | | } |
| | | } |