modalCtrl.js 1.18 KB
(function(angular) {
	function modalCtrl($scope, customerService,$uibModal, $uibModalInstance, $sce, $anchorScroll, $location, param, localStorageService) {
		customerService.getVehicleDetailsById({
			id: param.id
		}, function(result){
			if(result.returnCode == '0'){
				$scope.detail = result.data;
				angular.forEach($scope.detail, function(obj, key){
					if (key == 'displacement') {
						if (obj == null || obj == '') {
							console.log(key)
							$scope.detail[key] = '全部';
						}
					}
					if(obj === 'null'){
						$scope.detail[key] = null;
						
					}
				});
				$scope.detail.remark = $sce.trustAsHtml($scope.detail.remark);
				$scope.gotoMonitor = function(){
					$uibModalInstance.dismiss(0);
					var _str = angular.toJson({
			    		sn: $scope.detail.insureDevice.sn
			    	});
					localStorageService.set('monitor.index', _str);
			    	$location.path('/monitor/index');
				}
			}
		});
		
		$scope.goToBlock = function(index){
			$location.hash('block'+index);
			$anchorScroll();
			$scope.navActiveIndex = index;
		}

		$scope.close = function(){
			$uibModalInstance.dismiss(0);
		}

		

	}
	angular.module('customer').controller('modalCtrl', modalCtrl);
})(angular);