Browse Source

打印报表与注册页面

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

+ 2 - 2
src/main/webapp/WEB-INF/views/normal/register.html

@@ -23,7 +23,7 @@
 			</div>
 			<div class="navbar-right">
 				<p class="navbar-text">
-					已经注册优软商务平台?<a href="../signin">立即登录</a>
+					已经注册优软商务平台?<a href="signin">立即登录</a>
 				</p>
 			</div>
 		</div>
@@ -34,7 +34,7 @@
 		<!-- main content (step1\step2\step2\...) -->
 	</div>
 	<!-- main End -->
-	<div class="navbar navbar-fixed-bottom" id="footer">
+	<div class="navbar" id="footer">
 		<!-- footer inner -->
 		<div class="container">
 			<div class="link-group">

+ 4 - 0
src/main/webapp/resources/css/register.css

@@ -207,4 +207,8 @@ h1,h2,h3 {
 #footer .list-inline>li:not(:last-child):after {
 	margin-left: 15px;
 	content: "|"
+}
+
+.navbar {
+	margin-bottom: 0px;
 }

+ 32 - 2
src/main/webapp/resources/js/common/services.js

@@ -1,6 +1,6 @@
-define([ 'angular' ], function(angular) {
+define([ 'angular', 'toaster' ], function(angular) {
 	'use strict';
-	angular.module('common.services', [ ]).factory('SessionService', function() {
+	angular.module('common.services', ['toaster' ]).factory('SessionService', function() {
 		return {
 			get : function(key) {
 				return sessionStorage.getItem(key);
@@ -92,5 +92,35 @@ define([ 'angular' ], function(angular) {
 				return query.length ? query.substr(0, query.length - 1) : query;
 			}
 		};
+	}).factory('ReportService', function($http, toaster) {
+		return {
+			/**
+			 * 打印方法
+			 * enuu 企业的UU号
+			 * pageName 打印页面的名称
+			 * condition 单据的条件(格式:{tableName.propertyName}=value;当tableName含有'$'符号时将其换成'_'符号)
+			 * title 单据标题
+			 */
+			print: function(enuu, pageName, condition, title) {
+				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();
+				$http.get(rootPath + '/report/getName', {params: {enuu: enuu, pagename: pageName}})
+					.success(function(data){
+						if(data) {
+							var url = 'http://192.168.253.6:8099/B2BCR/?reportfile=' + data + '&rcondition=' + condition;		
+							window.open(url, title + '-打印', 'width=' + (window.screen.width-10) + ',height=' + (window.screen.height*0.87) + ',top=0,left=0,toolbar=no, menubar=no, scrollbars=no, resizable=no,location=no, status=no');
+						} else {
+							toaster.pop('error', '系统错误', '没有设置相应的报表');
+						}
+					}).error(function() {
+						toaster.pop('error', '系统错误', '获取报表名称失败');
+					});
+			}
+		}
 	});
 });

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

@@ -1,6 +1,6 @@
 define([ 'toaster', 'charts', 'ngTable', 'common/services', 'service/PurcOrder', 'ui.router', 'ui.bootstrap' ], function() {
 	'use strict';
-	var app = angular.module('myApp', [ 'toaster', 'angularCharts', 'ngTable', 'ui.router', 'common.services', 'PurcOrderServices', 'ui.bootstrap' ]);
+	var app = angular.module('myApp', [ 'toaster', 'angularCharts', 'ngTable', 'ui.router', 'common.services', 'PurcOrderServices', 'ui.bootstrap']);
 	app.init = function() {
 		angular.bootstrap(document, [ 'myApp' ]);
 	};
@@ -262,7 +262,8 @@ define([ 'toaster', 'charts', 'ngTable', 'common/services', 'service/PurcOrder',
 			}
 		};
 	});
-	app.controller('SaleOrderCtrl', function($scope, $filter, PurcOrderItem, ngTableParams, toaster){
+	app.controller('SaleOrderCtrl', function($scope, $filter, PurcOrderItem, ngTableParams, 
+		toaster, ReportService){
 		var isNumber = function(n) {
             return !isNaN(parseFloat(n)) && isFinite(n);
         };
@@ -342,6 +343,10 @@ define([ 'toaster', 'charts', 'ngTable', 'common/services', 'service/PurcOrder',
 				});
 			}
 		};
+		
+		$scope.print = function(order) {
+			ReportService.print(order.vendUU, 'purchase', '{purc$orders.pu_id}=' + order.id, '销售订单-' + order.code);
+		};
 	});
 	return app;
 });

+ 4 - 0
src/main/webapp/resources/js/register/app.js

@@ -16,6 +16,10 @@ define([ 'toaster', 'services' ,'ui.router'], function() {
 			url: '/step3',
       		templateUrl: 'static/tpl/register/step3.html'
     	});
+	});
+	
+	app.controller('Step1Ctrl', function() {
+		
 	});
 	return app;
 });

+ 1 - 1
src/main/webapp/resources/tpl/index/sale/order.html

@@ -166,7 +166,7 @@
 				</td>
 				<td colspan="1" class="text-center">
 					<div class="operates">
-						<a href="#" class="text-muted" title="打印"><i
+						<a ng-click="print(order)" class="text-muted" title="打印"><i
 							class="fa fa-print fa-lg"></i></a>
 					</div>
 				</td>

+ 2 - 2
src/main/webapp/resources/tpl/register/step1.html

@@ -34,10 +34,10 @@
 </div>
 <!-- alert end -->
 
-<div class="row">
+<div class="row" ng-controller="Step1Ctrl">
 	<!-- enterprise form start -->
 	<div class="col-md-9">
-		<form name="enterpriseForm" class="form-horizontal" role="form" ng-submit="sumibBaseInfo(enterprise)">
+		<form name="enterpriseForm" class="form-horizontal" role="form" ng-submit="register(enterprise)">
 		  	<div class="form-group">
 		    	<label for="enName" class="col-md-3 col-sm-4 control-label">企业名称:</label>
 			    <div class="col-md-5 col-sm-6">