地质所 沉降监测网建设项目
suerwei
2024-05-18 563619a5cb13b6f9fdaac2a87467780ced71c135
附件详情
3个文件已修改
2个文件已添加
152 ■■■■■ 已修改文件
javaweb-plus/javaweb-cms/src/main/java/com/javaweb/geo/controller/ProjectDataController.java 49 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
javaweb-plus/javaweb-cms/src/main/java/com/javaweb/geo/vo/FileVo.java 23 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
javaweb-plus/javaweb-cms/src/main/resources/templates/geo/project/project.html 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
javaweb-plus/javaweb-cms/src/main/resources/templates/geo/projectData/files.html 68 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
javaweb-plus/javaweb-cms/src/main/resources/templates/geo/projectData/projectData.html 7 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
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);
    }
}
javaweb-plus/javaweb-cms/src/main/java/com/javaweb/geo/vo/FileVo.java
New file
@@ -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;
    }
}
javaweb-plus/javaweb-cms/src/main/resources/templates/geo/project/project.html
@@ -63,6 +63,11 @@
                    checkbox: true
                },
                {
                        field : 'ids',
                        title : '主键',
                        visible: false
                    },
                {
                        field : 'code',
                        title : '场地编号',
                        sortable:true
javaweb-plus/javaweb-cms/src/main/resources/templates/geo/projectData/files.html
New file
@@ -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>
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>