Files
mayi-grade/application/admin/view/auth_group/edit.html
T
2018-10-25 16:54:56 +08:00

138 lines
3.9 KiB
HTML

{extend name="common@create" /}
{block name="formaa"}
<form action="/authgroup/{$list.id}" method="PUT" class="form form-horizontal" id="form-member-add">
<div class="row cl">
<label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>角色名称:</label>
<div class="formControls col-xs-8 col-sm-9">
<input type="text" class="input-text" value="{$list.title}" placeholder="角色名称" id="title" name="title">
</div>
</div>
<div class="row cl">
<label class="form-label col-xs-4 col-sm-3">角色描述:</label>
<div class="formControls col-xs-8 col-sm-9">
<input type="text" class="input-text" value="{$list.miaoshu}" placeholder="说明角色有哪些权限" id="miaoshu" name="miaoshu">
</div>
</div>
<div class="row cl">
<label class="form-label col-xs-4 col-sm-3">网站角色:</label>
<div class="formControls col-xs-8 col-sm-9">
{php}
$rule = new app\admin\model\AuthRule;;
$plist = $rule->getRule();
{/php}
{volist name="plist" id="p"}
<dl class="permission-list">
<dt>
<label>
<input type="checkbox" value="{$p.id}" name="rules[]" id="rule{$p.id}" {php}echo in_array($p['id'],$list['rules']) ? 'checked' : '';{/php}>
{$p.title}
</label>
</dt>
{php}
$clist = $rule->getRule($p['id']);
{/php}
<dd>
{volist name = "clist" id = "c"}
<dl class="cl permission-list2">
<dt>
<label class="">
<input type="checkbox" value="{$c.id}" name="rules[]" id="rule{$c.id}" {php}echo in_array($c['id'],$list['rules']) ? 'checked' : '';{/php}>
{$c.title}
</label>
</dt>
{php}
$slist = $rule->getRule($c['id']);
{/php}
<dd>
{volist name="slist" id="s"}
<label class="">
<input type="checkbox" value="{$s.id}" name="rules[]" id="rule{$s.id}" {php}echo in_array($s['id'],$list['rules']) ? 'checked' : '';{/php}>
{$s.title}</label>
{/volist}
</dd>
</dl>
{/volist}
</dd>
</dl>
{/volist}
</div>
</div>
<div class="row cl">
<div class="col-xs-8 col-sm-9 col-xs-offset-4 col-sm-offset-3">
<input class="btn btn-primary radius" type="submit" value="&nbsp;&nbsp;提交&nbsp;&nbsp;">
</div>
</div>
</form>
{/block}
{block name="yanzheng"}
<script type="text/javascript">
$(function(){
$(".permission-list dt input:checkbox").click(function(){
$(this).closest("dl").find("dd input:checkbox").prop("checked",$(this).prop("checked"));
});
$(".permission-list2 dd input:checkbox").click(function(){
var l =$(this).parent().parent().find("input:checked").length;
var l2=$(this).parents(".permission-list").find(".permission-list2 dd").find("input:checked").length;
if($(this).prop("checked")){
$(this).closest("dl").find("dt input:checkbox").prop("checked",true);
$(this).parents(".permission-list").find("dt").first().find("input:checkbox").prop("checked",true);
}
else{
if(l==0){
$(this).closest("dl").find("dt input:checkbox").prop("checked",false);
}
if(l2==0){
$(this).parents(".permission-list").find("dt").first().find("input:checkbox").prop("checked",false);
}
}
});
$("#form-admin-role-add").validate({
rules:{
roleName:{
required:true,
},
},
onkeyup:false,
focusCleanup:true,
success:"valid",
submitHandler:function(form){
$(form).ajaxSubmit();
var index = parent.layer.getFrameIndex(window.name);
parent.layer.close(index);
}
});
});
// 匹配用户名
$.validator.addMethod("zh",function(value,element){
var tel = /^[\u4e00-\u9fa5]*$/;
return this.optional(element) || tel.test(value);
}, "请输入中文");
// 设置表单验证规则
var myrules = {
title:{
required:true,
zh:true,
rangelength:[2,6]
},
miaoshu:{
required:true,
rangelength:[1,200]
},
rule:{
digits:true,
max:999
},
};
// 设置表单提交方式
var mytype = 'PUT';
</script>
{/block}