Преглед изворни кода

git-svn-id: svn+ssh://10.10.101.21/source/platform/platform-b2b@488 f3bf4e98-0cf0-11e4-a00c-a99a8b9d557d

administrator пре 11 година
родитељ
комит
2988ab49aa

+ 1 - 1
src/main/webapp/resources/css/index.css

@@ -695,7 +695,7 @@ solid
 }
 
 .data-wrap .todo {
-	height: 345px;
+	height: 244px;
 	margin-bottom: 15px;
 }
 

+ 21 - 8
src/main/webapp/resources/js/common/services.js

@@ -12,20 +12,23 @@ define([ 'angular', 'toaster' ], function(angular) {
 				return sessionStorage.removeItem(key);
 			}
 		};
-	}).factory('AuthenticationService', function($http, SessionService, SerializerUtil) {
+	}).factory('BaseService', function() {
+		return {
+			getRootPath : function() {
+				var fullPath = window.document.location.href;
+				var path = window.document.location.pathname;
+				var pos = fullPath.indexOf(path);
+				return fullPath.substring(0, pos) + path.substring(0, path.substr(1).indexOf('/') + 1);
+			}
+		};
+	}).factory('AuthenticationService', function($http, SessionService, BaseService, SerializerUtil) {
 		var cacheSession = function() {
 			SessionService.set('authenticated', true);
 		};
 		var uncacheSession = function() {
 			SessionService.unset('authenticated');
 		};
-		var getRootPath = function() {
-			var fullPath = window.document.location.href;
-			var path = window.document.location.pathname;
-			var pos = fullPath.indexOf(path);
-			return fullPath.substring(0, pos) + path.substring(0, path.substr(1).indexOf('/') + 1);
-		};
-		var rootPath = getRootPath();
+		var rootPath = BaseService.getRootPath();
 		return {
 			root : function() {
 				return rootPath;	
@@ -61,6 +64,16 @@ define([ 'angular', 'toaster' ], function(angular) {
 				return request;
 			}
 		};
+	}).factory('MessageService', function($http, BaseService) {
+		var rootPath = BaseService.getRootPath();
+		return {
+			getOnhand : function(success) {
+				var request = $http.get(rootPath + '/message/onhand');
+				request.success(function(data){
+					success.call(null, data);
+				});
+			}
+		};
 	}).factory('SerializerUtil', function() {
 		return {
 			/**

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

@@ -141,7 +141,7 @@ define([ 'toaster', 'charts', 'ngTable', 'common/services', 'service/Purc', 'ui.
 			});
 		};
 	});
-	app.controller('DataCtrl', function($scope) {
+	app.controller('DataCtrl', function($scope, MessageService) {
 		$scope.charts = {
 			product : {
 				chartType : 'pie',
@@ -282,6 +282,9 @@ define([ 'toaster', 'charts', 'ngTable', 'common/services', 'service/Purc', 'ui.
 				}
 			}
 		};
+		MessageService.getOnhand(function(data){
+			$scope.onhand = data;
+		});
 	});
 	var isNumber = function(n) {
         return !isNaN(parseFloat(n)) && isFinite(n);

+ 4 - 26
src/main/webapp/resources/tpl/index/home/right.html

@@ -8,44 +8,22 @@
 			<li>交易后</li>
 		</ul>
 		<div class="todo-content">
-			<ul class="list-unstyled list-inline">
-				<li class="icon">采购</li>
-				<li class="start">
-					<ul class="list-unstyled">
-						<li><a href="#">询价中(0)</a></li>
-						<li><a href="#">待回复(0)</a></li>
-					</ul>
-				</li>
-				<li class="doing">
-					<ul class="list-unstyled">
-						<li><a href="#">待卖家发货(0)</a></li>
-						<li><a href="#">变更中(0)</a></li>
-					</ul>
-				</li>
-				<li class="end">
-					<ul class="list-unstyled">
-						<li><a href="#">待确认收货(0)</a></li>
-						<li><a href="#">退货中(0)</a></li>
-					</ul>
-				</li>
-			</ul>
 			<ul class="list-unstyled list-inline">
 				<li class="icon">销售</li>
 				<li class="start">
 					<ul class="list-unstyled">
-						<li><a ui-sref="sale.inquiry">待报价(4)</a></li>
-						<li><a ui-sref="sale.order.reply">待回复(6)</a></li>
+						<li><a ui-sref="sale.inquiry">待报价(<span ng-class="{'text-inverse': onhand.inquiry>0}" ng-bind="onhand.inquiry"></span>)</a></li>
+						<li><a ui-sref="sale.order.reply">待回复(<span ng-class="{'text-inverse': onhand.order>0}" ng-bind="onhand.order"></span>)</a></li>
 					</ul>
 				</li>
 				<li class="doing">
 					<ul class="list-unstyled">
-						<li><a ui-sref="sale.notice">待发货(0)</a></li>
-						<li><a ui-sref="sale.change">变更中(2)</a></li>
+						<li><a ui-sref="sale.notice">待发货(<span ng-class="{'text-inverse': onhand.notice>0}" ng-bind="onhand.notice"></span>)</a></li>
+						<li><a ui-sref="sale.change">变更中(<span ng-class="{'text-inverse': onhand.orderChange>0}" ng-bind="onhand.orderChange"></span>)</a></li>
 					</ul>
 				</li>
 				<li class="end">
 					<ul class="list-unstyled">
-						<li><a href="#">待买家确认收货(0)</a></li>
 						<li><a href="#">买家退货中(0)</a></li>
 					</ul>
 				</li>