Browse Source

委外验退前端控制器

git-svn-id: svn+ssh://10.10.101.21/source/platform/platform-b2b@1471 f3bf4e98-0cf0-11e4-a00c-a99a8b9d557d
aof 10 years ago
parent
commit
e9a5d85cfb
1 changed files with 74 additions and 1 deletions
  1. 74 1
      src/main/webapp/resources/js/index/app.js

+ 74 - 1
src/main/webapp/resources/js/index/app.js

@@ -256,7 +256,7 @@ define([ 'toaster', 'charts', 'ngTable', 'common/services', 'service/Purc', 'ser
 		}).state('make.returns', {
 			url : "/returns",
 			templateUrl : "static/tpl/index/make/returns.html",
-			controller: 'MakeChangeCtrl'
+			controller: 'MakeReturnCtrl'
 		});
 	}]);
 	
@@ -3650,6 +3650,79 @@ app.controller('SaleSendCtrl', ['$scope', '$filter', 'SaleSend', 'ngTableParams'
 		
 	}]);
 	
+	/**
+	 * 客户委外验退
+	 */
+	app.controller('MakeReturnCtrl', ['$scope', '$filter', 'MakeReturn', 'ngTableParams', 'toaster', 'BaseService', 'Symbol', function($scope, $filter, MakeReturn, ngTableParams, toaster, BaseService, Symbol){
+		$scope.active = 'all';
+		$scope.agreedText = '全部';
+		$scope.dateZoneText = '一个月内';
+		$scope.condition = {dateZone: 1};
+		$scope.currency = Symbol.currency;//将币别转化为对应的符号
+		$scope.changeAgreed = function(agreed) {
+			$scope.condition.agreed = agreed;
+			$scope.agreedText = typeof agreed == 'undefined' ? '全部' : (agreed == 1 ? '已同意' : '不同意');
+			$scope.condition.$agreedOpen = false;
+		};
+		$scope.changeDateZone = function(zone) {
+				console.log("changeDateZone::" + zone);
+			$scope.condition.dateZone = zone;
+			$scope.dateZoneText = typeof zone == 'undefined' ? '半年前' : (zone == 1 ? '一个月内' : '半年内');
+			$scope.condition.$dateZoneOpen = false;
+		};
+		$scope.setActive = function(state) {
+			if($scope.active != state) {
+				$scope.active = state;
+				if($scope.tableParams.page() == 1)
+					$scope.tableParams.reload();
+				else
+					$scope.tableParams.page(1);
+			}
+		};
+		var getService = function() {
+			return MakeReturn;
+		};
+		
+		$scope.tableParams = new ngTableParams({
+			page : 1, 
+			count : 5,
+			sorting: {
+                date: 'desc' 
+            }
+		}, {
+			total : 0, 
+			counts: [5, 10, 25, 50],
+			getData : function($defer, params) {
+				$scope.loading = true;
+				var pageParams = params.url();
+				pageParams.keyword = $scope.keyword;
+				getService()[getState($scope.active)].call(null, BaseService.parseParams(pageParams), function(page){
+					$scope.loading = false;
+					if(page) {
+						params.total(page.totalElements);
+						$defer.resolve(page.content);
+						$scope.keywordXls = angular.copy($scope.keyword);//保存当前取值的关键词
+					}
+				}, function(response){
+					$scope.loading = false;
+					toaster.pop('error', '数据加载失败', response.data);
+				});
+			}
+		});
+		
+		$scope.openDatePicker = function($event, item, openParam) {
+			$event.preventDefault();
+		    $event.stopPropagation();
+		    item[openParam] = !item[openParam];
+		};
+		
+		// 搜索框回车
+		$scope.onSearch = function() {
+			$scope.tableParams.page(1);
+			$scope.tableParams.reload();
+		};
+		
+	}]);
 	/**
 	 * 委外加工变更
 	 */