---新增文件包下载功能
This commit is contained in:
parent
a99f3620c1
commit
58ce6e6482
|
@ -6,4 +6,5 @@ declare module Configs {
|
|||
对象的深拷贝
|
||||
*/
|
||||
function deepCopy(object: any): any;
|
||||
function downloadFile($scope: any, $http: any, url: any, fn?: any): void;
|
||||
}
|
||||
|
|
|
@ -1,6 +1,9 @@
|
|||
/// <reference path="../../includes.d.ts" />
|
||||
/// <reference path="systemPlugin.d.ts" />
|
||||
/// <reference path="systemHelpers.d.ts" />
|
||||
/// <reference path="../../configs/ts/customAlert.d.ts" />
|
||||
/// <reference path="../../kubernetes/ts/kubernetesHelpers.d.ts" />
|
||||
/// <reference path="../../configs/ts/configsUtils.d.ts" />
|
||||
declare module System {
|
||||
var SystemListController: ng.IModule;
|
||||
}
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -108,55 +108,48 @@
|
|||
<h2 class="mb10">查看详情</h2>
|
||||
<li class="clear">
|
||||
<span class="fl box_chakan_leftinfo">行政区划代码:</span>
|
||||
<p class="fl box_chakan_mininfo">321202</p>
|
||||
<p class="fl box_chakan_mininfo">{{ngDialogData.areaCode}}</p>
|
||||
|
||||
</li>
|
||||
<li class="clear">
|
||||
<span class="fl box_chakan_leftinfo">行政区划:</span>
|
||||
<p class="fl box_chakan_mininfo"><span class="mr5">泰州市</span><span class="mr5">海陵区</span><span class="mr5">县级</span></p>
|
||||
<p class="fl box_chakan_mininfo"><span class="mr5">{{ngDialogData.cityName}}</span><span class="mr5">{{ngDialogData.districtName}}</span><span class="mr5">{{ngDialogData.areaLevel}}</span></p>
|
||||
</li>
|
||||
<li class="clear">
|
||||
<span class="fl box_chakan_leftinfo">信息系统名称:</span>
|
||||
<p class="fl box_chakan_mininfo">国库集中支付管理</p>
|
||||
<p class="fl box_chakan_mininfo">{{ngDialogData.sysName}}</p>
|
||||
<span class="fl box_chakan_leftinfo">信息系统版本:</span>
|
||||
<p class="fl box_chakan_mininfo">11B</p>
|
||||
<p class="fl box_chakan_mininfo">{{ngDialogData.dataVersion}}</p>
|
||||
|
||||
</li>
|
||||
<li class="clear">
|
||||
<span class="fl box_chakan_leftinfo">数据库类型:</span>
|
||||
<p class="fl box_chakan_mininfo"><span>ORACLE</span><span class="ml5 mr5">/</span><span >11B</span></p>
|
||||
<span class="fl box_chakan_leftinfo">字符集:</span>
|
||||
<p class="fl box_chakan_mininfo">GBK</p>
|
||||
<p class="fl box_chakan_mininfo"><span>{{ngDialogData.dataBaseType}}</span><span class="ml5 mr5">/</span><span >{{ngDialogData.dataBaseVersion}}</span></p>
|
||||
<!--<span class="fl box_chakan_leftinfo">字符集:</span>
|
||||
<p class="fl box_chakan_mininfo">{{ngDialogData.charset}}}</p>-->
|
||||
</li>
|
||||
<li class="clear">
|
||||
<span class="fl box_chakan_leftinfo">投入使用时间:</span>
|
||||
<p class="fl box_chakan_mininfo"><span class="mr5">2009年</span><span>12月</span></p>
|
||||
<p class="fl box_chakan_mininfo"><span class="mr5">{{ngDialogData.beginUseTime}}</span></p>
|
||||
</li>
|
||||
<li class="clear">
|
||||
<span class="fl box_chakan_leftinfo">开发商全称:</span>
|
||||
<p class="fl box_chakan_maxinfo">常州富深协通技术有限公司</p>
|
||||
<p class="fl box_chakan_maxinfo">{{ngDialogData.developerFullName}}</p>
|
||||
</li>
|
||||
<li class="clear">
|
||||
<span class="fl box_chakan_leftinfo">联系人:</span>
|
||||
<p class="fl box_chakan_mininfo">姚虫虫</p>
|
||||
<p class="fl box_chakan_mininfo">{{ngDialogData.departmentManager}}</p>
|
||||
<span class="fl box_chakan_leftinfo">联系电话(手机):</span>
|
||||
<p class="fl box_chakan_mininfo">15515551555</p>
|
||||
<p class="fl box_chakan_mininfo">{{ngDialogData.managerContacts}}</p>
|
||||
</li>
|
||||
<li class="clear">
|
||||
<span class="fl box_chakan_leftinfo">功能描述:</span>
|
||||
<p class="fl box_chakan_maxinfo">记账记账记账记账记账记账记账记账记账记账记账记账记账记账记账记账记账记账记账记账记账记账记账记账记账记账记账记账记账记账记账记账记账</p>
|
||||
<p class="fl box_chakan_maxinfo">{{ngDialogData.functionDetails}}</p>
|
||||
</li>
|
||||
<li class="clear">
|
||||
<span class="fl box_chakan_leftinfo">业务范围:</span>
|
||||
<p class="fl box_chakan_maxinfo">
|
||||
<span class="mr5">部门预算管理</span>
|
||||
<span class="mr5">预算指标管理</span>
|
||||
<span class="mr5">财政经济景气预测与分析</span>
|
||||
<span class="mr5">政府性债务管理</span>
|
||||
<span class="mr5">部门预算管理</span>
|
||||
<span class="mr5">预算指标管理</span>
|
||||
<span class="mr5">财政经济景气预测与分析</span>
|
||||
<span class="mr5">政府性债务管理</span>
|
||||
<span class="mr5" ng-repeat='item in ngDialogData.workRange'>{{item}}</span>
|
||||
</p>
|
||||
</li>
|
||||
<li class="clear">
|
||||
|
|
|
@ -48,4 +48,102 @@ module Configs{
|
|||
return object;
|
||||
}
|
||||
}
|
||||
|
||||
export function downloadFile($scope, $http, url, fn?){
|
||||
$http.get(url, { responseType: 'arraybuffer' })
|
||||
.success( function(data, status, headers) {
|
||||
if(angular.isFunction(fn))
|
||||
fn();
|
||||
var octetStreamMime = 'application/octet-stream';
|
||||
var success = false;
|
||||
// Get the headers
|
||||
headers = headers();
|
||||
// Get the filename from the x-filename header or default to "服务列表"
|
||||
var filename = "服务文件";
|
||||
var params = headers['content-disposition'].split(";");
|
||||
for(var i = 0; i< params.length; i++){
|
||||
if(params[i].indexOf("filename") != -1){
|
||||
var tmp = params[i].split("=");
|
||||
if(tmp.length == 2)
|
||||
filename = tmp[1].replace(new RegExp("\"", "gm"),"");
|
||||
}
|
||||
}
|
||||
|
||||
// Determine the content type from the header or default to "application/octet-stream"
|
||||
var contentType = headers['content-type'] || octetStreamMime;
|
||||
try{
|
||||
// Try using msSaveBlob if supported
|
||||
console.log("Trying saveBlob method ...");
|
||||
var blob = new Blob([data], { type: contentType });
|
||||
if(navigator.msSaveBlob)
|
||||
navigator.msSaveBlob(blob, filename);
|
||||
else {
|
||||
// Try using other saveBlob implementations, if available
|
||||
var saveBlob = navigator["webkitSaveBlob"] || navigator["mozSaveBlob"] || navigator["saveBlob"];
|
||||
if(saveBlob === undefined) throw "Not supported";
|
||||
saveBlob(blob, filename);
|
||||
}
|
||||
console.log("saveBlob succeeded");
|
||||
success = true;
|
||||
} catch(ex){
|
||||
console.log("saveBlob method failed with the following exception:");
|
||||
console.log(ex);
|
||||
}
|
||||
if(!success){
|
||||
// Get the blob url creator
|
||||
var urlCreator = window.URL || window["webkitURL"] || window["mozURL"] || window["msURL"];
|
||||
if(urlCreator){
|
||||
// Try to use a download link
|
||||
var link = document.createElement('a');
|
||||
if('download' in link){
|
||||
// Try to simulate a click
|
||||
try{
|
||||
// Prepare a blob URL
|
||||
console.log("Trying download link method with simulated click ...");
|
||||
var blob = new Blob([data], { type: contentType });
|
||||
var url = urlCreator.createObjectURL(blob);
|
||||
link.setAttribute('href', url);
|
||||
// Set the download attribute (Supported in Chrome 14+ / Firefox 20+)
|
||||
link.setAttribute("download", filename);
|
||||
// Simulate clicking the download link
|
||||
var event = document.createEvent('MouseEvents');
|
||||
event.initMouseEvent('click', true, true, window, 1, 0, 0, 0, 0, false, false, false, false, 0, null);
|
||||
link.dispatchEvent(event);
|
||||
console.log("Download link method with simulated click succeeded");
|
||||
success = true;
|
||||
}catch(ex) {
|
||||
console.log("Download link method with simulated click failed with the following exception:");
|
||||
console.log(ex);
|
||||
}
|
||||
}
|
||||
if(!success){
|
||||
// Fallback to window.location method
|
||||
try{
|
||||
// Prepare a blob URL
|
||||
// Use application/octet-stream when using window.location to force download
|
||||
console.log("Trying download link method with window.location ...");
|
||||
var blob = new Blob([data], { type: octetStreamMime });
|
||||
var url = urlCreator.createObjectURL(blob);
|
||||
window.location = url;
|
||||
console.log("Download link method with window.location succeeded");
|
||||
success = true;
|
||||
}catch(ex){
|
||||
console.log("Download link method with window.location failed with the following exception:");
|
||||
console.log(ex);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if(!success){
|
||||
// Fallback to window.open method
|
||||
console.log("No methods worked for saving the arraybuffer, using last resort window.open");
|
||||
window.open('_blank', '');
|
||||
Configs.customAlert("提示", "文件下载失败", '',null, 0, "error");
|
||||
}
|
||||
}).error(function(data, status) {
|
||||
console.log("Request failed with status: " + status);
|
||||
// Optionally write the error out to scope
|
||||
$scope.errorDetails = "Request failed with status: " + status;
|
||||
});
|
||||
}
|
||||
}
|
|
@ -74,6 +74,7 @@ module Configs{
|
|||
}]);
|
||||
|
||||
export var SystemInfoController = controller('SystemInfoController', ['$scope', ($scope) =>{
|
||||
|
||||
var model = $scope.ngDialogData;
|
||||
//处理年月
|
||||
}]);
|
||||
}
|
|
@ -1859,6 +1859,9 @@ module Kubernetes {
|
|||
Kubernetes.createSuccessInfo("error", "连接汇总库失败,请检查服务集群中的汇总库配置是否正确!");
|
||||
setTimeout("Kubernetes.removeMask()", 1500);
|
||||
}
|
||||
},
|
||||
success: (data) => {
|
||||
|
||||
}
|
||||
});
|
||||
//Configs.oracleInfoOperate($http, "/java/console/api/oracle", Configs.OperateType.EXTRACT, data, fn);
|
||||
|
@ -1918,7 +1921,7 @@ module Kubernetes {
|
|||
*/
|
||||
export function create_locadEffect(msg){
|
||||
var tmp = "<div id=\"loading\"></div>"
|
||||
+ "<span>" + msg + "</span>";
|
||||
+ "<span id=\"loadmsg\">" + msg + "</span>";
|
||||
var load = document.createElement("div");
|
||||
load.id = "load";
|
||||
load.innerHTML = tmp;
|
||||
|
|
|
@ -1,42 +1,44 @@
|
|||
<div ng-controller="System.SystemListController">
|
||||
<div hawtio-tabs></div>
|
||||
<div class="container-content ">
|
||||
<div class="container-fluid sj_fluid">
|
||||
<div class="row clear fl">
|
||||
<div hawtio-tabs></div>
|
||||
<div class="container-content ">
|
||||
<div class="container-fluid sj_fluid">
|
||||
<div class="row clear fl">
|
||||
<!--<input type="checkbox" class="fl mr5 " style="margin-top: 8px;" />
|
||||
<label class="fl mr5 " style="margin-top: 5px; font-style:nomal;">全选</label>-->
|
||||
<span class="pull-right"> </span>
|
||||
<button class="btn pull-right sj_btn_grey " ng-disabled="!id && tableConfig.selectedItems.length == 0" ng-click="deletePrompt(id || tableConfig.selectedItems)">
|
||||
<i class="glyphicon glyphicon-open"></i> 脚本上传
|
||||
</button>
|
||||
<div class="btn pull-right sj_btn_grey ">
|
||||
<a class="data_file_btn fl">脚本上传</a>
|
||||
<input type="file" name="file-upload[]" id="file-uploads" onchange="angular.element(this).scope().sqlUpload(this.files);" accept="application/msexcel" multiple />
|
||||
</div>
|
||||
<span class="pull-right"> </span>
|
||||
<button class="btn pull-right sj_btn_grey " ng-disabled="!id && tableConfig.selectedItems.length == 0" ng-click="migrationClick.open(id || tableConfig.selectedItems)">
|
||||
<button class="btn pull-right sj_btn_grey " ng-click="downloadFilePackage()">
|
||||
<i class="glyphicon glyphicon-save"></i> 文件包导出
|
||||
</button>
|
||||
<span class="pull-right"> </span>
|
||||
<button class="btn pull-right sj_btn_grey " ng-disabled="!id && tableConfig.selectedItems.length == 0" ng-click="downLoadExcelFile()">
|
||||
<button class="btn pull-right sj_btn_grey " ng-click="downLoadExcelFile()">
|
||||
<i class="glyphicon glyphicon-export"></i> Excel导出
|
||||
</button>
|
||||
<span class="pull-right"> </span>
|
||||
<button class="btn pull-right sj_btn_grey " ng-disabled="!id && tableConfig.selectedItems.length == 0" ng-click="createOracleService(id || tableConfig.selectedItems)">
|
||||
<i class="glyphicon glyphicon-import"></i> Excel导入
|
||||
</button>
|
||||
<div class="btn pull-right sj_btn_grey ">
|
||||
<a class="data_file_btn fl" >导入到服务器</a><input type="file" name="file-upload[]" id="file-uploads" onchange="angular.element(this).scope().upLoadExcelFile(this.files)" multiple />
|
||||
<a class="data_file_btn fl">导入到服务器</a>
|
||||
<input type="file" name="file-upload[]" id="file-uploads" onchange="angular.element(this).scope().upLoadExcelFile(this.files);" accept="application/msexcel" multiple />
|
||||
</div>
|
||||
</div>
|
||||
<div ng-show="true">
|
||||
<div class="col-md-12" >
|
||||
<table ng-table-dynamic="tableParams with columns" class="table table-condensed table-bordered table-striped" >
|
||||
<tr ng-repeat="row in $data">
|
||||
<td ng-repeat="col in $columns">
|
||||
<span ng-show="col.field != 'id'">{{row[col.field]}}</span>
|
||||
<button class="btn sj_btn" ng-hide="col.field != 'id'" ng-click="viewClick(row)">查看</button>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div ng-show="true">
|
||||
<div class="col-md-12">
|
||||
<div ng-show="model.length == 0" class="alert alert-warning sj_alert-warning">
|
||||
<span class="help-block" >
|
||||
当前没有可以查看的数据,请点击Excel导入按钮导入Excel数据</span></div>
|
||||
<table ng-show="model.length != 0" ng-table-dynamic="tableParams with columns" class="table table-condensed table-bordered table-striped">
|
||||
<tr ng-repeat="row in $data">
|
||||
<td ng-repeat="col in $columns">
|
||||
<span ng-show="col.field != 'id'">{{row[col.field]}}</span>
|
||||
<button class="btn sj_btn" ng-hide="col.field != 'id'" ng-click="viewClick(row)">查看</button>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
|
@ -25,7 +25,7 @@
|
|||
<div ng-show="true">
|
||||
<div class="col-md-12">
|
||||
<table ng-table-dynamic="tableParams with columns" class="table table-condensed table-bordered table-striped">
|
||||
<tr ng-repeat="row in $data" ng-class="{'danger': row.checkResult = '否'}">
|
||||
<tr ng-repeat="row in $data" ng-class="{'danger': row.check = '否'}">
|
||||
<td ng-repeat="col in $columns">{{row[col.field]}}</td>
|
||||
{{row}}
|
||||
</tr>
|
||||
|
|
|
@ -1,202 +1,147 @@
|
|||
/// <reference path="../../includes.ts"/>
|
||||
/// <reference path="systemPlugin.ts"/>
|
||||
/// <reference path="systemHelpers.ts"/>
|
||||
/// <reference path="../../configs/ts/customAlert.ts"/>
|
||||
/// <reference path="../../kubernetes/ts/kubernetesHelpers.ts"/>
|
||||
/// <reference path="systemHelpers.ts"/>
|
||||
/// <reference path="../../configs/ts/configsUtils.ts"/>
|
||||
|
||||
module System{
|
||||
export var SystemListController = controller('SystemListController', ['$scope', '$location', '$http', '$templateCache', 'Upload', 'NgTableParams', 'ngDialog', ($scope, $location, $http, $templateCache, Upload, NgTableParams, ngDialog) => {
|
||||
export var SystemListController = controller('SystemListController', ['$scope', '$location', '$http', '$templateCache', 'Upload', 'NgTableParams', 'ngDialog', 'SystemModel', ($scope, $location, $http, $templateCache, Upload, NgTableParams, ngDialog, SystemModel) => {
|
||||
shareInit($scope);
|
||||
|
||||
$scope.modelServices = SystemModel;
|
||||
//$scope.modelServices.updateExcelInfo();
|
||||
$scope.model = SystemModel.systemInfoList;
|
||||
|
||||
// 表头显示的信息
|
||||
$scope.columns= [
|
||||
{ field: 'id', title: '操作', show: true},
|
||||
{ field: "object", title: "采集对象", filter: { object: "select" }, filterData: booleanChoose(), show: true },
|
||||
{ field: "city", title: "市", filter: { city: 'text' }, show: true },
|
||||
{ field: "county", title: "区/县", filter: { county: 'text' }, show: true },
|
||||
{ field: "regionalismCode", title: "行政区划代码", filter: {regionalismCode: 'text'}, show: true },
|
||||
{ field: "level", title: "级次", filter: { level: "select" }, filterData: levelType(), show: true },
|
||||
{ field: "systemCode", title: "系统编码", filter: { systemCode: "text" }, show: true },
|
||||
{ field: "systemName", title: "信息系统名称", filter: { systemName: "text" }, show: true },
|
||||
{ field: "contactsPerson", title: "联系人", filter: { contactsPerson: "text" }, show: true },
|
||||
{ field: "contactsMethod", title: "联系方式", filter: { contactsMethod: "text" }, show: true },
|
||||
{ field: "databaseType", title: "数据库类型", filter: { databaseType: "select" }, filterData: databaseType(), show: true},
|
||||
{ field: "updateExcelInfo", title: "采集对象", filter: { updateExcelInfo: "select" }, filterData: booleanChoose(), show: true },
|
||||
{ field: "cityName", title: "市", filter: { cityName: 'text' }, show: true },
|
||||
{ field: "districtName", title: "区/县", filter: { districtName: 'text' }, show: true },
|
||||
{ field: "areaCode", title: "行政区划代码", filter: {areaCode: 'text'}, show: true },
|
||||
{ field: "areaLevel", title: "级次", filter: { areaLevel: "select" }, filterData: levelType(), show: true },
|
||||
{ field: "sysName", title: "信息系统名称", filter: { sysName: "text" }, show: true },
|
||||
{ field: "departmentManager", title: "联系人", filter: { departmentManager: "text" }, show: true },
|
||||
{ field: "managerContacts", title: "联系方式", filter: { managerContacts: "text" }, show: true },
|
||||
{ field: "dataBaseType", title: "数据库类型", filter: { dataBaseType: "select" }, filterData: databaseType(), show: true},
|
||||
{ field: "userSql", title: "oracle用户名表空间", filter: { userSql: "select" }, filterData: booleanChoose(), show: true},
|
||||
{ field: "checkSql", title: "支付信息标准表脚本", filter: { checkSql: "select" }, filterData: booleanChoose(), show: true},
|
||||
{ field: "execSql", title: "可执行标准表脚本", filter: { execSql: "select" }, filterData: booleanChoose(), show: true},
|
||||
];
|
||||
|
||||
$scope.model = [{
|
||||
id: 1,
|
||||
object: '是',
|
||||
city: '南京市',
|
||||
county: '玄武区',
|
||||
regionalismCode: '321001',
|
||||
level: '市级',
|
||||
systemCode: '5',
|
||||
systemName: '非税系统',
|
||||
contactsPerson: '唐僧',
|
||||
contactsMethod: '15575170786',
|
||||
databaseType: 'oracle',
|
||||
userSql: '是',
|
||||
checkSql: '是',
|
||||
execSql: '是'
|
||||
},
|
||||
{
|
||||
id: 2,
|
||||
object: '是',
|
||||
city: '南京市',
|
||||
county: '浦口区',
|
||||
regionalismCode: '321011',
|
||||
level: '市级',
|
||||
systemCode: '5',
|
||||
systemName: '预算执行',
|
||||
contactsPerson: '唐僧',
|
||||
contactsMethod: '15675170786',
|
||||
databaseType: 'oracle',
|
||||
userSql: '是',
|
||||
checkSql: '是',
|
||||
execSql: '是'
|
||||
}]
|
||||
|
||||
// 点击查看按钮事件处理函数
|
||||
$scope.viewClick = (selected) => {
|
||||
ngDialog.open({
|
||||
template: 'systemInfo.html',
|
||||
controller: 'Configs.SystemInfoController',
|
||||
width: 790,
|
||||
closeByDocument: false,
|
||||
data: selected,
|
||||
className: 'ngdialog-theme-default'
|
||||
});
|
||||
}
|
||||
// 点击查看按钮事件处理函数
|
||||
$scope.viewClick = (selected) => {
|
||||
ngDialog.open({
|
||||
template: 'systemInfo.html',
|
||||
controller: 'Configs.SystemInfoController',
|
||||
width: 790,
|
||||
closeByDocument: false,
|
||||
data: selected,
|
||||
className: 'ngdialog-theme-default'
|
||||
});
|
||||
}
|
||||
|
||||
// 表数据
|
||||
$scope.tableParams = new NgTableParams({count: 25}, {
|
||||
counts: [25, 50, 100],
|
||||
dataset: $scope.model
|
||||
dataset: $scope.model
|
||||
});
|
||||
|
||||
// 文件上传
|
||||
$scope.upLoadExcelFile = (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: true,
|
||||
testChunks: false,
|
||||
throttleProgressCallbacks:1,
|
||||
method: "octet"
|
||||
/*headers: {
|
||||
"Content-Type": "application/x-www-form-urlencoded;charset=utf-8"
|
||||
}*/
|
||||
});
|
||||
if(!r.support){
|
||||
throw "当前浏览器不支持Resumable.js文件上传";
|
||||
}else{
|
||||
console.log(files);
|
||||
angular.forEach(files, (file) => {
|
||||
r.addFile(file);
|
||||
})
|
||||
|
||||
r.on('fileAdded', function(file){
|
||||
console.log(file);
|
||||
r.upload();
|
||||
});
|
||||
|
||||
r.on('complete', function(){
|
||||
// Hide pause/resume when the upload has completed
|
||||
console.log("文件上传完毕");
|
||||
$('#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){
|
||||
// Handle progress for both the file and the overall upload
|
||||
//$('.resumable-file-'+file.uniqueIdentifier+' .resumable-file-progress').html(Math.floor(file.progress()*100) + '%');
|
||||
//$('.progress-bar').css({width:Math.floor(r.progress()*100) + '%'});
|
||||
console.log(Math.floor(r.progress()*100) + '%');
|
||||
$('#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 = () =>{
|
||||
$http.get('/java/console/api/fileOperation/file/download', { responseType: 'arraybuffer' })
|
||||
.success( function(data, status, headers) {
|
||||
var octetStreamMime = 'application/octet-stream';
|
||||
var success = false;
|
||||
// Get the headers
|
||||
headers = headers();
|
||||
// Get the filename from the x-filename header or default to "服务列表"
|
||||
var filename = headers['x-filename'] || '服务列表.xls';
|
||||
// Determine the content type from the header or default to "application/octet-stream"
|
||||
var contentType = headers['content-type'] || octetStreamMime;
|
||||
try{
|
||||
// Try using msSaveBlob if supported
|
||||
console.log("Trying saveBlob method ...");
|
||||
var blob = new Blob([data], { type: contentType });
|
||||
if(navigator.msSaveBlob)
|
||||
navigator.msSaveBlob(blob, filename);
|
||||
else {
|
||||
// Try using other saveBlob implementations, if available
|
||||
var saveBlob = navigator["webkitSaveBlob"] || navigator["mozSaveBlob"] || navigator["saveBlob"];
|
||||
if(saveBlob === undefined) throw "Not supported";
|
||||
saveBlob(blob, filename);
|
||||
}
|
||||
console.log("saveBlob succeeded");
|
||||
success = true;
|
||||
} catch(ex){
|
||||
console.log("saveBlob method failed with the following exception:");
|
||||
console.log(ex);
|
||||
}
|
||||
if(!success){
|
||||
// Get the blob url creator
|
||||
var urlCreator = window.URL || window["webkitURL"] || window["mozURL"] || window["msURL"];
|
||||
if(urlCreator){
|
||||
// Try to use a download link
|
||||
var link = document.createElement('a');
|
||||
if('download' in link){
|
||||
// Try to simulate a click
|
||||
try{
|
||||
// Prepare a blob URL
|
||||
console.log("Trying download link method with simulated click ...");
|
||||
var blob = new Blob([data], { type: contentType });
|
||||
var url = urlCreator.createObjectURL(blob);
|
||||
link.setAttribute('href', url);
|
||||
// Set the download attribute (Supported in Chrome 14+ / Firefox 20+)
|
||||
link.setAttribute("download", filename);
|
||||
// Simulate clicking the download link
|
||||
var event = document.createEvent('MouseEvents');
|
||||
event.initMouseEvent('click', true, true, window, 1, 0, 0, 0, 0, false, false, false, false, 0, null);
|
||||
link.dispatchEvent(event);
|
||||
console.log("Download link method with simulated click succeeded");
|
||||
success = true;
|
||||
}catch(ex) {
|
||||
console.log("Download link method with simulated click failed with the following exception:");
|
||||
console.log(ex);
|
||||
}
|
||||
}
|
||||
if(!success){
|
||||
// Fallback to window.location method
|
||||
try{
|
||||
// Prepare a blob URL
|
||||
// Use application/octet-stream when using window.location to force download
|
||||
console.log("Trying download link method with window.location ...");
|
||||
var blob = new Blob([data], { type: octetStreamMime });
|
||||
var url = urlCreator.createObjectURL(blob);
|
||||
window.location = url;
|
||||
console.log("Download link method with window.location succeeded");
|
||||
success = true;
|
||||
}catch(ex){
|
||||
console.log("Download link method with window.location failed with the following exception:");
|
||||
console.log(ex);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if(!success){
|
||||
// Fallback to window.open method
|
||||
console.log("No methods worked for saving the arraybuffer, using last resort window.open");
|
||||
window.open('_blank', '');
|
||||
}
|
||||
}).error(function(data, status) {
|
||||
console.log("Request failed with status: " + status);
|
||||
// Optionally write the error out to scope
|
||||
$scope.errorDetails = "Request failed with status: " + status;
|
||||
});
|
||||
Configs.downloadFile($scope, $http, '/java/console/api/fileOperation/file/download');
|
||||
}
|
||||
|
||||
$scope.downloadFilePackage = () =>{
|
||||
Configs.create_mask();
|
||||
Kubernetes.create_locadEffect("正在下载文件,请稍等...");
|
||||
var target = document.getElementById('loading');
|
||||
var spinner = new Spinner(Kubernetes.loadConfigs()).spin(target);
|
||||
Configs.downloadFile($scope, $http, '/java/console/api/filePackage/download', () =>{
|
||||
$("#load").remove();
|
||||
Kubernetes.removeMask();
|
||||
});
|
||||
}
|
||||
|
||||
$scope.sqlUpload = (files) => {
|
||||
console.log(files);
|
||||
}
|
||||
|
||||
//boolean选择条件:是/否
|
||||
|
@ -205,7 +150,7 @@ module System{
|
|||
}
|
||||
// 数据库类型选择条件:oracle/sqlServer
|
||||
function databaseType(){
|
||||
return [{id: 'oracle', title: 'Oracle'}, {id: 'sqlServer', title: 'sqlServer'}];
|
||||
return [{id: 'oracle', title: 'ORACLE'}, {id: 'sqlServer', title: 'sqlServer'}];
|
||||
}
|
||||
|
||||
//level选择条件
|
||||
|
|
|
@ -29,22 +29,23 @@ module System{
|
|||
public regionalismInfo: Array<any> = [];
|
||||
|
||||
public constructor(){
|
||||
//this.updateSystemInfoList();
|
||||
this.updateCodeInfo();
|
||||
this.updateExcelInfo();
|
||||
//console.log(classifyCountry(this.regionalismInfo, '南京市'));
|
||||
}
|
||||
|
||||
//执行数据更新操作
|
||||
public updateSystemInfoList(){
|
||||
var result = [];
|
||||
public updateExcelInfo(){
|
||||
var result = null;
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
url: '/java/console/api/system/infoList',
|
||||
async: false,
|
||||
type: "POST",
|
||||
url: "/java/console/api/fileOperation/findAll",
|
||||
success: (data) =>{
|
||||
if(data)
|
||||
result = data;
|
||||
result = data.data;
|
||||
}
|
||||
});
|
||||
this.systemInfoList = result;
|
||||
}
|
||||
|
||||
public updateCodeInfo(){
|
||||
|
|
|
@ -9,7 +9,7 @@ module System{
|
|||
|
||||
$scope.columns = [
|
||||
{ field: "id", title: '序号', show: false},
|
||||
{ field: "checkResult", title: "验证结果", show: true},
|
||||
{ field: "check", title: "验证结果", show: true},
|
||||
{ field: "hasCollect", title: "采集", show: true },
|
||||
{ field: "hasCheckSql", title: "支付信息标准表", show: true },
|
||||
{ field: "hasExecSql", title: "可执行标准表", show: true },
|
||||
|
@ -22,7 +22,8 @@ module System{
|
|||
{ field: "databaseType", title: "数据库类型", show: true}
|
||||
];
|
||||
|
||||
$scope.model = [{
|
||||
$scope.tableData = []
|
||||
$scope.tableData.push({
|
||||
id: 1,
|
||||
checkResult: '是',
|
||||
hasCollect: '是',
|
||||
|
@ -49,11 +50,11 @@ module System{
|
|||
contactsPerson: '文豆豆',
|
||||
contactsMethod: '15578203147',
|
||||
databaseType: 'sqlServer'
|
||||
}];
|
||||
});
|
||||
|
||||
console.log($scope.model);
|
||||
console.log($scope.tableData);
|
||||
|
||||
$scope.filterResult = $scope.model;
|
||||
$scope.filterResult = $scope.tableData;
|
||||
|
||||
// 表数据
|
||||
$scope.tableParams = new NgTableParams({count: 25}, {
|
||||
|
@ -65,7 +66,7 @@ module System{
|
|||
if(x != 'all'){
|
||||
$scope.countries = classifyCountry(SystemModel.regionalismInfo, x);
|
||||
$scope.filterResult = [];
|
||||
angular.forEach($scope.model, (item) => {
|
||||
angular.forEach($scope.tableData, (item) => {
|
||||
if(item.city == x)
|
||||
$scope.filterResult.push(item);
|
||||
});
|
||||
|
@ -73,7 +74,7 @@ module System{
|
|||
dataset: $scope.filterResult
|
||||
});
|
||||
}else{
|
||||
$scope.filterResult = $scope.model;
|
||||
$scope.filterResult = $scope.tableData;
|
||||
$scope.tableParams.settings({
|
||||
dataset: $scope.filterResult
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue