Commit b0b04bce authored by zfcaa's avatar zfcaa Committed by zfc

编辑4

parent d73e0781
...@@ -102,7 +102,7 @@ class Auth extends Basic ...@@ -102,7 +102,7 @@ class Auth extends Basic
$data['msg'] = ''; $data['msg'] = '';
$title = $group_id ? '编辑':'新增'; $title = $group_id ? '编辑':'新增';
$table= New AuthGroup(); $table= New AuthGroup();
$info= $table->find();
if (empty($group_id)) { if (empty($group_id)) {
$data = input('post.'); $data = input('post.');
...@@ -126,6 +126,7 @@ class Auth extends Basic ...@@ -126,6 +126,7 @@ class Auth extends Basic
} }
} else { } else {
$info= $table->where("id={$group_id}")->find();
return $this->response(200, $title, $info); return $this->response(200, $title, $info);
...@@ -236,7 +237,7 @@ class Auth extends Basic ...@@ -236,7 +237,7 @@ class Auth extends Basic
} }
//编辑权限窗口 //编辑权限窗口
public function AuthRuleBox(){ public function AuthRuleBox($id=0){
return view('auth_rule_box'); return view('auth_rule_box');
} }
//分类列表 //分类列表
...@@ -252,6 +253,33 @@ class Auth extends Basic ...@@ -252,6 +253,33 @@ class Auth extends Basic
//prt(collection($data['list'])->toArray());//转化arr //prt(collection($data['list'])->toArray());//转化arr
return $this->response(200,'成功',$data); return $this->response(200,'成功',$data);
} }
//新增编辑权限
public function updateAuthRule($group_id=0){
$data['status'] = 200;
$data['msg'] = '';
$title = $group_id ? '编辑':'新增';
$table= New AuthGroup();
if (IS_POST) {
$data = input('post.');
$id = isset($data['id']) && $data['id']>0 ? $data['id']:false;
//新增或者编辑数据
if ($table->editData($data,$id)) {
return $this->response(200, '成功');
} else {
return $this->response(101, '失败');
}
} else {
$info= $table->findById($group_id);
return $this->response(200, $title, $info);
}
}
......
...@@ -26,7 +26,7 @@ ...@@ -26,7 +26,7 @@
<div class="form-group item_title "> <div class="form-group item_title ">
<label class="col-md-2 control-label" for="title">标题</label> <label class="col-md-2 control-label" for="title">标题</label>
<div class="col-md-4"> <div class="col-md-4">
<input type="text" value="仪表盘" name="title" class="form-control"> <input type="text" value="" name="title" class="form-control">
</div> </div>
<div class="col-md-5 help-block"><i class="fa fa-info-circle color-info1"></i> 用于后台显示的配置标题</div></div> <div class="col-md-5 help-block"><i class="fa fa-info-circle color-info1"></i> 用于后台显示的配置标题</div></div>
...@@ -73,7 +73,7 @@ ...@@ -73,7 +73,7 @@
<div class="form-group item_name "> <div class="form-group item_name ">
<label class="col-md-2 control-label" for="name">链接</label> <label class="col-md-2 control-label" for="name">链接</label>
<div class="col-md-4"> <div class="col-md-4">
<input type="text" value="admin/dashboard/index" name="name" class="form-control"> <input type="text" value="" name="name" class="form-control">
</div> </div>
<div class="col-md-5 help-block"><i class="fa fa-info-circle color-info1"></i> 链接</div></div> <div class="col-md-5 help-block"><i class="fa fa-info-circle color-info1"></i> 链接</div></div>
......
...@@ -14,20 +14,20 @@ ...@@ -14,20 +14,20 @@
<div class="builder formbuilder-box panel-body bg-color-fff"> <div class="builder formbuilder-box panel-body bg-color-fff">
<div class="row"> <div class="row">
<div class="col-md-7"> <div class="col-md-7">
<form action="/index/addAUth" method="post" class="form-builder form-horizontal"> <form action="/index/addAuth" method="post" class="form-builder form-horizontal">
<fieldset> <fieldset>
<!-- <input type="hidden" name="id" value="3">--> <!-- <input type="hidden" name="id" value="3">-->
<div class="form-group"> <div class="form-group">
<label for="title" class="col-md-2 control-label">名称:</label> <label for="title" class="col-md-2 control-label">名称:</label>
<div class="col-md-10"> <div class="col-md-10">
<input type="text" class="form-control" name="title" placeholder="创建的角色名称" value="普通用户"> <input type="text" class="form-control" name="title" placeholder="创建的角色名称" value="">
<span class="material-input"></span> <span class="material-input"></span>
</div> </div>
</div> </div>
<div class="form-group item_description"> <div class="form-group item_description">
<label for="description" class="col-md-2 control-label">描述:</label> <label for="description" class="col-md-2 control-label">描述:</label>
<div class="col-md-10"> <div class="col-md-10">
<textarea name="description" class="form-control" length="120" rows="5">这是普通用户的权限</textarea> <textarea id="description" name="description" class="form-control" length="120" rows="5"></textarea>
<span class="material-input"></span> <span class="material-input"></span>
</div> </div>
</div> </div>
......
...@@ -9,7 +9,7 @@ define (['doT', 'text!temp/auth_rule_box_template_tpl.html', 'css!style/home.css ...@@ -9,7 +9,7 @@ define (['doT', 'text!temp/auth_rule_box_template_tpl.html', 'css!style/home.css
event:function () { event:function () {
}, },
getList:function(pageNo){ getList:function(){
$.ajax({ $.ajax({
url: '/index/AuthClass.html', url: '/index/AuthClass.html',
type: 'GET', type: 'GET',
......
...@@ -15,11 +15,28 @@ define (['doT', 'text!temp/user_template_tpl.html', 'css!style/home.css','pagina ...@@ -15,11 +15,28 @@ define (['doT', 'text!temp/user_template_tpl.html', 'css!style/home.css','pagina
}, },
getList: function(){ getList: function(){
//ajax //ajax
$("input[name = title]").val("1111"); var id= getUrlParam('id');
$.ajax({
url: '/index/addAuth/group_id/'+id,
type: 'post',
async: true,
dataType: 'json',
success: function (data) {
$("input[name = title]").val(data.data.title);
$("#description").val(data.data.description);
}
})
} }
} }
return Role; return Role;
}); });
function getUrlParam(name) {
var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)");
var r = decodeURI(window.location.search).substr(1).match(reg);
if (r != null) return unescape(r[2]); return null;
}
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
[% for(var item in it){ %] [% for(var item in it){ %]
<tr> <tr>
<td><div class="icheckbox_minimal-blue" style="" aria-checked="false" aria-disabled="false"> <td><div class="icheckbox_minimal-blue" style="" aria-checked="false" aria-disabled="false">
<input type="checkbox" name="ids[]" value="1" class="ids" style=""> <!--<input type="checkbox" name="ids[]" value="1" class="ids" style="">-->
</div> </div>
</td> </td>
<td>[%= it[item]["id"] %]</td> <td>[%= it[item]["id"] %]</td>
...@@ -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/group_id/[%= it[item]['id'] %]" class="btn btn-primary btn-xs" title="编辑">编辑</a> <a style="margin-right:6px;" href="/index/authRuleBox/group_id/[%= it[item]['id'] %]" class="btn btn-primary btn-xs" title="编辑">编辑</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>
......
...@@ -11,9 +11,9 @@ ...@@ -11,9 +11,9 @@
</td> </td>
<td>[%= it[item]["status"] %]</td> <td>[%= it[item]["status"] %]</td>
<td> <td>
<a title="编辑" class="btn btn-success btn-xs" href="/admin.php/index/roleedit?id=[%= it[item]['id']%].html" style="margin-right:6px;">编辑</a> <a title="编辑" class="btn btn-success btn-xs" href="/admin.php/index/roleedit?id=[%= it[item]['id']%]" style="margin-right:6px;">编辑</a>
<a title="权限分配" class="btn btn-info btn-xs" href="/admin.php/index/access?id=[%= it[item]['id']%].html" style="margin-right:6px;">权限分配</a> <a title="权限分配" class="btn btn-info btn-xs" href="/admin.php/index/access?id=[%= it[item]['id']%]" style="margin-right:6px;">权限分配</a>
<a title="成员授权" class="btn btn-primary btn-xs" href="/admin.php/index/accessUser?id=[%= it[item]['id']%].html" style="margin-right:6px;">成员授权</a> <a title="成员授权" class="btn btn-primary btn-xs" href="/admin.php/index/accessUser?id=[%= it[item]['id']%]" style="margin-right:6px;">成员授权</a>
</td> </td>
</tr> </tr>
[% } %] [% } %]
......
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