<a class="mini-button" iconCls="icon-download" onclick="mbdownload()">模板下载</a>
<%--选择文件按钮--%>
<input type="file" name="uploadFile" id="uploadFile" style="width:220px;height:28px;vertical-align: middle"/>
<a class="mini-button" iconCls="icon-import" onclick="doSetData()">信息导入</a>
<a class="mini-button" iconCls="icon-export" onclick="errInfoDown()">错误信息导出</a>
//模板下载
function mbdownload(){
debugger;
setTimeout(function () {
window.open("${basePath}/xxgl/downFile");
mini.showTips({
content: " <b>下载成功!</b>",
state: "success",
x: "center",
y: "center",
timeout:1000
});
},300);
}
//清屏
function doClear() {
errInfoGrid.clearRows();
}
//导入
function doSetData() {
var fileInput = $(‘#uploadFile‘).get(0).files[0];
console.info(fileInput);
if(!fileInput){
mini.alert("请选择上传文件!");
}else{
mini.mask({
el: document.body,
cls: ‘mini-mask-loading‘,
html: ‘Excle表格数据上传中,请稍等...‘
});
errInfoGrid.clearRows();
$.ajaxFileUpload({
url: "${basePath}/knqzxxgl/fileImport",
fileElementId: ‘uploadFile‘, //文件上传域的ID
dataType: ‘json‘,
success: function (data) {
mini.unmask();
if (data.exception == undefined || data.exception == ""
||data.exception == null ) {
errInfoGrid.setData(data.errorList);
mini.alert(data.message);
} else {
mini.alert(data.exception);
}
},
error: function (error) {
mini.unmask();
mini.alert("系统异常,原因:" + mini.encode(error));
}
});
}
}
//导出
function errInfoDown(){
var errInfoData =errInfoGrid.data;
if(errInfoData.length==0){
mini.alert("无错误信息!");
return;
}
var url = "${basePath}/xxgl/errInfoDown";
window.open(url);
}