Browse Source

客户采购预测界面

git-svn-id: svn+ssh://10.10.101.21/source/platform/platform-b2b@626 f3bf4e98-0cf0-11e4-a00c-a99a8b9d557d
suntg 11 years ago
parent
commit
345bc59585

+ 66 - 0
src/main/webapp/resources/js/index/app.js

@@ -97,6 +97,10 @@ define([ 'toaster', 'charts', 'ngTable', 'common/services', 'service/Purc', 'ui.
 			url : "/send",
 			templateUrl : "static/tpl/index/sale/send.html",
 			controller: 'SaleSendCtrl'
+		}).state('sale.forecast', {
+			url : "/forecast",
+			templateUrl : "static/tpl/index/sale/forecast.html",
+			controller: 'SaleForecastCtrl'
 		}).state('sale.accept', {
 			url : "/accept",
 			templateUrl : "static/tpl/index/sale/accept.html",
@@ -797,6 +801,68 @@ define([ 'toaster', 'charts', 'ngTable', 'common/services', 'service/Purc', 'ui.
 		};
 	});
 	
+	/**
+	 * 客户采购预测
+	 */
+	app.controller('SaleForecastCtrl', function($scope, $rootScope, $filter, PurcForecast, ngTableParams, toaster, BaseService, Symbol){
+		$rootScope.active = 'forecast';
+		$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) {
+			$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 PurcForecast;
+		};
+		
+		$scope.tableParams = new ngTableParams({
+			page : 1, 
+			count : 5,
+			sorting: {
+				orderDate: 'desc'
+            }
+		}, {
+			total : 0, 
+			counts: [5, 10, 25, 50],
+			getData : function($defer, params) {
+				$scope.loading = true;
+				getService()[getState($scope.active)].call(null, BaseService.parseParams(params.url()), function(page){
+					$scope.loading = false;
+					if(page) {
+						params.total(page.totalElements);
+						$defer.resolve(page.content);
+					}
+				});
+			}
+		});
+		
+		$scope.openDatePicker = function($event, item, openParam) {
+			$event.preventDefault();
+		    $event.stopPropagation();
+		    item[openParam] = !item[openParam];
+		};
+		
+	});
+	
 	/**
 	 * 客户采购验收
 	 */

+ 3 - 0
src/main/webapp/resources/js/index/services/Purc.js

@@ -121,6 +121,9 @@ define([ 'ngResource' ], function() {
 				isArray: true
 			}
 		});
+	}).factory('PurcForecast', function($resource) {
+		return $resource('sale/forecast/:id', {}, {
+		});
 	}).factory('PurcAccept', function($resource) {
 		return $resource('sale/accept/:id', {}, {
 		});