| | |
| | | #include <QPushButton> |
| | | #include <QDebug> |
| | | #include <QSqlQuery> |
| | | #include <QFile> |
| | | #include <QProcess> |
| | | |
| | | extern int g_comId; |
| | | extern QString g_auditDate; |
| | | extern QString g_dataRootPath; |
| | | |
| | | ProblemMoney::ProblemMoney(QWidget *parent) : |
| | | QMainWindow(parent), |
| | |
| | | QStringList files = QFileDialog::getOpenFileNames(); |
| | | QString str; |
| | | for(auto f:files){ |
| | | str += f + " "; |
| | | copyFile(f); |
| | | QString targetPath = g_dataRootPath + QString("/%1/%2").arg(g_comId).arg(f.split("/").back()); |
| | | str += targetPath + " "; |
| | | } |
| | | ui->tableWidget->setItem(i,4,new QTableWidgetItem(str)); |
| | | }); |
| | | |
| | | // 查看佐证 |
| | | QPushButton *lookBtn = new QPushButton("查看",this); |
| | | ui->tableWidget->setCellWidget(i,5,lookBtn); |
| | | connect(lookBtn,&QPushButton::clicked,this,[=]{ |
| | | QStringList files = ui->tableWidget->item(i,4)->text().split(" "); |
| | | if(files.size() > 0 ){ |
| | | QString f = files.at(0); |
| | | qDebug()<<"f:"<<f; |
| | | if(f.size() > 10){ |
| | | f.replace("/", "\\"); //win32下替换斜杠 |
| | | QProcess process; |
| | | process.startDetached("explorer", QStringList() << QString("/select,") << QString("%1").arg(f)); |
| | | } |
| | | } |
| | | }); |
| | | } |
| | | } |
| | |
| | | ProblemMoney::~ProblemMoney() |
| | | { |
| | | delete ui; |
| | | } |
| | | |
| | | void ProblemMoney::copyFile(QString path) |
| | | { |
| | | QStringList paths = path.split("/"); |
| | | QString comPath = g_dataRootPath + QString("/%1").arg(g_comId); |
| | | QDir comDir(comPath); |
| | | if(!comDir.exists()){ |
| | | // 创建路径 |
| | | if(QDir().mkdir(comPath)){ |
| | | qDebug()<<"创建目录成功:"<<comPath; |
| | | } |
| | | } |
| | | QString targetPath = g_dataRootPath + QString("/%1/%2").arg(g_comId).arg(paths.back()); |
| | | qDebug()<<"targetPath"<<targetPath; |
| | | if(QFile::copy(path,targetPath)){ |
| | | qDebug()<<"成功拷贝:"<<path; |
| | | }else{ |
| | | qDebug()<<"拷贝失败"<<path; |
| | | } |
| | | } |
| | | |
| | | void ProblemMoney::on_pushButton_clicked() |
| | |
| | | } |
| | | // 统计 |
| | | on_tableWidget_activated(QModelIndex()); |
| | | qDebug()<<"g_dataRootPath"<<g_dataRootPath; |
| | | |
| | | } |
| | | |
| | | void ProblemMoney::on_tableWidget_activated(const QModelIndex &index) |