From bbacbbede6a3c7265f165642ab19afb61bbcac8d Mon Sep 17 00:00:00 2001
From: wumu <mayi@mayi.com>
Date: 星期一, 02 十二月 2024 23:31:57 +0800
Subject: [PATCH] 1202

---
 internal_system_v1/problemmoney.cpp |   49 +++++++++++++++++++++++++++++++++++++++++++++++--
 1 files changed, 47 insertions(+), 2 deletions(-)

diff --git a/internal_system_v1/problemmoney.cpp b/internal_system_v1/problemmoney.cpp
index b592b42..5c82f91 100644
--- a/internal_system_v1/problemmoney.cpp
+++ b/internal_system_v1/problemmoney.cpp
@@ -1,11 +1,16 @@
-#include "problemmoney.h"
+锘�#include "problemmoney.h"
 #include "ui_problemmoney.h"
 #include <QPushButton>
 #include <QDebug>
 #include <QSqlQuery>
+#include <QFile>
+#include <QProcess>
+
+#pragma execution_character_set("utf-8")
 
 extern int g_comId;
 extern QString g_auditDate;
+extern QString g_dataRootPath;
 
 ProblemMoney::ProblemMoney(QWidget *parent) :
     QMainWindow(parent),
@@ -21,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));
+                }
+            }
         });
     }
 }
@@ -31,6 +54,26 @@
 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()
@@ -67,6 +110,8 @@
     }
     // 缁熻
     on_tableWidget_activated(QModelIndex());
+    qDebug()<<"g_dataRootPath"<<g_dataRootPath;
+
 }
 
 void ProblemMoney::on_tableWidget_activated(const QModelIndex &index)

--
Gitblit v1.8.0