zoukankan      html  css  js  c++  java
  • 导入导出

    <!-- 导入页面 -->
    <div class="modal-dialog" id='ImportMoadl' style='display:none;'>
    <div class="modal-content" style='z-index: 9999;'>
    <div class="modal-header">
    <button type="button" onclick='onExit()' class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
    <h4 class="modal-title">导入终端信息</h4>
    </div>
    <div class="modal-body">
    <form id="terminalUploadForm" >
    <div class="row">
    <div class="col-sm-6 form-group">
    <input id="filePath" name="filePath" class="file-loading"
    type="file" multiple accept=".xls,.xlsx" data-min-file-count="1"
    data-show-preview="true">
    <input class="form-control" id="fileName" name="fileName" type=hidden
    data-bv-remote-name="value" disabled="disabled" />
    </div>
    <div class="col-sm-6 form-group">
    <a onclick="onImportModel()" style="cursor: pointer; " >请下载导入的模板</a>
    </div>
    </div>

    </form>
    </div>
    <div class="modal-footer text-center">
    <button type="button" class="btn btn-primary" onclick="uploadInfo();">提交</button>
    <button type="button" class="btn btn-default" onclick="onExit();">取消</button>
    </div>
    </div>
    <div class="modal-backdrop fade in"></div>
    </div>

    js部分

    //导入
    function onImport(){
    $('#ImportMoadl').show();
    }
    //导入提交
    function uploadInfo(){
    alert(1)
    var filePath = document.getElementById("filePath");
    if (filePath.value == null || filePath.value == "" || filePath.value == undefined || filePath.value.length == 0) {
    return;
    } else {
    filePath = filePath.value;
    if (checkFiles(filePath) == ".xlsx" || checkFiles(filePath) == ".xls") {
    $.ajaxFileUpload({
    type : "get",
    url : '/sncp/terminal/onImport',
    fileElementId : 'filePath',// file标签的id
    dataType : 'json',// 返回数据的类型
    success : function(data) {
    $('#ImportMoadl').hide();
    if (data.success == false) {
    alertModal("导入成功!");
    $("#fileName").val(data.data);
    } else {
    alertModal("导入失败!");
    $('#ImportloserMoadl').show(); //显示失败下载弹框

    }
    },
    error : function(data) {
    alertModal("导入失败!");
    }
    });
    } else {
    alertModal('格式不正确!');
    }
    }
    }
    //检查文件后缀名
    function checkFiles(file_name) {
    var result = /.[^.]+/.exec(file_name);
    return result;
    }
    //导入取消
    function onExit(){
    alert(2);
    $('#ImportMoadl').hide();
    $('#ImportloserMoadl').hide();
    }
    //导入失败点击下载
    function onImportDefeatedModel(){

    }

    function onExport(){
    window.location.href = $ctx +"/t_user/onExport";
    }

  • 相关阅读:
    java处理特殊时间格式,2019-11-28T06:52:09.724+0000 转为常见格式2019-11-28 06:52:09,同时转为数据库日期格式Timestamp
    最近比较忙,处理项目上各种问题。此时有新任务来临,赶时间记录一个方法,加深对数组的理解
    springboot项目通过gradle运用capsule插件打可执行jar包
    HanLP 关键词提取。总结
    mmdet阅读笔记
    mmcv阅读笔记
    Monocular Real-time Hand Shape and Motion Capture using Multi-modal Data
    3D Hand Shape and Pose from Images in the Wild
    End to end recovery of human shape and pose
    工作小结五
  • 原文地址:https://www.cnblogs.com/benmumu/p/10437413.html
Copyright © 2011-2022 走看看