地质所 沉降监测网建设项目
chenhuan
2024-05-21 259f95deb2ea38287d488d12060d7600c36cd92a
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
<!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 :: select2-css" />
</head>
 
<body class="gray-bg">
    <div class="container-div">
        <div class="row">
            <div class="col-sm-12 search-collapse">
                <form id="formId"  enctype="multipart/form-data">
                    <div class="select-list">
                        <ul>
 
                             <li>
                                <p>上传文件:</p>
                               <input type="file" id="file" name="file"/>       
                             </li>  
                             
                             <li>
                                 <a class="btn btn-primary btn-rounded btn-sm" onclick="upload()"><i class="fa fa-upload"></i>&nbsp;上传</a>
                             </li>
                        </ul>
                    </div>
                </form>
            </div>
 
            <div class="col-sm-12 select-table table-striped">
                <h3>1、支持单文件和多文件模式<br> </h3>
                <h3>2、多个文件请以.ZIP压缩包的形式上传,把单个或者多个文件放到文件夹中,压缩文件夹为zip格式<br> </h3>
                <h3>3、文件不允许包含特殊字符:空格 、正反斜线、问号、星号等<br> </h3>
                <h3>4、上传文件经过了 解压 、 移动  、遍历 、更新数据库等多个步骤,请耐心等待<br> </h3>
            </div>
        </div>
    </div>
 
    <th:block th:include="include :: footer" />
    <th:block th:include="include :: select2-js" />
    <script th:inline="javascript">
        var projectDataId = [[${projectDataId}]];
    
    function upload(){
        var file = $('#file').val();
        if (file == '' || (!$.common.endWith(file, '.zip'))){
            $.modal.msgWarning("请选择待上传的文件");
            return false;
        }
    
        var formData = new FormData();
        formData.append("file", $('#file')[0].files[0]);
        formData.append("projectDataId", projectDataId);
        $.modal.loading("数据上传解析中");
 
        $.ajax({
            url: ctx + "geo/projectData/uploadZIP",
            data: formData,
            cache: false,
            contentType: false,
            processData: false,
            type: 'POST',
            success: function (result) {
                if (result.code == web_status.SUCCESS) {
                    $.modal.closeLoading();    
                    $.modal.alertSuccess(result.msg);
                } else if (result.code == web_status.WARNING) {
 
                    $.modal.closeLoading();        
                    $.modal.alertWarning(result.msg)
                } else {
                
                    $.modal.closeLoading();
                    $.modal.alertError(result.msg);
                }
            }
        });
    }
 
    </script>
</body>
 
</html>