Browse Source

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

administrator 11 years ago
parent
commit
5e59937d73

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

@@ -1179,9 +1179,31 @@ a.none:hover {
 	z-index: 2;
 }
 /*account*/
+.user-role>.role-item{
+	float: left;
+}
+
+.user-role>.role-item>.icon{
+  	text-align: center;
+  	color: #333;
+  	padding: 1px 3px;
+  	border-radius: 50%;
+  	border: 1px solid #333;
+}
+
+.user-role>.role-item>.icon.info{
+  	color: #56a022;
+  	border: 1px solid #56a022;
+}
+
+.user-role>.role-item>.icon.warning{
+  	color: #8a6d3b;
+  	border: 1px solid #8a6d3b;
+}
+
 .resource-container,.role-container {
 	padding: 15px;
-	min-height: 677px;
+	min-height: 645px;
 }
 
 .simple-list {

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

@@ -1,6 +1,6 @@
-define([ 'angular', 'toaster', 'ui.bootstrap' ], function(angular) {
+define([ 'angular', 'toaster' ], function(angular) {
 	'use strict';
-	angular.module('common.services', ['toaster', 'ui.bootstrap', 'common.tpls' ]).factory('SessionService', function() {
+	angular.module('common.services', ['toaster' ]).factory('SessionService', function() {
 		return {
 			get : function(key) {
 				var storage = window.sessionStorage;
@@ -216,44 +216,5 @@ define([ 'angular', 'toaster', 'ui.bootstrap' ], function(angular) {
 			customer: $resource('vendor/customer/:id', {}),
 			vendor: $resource('vendor/:id', {})
 		};
-	}).factory('ngAlert', function($modal){
-		var ngAlert = function(config, trueFn, falseFn){
-			var modalInstance = $modal.open({
-				animation: true,
-				templateUrl: 'common/template/alert.html',
-				controller: 'AlertInstanceCtrl',
-				resolve: {
-					alertConfig: function() {
-						return config;
-					}
-				}
-			});
-			modalInstance.result.then(function(bool){
-				var fn = bool ? trueFn : falseFn;
-				fn && (fn.call());
-			});
-			return this;
-		};
-		return ngAlert;
-	}).controller('AlertInstanceCtrl', function($scope, $modalInstance, alertConfig){
-		$scope.alertConfig = alertConfig;
-		$scope.ok = function () {
-		    $modalInstance.close(true);
-		};
-		$scope.cancel = function () {
-			$modalInstance.close(false);
-		};
 	});
-	angular.module("common.tpls", ["common/template/alert.html"]);
-	angular.module("common/template/alert.html", []).run(["$templateCache", function($templateCache) {
-		  $templateCache.put("common/template/alert.html",
-			"<div class=\"modal-header\">" +
-				  		"<h3 class=\"modal-title\" ng-bind=\"alertConfig.title\"></h3>" + 
-			"</div>" +
-			"<div class=\"modal-body\" ng-bind=\"alertConfig.content\"></div>" +
-			"<div class=\"modal-footer\">" +
-				  	"<button class=\"btn btn-primary\" ng-click=\"ok()\">确定</button>" +
-				  	"<button class=\"btn btn-warning\" ng-click=\"cancel()\">取消</button>" +
-		  	"</div>");
-	}]);
 });

+ 11 - 10
src/main/webapp/resources/js/index/app.js

@@ -1,6 +1,6 @@
-define([ 'toaster', 'charts', 'ngTable', 'common/services', 'service/Purc', 'service/Account', 'ui.router', 'ui.bootstrap' , 'file-upload', 'ngSanitize'], function() {
-//	'use strict';
-	var app = angular.module('myApp', [ 'toaster', 'angularCharts', 'ngTable', 'ui.router', 'common.services', 'PurcServices', 'AccountServices', 'ui.bootstrap', 'angularFileUpload', 'ngSanitize']);
+define([ 'toaster', 'charts', 'ngTable', 'common/services', 'service/Purc', 'service/Account', 'service/Alert', 'ui.router', 'ui.bootstrap' , 'file-upload', 'ngSanitize'], function() {
+	'use strict';
+	var app = angular.module('myApp', [ 'toaster', 'angularCharts', 'ngTable', 'ui.router', 'common.services', 'PurcServices', 'AccountServices', 'AlertServices', 'ui.bootstrap', 'angularFileUpload', 'ngSanitize']);
 	app.init = function() {
 		angular.bootstrap(document, [ 'myApp' ]);
 	};
@@ -153,10 +153,6 @@ define([ 'toaster', 'charts', 'ngTable', 'common/services', 'service/Purc', 'ser
 			url : "/resource",
 			templateUrl : "static/tpl/index/account/resource.html",
 			controller: 'ResourceCtrl'
-		}).state('account.authority', {
-			url : "/authority",
-			templateUrl : "static/tpl/index/account/authority.html",
-			controller: 'AuthorityCtrl'
 		}).state('account.role', {
 			url : "/role",
 			templateUrl : "static/tpl/index/account/role.html",
@@ -2146,6 +2142,7 @@ define([ 'toaster', 'charts', 'ngTable', 'common/services', 'service/Purc', 'ser
 				toaster.pop('error', '提示', '删除用户失败。');
 			});
 		};
+		
 	});
 	
 	app.controller('PasswordCtrl', function($scope, $modalInstance, user, AccountUser, toaster){
@@ -2245,9 +2242,6 @@ define([ 'toaster', 'charts', 'ngTable', 'common/services', 'service/Purc', 'ser
 		});
 	});
 	
-	app.controller('AuthorityCtrl', function($scope){
-	});
-	
 	app.controller('RoleCtrl', function($scope, $modal, AccountRole){
 		$scope.roles = {};
 		var getData = function() {
@@ -2404,6 +2398,13 @@ define([ 'toaster', 'charts', 'ngTable', 'common/services', 'service/Purc', 'ser
 			return '0天';
 		};
 	});
+	app.filter('firstchar', function(){
+		return function(str) {
+			if(str == null)
+				return null;
+			return str.substring(0, 1);
+		};
+	});
 	/**
 	 * 搜索框,回车触发
 	 */

+ 43 - 0
src/main/webapp/resources/js/index/services/Alert.js

@@ -0,0 +1,43 @@
+define([ 'angular', 'ui.bootstrap' ], function(angular) {
+	'use strict';
+	angular.module('AlertServices', ['ui.bootstrap', 'tpls' ]).factory('ngAlert', function($modal){
+		var ngAlert = function(config, trueFn, falseFn){
+			var modalInstance = $modal.open({
+				animation: true,
+				templateUrl: 'tpl/alert.html',
+				controller: 'AlertInstanceCtrl',
+				resolve: {
+					alertConfig: function() {
+						return config;
+					}
+				}
+			});
+			modalInstance.result.then(function(bool){
+				var fn = bool ? trueFn : falseFn;
+				fn && (fn.call());
+			});
+			return this;
+		};
+		return ngAlert;
+	}).controller('AlertInstanceCtrl', function($scope, $modalInstance, alertConfig){
+		$scope.alertConfig = alertConfig;
+		$scope.ok = function () {
+		    $modalInstance.close(true);
+		};
+		$scope.cancel = function () {
+			$modalInstance.close(false);
+		};
+	});
+	angular.module("tpls", ["tpl/alert.html"]);
+	angular.module("tpl/alert.html", []).run(["$templateCache", function($templateCache) {
+		  $templateCache.put("tpl/alert.html",
+			"<div class=\"modal-header\">" +
+				  		"<h3 class=\"modal-title\" ng-bind=\"alertConfig.title\"></h3>" + 
+			"</div>" +
+			"<div class=\"modal-body\" ng-bind=\"alertConfig.content\"></div>" +
+			"<div class=\"modal-footer\">" +
+				  	"<button class=\"btn btn-primary\" ng-click=\"ok()\">确定</button>" +
+				  	"<button class=\"btn btn-warning\" ng-click=\"cancel()\">取消</button>" +
+		  	"</div>");
+	}]);
+});

+ 0 - 1
src/main/webapp/resources/tpl/index/account/authority.html

@@ -1 +0,0 @@
-权限分配

+ 0 - 1
src/main/webapp/resources/tpl/index/account/left.html

@@ -20,7 +20,6 @@
 	</div>
 	<ul class="list-unstyled">
 		<li ui-sref-active="active"><a ui-sref="account.resource">系统资源</a></li>
-		<li ui-sref-active="active"><a ui-sref="account.authority">权限管理</a></li>
 		<li ui-sref-active="active"><a ui-sref="account.role">角色管理</a></li>
 	</ul>
 </div>

+ 105 - 68
src/main/webapp/resources/tpl/index/account/user.html

@@ -3,18 +3,24 @@
 	width: 56px;
 	line-height: 30px;
 }
+
 .base-info .content {
 	line-height: 30px;
 }
-.radio input[type="radio"], .radio-inline input[type="radio"], .checkbox input[type="checkbox"], .checkbox-inline input[type="checkbox"] {
+
+.radio input[type="radio"],.radio-inline input[type="radio"],.checkbox input[type="checkbox"],.checkbox-inline input[type="checkbox"]
+	{
 	margin-top: 10px;
 }
+
 .password label {
 	
 }
+
 .password .col {
 	line-height: 30px;
 }
+
 .password .line {
 	margin-bottom: 15px;
 }
@@ -26,54 +32,72 @@
 	<div class="pane-header">
 		我的个人资料
 		<div class="pull-right">
-			<a ng-disabled="userForm.$invalid" class="text-simple text-success" ng-show="editing" ng-click="saveUser()"><i class="fa fa-save fa-fw"></i>保存修改</a>
-			<a class="text-simple" ng-show="editing" ng-click="editing=false"><i class="fa fa-reply-all fa-fw"></i>取消编辑</a>
-			<a class="text-simple" ng-show="!editing" ng-click="editing=true"><i class="fa fa-pencil fa-fw"></i>编辑</a>
-			<a class="text-simple text-danger" ng-click="updatePassword()"><i class="fa fa-lock fa-fw"></i>修改密码</a>
+			<a ng-disabled="userForm.$invalid" class="text-simple text-success"
+				ng-show="editing" ng-click="saveUser()"><i
+				class="fa fa-save fa-fw"></i>保存修改</a> <a class="text-simple"
+				ng-show="editing" ng-click="editing=false"><i
+				class="fa fa-reply-all fa-fw"></i>取消编辑</a> <a class="text-simple"
+				ng-show="!editing" ng-click="editing=true"><i
+				class="fa fa-pencil fa-fw"></i>编辑</a> <a class="text-simple text-danger"
+				ng-click="updatePassword()"><i class="fa fa-lock fa-fw"></i>修改密码</a>
 		</div>
 	</div>
 	<div class="pane-body">
 		<form ng="userForm" class="form-inline">
-		<div class="row row-sm item">
-			<div class="col-xs-3">
-				<span class="title">姓名</span>
-				<div class="content" ng-show="!editing" ng-bind="user.userName"></div>
-				<div class="content" ng-show="editing"><input reqired ng-model="user.userName" class="form-control input-sm" type="text"/></div>
-			</div>
-			<div class="col-xs-3">
-				<span class="title">性别</span>
-				<div class="content" ng-show="!editing" ng-bind="user.userSex == 'F' ? '女' : '男'"></div>
-				<div class="content" ng-show="editing">
-					<label class="radio-inline"><input ng-model="user.userSex" value="F" type="radio"/> 女 </label>
-					<label class="radio-inline"><input ng-model="user.userSex" value="M" type="radio"/> 男 </label>
+			<div class="row row-sm item">
+				<div class="col-xs-3">
+					<span class="title">姓名</span>
+					<div class="content" ng-show="!editing" ng-bind="user.userName"></div>
+					<div class="content" ng-show="editing">
+						<input reqired ng-model="user.userName"
+							class="form-control input-sm" type="text" />
+					</div>
+				</div>
+				<div class="col-xs-3">
+					<span class="title">性别</span>
+					<div class="content" ng-show="!editing"
+						ng-bind="user.userSex == 'F' ? '女' : '男'"></div>
+					<div class="content" ng-show="editing">
+						<label class="radio-inline"><input ng-model="user.userSex"
+							value="F" type="radio" /> 女 </label> <label class="radio-inline"><input
+							ng-model="user.userSex" value="M" type="radio" /> 男 </label>
+					</div>
+				</div>
+				<div class="col-xs-6">
+					<span class="title">身份证号</span>
+					<div class="content" ng-show="!editing" ng-bind="user.userIdcode"></div>
+					<div class="content" ng-show="editing">
+						<input ng-model="user.userIdcode" class="form-control input-sm"
+							type="text" />
+					</div>
 				</div>
 			</div>
-			<div class="col-xs-6">
-				<span class="title">身份证号</span>
-				<div class="content" ng-show="!editing" ng-bind="user.userIdcode"></div>
-				<div class="content" ng-show="editing"><input ng-model="user.userIdcode" class="form-control input-sm" type="text"/></div>
-			</div>
-		</div>
-		<div class="row row-sm item">
-			<div class="col-xs-3">
-				<span class="title">UU</span>
-				<div class="content" ng-bind="::user.userUU"></div>
-			</div>
-			<div class="col-xs-3">
-				<span class="title">电话</span>
-				<div class="content" ng-show="!editing" ng-bind="user.userTel"></div>
-				<div class="content" ng-show="editing"><input reqired ng-model="user.userTel" class="form-control input-sm" type="text"/></div>
-			</div>
-			<div class="col-xs-6">
-				<span class="title">邮箱</span>
-				<div class="content" ng-show="!editing" ng-bind="user.userEmail"></div>
-				<div class="content" ng-show="editing"><input reqired ng-model="user.userEmail" class="form-control input-sm" type="text"/></div>
+			<div class="row row-sm item">
+				<div class="col-xs-3">
+					<span class="title">UU</span>
+					<div class="content" ng-bind="::user.userUU"></div>
+				</div>
+				<div class="col-xs-3">
+					<span class="title">电话</span>
+					<div class="content" ng-show="!editing" ng-bind="user.userTel"></div>
+					<div class="content" ng-show="editing">
+						<input reqired ng-model="user.userTel"
+							class="form-control input-sm" type="text" />
+					</div>
+				</div>
+				<div class="col-xs-6">
+					<span class="title">邮箱</span>
+					<div class="content" ng-show="!editing" ng-bind="user.userEmail"></div>
+					<div class="content" ng-show="editing">
+						<input reqired ng-model="user.userEmail"
+							class="form-control input-sm" type="text" />
+					</div>
+				</div>
 			</div>
-		</div>
 		</form>
 	</div>
 </div>
-	<script type="text/ng-template" id="updatePassword.html">
+<script type="text/ng-template" id="updatePassword.html">
         <div class="modal-header">
             <h3 class="modal-title"><i class="fa fa-lock fa-fw"></i>修改密码</h3>
         </div>
@@ -113,12 +137,14 @@
 	<div class="pane-header">
 		全部用户
 		<div class="pull-right">
-			<a title="新增用户默认密码为111111" ng-show="adding == true" class="btn btn-success btn-sm" 
-				ng-disabled="newUserForm.$invalid" ng-click="addUser(newUser)" class="text-simple">
-				<i class="fa fa-user-plus fa-fw"></i>确定添加
-			</a>
-			<a ng-click="adding = false" ng-show="adding == true" class="text-simple"><i class="fa fa-user-plus fa-fw"></i>取消</a>
-			<a ng-click="adding = true" ng-show="adding != true" class="text-simple"><i class="fa fa-user-plus fa-fw"></i>添加用户</a>
+			<a title="新增用户默认密码为111111" ng-show="adding == true"
+				class="btn btn-success btn-sm" ng-disabled="newUserForm.$invalid"
+				ng-click="addUser(newUser)" class="text-simple"> <i
+				class="fa fa-user-plus fa-fw"></i>确定添加
+			</a> <a ng-click="adding = false" ng-show="adding == true"
+				class="text-simple"><i class="fa fa-user-plus fa-fw"></i>取消</a> <a
+				ng-click="adding = true" ng-show="adding != true"
+				class="text-simple"><i class="fa fa-user-plus fa-fw"></i>添加用户</a>
 		</div>
 	</div>
 	<div class="pane-body">
@@ -127,13 +153,13 @@
 				ng-table="tableParams">
 				<thead>
 					<tr class="header">
-						<th>UU</th>
-						<th>姓名</th>
-						<th>性别</th>
-						<th>身份证号</th>
-						<th>电话</th>
-						<th>邮箱</th>
-						<th></th>
+						<th width="90">UU</th>
+						<th width="120">姓名</th>
+						<th width="80">性别</th>
+						<th width="170">身份证号</th>
+						<th width="170">电话</th>
+						<th width="200">邮箱</th>
+						<th>角色</th>
 					</tr>
 				</thead>
 				<tbody>
@@ -141,28 +167,34 @@
 						<td class="text-center">
 							<div style="line-height: 30px;">系统生成</div>
 						</td>
-						<td class="text-center">
-							<input ng-model="newUser.userName" class="form-control input-sm" required type="text" placeholder="用户名">
-						</td>
-						<td class="text-center">
-							<select ng-model="newUser.userSex" class="form-control input-sm" ng-init="newUser.userSex='M'">
+						<td class="text-center"><input ng-model="newUser.userName"
+							class="form-control input-sm" required type="text"
+							placeholder="用户名"></td>
+						<td class="text-center"><select ng-model="newUser.userSex"
+							class="form-control input-sm" ng-init="newUser.userSex='M'">
 								<option value="F">女</option>
 								<option value="M">男</option>
-							</select>
-						</td>
-						<td class="text-center">
-							<input ng-model="newUser.userIdcode" class="form-control input-sm" type="text" placeholder="身份证号">
+						</select></td>
+						<td class="text-center"><input ng-model="newUser.userIdcode"
+							class="form-control input-sm" type="text" placeholder="身份证号">
 						</td>
-						<td class="text-center" ng-class="{'has-error': userTelError, 'has-success': userTelSuccess}">
-							<input ng-model="newUser.userTel" ng-blur="telValid(newUser.userTel)" required name="newUserTel" class="form-control input-sm" type="text" placeholder="手机号">
+						<td class="text-center"
+							ng-class="{'has-error': userTelError, 'has-success': userTelSuccess}">
+							<input ng-model="newUser.userTel"
+							ng-blur="telValid(newUser.userTel)" required name="newUserTel"
+							class="form-control input-sm" type="text" placeholder="手机号">
 						</td>
-						<td class="text-center" ng-class="{'has-error': userEmailError, 'has-success': userEmailSuccess}">
-							<input ng-model="newUser.userEmail" ng-blur="emailValid(newUser.userEmail)" required name="newUserEmail" class="form-control input-sm" type="text" placeholder="邮箱">
+						<td class="text-center"
+							ng-class="{'has-error': userEmailError, 'has-success': userEmailSuccess}">
+							<input ng-model="newUser.userEmail"
+							ng-blur="emailValid(newUser.userEmail)" required
+							name="newUserEmail" class="form-control input-sm" type="text"
+							placeholder="邮箱">
 						</td>
-						<td></td>
+						<td><a ng-click="">设置角色</a></td>
 					</tr>
 				</tbody>
-				<tbofy>
+				<tbody>
 					<tr ng-repeat="u in $data track by u.userUU">
 						<td class="text-center" ng-bind="::u.userUU"></td>
 						<td class="text-center" ng-bind="::u.userName"></td>
@@ -170,7 +202,12 @@
 						<td class="text-center" ng-bind="::u.userIdcode"></td>
 						<td class="text-center" ng-bind="::u.userTel"></td>
 						<td class="text-center" ng-bind="::u.userEmail"></td>
-						<td class="text-center"><a ng-if="u.userUU != user.userUU" ng-click="removeUser(u.userUU)" title="删除该用户"><i class="fa fa-trash-o fa-lg"></></a></td>
+						<td class="user-role">
+							<div class="role-item" ng-repeat="role in u.roles"><span class="icon" ng-class="{'info':role}" ng-bind="role.desc | firstchar"></span></div>
+						</td>
+						<!-- <td class="text-center"><a ng-if="u.userUU != user.userUU"
+							ng-click="removeUser(u.userUU)" title="删除该用户"><i
+								class="fa fa-trash-o fa-lg"></></a></td> -->
 					</tr>
 				</tbody>
 			</table>