浏览代码

客户资料列表、导航栏

git-svn-id: svn+ssh://10.10.101.21/source/platform/platform-b2b@716 f3bf4e98-0cf0-11e4-a00c-a99a8b9d557d
suntg 11 年之前
父节点
当前提交
be848d53e5
共有 2 个文件被更改,包括 69 次插入2 次删除
  1. 12 0
      src/main/webapp/resources/js/common/services.js
  2. 57 2
      src/main/webapp/resources/js/index/app.js

+ 12 - 0
src/main/webapp/resources/js/common/services.js

@@ -203,5 +203,17 @@ define([ 'angular', 'toaster' ], function(angular) {
 					});
 			}
 		}
+	}).factory('VendorService', function($http, $resource, BaseService){
+		var rootPath = BaseService.getRootPath();
+		return {
+			getCount: function(success){
+				var request = $http.get(rootPath + '/vendor/count');
+				request.success(function(data){
+					success.call(null, data);
+				});
+			},
+			customer: $resource('vendor/customer/:id', {}),
+			vendor: $resource('vendor/:id', {})
+		};
 	});
 });

+ 57 - 2
src/main/webapp/resources/js/index/app.js

@@ -73,6 +73,10 @@ define([ 'toaster', 'charts', 'ngTable', 'common/services', 'service/Purc', 'ser
 			url : "/notice",
 			templateUrl : "static/tpl/index/sale/notice.html",
 			controller: 'SaleNoticeCtrl'
+		}).state('sale.customer', {
+			url : "/customer",
+			templateUrl : "static/tpl/index/sale/customer.html",
+			controller: 'CustomerCtrl'
 		}).state('sale.inquiry', {
 			url : "/inquiry",
 			templateUrl : "static/tpl/index/sale/inquiry.html",
@@ -227,7 +231,7 @@ define([ 'toaster', 'charts', 'ngTable', 'common/services', 'service/Purc', 'ser
 			$scope.routeState = routeState || 'home';
 		});
 	});
-	app.controller('AuthCtrl', function($scope, $window, AuthenticationService) {
+	app.controller('AuthCtrl', function($scope, $window, AuthenticationService, toaster) {
 		$scope.isAuthed = AuthenticationService.isAuthed();
 		$scope.userInfo = {};
 		AuthenticationService.getAuthentication().success(function(data) {
@@ -240,6 +244,22 @@ define([ 'toaster', 'charts', 'ngTable', 'common/services', 'service/Purc', 'ser
 				$window.location.reload();
 			});
 		};
+		
+		$scope.addFavorite = function(){
+			var url = encodeURI(window.location.href); 
+		    try{
+		    //ie浏览器收藏方式
+		        window.external.addFavorite(url, "优软商务平台");
+		    }catch(e) {
+		        try{
+		            //火狐浏览器收藏方式
+		            window.sidebar.addPanel("优软商务平台", url);
+		        }catch (e) {
+		            toaster.pop('warning', '提示', "您的浏览器不支持自动添加收藏夹,请使用Ctrl+D进行添加,"+
+		                    "或手动在浏览器里进行设置。");
+		        }
+		   }
+		};
 	});
 	app.controller('TodoCtrl', function($scope, SnapshotService){
 		SnapshotService.getTodo(function(data){
@@ -392,6 +412,41 @@ define([ 'toaster', 'charts', 'ngTable', 'common/services', 'service/Purc', 'ser
 		SnapshotService.getNotice(5, function(data){
 			$scope.notices = data;
 		});
+		
+		$scope.dateTime = new Date();
+	});
+	app.controller('VendCountCtrl', function($scope, VendorService){
+		VendorService.getCount(function(date){
+			$scope.count = date;
+		});
+	});
+	app.controller('CustomerCtrl', function($scope, $rootScope, VendorService, BaseService, ngTableParams){
+		$rootScope.active = 'customer';
+		
+		$scope.customerParams = new ngTableParams({
+			page : 1, 
+			count : 10,
+			sorting: {
+//				time: 'desc'
+            }
+		}, {
+			total : 0, 
+			counts: [5, 10, 25, 50],
+			getData : function($defer, params) {
+				$scope.loading = true;
+				VendorService.customer.get(BaseService.parseParams(params.url()), function(page){
+					$scope.loading = false;
+					if(page) {
+						params.total(page.totalElements);
+						$defer.resolve(page.content);
+					}
+					$scope.totalCount = page.totalElements;
+				});
+			}
+		});
+	});
+	app.controller('VendorCtrl', function($scope, $rootScope, VendorService){
+		$rootScope.active = 'customer';
 	});
 	var getState = function(active) {
 		var fn = 'get';
@@ -494,7 +549,7 @@ define([ 'toaster', 'charts', 'ngTable', 'common/services', 'service/Purc', 'ser
 		};
 		
 		$scope.print = function(order) {
-			ReportService.print(order.vendUU, 'purchase', '{purc_orders.pu_id}=' + order.id, '销售订单-' + order.code);
+			ReportService.print(order.enUU, 'purchase', '{purc_orders.pu_id}=' + order.id, '销售订单-' + order.code);
 		};
 		
 		$scope.getReply = function(item) {