Files
OMS/app/desktop/view/users/add_roles.html
2025-12-28 23:13:25 +08:00

183 lines
6.5 KiB
HTML
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<!--
Copyright © ShopeX http://www.shopex.cn. All rights reserved.
See LICENSE file for license details.
-->
<style>
.span-2 input {
float: left;
}
.span-2 strong {
line-height: 36px;padding-left: 10px;
}
.span-4 input {
float: left;
}
.span-4 strong {
line-height: 36px;padding-left: 10px;
}
.span-3 input {
float: left;
}
.span-3 strong {
line-height: 36px;padding-left: 10px;
}
</style>
<form id="rolesform" action="index.php?ctl=roles&act=save" method="POST">
<div style="text-align:right;padding:3px 18px"><{help docid="101" type="link"}><{t}>点击查看帮助<{/t}><{/help}></div>
<div class="division">
<h4><{t}>角色名称<{/t}></h4>
<input type="text" vtype="required" name="role_name" value="<{$roles.role_name}>" class="x-input " autocomplete="off">
</div>
<div class='division'>
<h4><{t}>操作权限<{/t}></h4>
<input type='hidden' vtype='requiredcheckbox'/>
<{foreach from=$workgrounds item=workground name=d }>
<div class="row clearfix clear" style="padding:5px;border-bottom:1px #e9e9e9 solid;">
<div class="span-3">
<input type="checkbox" class="role_workground" value="<{$workground.workground}>">&nbsp;&nbsp;<strong><{$workground.menu_title}></strong>
</div>
<div class="span-13" style="width:528px;">
<div class="clearfix">
<{foreach from=$workground.permissions item=permission key=key}>
<div class="span-4">
<label>
<input type="checkbox" class="<{$permission.role_workground}>" name="workground[]" value="<{$permission.permission}>" <{if $permission.checked}>checked=checked<{/if}>/><strong><{$permission.menu_title}></strong>
</label>
</div>
<{/foreach}>
</div>
</div>
</div>
<{/foreach}>
<div class="row clearfix clear" style="padding:5px;">
<div class="span-3"><strong><{t}>桌面挂件<{/t}></strong></div>
<div class="span-13" style="width:528px;">
<div class="clearfix">
<{foreach from=$widgets item=widget key=key}>
<div class="span-4">
<label>
<input type="checkbox" name="workground[]" value="<{$widget.addon}>" <{if $widget.checked}>checked=checked<{/if}>/><strong><{$widget.menu_title}></strong>
</label>
</div>
<{/foreach}>
</div>
</div>
</div>
<{if $others}>
<div class="row clearfix clear" style="padding:5px;">
<div class="span-3"><strong><{t}>其他<{/t}></strong></div>
<div class="span-13" style="width:528px;">
<div class="clearfix">
<{foreach from=$others item=other key=key}>
<div class="span-4" style="width:120px">
<label>
<input type="checkbox" name="workground[]" value="<{$other.permission}>" <{if $other.checked}>checked=checked<{/if}>/><strong><{$other.menu_title}></strong>
</label>
</div>
<{/foreach}>
</div>
</div>
</div>
<{/if}>
</div>
<div class='division'>
<h4><{t}>数据权限<{/t}></h4>
<div id="data_authority" class="clearfix">
<div class="span-4">
<label>
<input type="checkbox" name="data_authority[]" value="customer_sensitive_info" />&nbsp;&nbsp;<strong style="padding-left: 0px;">客户敏感信息</strong>
</label>
</div>
<div class="span-4">
<label>
<input type="checkbox" name="data_authority[]" value="purchase_price" />&nbsp;&nbsp;<strong style="padding-left: 0px;">采购价</strong>
</label>
</div>
<div class="span-4">
<label>
<input type="checkbox" name="data_authority[]" value="cost_price" />&nbsp;&nbsp;<strong style="padding-left: 0px;">成本价</strong>
</label>
</div>
<div class="span-4">
<label>
<input type="checkbox" name="data_authority[]" value="sale_price" />&nbsp;&nbsp;<strong style="padding-left: 0px;">销售价</strong>
</label>
</div>
</div>
</div>
</form>
<{area inject=".mainFoot"}>
<div class="table-action">
<{button label=$___desktop="确定"|t:'desktop' id="rolesform-submit" class="btn-primary"}>
</div>
<{/area}>
<script>
function nameCheck(input){
id = input.value;
role_id = $('roleID').value;
if((input.checked)){
new Request.HTML({url:'index.php?app=desktop&ctl=roles&act=get_permission',method:'post',
update:$(input).getNext(),data:'role_id='+role_id+'&name='+encodeURIComponent(input.value=input.value.trim())}).send();
$('workground'+id).setStyle('display','block');
}
else{
$('workground'+id).setStyle('display','none').empty();;
}
}
</script>
<script>
(function(){
var _form = $('rolesform');
var btn =$('rolesform-submit');
var finder = finderGroup['<{$env.get.finder_id}>'];
_form.store('target',{
onComplete:function(){},
onSuccess:function(response){
var hash_res_obj = JSON.decode(response);
if (hash_res_obj.success != undefined && hash_res_obj.success != ""){
try{
var _dialogIns = btn.getParent('.dialog').retrieve('instance');
}catch(e){}
if(_dialogIns){
_dialogIns.close();
finder.refresh.delay(400,finder);
}
}
}
});
btn.addEvent('click',function(){
_form.fireEvent('submit',{stop:$empty});
});
})();
if ($$('.role_workground')){
$$('.role_workground').addEvent('click',function(e){
var role_menu = this.value;
var checked = this.checked;
var _this=this;
$$('.'+role_menu+'').each(function(role){
role.set('checked',checked);
});
$$('.'+role_menu+'').addEvent('click',function(item){
if (checked == true)
{
checked = false;
_this.set('checked',false);
}
});
});
}
</script>