1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980 |
- <?php
- /**
- * 权限列表
- * User: yang
- * Date: 16-4-28
- * Time: 上午11:10
- */
- use yii\helpers\Url;
- use yii\widgets\LinkPager;
- ?>
- <div class="panel panel-default">
- <div class="panel-heading">
- <h3 class="panel-title">权限列表</h3>
- </div>
- <div class="panel-body">
- <form action="<?=Url::toRoute(['auth/permission'])?>" method="get">
- <div class="col-sm-3">
- <div class="input-group">
- <input type="text" value="<?=Yii::$app->request->get('keyword');?>" name="keyword" placeholder="请输入搜索关键词" class="input-sm form-control search-input">
- </div>
- </div>
- <span class="input-group">
- <button type="submit" class="btn btn-sm btn-primary search-button"> 搜索</button>
- </span>
- </form>
- </div>
- <table class="table">
- <tr>
- <th>权限名称</th>
- <th>权限描述</th>
- <th>操作</th>
- </tr>
- <?php foreach ($datas as $vo):?>
- <tr>
- <td><?=$vo->name?></td>
- <td><?=$vo->description?></td>
- <td>
- <a class="btn btn-xs btn-primary" href="<?=Url::toRoute(['auth/updateper','name'=>$vo->name]);?>">修改</a>
- <a class="btn btn-xs btn-primary del" name="<?=$vo->name;?>" data-description = '<?=$vo->description;?>'>删除</a>
- </td>
- </tr>
- <?php endforeach;?>
- </table>
- </div>
- <?= LinkPager::widget(['pagination' => $pages]); ?>
- <script>
- $(".del").click(function(){
- var au=$(this);
- var name=$(this).attr("name");
- var description = $(this).attr('data-description');
- swal({
- title: "确定删除"+description+"权限?",
- test: '删除后,该权限操作不再约束。',
- type: "warning",
- showCancelButton: true,
- confirmButtonColor: "#DD6B55",
- confirmButtonText: "确定",
- cancelButtonText: "取消",
- closeOnConfirm: true,
- closeOnCancel: true },
- function(isConfirm){
- if (isConfirm) {
- $.ajax({
- type:"POST",
- data:{name:name,'_csrf-backend':"<?=Yii::$app->request->csrfToken;?>"},
- dataType:"JSON",
- url:"<?=Url::toRoute(['auth/del-permission']);?>",
- success:function(data){
- if(data.status==0){
- swal("", data.msg, "success");
- au.parent().parent().hide();
- }else{
- swal("警告", data.msg, "error");
- }
- }
- })
- }
- });
- });
- </script>
|