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/problemcount.cpp |   45 +++++++++++++++++++++++++++++++++++++++++++--
 1 files changed, 43 insertions(+), 2 deletions(-)

diff --git a/internal_system_v1/problemcount.cpp b/internal_system_v1/problemcount.cpp
index d7e89e1..1dfacee 100644
--- a/internal_system_v1/problemcount.cpp
+++ b/internal_system_v1/problemcount.cpp
@@ -1,12 +1,16 @@
-#include "problemcount.h"
+锘�#include "problemcount.h"
 #include "ui_problemcount.h"
 #include <QDebug>
 #include <QFileDialog>
+#include <QProcess>
 #include <QPushButton>
 #include <QSqlQuery>
 
+#pragma execution_character_set("utf-8")
+
 extern int g_comId;
 extern QString g_auditDate;
+extern QString g_dataRootPath;
 
 ProblemCount::ProblemCount(QWidget *parent) :
     QMainWindow(parent),
@@ -22,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));
+                }
+            }
         });
     }
 }
@@ -34,6 +56,25 @@
     delete ui;
 }
 
+void ProblemCount::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 ProblemCount::on_tableWidget_clicked(const QModelIndex &index)
 {
     qDebug()<<"index"<<index;

--
Gitblit v1.8.0