@ -336,153 +336,11 @@ define(['angular', 'jquery', 'uiRouter', './monitoring/analysis-monitoring'],
// 以下为BD上传材料相关
// 以下为BD上传材料相关
$scope . material = { } ;
$scope . material = { } ;
$scope . material . update _time = $filter ( 'date' ) ( new Date ( ) , 'yyyy-MM-dd HH:mm:ss' ) ;
$scope . uploadFile = function ( files , index ) {
$scope . material . risk _id = $scope . riskEvent . risk _id ;
// $scope.uploadFile = function(files, index) {
// if (files && files.length) {
// var urls = new Array();
// var value = 0;
// var progressKey = 'fileProgress' + (index + 1);
// $scope[progressKey] = {value: 0};
// for (var i = 0; i < files.length; i++) {
// var file = files[i];
// Upload.upload({
// url: '/attachment/riskFiles',
// data: {file: file}
// }).then(function (resp) {
// urls.push(resp.data.url);
// }, function (resp) {
// delete $scope[progressKey];
// alert('Upload Failed');
// }, function (evt) {
// value += parseInt(100 * evt.loaded / evt.total );
// $scope[progressKey].value = value/(files.length*2);
// })
// }
// var fileKey = 'file' + (index + 1) +'_url';
// $scope.material[fileKey] = urls;
// }
// };
$scope . uploadFile1 = function ( files ) {
if ( files && files . length ) {
var urls = new Array ( ) ;
var value = 0 ;
$scope . file1Progress = { value : 0 } ;
for ( var i = 0 ; i < files . length ; i ++ ) {
var file = files [ i ] ;
Upload . upload ( {
url : '/attachment/riskFiles' ,
data : { file : file }
} ) . then ( function ( resp ) {
urls . push ( resp . data . url ) ;
} , function ( resp ) {
delete $scope . file1Progress ;
alert ( 'Upload Failed' ) ;
} , function ( evt ) {
value += parseInt ( 100 * evt . loaded / evt . total ) ;
$scope . file1Progress . value = value / ( files . length * 2 ) ;
} )
}
$scope . material . file1 _url = urls ;
}
} ;
$scope . uploadFile2 = function ( files ) {
if ( files && files . length ) {
var urls = new Array ( ) ;
var value = 0 ;
$scope . file2Progress = { value : 0 } ;
for ( var i = 0 ; i < files . length ; i ++ ) {
var file = files [ i ] ;
Upload . upload ( {
url : '/attachment/riskFiles' ,
data : { file : file }
} ) . then ( function ( resp ) {
urls . push ( resp . data . url ) ;
} , function ( resp ) {
delete $scope . file2Progress ;
alert ( 'Upload Failed' ) ;
} , function ( evt ) {
value += parseInt ( 100 * evt . loaded / evt . total ) ;
$scope . file2Progress . value = value / ( files . length * 2 ) ;
} )
}
$scope . material . file2 _url = urls ;
}
} ;
$scope . uploadFile3 = function ( files ) {
if ( files && files . length ) {
var urls = new Array ( ) ;
var value = 0 ;
$scope . file3Progress = { value : 0 } ;
for ( var i = 0 ; i < files . length ; i ++ ) {
var file = files [ i ] ;
Upload . upload ( {
url : '/attachment/riskFiles' ,
data : { file : file }
} ) . then ( function ( resp ) {
urls . push ( resp . data . url ) ;
} , function ( resp ) {
delete $scope . file3Progress ;
alert ( 'Upload Failed' ) ;
} , function ( evt ) {
value += parseInt ( 100 * evt . loaded / evt . total ) ;
$scope . file3Progress . value = value / ( files . length * 2 ) ;
} )
}
$scope . material . file3 _url = urls ;
}
} ;
$scope . uploadFile4 = function ( files ) {
if ( files && files . length ) {
var urls = new Array ( ) ;
var value = 0 ;
$scope . file4Progress = { value : 0 } ;
for ( var i = 0 ; i < files . length ; i ++ ) {
var file = files [ i ] ;
Upload . upload ( {
url : '/attachment/riskFiles' ,
data : { file : file }
} ) . then ( function ( resp ) {
urls . push ( resp . data . url ) ;
} , function ( resp ) {
delete $scope . file4Progress ;
alert ( 'Upload Failed' ) ;
} , function ( evt ) {
value += parseInt ( 100 * evt . loaded / evt . total ) ;
$scope . file4Progress . value = value / ( files . length * 2 ) ;
} )
}
$scope . material . file4 _url = urls ;
}
} ;
$scope . uploadFile5 = function ( files ) {
if ( files && files . length ) {
var urls = new Array ( ) ;
var value = 0 ;
$scope . file5Progress = { value : 0 } ;
for ( var i = 0 ; i < files . length ; i ++ ) {
var file = files [ i ] ;
Upload . upload ( {
url : '/attachment/riskFiles' ,
data : { file : file }
} ) . then ( function ( resp ) {
urls . push ( resp . data . url ) ;
} , function ( resp ) {
delete $scope . file5Progress ;
alert ( 'Upload Failed' ) ;
} , function ( evt ) {
value += parseInt ( 100 * evt . loaded / evt . total ) ;
$scope . file5Progress . value = value / ( files . length * 2 ) ;
} )
}
$scope . material . file5 _url = urls ;
}
} ;
$scope . uploadFile6 = function ( files ) {
if ( files && files . length ) {
if ( files && files . length ) {
var urls = new Array ( ) ;
var urls = new Array ( ) ;
var value = 0 ;
var value = 0 ;
$scope . file6Progress = { value : 0 } ;
$scope . allMaterialInfo . material [ index ] . fileProgressValue = 0 ;
for ( var i = 0 ; i < files . length ; i ++ ) {
for ( var i = 0 ; i < files . length ; i ++ ) {
var file = files [ i ] ;
var file = files [ i ] ;
Upload . upload ( {
Upload . upload ( {
@ -491,18 +349,26 @@ define(['angular', 'jquery', 'uiRouter', './monitoring/analysis-monitoring'],
} ) . then ( function ( resp ) {
} ) . then ( function ( resp ) {
urls . push ( resp . data . url ) ;
urls . push ( resp . data . url ) ;
} , function ( resp ) {
} , function ( resp ) {
delete $scope . file6Progress ;
delete $scope . allMaterialInfo. material [ index ] . fileProgressValue ;
alert ( 'Upload Failed' ) ;
alert ( 'Upload Failed' ) ;
} , function ( evt ) {
} , function ( evt ) {
value += parseInt ( 100 * evt . loaded / evt . total ) ;
value += parseInt ( 100 * evt . loaded / evt . total ) ;
$scope . file6Progress. v alue = value / ( files . length * 2 ) ;
$scope . allMaterialInfo. material [ index ] . fileProgressV alue = value / ( files . length * 2 ) ;
} )
} )
}
}
$scope . material. file6 _url = urls ;
$scope . allMaterialInfo. material [ index ] . uploadFile = urls ;
}
}
} ;
} ;
$scope . submit = function ( form ) {
$scope . submit = function ( form ) {
var codeKey = $scope . riskEvent . submit _url . substring ( $scope . riskEvent . submit _url . lastIndexOf ( '=' ) + 1 ) || $scope . riskEvent . submit _url . substring ( $scope . riskEvent . submit _url . lastIndexOf ( '/' ) + 1 ) ;
var codeKey = $scope . riskEvent . submit _url . substring ( $scope . riskEvent . submit _url . lastIndexOf ( '=' ) + 1 ) || $scope . riskEvent . submit _url . substring ( $scope . riskEvent . submit _url . lastIndexOf ( '/' ) + 1 ) ;
$scope . material . update _time = $filter ( 'date' ) ( new Date ( ) , 'yyyy-MM-dd HH:mm:ss' ) ;
$scope . material . risk _id = $scope . riskEvent . risk _id ;
for ( var i = 0 ; i < $scope . allMaterialInfo . material . length ; i ++ ) {
var key = 'file' + ( i + 1 ) + "_url" ;
$scope . material [ key ] = $scope . allMaterialInfo . material [ i ] . uploadFile ;
}
$scope . material . description = $scope . allMaterialInfo . description ;
$http . post ( '/risk/upload/' + codeKey , $scope . material ) . then ( function ( resp ) {
$http . post ( '/risk/upload/' + codeKey , $scope . material ) . then ( function ( resp ) {
commonDialog . alert ( {
commonDialog . alert ( {
title : 'Success' ,
title : 'Success' ,
@ -521,18 +387,21 @@ define(['angular', 'jquery', 'uiRouter', './monitoring/analysis-monitoring'],
// 加载提交材料
// 加载提交材料
$scope . loadRiskMaterial = function ( ) {
$scope . loadRiskMaterial = function ( ) {
$http . get ( '/risk/business/' + $scope . riskEvent . risk _id + '/material' ) . then ( function ( resp ) {
// $http.get('/risk/business/' + $scope.riskEvent.risk_id + '/material').then(function(resp) {
$scope . material = resp . data ;
// $scope.material = resp.data;
} ) ;
// });
$http . get ( '/risk/business/' + $scope . riskEvent . risk _id + '/all_material_info' ) . then ( function ( resp ) {
$http . get ( '/risk/business/' + $scope . riskEvent . risk _id + '/all_material_info' ) . then ( function ( resp ) {
$scope . allMaterialInfo = resp . data ;
$scope . allMaterialInfo = resp . data ;
if ( $scope . uploadShowFlag ) {
$scope . allMaterialInfo . description = '' ;
}
} ) ;
} ) ;
} ;
} ;
// BD是否可上传
// BD是否可上传
$scope . uploadShowFlag = ( $scope . riskEvent . result _type == 1 || $scope . riskEvent . result _type == 4 ) ? true : false ;
$scope . uploadShowFlag = ( $scope . riskEvent . result _type == 1 || $scope . riskEvent . result _type == 4 ) ? true : false ;
if ( ! $scope . uploadShowFlag )
//if (!$scope.uploadShowFlag)
$scope . loadRiskMaterial ( ) ;
$scope . loadRiskMaterial ( ) ;
}
}
] ) ;
] ) ;
@ -548,22 +417,26 @@ define(['angular', 'jquery', 'uiRouter', './monitoring/analysis-monitoring'],
// 加载提交材料
// 加载提交材料
// $scope.fileObject = {};
// $scope.fileObject = {};
$scope . loadRiskMaterial = function ( ) {
$scope . loadRiskMaterial = function ( ) {
$http . get ( '/risk/business/' + $scope . riskEvent . risk _id + '/material' ) . then ( function ( resp ) {
// $http.get('/risk/business/' + $scope.riskEvent.risk_id + '/material').then(function(resp) {
// $scope.riskMaterial = resp.data;
// $scope.file1 = resp.data.file1;
// $scope.file2 = resp.data.file2;
// $scope.file3 = resp.data.file3;
// $scope.file4 = resp.data.file4;
// $scope.file5 = resp.data.file5;
// $scope.file6 = resp.data.file6;
//
// // for (var i = 1; i <= 10; i++) {
// // var key = "file" + i;
// // if (riskMaterial[key + '_url'] != null)
// // $scope.fileObject[key] = riskMaterial[key + '_url'];
// // }
// // $scope.fileLength = Object.keys($scope.fileObject).length;
// })
$http . get ( '/risk/business/' + $scope . riskEvent . risk _id + '/all_material_info' ) . then ( function ( resp ) {
$scope . riskMaterial = resp . data ;
$scope . riskMaterial = resp . data ;
$scope . file1 = resp . data . file1 ;
} ) ;
$scope . file2 = resp . data . file2 ;
$scope . file3 = resp . data . file3 ;
$scope . file4 = resp . data . file4 ;
$scope . file5 = resp . data . file5 ;
$scope . file6 = resp . data . file6 ;
// for (var i = 1; i <= 10; i++) {
// var key = "file" + i;
// if (riskMaterial[key + '_url'] != null)
// $scope.fileObject[key] = riskMaterial[key + '_url'];
// }
// $scope.fileLength = Object.keys($scope.fileObject).length;
} )
} ;
} ;
$scope . loadRiskMaterial ( ) ;
$scope . loadRiskMaterial ( ) ;