From 20ffcfb5507daf34f81346ca3dfa4c031e7b2fe3 Mon Sep 17 00:00:00 2001 From: wumu <mayi@mayi.com> Date: 星期日, 27 四月 2025 22:13:53 +0800 Subject: [PATCH] 0427 --- internal_system_v1/problemnotmoney.cpp | 45 +++++++++++++++++++++++++++++++++++++++++++-- 1 files changed, 43 insertions(+), 2 deletions(-) diff --git a/internal_system_v1/problemnotmoney.cpp b/internal_system_v1/problemnotmoney.cpp index 5c3b0d1..7118998 100644 --- a/internal_system_v1/problemnotmoney.cpp +++ b/internal_system_v1/problemnotmoney.cpp @@ -1,13 +1,16 @@ -#include "problemnotmoney.h" +锘�#include "problemnotmoney.h" #include "ui_problemnotmoney.h" #include <QFileDialog> #include <QPushButton> #include <QSqlQuery> #include <QDebug> +#include <QProcess> +#pragma execution_character_set("utf-8") extern int g_comId; extern QString g_auditDate; +extern QString g_dataRootPath; ProblemNotMoney::ProblemNotMoney(QWidget *parent) : QMainWindow(parent), @@ -23,9 +26,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 +56,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