From dfef23453ad106efad95e40cbeaa191d8b3f6961 Mon Sep 17 00:00:00 2001 From: wumu <mayi@mayi.com> Date: 星期四, 21 九月 2023 23:07:45 +0800 Subject: [PATCH] 0921 --- internal_system_v1/problemnotmoney.cpp | 42 +++++++++++++++++++++++++++++++++++++++++- 1 files changed, 41 insertions(+), 1 deletions(-) diff --git a/internal_system_v1/problemnotmoney.cpp b/internal_system_v1/problemnotmoney.cpp index 5c3b0d1..bd03320 100644 --- a/internal_system_v1/problemnotmoney.cpp +++ b/internal_system_v1/problemnotmoney.cpp @@ -5,9 +5,11 @@ #include <QPushButton> #include <QSqlQuery> #include <QDebug> +#include <QProcess> extern int g_comId; extern QString g_auditDate; +extern QString g_dataRootPath; ProblemNotMoney::ProblemNotMoney(QWidget *parent) : QMainWindow(parent), @@ -23,9 +25,27 @@ 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)); + } + } }); } } @@ -35,6 +55,26 @@ delete ui; } +void ProblemNotMoney::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 ProblemNotMoney::on_tableWidget_clicked(const QModelIndex &index) { int allCnt = 0; -- Gitblit v1.8.0