jiapeng 8 years ago
parent
commit
ec579280f8

+ 23 - 0
css/model/sys/role.css

@ -0,0 +1,23 @@
1
@charset "utf-8";
2
.sys_role_index .queryForm{
3
	position: relative;
4
}
5
.sys_role_index .queryForm .icon-search{
6
	position: absolute;
7
	top:7px;
8
	right:15px;
9
	font-size:25px;
10
}
11
.sys_role_index .table-opt .icon {
12
	margin: 10px;
13
	font-size: 20px;
14
}
15
.sys_role_new,.sys_role_display,.sys_role_edit{
16
	width:600px;
17
	padding: 10px;
18
}
19
.sys_role_new .right-ctn,.sys_role_display  .right-ctn,.sys_role_edit  .right-ctn{
20
	max-height: 200px;
21
	padding: 20px;
22
	overflow: auto;
23
}

+ 1 - 1
html/model/sys/org/index.html

@ -74,7 +74,7 @@
74 74
			</tbody>
75 75
			<tbody ch-dir="array.empty">
76 76
				<tr>
77
					<td colspan="6">表格暂无数据</td>
77
					<td class="empty-desc" colspan="6">表格暂无数据</td>
78 78
				</tr>
79 79
			</tbody>
80 80
		</table>

+ 1 - 1
html/model/sys/resource/index.html

@ -46,7 +46,7 @@
46 46
			</tbody>
47 47
			<tbody ch-dir="array.empty">
48 48
				<tr>
49
					<td colspan="8">表格暂无数据</td>
49
					<td class="empty-desc" colspan="8">表格暂无数据</td>
50 50
				</tr>
51 51
			</tbody>
52 52
		</table>

+ 41 - 0
html/model/sys/role/edit.html

@ -0,0 +1,41 @@
1
<div class="sys_role_edit centerModal">
2
	<div class="modal-ctrl">
3
		<i class="icon icon-times"></i>
4
	</div>
5
	<div class="containe">
6
		<div class="row">
7
			<div class="col-6">
8
				<div class="container newForm">
9
					<div class="row">
10
						<div class="col-4 item-caption ">类型</div>
11
						<div class="col-8">
12
							<div class="form-item select" dictCode="roleType" defVal="" name="type"></div>
13
						</div>
14
					</div>
15
					<div class="row">
16
						<div class="col-4 item-caption">名称</div>
17
						<div class="col-8">
18
							<div class="form-item text" defVal="" name="name"></div>
19
						</div>
20
					</div>
21
					<div class="row">
22
						<div class="col-4 item-caption">备注</div>
23
						<div class="col-8">
24
							<div class="form-item textarea" defVal="" name="descp"></div>
25
						</div>
26
					</div>
27
				</div>
28
			</div>
29
			<div class="col-6">
30
				<ul class ="right-ctn">
31
					<li ch-dir="list" class="right-item opt-check"><i class="icon icon-st-check {{checked}}" right="{{id}}"></i>&nbsp;&nbsp;&nbsp;{{name}}</li>
32
				</ul>
33
			</div>
34
		</div>
35
		<div class="row">
36
			<div class="col-12">
37
				<div class="btn opt-save pull-right">SAVE</div>
38
			</div>
39
		</div>
40
	</div>
41
</div>

+ 46 - 0
html/model/sys/role/index.html

@ -0,0 +1,46 @@
1
<div class="sys_role_index">
2
	<div class="modal-ctrl">
3
		<i class="icon icon-times"></i>
4
	</div>
5

6
	<div class="container queryForm">
7
		<div class="row">
8
			<div class="col-6">
9
				<div class="btn opt-new">
10
					<i class="icon-plus"></i>
11
					新增
12
				</div>
13
				
14
			</div>
15
			<div class="col-6">				
16
				<div class="form-item text" name="qn"></div><i class="icon icon-search"></i>
17
			</div>
18

19
		</div>
20
	</div>
21
	<div class="container dt-tpl">
22
		<table class="table table-bordered">
23
			<thead>
24
				<tr>
25
					<th>#</th>
26
					<th>名称</th>
27
					<th>分类</th>
28
					<th>操作</th>
29
				</tr>
30
			</thead>
31
			<tbody>
32
				<tr ch-dir="list">
33
					<td>{{-_index}}</td>
34
					<td>{{name}}</td>
35
					<td class="hand-dict" dict="roleType" code="{{type}}" ></td>
