@ -3,104 +3,130 @@
/// <reference path="systemHelpers.ts"/>
/// <reference path="systemServices.ts"/>
module System {
export var SystemVerificationController = controller ( 'SystemVerificationController' , [ '$scope' , '$location' , '$ templateCache', 'Upload' , 'NgTableParams' , 'ngDialog' , 'SystemModel' , ( $scope , $location , $templateCache , Upload , NgTableParams , ngDialog , SystemModel ) = > {
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 . columns = [
{ field : "id" , title : '序号' , show : false } ,
{ field : "check" , title : "验证结果" , show : true } ,
{ field : "hasCollect" , title : "采集" , show : true } ,
{ field : "hasCheckSql" , title : "支付信息标准表" , show : true } ,
{ field : "hasExecSql" , title : "可执行标准表" , show : true } ,
{ field : "city" , title : "市" , show : true } ,
{ field : "county" , title : "区/县" , show : true } ,
{ field : "regionalismCode" , title : "行政区划代码" , show : true } ,
{ field : "systemCode" , title : "信息系统代码" , show : true } ,
{ field : "contactsPerson" , title : "联系人" , show : true } ,
{ field : "contactsMethod" , title : "联系方式" , show : true } ,
{ field : "databaseType" , title : "数据库类型" , show : true }
] ;
$scope . tableData = [ ]
$scope . tableData . push ( {
id : 1 ,
checkResult : '是' ,
hasCollect : '是' ,
hasCheckSql : '是' ,
hasExecSql : '是' ,
city : '南京市' ,
county : '玄武区' ,
regionalismCode : '320105' ,
systemCode : '2' ,
contactsPerson : '文豆豆' ,
contactsMethod : '15578203146' ,
databaseType : 'oracle'
} ,
{
id : 2 ,
checkResult : '否' ,
hasCollect : '是' ,
hasCheckSql : '否' ,
hasExecSql : '是' ,
city : '连云港市' ,
county : '浦口区' ,
regionalismCode : '320105' ,
systemCode : '6' ,
contactsPerson : '文豆豆' ,
contactsMethod : '15578203147' ,
databaseType : 'sqlServer'
} ) ;
console . log ( $scope . tableData ) ;
$scope . filterResult = $scope . tableData ;
$scope . model = SystemModel ;
$scope . tableData = null ;
$scope . checkboxes = {
checked : false ,
items : { }
} ;
// 表数据
$scope . tableParams = new NgTableParams ( { count : 25 } , {
counts : [ 25 , 50 , 100 ] ,
dataset : $scope.filterResult
counts : [ 25 , 50 , 100 ] ,
dataset : $scope.tableData
} ) ;
$scope . citySelect = ( x ) = > {
if ( x != 'all' ) {
$scope . countries = classifyCountry ( SystemModel . regionalismInfo , x ) ;
$scope . filterResult = [ ] ;
angular . forEach ( $scope . tableData , ( item ) = > {
if ( item . city == x )
$scope . filterResult . push ( item ) ;
} ) ;
$scope . tableParams . settings ( {
dataset : $scope.filterResult
} ) ;
$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 . filterResult = $scope . tableData ;
$scope . tableParams . settings ( {
dataset : $scope.filterResult
} ) ;
$scope . countries = [ ] ;
$scope . y = "all" ;
$scope . tableData = null ;
$scope . checkboxes = {
checked : false ,
items : { }
} ;
}
}
$scope . countrySelect = ( y ) = > {
if ( y != 'all' ) {
var result = [ ] ;
angular . forEach ( $scope . filterResult , ( item ) = > {
if ( item . county == y )
angular . forEach ( $scope . tableData , ( item ) = > {
if ( item . districtName == y )
result . push ( item ) ;
} ) ;
$scope . tableParams . settings ( {
dataset : result
} ) ;
} else {
} else {
$scope . tableParams . settings ( {
dataset : $scope. filterResult
dataset : $scope. tableData
} ) ;
}
}
$scope . check = ( ) = > {
console . log ( $scope . tableParams . data [ 0 ] ) ;
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'
} ) ;
}
} ] ) ;
}