You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
aggregation-platform/plugins/system/ts/systemList.ts

165 lines
7.5 KiB

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

/// <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', '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: "collection", title: "采集对象", filter: { collection: "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: "userTablespaceStatus", title: "oracle用户名表空间", filter: { userTablespaceStatus: "select" }, filterData: booleanChoose(), show: true},
{ field: "checkoutPayStatus", title: "支付信息标准表脚本", filter: { checkoutPayStatus: "select" }, filterData: booleanChoose(), show: true},
{ field: "checkoutIndicateStatus", title: "可执行标准表脚本", filter: { checkoutIndicateStatus: "select" }, filterData: booleanChoose(), show: true},
];
// 点击查看按钮事件处理函数
$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
});
// 文件上传
$scope.upLoadExcelFile = () => {
Configs.FileInputPlugin((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) =>{
},
success : (data) =>{
$("#load").remove();
Kubernetes.removeMask();
$scope.model = SystemModel.systemInfoList = data.data;
$scope.tableParams.settings({
dataset: $scope.model
});
Configs.customAlert("提示", "操作成功: 本次合计新增了" + data.area + "个行政区划、" + data.system + "个信息系统,更新了" + data.update + "个信息系统", '',null, 0, "success");
},
error: (XMLHttpRequest, textStatus, errorThrown) =>{
$("#load").remove();
Kubernetes.removeMask();
if(XMLHttpRequest["responseJSON"].err && XMLHttpRequest["responseJSON"].err instanceof Array)
ngDialog.open({
template: 'uploadErrorInfo.html',
width: 755,
closeByDocument: false,
data: XMLHttpRequest["responseJSON"].err,
className: 'ngdialog-theme-default'
});
}
});
});
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");
if(null != element)
element.outerHTML = element.outerHTML;
}
}, true);
}
//excel下载
$scope.downLoadExcelFile = () =>{
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();
});
}
//boolean选择条件是/否
function booleanChoose(){
return [{id: '是', title: '是'}, {id: '否', title: '否'}];
}
// 数据库类型选择条件oracle/sql Server
function databaseType(){
return [{id: 'oracle', title: 'ORACLE'}, {id: 'sql Server', title: 'SQL SERVER'}];
}
//level选择条件
function levelType(){
return [{id: '省', title: '省'}, {id: '市', title: '市'}, {id: '县', title: '县'}];
}
}])
}