36
					<td class="table-opt" roleId="{{id}}"><i class="icon icon-remove-sign opt-del"></i><i class="icon icon-th-large opt-display"></i></td>
37
				</tr>
38
			</tbody>
39
			<tbody ch-dir="array.empty">
40
				<tr>
41
					<td class="empty-desc" colspan="4">表格暂无数据</td>
42
				</tr>
43
			</tbody>
44
		</table>
45
	</div>
46
</div>

+ 41 - 0
html/model/sys/role/new.html

@ -0,0 +1,41 @@
1
<div class="sys_role_new centerModal">
2
	<div class="modal-ctrl">
3
		<i class="icon icon-times"></i>
4
	</div>
5
	<div class="containe">
6
		<div class="row">
7
			<div class="col-6">
8
				<div class="container newForm">
9
					<div class="row">
10
						<div class="col-4 item-caption ">类型</div>
11
						<div class="col-8">
12
							<div class="form-item select" dictCode="roleType" defVal="" name="type"></div>
13
						</div>
14
					</div>
15
					<div class="row">
16
						<div class="col-4 item-caption">名称</div>
17
						<div class="col-8">
18
							<div class="form-item text" defVal="" name="name"></div>
19
						</div>
20
					</div>
21
					<div class="row">
22
						<div class="col-4 item-caption">备注</div>
23
						<div class="col-8">
24
							<div class="form-item textarea" defVal="" name="descp"></div>
25
						</div>
26
					</div>
27
				</div>
28
			</div>
29
			<div class="col-6">
30
				<ul class ="right-ctn">
31
					<li ch-dir="list" class="right-item opt-check"><i class="icon icon-st-check" right="{{id}}"></i>&nbsp;&nbsp;&nbsp;{{name}}</li>
32
				</ul>
33
			</div>
34
		</div>
35
		<div class="row">
36
			<div class="col-12">
37
				<div class="btn opt-save pull-right">SAVE</div>
38
			</div>
39
		</div>
40
	</div>
41
</div>

+ 11 - 5
html/model/sys/user/index.html

@ -58,13 +58,19 @@
58 58
			<div class="btn opt-del">
59 59
				<i class="icon-remove-sign"></i>删除
60 60
			</div>
61
			<div class="btn opt-role">
62
				<i class="icon-group"></i>角色
63
			</div>
64
			<div class="btn opt-right">
65
				<i class="icon-key"></i>权限
66
			</div>
61 67
		</div>
62 68
	</div>
63 69
	<div class="container dt-tpl">
64 70
		<table class="table table-bordered">
65 71
			<thead>
66 72
				<tr>
67
					<th class="opt-check" ><i class="icon icon-st-check"></i> </th>
73
					<th class="opt-check"><i class="icon icon-st-check"></i> </th>
68 74
					<th>序号</th>
69 75
					<th>名称</th>
70 76
					<th>手机</th>
@ -75,11 +81,11 @@
75 81
			</thead>
76 82
			<tbody>
77 83
				<tr ch-dir="list">
78
					<td class="opt-check" ><i class="icon icon-st-check" userId="{{id}}"></i></td>
84
					<td class="opt-check"><i class="icon icon-st-check" userId="{{id}}"></i></td>
79 85
					<td>{{-_index}}</td>
80
					<td>{{name}}</td>
81
					<td>{{mobile}}</td>
82
					<td>{{email}}</td>
86
					<td class="data-name">{{name}}</td>
87
					<td class="data-mobile">{{mobile}}</td>
88
					<td class="data-email">{{email}}</td>
83 89
					<td>{{actived-bool}}</td>
84 90
					<td>{{createTime-date}}</td>
85 91
				</tr>

+ 39 - 0
js/model/sys/role/edit.js

@ -0,0 +1,39 @@
1
;
2
spa_define(function() {
3
	return $.use(["spa", "form", "code"], function(spa, fb, code) {
4
		return {
5
			modal: function(data) {
6
				var root = spa.findInModal(".sys_role_edit");
7
				var form = fb.build(root.find(".newForm"));
8
				var cr = code.parseCode(root.find(".right-ctn"));
9
				root.find(".modal-ctrl .icon-times").on("click", function() {
10
					spa.closeModal();
11
				});
12
				root.on("click", ".icon-st-check", function() {
13
					$(this).toggleClass("checked");
14
				});
15

16
				root.find(".opt-save").on("click", function() {
17
					var ret = [];
18
					root.find(".right-ctn i.checked").each(function() {
19
						ret.push(parseInt($(this).attr("right")));
20
					});
21
					form.val({ "auths": ret });
22
					form.doPut("../ajax/sys/role", function() {
23
						spa.closeModal();
24
						if(data.hand) {
25
							data.hand();
26
						}
27
					});
28

29
				});
30
				data.rights.forEach(function(item) {
31
					item.checked = (data.data.auths.indexOf(item.id) >= 0) ? "checked" : "";
32
				});
33
				cr.val(data.rights);
34
				form.val(data.data);
35
			}
36
		};
37
	});
38

39
});

