|
|
|
@ -93,22 +93,28 @@ module System{
|
|
|
|
|
data: JSON.stringify(fileNameList),
|
|
|
|
|
contentType: "application/json; charset=utf-8",
|
|
|
|
|
complete: (XMLHttpRequest, textStatus) =>{
|
|
|
|
|
$("#load").remove();
|
|
|
|
|
Kubernetes.removeMask();
|
|
|
|
|
if(XMLHttpRequest.status == 200){
|
|
|
|
|
Configs.customAlert("提示", "操作成功: 本次excel文件录入成功!", '',null, 0, "success");
|
|
|
|
|
}else{
|
|
|
|
|
Configs.customAlert("提示", "操作失败: 本次excel文件录入失败", '',null, 0, "error");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
},
|
|
|
|
|
success : (data) =>{
|
|
|
|
|
$("#load").remove();
|
|
|
|
|
Kubernetes.removeMask();
|
|
|
|
|
$scope.model = SystemModel.systemInfoList = data.data;
|
|
|
|
|
$scope.tableParams.settings({
|
|
|
|
|
dataset: $scope.model
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
Configs.customAlert("提示", "操作成功: 本次excel文件录入成功!", '',null, 0, "success");
|
|
|
|
|
},
|
|
|
|
|
error: (MLHttpRequest, textStatus, errorThrown) =>{
|
|
|
|
|
//Configs.customAlert("提示", "操作失败: 本次excel文件录入失败, " + textStatus, '',null, 0, "error");
|
|
|
|
|
error: (XMLHttpRequest, textStatus, errorThrown) =>{
|
|
|
|
|
$("#load").remove();
|
|
|
|
|
Kubernetes.removeMask();
|
|
|
|
|
if(XMLHttpRequest["responseJSON"].err && XMLHttpRequest["responseJSON"].err instanceof Array)
|
|
|
|
|
ngDialog.open({
|
|
|
|
|
template: 'uploadErrorInfo.html',
|
|
|
|
|
width: 790,
|
|
|
|
|
closeByDocument: false,
|
|
|
|
|
data: XMLHttpRequest["responseJSON"].err,
|
|
|
|
|
className: 'ngdialog-theme-default'
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
@ -124,81 +130,7 @@ module System{
|
|
|
|
|
element.outerHTML = element.outerHTML;
|
|
|
|
|
}
|
|
|
|
|
}, true);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$scope.upLoadExcelFiles = (files) =>{
|
|
|
|
|
var fileNameList = []; //获取文件名列表
|
|
|
|
|
angular.forEach(files, (file) => {
|
|
|
|
|
fileNameList.push(file.name);
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
Configs.create_mask();
|
|
|
|
|
Kubernetes.create_locadEffect("正在上传文件...");
|
|
|
|
|
var target = document.getElementById('loading');
|
|
|
|
|
var spinner = new Spinner(Kubernetes.loadConfigs()).spin(target);
|
|
|
|
|
|
|
|
|
|
var r = new Resumable({
|
|
|
|
|
target:'/java/console/api/fileOperation/file/upload',
|
|
|
|
|
chunkSize:1*1024*1024,
|
|
|
|
|
simultaneousUploads:4,
|
|
|
|
|
testChunks: false,
|
|
|
|
|
throttleProgressCallbacks:1,
|
|
|
|
|
method: "octet"
|
|
|
|
|
/*headers: {
|
|
|
|
|
"Content-Type": "application/x-www-form-urlencoded;charset=utf-8"
|
|
|
|
|
}*/
|
|
|
|
|
});
|
|
|
|
|
if(!r.support){
|
|
|
|
|
throw "当前浏览器不支持Resumable.js文件上传";
|
|
|
|
|
}else{
|
|
|
|
|
angular.forEach(files, (file) => {
|
|
|
|
|
r.addFile(file);
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
r.on('fileAdded', function(file){
|
|
|
|
|
r.upload();
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
r.on('complete', function(){
|
|
|
|
|
$('#loadmsg').html("所以文件上传完毕,正在读取文件中的数据,此过程时间可能会较长,请稍等...");
|
|
|
|
|
$.ajax({
|
|
|
|
|
type: "POST",
|
|
|
|
|
url: UrlHelpers.join("/java/console/api/fileOperation/importExcel"),
|
|
|
|
|
timeout: 8000 * fileNameList.length,
|
|
|
|
|
dataType: 'json',
|
|
|
|
|
data: JSON.stringify(fileNameList),
|
|
|
|
|
contentType: "application/json; charset=utf-8",
|
|
|
|
|
complete: (XMLHttpRequest, textStatus) =>{
|
|
|
|
|
$("#load").remove();
|
|
|
|
|
Kubernetes.removeMask();
|
|
|
|
|
if(XMLHttpRequest.status == 200){
|
|
|
|
|
Configs.customAlert("提示", "操作成功: 本次excel文件录入成功!", '',null, 0, "success");
|
|
|
|
|
}else{
|
|
|
|
|
Configs.customAlert("提示", "操作失败: 本次excel文件录入失败", '',null, 0, "error");
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
success : (data) =>{
|
|
|
|
|
$scope.model = SystemModel.systemInfoList = data.data;
|
|
|
|
|
$scope.tableParams.settings({
|
|
|
|
|
dataset: $scope.model
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
error: (MLHttpRequest, textStatus, errorThrown) =>{
|
|
|
|
|
//Configs.customAlert("提示", "操作失败: 本次excel文件录入失败, " + textStatus, '',null, 0, "error");
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
r.on('fileProgress', function(file){
|
|
|
|
|
$('#loadmsg').html("上传文件:" + file.fileName + " " + Math.floor(r.progress()*100) + '%');
|
|
|
|
|
//Kubernetes.create_locadEffect("上传文件:" + file.name + " " + Math.floor(r.progress()*100) + '%'); //创建数据加载效果层
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
//解决不同重复选择相同文件
|
|
|
|
|
var element = document.getElementById("file-uploads");
|
|
|
|
|
element.outerHTML = element.outerHTML;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//excel下载
|
|
|
|
|
$scope.downLoadExcelFile = () =>{
|
|
|
|
|