From 563619a5cb13b6f9fdaac2a87467780ced71c135 Mon Sep 17 00:00:00 2001
From: suerwei <18810552194@163.com>
Date: 星期六, 18 五月 2024 16:22:39 +0800
Subject: [PATCH] 附件详情
---
javaweb-plus/javaweb-cms/src/main/java/com/javaweb/geo/controller/ProjectDataController.java | 49 ++++++++++++++++
javaweb-plus/javaweb-cms/src/main/resources/templates/geo/projectData/projectData.html | 7 ++
javaweb-plus/javaweb-cms/src/main/java/com/javaweb/geo/vo/FileVo.java | 23 +++++++
javaweb-plus/javaweb-cms/src/main/resources/templates/geo/projectData/files.html | 68 ++++++++++++++++++++++
javaweb-plus/javaweb-cms/src/main/resources/templates/geo/project/project.html | 5 +
5 files changed, 151 insertions(+), 1 deletions(-)
diff --git a/javaweb-plus/javaweb-cms/src/main/java/com/javaweb/geo/controller/ProjectDataController.java b/javaweb-plus/javaweb-cms/src/main/java/com/javaweb/geo/controller/ProjectDataController.java
index f99e75f..73a71ef 100644
--- a/javaweb-plus/javaweb-cms/src/main/java/com/javaweb/geo/controller/ProjectDataController.java
+++ b/javaweb-plus/javaweb-cms/src/main/java/com/javaweb/geo/controller/ProjectDataController.java
@@ -1,7 +1,12 @@
package com.javaweb.geo.controller;
+import java.io.File;
+import java.util.ArrayList;
import java.util.List;
+import cn.hutool.core.io.FileUtil;
+import com.javaweb.common.config.Global;
+import com.javaweb.geo.vo.FileVo;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
@@ -70,6 +75,16 @@
}
mmap.put("urlAddress",path);
return prefix + "/image_view";
+ }
+
+ /**
+ * 椤圭洰鏂囦欢鍒楄〃椤甸潰
+ * @return
+ */
+ @GetMapping("/projectDataFileList")
+ public String projectDataFileList(String id ,ModelMap modelMap){
+ modelMap.put("id",id);
+ return prefix + "/files";
}
/**
@@ -159,4 +174,38 @@
return projectDataService.uploadZIP(file,request);
}
+ /**
+ * 鑾峰彇鏂囦欢鍒楄〃
+ * @param id
+ * @return
+ */
+ @PostMapping( "/listFile")
+ @ResponseBody
+ public TableDataInfo listFile(String id){
+ List<FileVo> paths = new ArrayList<>();
+ ProjectData projectData = projectDataService.selectProjectDataById(id);
+// if (!ObjectUtils.isEmpty(projectData)){
+// String num = project.getNum();
+//
+// String diskPath = Global.getUploadPath() + "\\sources\\椤圭洰璧勬枡\\"+num;
+//
+// File file = new File(diskPath);
+//
+// if(FileUtil.exist(file)){
+// if(file.isDirectory()){
+// File []lists = file.listFiles();
+// for(int i =0;i<lists.length;i++){
+// String name =lists[i].getName();
+// String path = urlPrefixPath + num + "/" +name;
+// FileVo vo = new FileVo() ;
+// vo.setName(name);
+// vo.setPath(path);
+// paths.add(vo);
+// }
+// }
+// }
+// }
+ return getDataTable(paths);
+ }
+
}
diff --git a/javaweb-plus/javaweb-cms/src/main/java/com/javaweb/geo/vo/FileVo.java b/javaweb-plus/javaweb-cms/src/main/java/com/javaweb/geo/vo/FileVo.java
new file mode 100644
index 0000000..7f7dcb7
--- /dev/null
+++ b/javaweb-plus/javaweb-cms/src/main/java/com/javaweb/geo/vo/FileVo.java
@@ -0,0 +1,23 @@
+package com.javaweb.geo.vo;
+
+public class FileVo {
+
+ private String path ;
+ private String name ;
+
+ public String getPath() {
+ return path;
+ }
+
+ public void setPath(String path) {
+ this.path = path;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+}
diff --git a/javaweb-plus/javaweb-cms/src/main/resources/templates/geo/project/project.html b/javaweb-plus/javaweb-cms/src/main/resources/templates/geo/project/project.html
index 568865c..3384ce3 100644
--- a/javaweb-plus/javaweb-cms/src/main/resources/templates/geo/project/project.html
+++ b/javaweb-plus/javaweb-cms/src/main/resources/templates/geo/project/project.html
@@ -62,6 +62,11 @@
columns: [{
checkbox: true
},
+ {
+ field : 'ids',
+ title : '涓婚敭',
+ visible: false
+ },
{
field : 'code',
title : '鍦哄湴缂栧彿',
diff --git a/javaweb-plus/javaweb-cms/src/main/resources/templates/geo/projectData/files.html b/javaweb-plus/javaweb-cms/src/main/resources/templates/geo/projectData/files.html
new file mode 100644
index 0000000..ed45897
--- /dev/null
+++ b/javaweb-plus/javaweb-cms/src/main/resources/templates/geo/projectData/files.html
@@ -0,0 +1,68 @@
+<!DOCTYPE html>
+<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
+<head>
+ <th:block th:include="include :: header('璧勬枡鍒楄〃')" />
+ <th:block th:include="include :: bootstrap-fileinput-css" />
+</head>
+<body class="gray-bg">
+ <div class="container-div">
+ <div class="row">
+ <div class="col-sm-12 select-table table-striped">
+ <table id="bootstrap-table"></table>
+ </div>
+ </div>
+ </div>
+ <th:block th:include="include :: footer" />
+
+ <script th:inline="javascript">
+
+ var id =[[${id}]];
+ var prefix = ctx + "geo/projectData";
+
+ $(function() {
+ var options = {
+ showFooter: true,
+ showSearch: false,
+ showRefresh: false,
+ showToggle: false,
+ showColumns: false,
+ url: prefix + "/listFile?id=" + id,
+ modalName: "璧勬枡鍒楄〃",
+ columns: [{
+ checkbox: true
+ },
+ {
+ field : 'name',
+ title : '鏂囦欢鍚嶇О'
+
+ },
+ {
+ field : 'path',
+ title : '鏂囦欢璺緞',
+ visible:false
+ },
+ {
+ title: '鎿嶄綔',
+ align: 'center',
+ formatter: function(value, row, index) {
+ var actions = [];
+ actions.push('<a class="btn btn-warning btn-xs ' + '" href="javascript:void(0)" onclick="file(\'' + row.path + '\')"><i class="fa fa-eye"></i>鏌ョ湅</a> ');
+ return actions.join('');
+ }
+ }
+ ]
+ };
+ $.table.init(options);
+ });
+
+ /**
+ * 鎵撳紑鏂囦欢
+ * @param path
+ */
+ function file(path) {
+ window.open(path);
+ }
+ </script>
+</body>
+
+</html>
\ No newline at end of file
diff --git a/javaweb-plus/javaweb-cms/src/main/resources/templates/geo/projectData/projectData.html b/javaweb-plus/javaweb-cms/src/main/resources/templates/geo/projectData/projectData.html
index 50579ed..fdb6426 100644
--- a/javaweb-plus/javaweb-cms/src/main/resources/templates/geo/projectData/projectData.html
+++ b/javaweb-plus/javaweb-cms/src/main/resources/templates/geo/projectData/projectData.html
@@ -96,7 +96,7 @@
var actions = [];
actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="$.operate.edit(\'' + row.id + '\')"><i class="fa fa-edit"></i>缂栬緫</a> ');
actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="javascript:void(0)" onclick="$.operate.remove(\'' + row.id + '\')"><i class="fa fa-remove"></i>鍒犻櫎</a> ');
- actions.push('<a class="btn btn-info btn-xs ' + '" href="javascript:void(0)" onclick="viewImg(\'' + row.dataUrl + '\' , \'' + row.id + '\')"><i class="glyphicon glyphicon-menu-hamburger"></i>鏌ョ湅闄勪欢</a>');
+ actions.push('<a class="btn btn-info btn-xs ' + '" href="javascript:void(0)" onclick="viewResource(\'' + row.id + '\' , \'' + row.id + '\')"><i class="glyphicon glyphicon-menu-hamburger"></i>鏌ョ湅闄勪欢</a>');
return actions.join('');
}
}]
@@ -119,6 +119,11 @@
var url = prefix + "/viewImage?id=" + id;
$.modal.open("鏌ョ湅鍥剧墖", url, 800, 600);
}
+
+ //鏌ョ湅璧勬枡
+ function viewResource(id){
+ $.modal.open("璧勬枡鍒楄〃", prefix + "/projectDataFileList?id=" + id, 800, 600);
+ }
</script>
</body>
</html>
\ No newline at end of file
--
Gitblit v1.9.1