Files
OMS/app/desktop/view/users/edit_roles.html
2026-01-04 19:08:31 +08:00

190 lines
7.2 KiB
HTML

<!--
Copyright 2012-2026 ShopeX (https://www.shopex.cn)
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<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=edit&p[0]=<{$roles.role_id}>" method="POST">
<div style="text-align:right;padding:3px 18px"><{help docid="101" type="link"}><{t}>点击查看帮助<{/t}><{/help}></div>
<input type="hidden" name="role_id" value="<{$roles.role_id}>" />
<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}>"> <strong><{$workground.menu_title}></strong>
</div>
<div class="span-13">
<{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>
<{/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">
<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" <{if $dataauthorities.customer_sensitive_info.checked == 1}>checked="checked"<{/if}>/>&nbsp;&nbsp;<strong style="padding-left: 0px;">客户敏感信息</strong>
</label>
</div>
<div class="span-4">
<label>
<input type="checkbox" name="data_authority[]" value="purchase_price" <{if $dataauthorities.purchase_price.checked == 1}>checked="checked"<{/if}>/>&nbsp;&nbsp;<strong style="padding-left: 0px;">采购价</strong>
</label>
</div>
<div class="span-4">
<label>
<input type="checkbox" name="data_authority[]" value="cost_price" <{if $dataauthorities.cost_price.checked == 1}>checked="checked"<{/if}>/>&nbsp;&nbsp;<strong style="padding-left: 0px;">成本价</strong>
</label>
</div>
<div class="span-4">
<label>
<input type="checkbox" name="data_authority[]" value="sale_price" <{if $dataauthorities.sale_price.checked == 1}>checked="checked"<{/if}>/>&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(){
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>