You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
@{ ViewBag.Title = "Form"; Layout = "~/Views/Shared/_Form.cshtml"; }
<link href="~/Content/css/bootstrap/bootstrap-select.css" rel="stylesheet" /> <link href="~/Content/css/toastr.min.css" rel="stylesheet" /> <script src="~/Content/js/datepicker/WdatePicker.js"></script> <script src="~/Content/js/bootstrap/bootstrap-select.min.js"></script> <script src="~/Content/js/toastr.min.js"></script> <script src="~/Content/js/parseForm.js"></script>
<style> .u-file-btn { position: relative; direction: ltr; height: 23px; overflow: hidden; line-height: 23px; margin-right: 10px; padding: 3px 0; text-align: center; width: 105px; color: black; background: #D0EEFF; border: 1px solid #1281c1; border-radius: 4px; color: #fff; background-color: #1281c1; border-color: #1281c1; }
.u-file-btn-input { cursor: pointer; text-align: right; z-index: 10; font-size: 118px; /* font-size: 118px 工作正常 */ position: absolute; top: 0px; right: 0px; opacity: 0; filter: Alpha(opacity:0); } </style> <script type="text/javascript"> toastr.options.positionClass = 'toast-center-center'; </script>
<form id="form1">
<div style="padding-top: 20px; ">
<table class="form" style="text-align:left"> <tr> <td class="formValue" colspan="2">
<img src="~/Content/img/Excel.png" style="width:22px;height:22px" /> <a href="~/ReportFile/工单条码导入模板.xlsx" style="color:darkblue; ">原条码导入模板 </a> (支持"xls","xlsx"格式)
</td> </tr> <tr> <td> <label id="showFileName"></label> </td> </tr> <tr> <td class="formValue" style="width:125px"> <div id="u-file-c" class="u-file-btn">
<input id="FileUp" type="file" class="u-file-btn-input" name="files" accept=".csv, application/vnd.ms-excel, application/vnd.openxmlformats-officedocument.spreadsheetml.sheet" style="width:350px" />选择上传文件 </div> </td>
<td class="formValue"> <a id="NF-ExportCurrentStock" authorize="yes" class="btn btn-primary dropdown-text" onclick="Upload()"><i class="fa fa-download"></i>导入数据</a> </td> </tr>
</table>
</div>
</form>
<script>
$(".u-file-btn").on("change", "input[type='file']", function () { var filePath = $(this).val(); if (filePath.indexOf("xls") != -1 || filePath.indexOf("xlsx") != -1) {
var arr = filePath.split('\\'); var fileName = arr[arr.length - 1];
document.getElementById("showFileName").innerText = fileName; } else {
document.getElementById("showFileName").innerText = ""; alert("您未上传文件,或者您上传文件类型有误!"); return false } })
$(function () { //var day = new Date(); //day.setTime(day.getTime()); //var Year = day.getFullYear(); //document.getElementById("txt_Year").value = Year; });
function Upload() {
var form = new FormData(document.getElementById("form1"));
$.ajax({ url: "/WMS/WMSCreateItemLot/UploadFile?" + Math.random(), type: "post", data: form, contentType: false, processData: false, success: function (data) { if (data == "true" || data == true) { //alert("上传成功"); //layer.msg("上传成功"); $.modalAlertNew("WMS00014"); window.setTimeout(function () { $.modalClose(); }, 2500); $.currentWindow().$("#gridList").trigger("reloadGrid"); } else { //alert("上传失败:" + data); $.modalAlertNew("WMS00016", data); } }, error: function (aa) { $.modalAlertNew("WMS00016", aa); } });
document.getElementById("FileUp").value = "";
}
</script>
|