ソースを参照

完成系统管理页面,权限控制按钮

shuzheng 9 年 前
コミット
530195243a

+ 42 - 38
zheng-upms/zheng-upms-server/src/main/webapp/WEB-INF/jsp/manage/system/index.jsp

@@ -12,7 +12,7 @@
 	<meta charset="utf-8">
 	<meta http-equiv="X-UA-Compatible" content="IE=edge">
 	<meta name="viewport" content="width=device-width, initial-scale=1">
-	<title>系统注册</title>
+	<title>系统管理</title>
 
 	<link href="${basePath}/resources/zheng-admin/plugins/bootstrap-3.3.0/css/bootstrap.min.css" rel="stylesheet"/>
 	<link href="${basePath}/resources/zheng-admin/plugins/material-design-iconic-font-2.2.0/css/material-design-iconic-font.min.css" rel="stylesheet"/>
@@ -24,9 +24,9 @@
 <body>
 <div id="main">
 	<div id="toolbar">
-		<a class="waves-effect waves-button" href="javascript:;"><i class="zmdi zmdi-plus"></i> 新增用户</a>
-		<a class="waves-effect waves-button" href="javascript:;"><i class="zmdi zmdi-edit"></i> 编辑用户</a>
-		<a class="waves-effect waves-button" href="javascript:;"><i class="zmdi zmdi-close"></i> 删除用户</a>
+		<shiro:hasPermission name="upms:system:create"><a class="waves-effect waves-button" href="javascript:;"><i class="zmdi zmdi-plus"></i> 新增系统</a></shiro:hasPermission>
+		<shiro:hasPermission name="upms:system:update"><a class="waves-effect waves-button" href="javascript:;"><i class="zmdi zmdi-edit"></i> 编辑系统</a></shiro:hasPermission>
+		<shiro:hasPermission name="upms:system:delete"><a class="waves-effect waves-button" href="javascript:;"><i class="zmdi zmdi-close"></i> 删除系统</a></shiro:hasPermission>
 	</div>
 	<table id="table"></table>
 </div>
@@ -37,46 +37,40 @@
 <script src="${basePath}/resources/zheng-admin/plugins/waves-0.7.5/waves.min.js"></script>
 
 <script src="${basePath}/resources/zheng-admin/js/common.js"></script>
+<style>
+    body{font-size: 12px;}
+    .table i{font-size: 12px; color: #000;}
+    .bootstrap-table .table>thead>tr>th{border-bottom: none;}
+</style>
 <script>
 $(function() {
 	// bootstrap table初始化
 	$('#table').bootstrapTable({
-		idField: 'id',
-		url: '${basePath}/resources/zheng-admin/data/data1.json',
+		url: '${basePath}/manage/system/list',
 		height: getHeight(),
 		striped: true,
 		search: true,
 		showRefresh: true,
-		showToggle: true,
 		showColumns: true,
 		minimumCountColumns: 2,
-		showPaginationSwitch: true,
 		clickToSelect: true,
 		detailView: true,
 		detailFormatter: 'detailFormatter',
 		pagination: true,
-		//sidePagination: 'server',
-		idField: 'id',
-		sortName: 'id',
-		sortOrder: 'desc',
 		toolbar: '#toolbar',
 		columns: [
 			{field: 'state', checkbox: true},
-			{field: 'id', title: '编号', sortable: true, halign: 'center'},
-			{field: 'username', title: '账号', sortable: true, halign: 'center'},
-			{field: 'password', title: '密码', sortable: true, halign: 'center'},
-			{field: 'name', title: '姓名', sortable: true, halign: 'center'},
-			{field: 'sex', title: '性别', sortable: true, halign: 'center'},
-			{field: 'age', title: '年龄', sortable: true, halign: 'center'},
-			{field: 'phone', title: '年龄', sortable: true, halign: 'center'},
-			{field: 'email', title: '邮箱', sortable: true, halign: 'center'},
-			{field: 'address', title: '地址', sortable: true, halign: 'center'},
-			{field: 'remark', title: '备注', sortable: true, halign: 'center'},
-			{field: 'action', title: '操作', halign: 'center', align: 'center', formatter: 'actionFormatter', events: 'actionEvents'}
+			{field: 'systemId', title: '编号', sortable: true, align: 'center'},
+			{field: 'icon', title: '图标', sortable: true, align: 'center', formatter: 'iconFormatter'},
+            {field: 'title', title: '系统标题'},
+			{field: 'name', title: '系统名称'},
+			{field: 'basepath', title: '根目录'},
+			{field: 'status', title: '状态', sortable: true, align: 'center', formatter: 'statusFormatter'},
+			{field: 'action', title: '操作', align: 'center', formatter: 'actionFormatter', events: 'actionEvents'}
 		]
 	}).on('all.bs.table', function (e, name, args) {
 		$('[data-toggle="tooltip"]').tooltip();
-		$('[data-toggle="popover"]').popover();  
+		$('[data-toggle="popover"]').popover();
 	});
 	$(window).resize(function () {
 		$('#table').bootstrapTable('resetView', {
@@ -84,28 +78,37 @@ $(function() {
 		});
 	});
 });
+// 格式化操作按钮
 function actionFormatter(value, row, index) {
     return [
-        '<a class="like" href="javascript:void(0)" data-toggle="tooltip" title="Like"><i class="glyphicon glyphicon-heart"></i></a> ',
-        '<a class="edit ml10" href="javascript:void(0)" data-toggle="tooltip" title="Edit"><i class="glyphicon glyphicon-edit"></i></a> ',
-        '<a class="remove ml10" href="javascript:void(0)" data-toggle="tooltip" title="Remove"><i class="glyphicon glyphicon-remove"></i></a>'
+        '<a class="update" href="javascript:void(0)" data-toggle="tooltip" title="Edit"><i class="glyphicon glyphicon-edit"></i></a> ',
+        '<a class="delete" href="javascript:void(0)" data-toggle="tooltip" title="Remove"><i class="glyphicon glyphicon-remove"></i></a>'
     ].join('');
 }
-
+// 格式化图标
+function iconFormatter(value, row, index) {
+    return '<i class="' + value + '"></i>';
+}
+// 格式化状态
+function statusFormatter(value, row, index) {
+	if (value == 1) {
+		return '<span class="label label-success">正常</span>';
+	} else {
+		return '<span class="label label-danger">锁定</span>';
+	}
+}
+// 操作按钮事件
 window.actionEvents = {
-    'click .like': function (e, value, row, index) {
-        alert('You click like icon, row: ' + JSON.stringify(row));
-        console.log(value, row, system);
-    },
-    'click .edit': function (e, value, row, index) {
-        alert('You click edit icon, row: ' + JSON.stringify(row));
-        console.log(value, row, system);
+    'click .update': function (e, value, row, index) {
+        alert('You click update icon, row: ' + JSON.stringify(row));
+        console.log(value, row, index);
     },
-    'click .remove': function (e, value, row, index) {
-        alert('You click remove icon, row: ' + JSON.stringify(row));
-        console.log(value, row, system);
+    'click .delete': function (e, value, row, index) {
+        alert('You click delete icon, row: ' + JSON.stringify(row));
+        console.log(value, row, index);
     }
 };
+// 展开内容
 function detailFormatter(index, row) {
 	var html = [];
 	$.each(row, function (key, value) {
@@ -113,6 +116,7 @@ function detailFormatter(index, row) {
 	});
 	return html.join('');
 }
+// 动态高度
 function getHeight() {
 	return $(window).height() - 20;
 }