+ 77 - 0
js/model/sys/role/index.js

@ -0,0 +1,77 @@
1
;
2
spa_define(function() {
3
	return $.use(["spa", "code", "form", "util", "dict"], function(spa, code, form, util, dict) {
4
		return {
5
			main: function() {
6
				var root = spa.findInMain(".sys_role_index");
7
				var qf = form.build(root.find(".queryForm"));
8
				var cr = code.parseCode(root.find(".dt-tpl"));
9
				var queryBtn = root.find(".queryForm .icon-search");
10
				var newBtn = root.find(".opt-new");
11
				root.on("click", ".opt-del", function() {
12
					var resId = $(this).parent().attr("roleId");
13
					if(resId) {
14
						util.boxMsg({
15
							title: "确认删除",
16
							content: "您是否要删除选中的角色信息,角色信息删除后不可恢复!!!!!!!!!!!!!!!!!!",
17
							btns: [{
18
									caption: "删除",
19
									hand: function() {
20
										util.del("../ajax/sys/role/" + resId, load, {});
21
									}
22
								},
23
								{ caption: "取消" }
24
							]
25
						});
26
					}
27
				});
28
				root.on("click", ".opt-display", function() {
29
					var rId = $(this).parent().attr("roleId");
30
					if(rId) {
31
						var role = allData.find(function(item) { return item.id === rId });
32
						if(role) {
33
							util.get("../ajax/sys/right/all", null, function(data) {
34
								spa.showModal("sys_role_edit", { data: role, rights: data, hand: load });
35
							});
36
						}
37
					}
38
				});
39
				newBtn.on("click", function() {
40
					util.get("../ajax/sys/right/all", null, function(data) {
41
						spa.showModal("sys_role_new", { data: data, hand: load });
42
					});
43
				});
44
				var tableData = { data: [] },
45
					allData = [];
46
				var query = function() {
47
					var val = qf.item("qn").get();
48
					if(val) {
49
						var td = tableData.data = [];
50
						for(var i = 0; i < allData.length; ++i) {
51
							var item = allData[i];
52
							if(item && item.name && item.name.indexOf(val) >= 0) {
53
								td.push(item);
54
							}
55
						}
56
					} else {
57
						tableData.data = allData;
58
					}
59
					cr.val(tableData.data);
60
				};
61
				var load = function() {
62
					util.get("../ajax/sys/role/all", null, function(data) {
63
						allData = data || [];
64
						query();
65
					}, {});
66
				};
67

68
				queryBtn.on("click", query);
69
				cr.listen(dict.doTransfer)
70
				load();
71
			},
72
			mainDestory: function() {
73

74
			}
75
		};
76
	});
77
});

+ 36 - 0
js/model/sys/role/new.js

@ -0,0 +1,36 @@
1
;
2
spa_define(function() {
3
	return $.use(["spa","form","code"], function(spa,fb,code) {
4
		return {
5
			modal: function(data) {
6
				var root = spa.findInModal(".sys_role_new");
7
				var form = fb.build(root.find(".newForm"));
8
				var cr = code.parseCode(root.find(".right-ctn"));
9
				root.find(".modal-ctrl .icon-times").on("click", function() {
10
					spa.closeModal();
11
				});
12
				root.on("click",".icon-st-check",function(){
13
					$(this).toggleClass("checked");
14
				});
15
				cr.val(data.data);
16
				root.find(".opt-save").on("click",function(){
17
					var ret =[];
18
					root.find(".right-ctn i.checked").each(function(){
19
						ret.push($(this).attr("right"));
20
					});
21
					form.val({"auths":ret});
22
					form.doPost("../ajax/sys/role",function(){
23
						spa.closeModal();
24
						if(data.hand){
25
							data.hand();
26
						}
27
					});
28
					
29
				});
30
				
31
				
32
			}
33
		};
34
	});
35

36
});