You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

102 lines
4.8 KiB

{% extends 'baseBZPForm.html' %}
{% block content %}
{% load static %}
<div class="layui-form" lay-filter="layuiadmin-form-admin" id="layuiadmin-form-admin" style="padding: 20px 30px 0 0;">
<input name="RoleId" type="hidden" value="{% firstof role.RoleId '' %}" />
<div class="layui-form-item">
<label class="layui-form-label">角色代码</label>
<div class="layui-input-inline">
<input type="text" name="RoleCode" value="{% firstof role.RoleCode '' %}" lay-verify="required" placeholder="请输入角色代码" autocomplete="off"
class="layui-input">
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">角色名</label>
<div class="layui-input-inline">
<input type="text" name="RoleName" value="{% firstof role.RoleName '' %}" lay-verify="required" placeholder="请输入角色名" autocomplete="off"
class="layui-input">
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">系统权限</label>
<div class="layui-input-block">
{% for each_function_obj in sys_function_model_obj_list %}
{# 判断ModuleId 是否在后端传入的object_id_list里面, 如果在, 则选中 #}
{% if each_function_obj.ModuleId in sys_object_id_list %}
<input type="checkbox" checked value="{{ each_function_obj.ModuleId }}" class="SysLimits" lay-skin="primary" title="{{ each_function_obj.ModuleName }}">
{% else %}
<input type="checkbox" value="{{ each_function_obj.ModuleId }}" class="SysLimits" lay-skin="primary" title="{{ each_function_obj.ModuleName }}">
{% endif %}
{% endfor %}
<!-- <input type="checkbox" value="Home" class="SysLimits" lay-skin="primary" title="主页">
<input type="checkbox" value="UserManage" class="SysLimits" lay-skin="primary" title="试剂领用"> -->
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">终端权限</label>
<div class="layui-input-block">
{% for each_function_obj in client_function_model_obj_list %}
{# 判断ModuleId 是否在后端传入的object_id_list里面, 如果在, 则选中 #}
{% if each_function_obj.ModuleId in client_object_id_list %}
<input type="checkbox" checked value="{{ each_function_obj.ModuleId }}" class="ClientLimits" lay-skin="primary" title="{{ each_function_obj.ModuleName }}">
{% else %}
<input type="checkbox" value="{{ each_function_obj.ModuleId }}" class="ClientLimits" lay-skin="primary" title="{{ each_function_obj.ModuleName }}">
{% endif %}
{% endfor %}
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">具体描述</label>
<div class="layui-input-block">
<textarea type="text" name="Description" autocomplete="off" class="layui-textarea">{% firstof role.Description '' %}</textarea>
</div>
</div>
<div class="layui-form-item layui-hide">
<input type="button" lay-submit lay-filter="LAY-user-front-submit" id="LAY-user-front-submit" value="确认">
</div>
</div>
<script>
layui.use('form', function () {
var form = layui.form;
form.render(); //刷新select选择框渲染
});
var index = parent.layer.getFrameIndex(window.name);
layui.use(['index', 'form'], function () {
var form = layui.form;
form.on('submit(LAY-user-front-submit)', function(obj){
var fieldData= obj.field;
var SysPowerValue = "";
$(".SysLimits:checked").each(function (index, obj) {
if (SysPowerValue != "") {
SysPowerValue += ",";
}
SysPowerValue += $(".SysLimits:checked").eq(index).val();
});
var ClientPowerValue = "";
$(".ClientLimits:checked").each(function (index, obj) {
if (ClientPowerValue != "") {
ClientPowerValue += ",";
}
ClientPowerValue += $(".ClientLimits:checked").eq(index).val();
});
fieldData.SysPowerValue=SysPowerValue;
fieldData.ClientPowerValue=ClientPowerValue;
//提交修改
$.post("{% url 'user:saveRoleData' %}", fieldData, function (obj) {
if (obj.status == 1) {
msg("保存成功", function () {
parent.layer.close(index);
});
}
else {
msg("保存失败 " + obj.message);
}
});
return false;
});
})
</script>
{% endblock %}