|
|
|
@ -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"
|
|
|
|
|
method: "octet"
|
|
|
|
|
/*headers: {
|
|
|
|
|
"Content-Type": "application/x-www-form-urlencoded;charset=utf-8"
|
|
|
|
|
}*/
|
|
|
|
|
});
|
|
|
|
|
if(!r.support){
|
|
|
|
|
throw "当前浏览器不支持Resumable.js文件上传";
|
|
|
|
|
}else{
|
|
|
|
|
console.log(files);
|
|
|
|
|
}else{
|
|
|
|
|
angular.forEach(files, (file) => {
|
|
|
|
|
r.addFile(file);
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
r.on('fileAdded', function(file){
|
|
|
|
|
console.log(file);
|
|
|
|
|
r.on('fileAdded', function(file){
|
|
|
|
|
r.upload();
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
r.on('complete', function(){
|
|
|
|
|
// Hide pause/resume when the upload has completed
|
|
|
|
|
console.log("文件上传完毕");
|
|
|
|
|
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){
|
|
|
|
|
// 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) + '%');
|
|
|
|
|
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 = () =>{
|
|
|
|
|
$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选择条件
|
|
|
|
|