地质所 沉降监测网建设项目
chenhuan
2024-05-20 c6f79f5720c5d4a700b8b759a93393559409fd1c
javaweb-plus/javaweb-cms/src/main/resources/templates/geo/projectData/upload.html
New file
@@ -0,0 +1,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-search"></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>