129 lines
4.0 KiB
TypeScript
129 lines
4.0 KiB
TypeScript
/// <reference path="../../includes.ts"/>
|
|
/// <reference path="../../kubernetes/ts/kubernetesHelpers.ts"/>
|
|
/// <reference path="developerEnrichers.ts"/>
|
|
/// <reference path="developerHelpers.ts"/>
|
|
/// <reference path="dataManagerHelper.ts"/>
|
|
/// <reference path="dataManagerModel.ts"/>
|
|
|
|
module Developer {
|
|
export var WorkspacesController = controller("WorkspacesController", ["$scope", "KubernetesModel", "DataModel","KubernetesState", "$templateCache", "$location", "$routeParams", "$http", "$timeout", "KubernetesApiURL", "$element",
|
|
($scope, KubernetesModel:Kubernetes.KubernetesModelService, DataModel:Developer.DataModelService, KubernetesState, $templateCache:ng.ITemplateCacheService, $location:ng.ILocationService, $routeParams, $http, $timeout, KubernetesApiURL, $element) => {
|
|
init($scope,location,$routeParams);
|
|
|
|
$scope.model=DataModel;
|
|
$scope.options = DataModel.paramOptions;
|
|
|
|
//配置数据表格需要显示的内容及显示格式
|
|
$scope.tableConfig = {
|
|
data: 'model.data',
|
|
enableRowClickSelection: true,
|
|
showSelectionCheckbox: true,
|
|
multiSelect: true,
|
|
selectedItems: [],
|
|
filterOptions: {
|
|
filterText: $location.search()["q"] || ''
|
|
},
|
|
columnDefs: [
|
|
{
|
|
field: "_key",
|
|
displayName: '编码'
|
|
},
|
|
{
|
|
field: "name",
|
|
displayName: '市-区/县'
|
|
},
|
|
{
|
|
field: "systemName",
|
|
displayName: '系统名称'
|
|
},
|
|
{
|
|
field: "collectingTime",
|
|
displayName: '采集时间'
|
|
},
|
|
{
|
|
field: "collectorName",
|
|
displayName: '联系人'
|
|
},
|
|
{
|
|
field: "collectorContacts",
|
|
displayName: '联系方式'
|
|
}
|
|
]
|
|
};
|
|
|
|
$scope.selectBatchItem = (item)=> {
|
|
$scope.navbarItems.forEach((nav) =>{
|
|
nav.class="";
|
|
});
|
|
item.class="active";
|
|
$scope.model.updateParamOption("dataBath", item.label);
|
|
}
|
|
|
|
$scope.isEmptyOrFirst = () => {
|
|
var idx = $scope.model.getParamOption("currentPageNum");
|
|
var length = $scope.model.getParamOption("pageSize");
|
|
return length <= 0 || idx <= 0;
|
|
}
|
|
|
|
$scope.isEmptyOrLast = () =>{
|
|
var idx = $scope.model.getParamOption("currentPageNum");
|
|
var length = $scope.model.getParamOption("pageSize");
|
|
return length < 1 || idx + 1 >= length;
|
|
}
|
|
|
|
$scope.first = () => {
|
|
var idx = $scope.model.getParamOption("currentPageNum");
|
|
if(idx >1)
|
|
$scope.model.updateParamOption("currentPageNum", 1);
|
|
}
|
|
|
|
$scope.last = () =>{
|
|
var idx = $scope.model.getParamOption("currentPageNum");
|
|
var length = $scope.model.getParamOption("pageSize");
|
|
if(idx < length)
|
|
$scope.model.updateParamOption("currentPageNum", length);
|
|
}
|
|
|
|
$scope.previous = () => {
|
|
var idx = $scope.model.getParamOption("currentPageNum");
|
|
var length = $scope.model.getParamOption("pageSize");
|
|
if(idx < length)
|
|
$scope.model.updateParamOption("currentPageNum", idx+1);
|
|
}
|
|
|
|
$scope.next = () =>{
|
|
var idx = $scope.model.getParamOption("currentPageNum");
|
|
if(idx >1)
|
|
$scope.model.updateParamOption("currentPageNum", idx-1);
|
|
}
|
|
|
|
$scope.$watch('scope.options', (newValue, oldValue) => {
|
|
if(newValue && newValue !== oldValue)
|
|
console.log("++=====+=");
|
|
}, true);
|
|
|
|
function init($scope,$location,$routeParams){
|
|
//创建二级菜单
|
|
$scope.subTabConfig = Developer.createCurrentSubNavBar($scope, $location, $routeParams);
|
|
$scope.navbarItems =[{
|
|
herf: "",
|
|
label: "全部",
|
|
title: "查看全部数据",
|
|
class: "active"
|
|
},
|
|
{
|
|
herf: "",
|
|
label: "批次A",
|
|
title: "查看批次A的数据",
|
|
class: ""
|
|
},
|
|
{
|
|
herf: "",
|
|
label: "批次B",
|
|
title: "查看批次B的数据",
|
|
class: ""
|
|
}]
|
|
}
|
|
}]);
|
|
}
|