Commit 94a5defb authored by 刘丹's avatar 刘丹

用户列表

parent d513eda6
...@@ -9,8 +9,75 @@ authRule={ ...@@ -9,8 +9,75 @@ authRule={
authRule.event(); authRule.event();
}, },
event:function () { event:function () {
$ (document).delegate (".edit", "click", function () {//点击编辑
authRule.house_id = $ (this).attr ("data-id");
authRule.Edid_add();
authRule.Edit();
});
$ (document).delegate (".submit_edit", "click", function () {//提交编辑
authRule.Submit_edit();
authRule.getList();
});
$ (document).delegate (".edit_add", "click", function () {//新增
authRule.Edid_add();
});
}, },
Edid_add:function(){
$.ajax({
url: '/index/classList/type/1',//获取后台菜单
type: 'GET',
async: true,
dataType: 'json',
success: function (data) {
var temp=document.getElementById('auth_class_tpl').innerHTML;
var doTempl=doT.template(temp);
$("#pid").html(doTempl(data.data));//赋值
}
});
},
Edit:function(){//获取
$.ajax({
'type': 'GET',
'url' : '/index/updateAuthRule/group_id/',//获取编辑数据
data: {"id":authRule.house_id},
dataType: "json",
success: function (data) {
$("input[name = id]").val(data.data.id);
$("input[name = title]").val(data.data.title);
$("input[name = name]").val(data.data.name);
$("input[name = sort]").val(data.data.sort);
$("#pid").val(data.data.pid);
if(data.data.is_menu==0){
$("#is_menu2").attr('checked',true);
}else{
$("#is_menu1").attr('checked',true);
}
}
});
},
Submit_edit:function(){//提交编辑的信息
var par={}
par.id= authRule.house_id;
par.title= $("input[name = title]").val();
par.name= $("input[name = name]").val();
par.sort= $("input[name = sort]").val();
par.pid=$("#pid").val();
par.is_menu=$("input[name =is_menu]:checked").val();
$.ajax({
'type': 'POST',
'url' : '/index/updateAuthRule',
data:par,
dataType: "json",
success: function(data){
if(data.code==200){
}else{
alert(data.msg);
}
}
});
},
getList:function(pageNo){ getList:function(pageNo){
authRule.pageNo =pageNo; authRule.pageNo =pageNo;
var params ={}; var params ={};
......
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
<td>[%= it[item]["status"] %]</td> <td>[%= it[item]["status"] %]</td>
<!--<td><span class="fa fa-check text-success"></span></td>--> <!--<td><span class="fa fa-check text-success"></span></td>-->
<td> <td>
<a style="margin-right:6px;" href="/index/authRuleBox.html?id=[%= it[item]['id'] %]" class="btn btn-primary btn-xs" title="编辑">编辑</a> <a class="btn1 btn-success edit" href="#modal-edit" data-toggle="modal" data-id='[%= it[item]["id"] %]'>编辑</a>
<a style="margin-right:6px;" href="" class="btn btn-warning btn-xs ajax-get confirm" title="禁用">禁用</a> <a style="margin-right:6px;" href="" class="btn btn-warning btn-xs ajax-get confirm" title="禁用">禁用</a>
</td> </td>
</tr> </tr>
...@@ -25,4 +25,19 @@ ...@@ -25,4 +25,19 @@
<td colspan="8" style="text-align:center;"> 暂无数据</td> <td colspan="8" style="text-align:center;"> 暂无数据</td>
</tr> </tr>
[% } %] [% } %]
</script>
<!--权限管理模板-->
<script id="auth_class_tpl" type="text/template">
<option selected="" value="0">顶级菜单</option>
[% if(it) { %]
[% for(var item in it){ %]
[% if(it[item]['pid']!=0){ %]
<option value="[%= it[item]['id'] %]">[%= it[item]["title_show"] %]</option>
[% }else{ %]
<option value="[%= it[item]['id'] %]">[%= it[item]["title_show"] %]</option>
[% } %]
[% } %]
[% } %]
</script> </script>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment