|
|
|
/// <reference path="../../includes.ts"/>
|
|
|
|
/// <reference path="systemPlugin.ts"/>
|
|
|
|
/// <reference path="systemHelpers.ts"/>
|
|
|
|
/// <reference path="systemServices.ts"/>
|
|
|
|
module System{
|
|
|
|
export var SystemVerificationController = controller('SystemVerificationController', ['$scope', '$location', '$http', '$templateCache', 'Upload', 'NgTableParams', 'ngDialog', 'SystemModel', '$element', ($scope, $location, $http, $templateCache, Upload, NgTableParams, ngDialog, SystemModel, $element) => {
|
|
|
|
shareInit($scope);
|
|
|
|
$scope.cities = classifyCity(SystemModel.regionalismInfo);
|
|
|
|
$scope.model = SystemModel;
|
|
|
|
$scope.tableData = null;
|
|
|
|
$scope.checkboxes = {
|
|
|
|
checked: false,
|
|
|
|
items: {}
|
|
|
|
};
|
|
|
|
// 表数据
|
|
|
|
$scope.tableParams = new NgTableParams({count: 25}, {
|
|
|
|
counts: [25, 50, 100],
|
|
|
|
dataset: $scope.tableData
|
|
|
|
});
|
|
|
|
|
|
|
|
$scope.citySelect = (x) =>{
|
|
|
|
if(x != 'all'){
|
|
|
|
$scope.countries = classifyCountry(SystemModel.regionalismInfo, x);
|
|
|
|
$http({
|
|
|
|
url: "/java/console/api/checkout/findByCity",
|
|
|
|
method: "POST",
|
|
|
|
data: x
|
|
|
|
}).success((data, header, config, status) => {
|
|
|
|
$scope.tableData =data.data;
|
|
|
|
$scope.tableParams.settings({
|
|
|
|
dataset: $scope.tableData
|
|
|
|
});
|
|
|
|
}).error((data, header, config, status) => {
|
|
|
|
throw "请求失败"
|
|
|
|
});
|
|
|
|
}else{
|
|
|
|
$scope.countries=[];
|
|
|
|
$scope.y = "all";
|
|
|
|
$scope.tableData = null;
|
|
|
|
$scope.checkboxes = {
|
|
|
|
checked: false,
|
|
|
|
items: {}
|
|
|
|
};
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
$scope.countrySelect = (y) => {
|
|
|
|
if(y != 'all'){
|
|
|
|
var result = [];
|
|
|
|
angular.forEach($scope.tableData, (item) => {
|
|
|
|
if(item.districtName == y)
|
|
|
|
result.push(item);
|
|
|
|
});
|
|
|
|
$scope.tableParams.settings({
|
|
|
|
dataset: result
|
|
|
|
});
|
|
|
|
}else{
|
|
|
|
$scope.tableParams.settings({
|
|
|
|
dataset: $scope.tableData
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
$scope.check = () => {
|
|
|
|
var filter = [];
|
|
|
|
if($scope.tableData && $scope.tableData.length > 0){
|
|
|
|
angular.forEach($scope.tableData, (item) => {
|
|
|
|
if($scope.checkboxes.items[item.id])
|
|
|
|
filter.push(item);
|
|
|
|
});
|
|
|
|
$http({
|
|
|
|
url: "/java/console/api/checkout/checkList",
|
|
|
|
method: "POST",
|
|
|
|
data: filter
|
|
|
|
}).success((data, header, config, status) => {
|
|
|
|
$scope.tableData =data.data;
|
|
|
|
$scope.tableParams.settings({
|
|
|
|
dataset: $scope.tableData
|
|
|
|
});
|
|
|
|
}).error((data, header, config, status) => {
|
|
|
|
throw "请求失败"
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
// watch for check all checkbox
|
|
|
|
$scope.$watch(function() {
|
|
|
|
return $scope.checkboxes.checked;
|
|
|
|
}, function(value) {
|
|
|
|
angular.forEach($scope.tableData, function(item) {
|
|
|
|
$scope.checkboxes.items[item.id] = value;
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
// watch for data checkboxes
|
|
|
|
$scope.$watch(function() {
|
|
|
|
return $scope.checkboxes.items;
|
|
|
|
}, function(values) {
|
|
|
|
$scope.checkable = false;
|
|
|
|
for(var index in values){
|
|
|
|
if(values[index] == true){
|
|
|
|
$scope.checkable = true;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
var checked = 0, unchecked = 0, total = -1;
|
|
|
|
if($scope.tableData && ($scope.tableData instanceof Array))
|
|
|
|
total = $scope.tableData.length;
|
|
|
|
angular.forEach($scope.tableData, function(item) {
|
|
|
|
checked += ($scope.checkboxes.items[item.id]) || 0;
|
|
|
|
unchecked += Number(!$scope.checkboxes.items[item.id]) || 0;
|
|
|
|
});
|
|
|
|
|
|
|
|
if ((unchecked == 0) || (checked == 0)) {
|
|
|
|
$scope.checkboxes.checked = (checked == total);
|
|
|
|
}
|
|
|
|
// grayed checkbox
|
|
|
|
angular.element($element[0].getElementsByClassName("select-all")).prop("indeterminate", (checked != 0 && unchecked != 0));
|
|
|
|
}, true);
|
|
|
|
|
|
|
|
$scope.update = (entity) => {
|
|
|
|
ngDialog.open({
|
|
|
|
template: 'sysVerificationUpdate.html',
|
|
|
|
controller: 'Configs.sysVerUpdateController',
|
|
|
|
width: 790,
|
|
|
|
height: 800,
|
|
|
|
closeByDocument: false,
|
|
|
|
data: entity,
|
|
|
|
className: 'ngdialog-theme-default'
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}]);
|
|
|
|
}
|