1、导入t:upload标签
<t:upload name="fiels" buttonText="选择文件" uploader="predictOrderController.do?importonlyone" extend="*.xls;*.xlsx" id="file_upload" formData="templates,productId,cargotypeCode,customerId" onUploadSuccess="uploadFile" auto="true" onFileAdded="onFileAddedaa"> <input id="customerId" name="customerId" type="hidden" class="inputxt"/> <input id="productId" name="productId" type="hidden" class="inputxt" /> <input id="cargotypeCode" name="cargotypeCode" type="hidden" class="inputxt" value="P"/> <input id="barcode" name="barcode" type="hidden" value="Y"/> </t:upload>
2、添加文件时方法
function onFileAddedaa(){ $.messager.progress({ title:'请稍后', msg:'数据导入中...',text:'努力中...' }); //$.messager.progress('close'); }
3、提交成功后方法
function uploadFile(data){ var msg = data.msg; msg = msg.replace(/\n/g,"<br>") $("#res").html(msg); $.messager.progress('close'); }