146 lines
6.2 KiB
Plaintext
146 lines
6.2 KiB
Plaintext
@model RoleEditModel
|
|
@using BaseOUDAL;
|
|
@{
|
|
ViewBag.Title = "角色 | 权限修改";
|
|
Layout = "~/Views/Shared/_InfoLayout.cshtml";
|
|
var functionList = new BaseOUDAL.ErpBaseContext().Functions.OrderBy(o=>o.Sort).ToList();
|
|
var viewFunctionList = functionList.Where(f => f.Type != FunctionHelper.OperateType).ToList();
|
|
var optFunctionList = functionList.Where(f => f.Type == FunctionHelper.OperateType).ToList();
|
|
//加入父节点
|
|
FunctionHelper.AppendParent(functionList, viewFunctionList);
|
|
FunctionHelper.AppendParent(functionList, optFunctionList);
|
|
optFunctionList = optFunctionList.OrderBy(o => o.Sort).ToList();
|
|
var funcCheckSet = Model.RoleFunctions.Select(n => n.FunctionId).ToHashSet();
|
|
}
|
|
@section CSS{
|
|
<link href="~/Style/Css/roleEdit.css" rel="stylesheet" />
|
|
}
|
|
|
|
@section JS{
|
|
<script type="text/javascript">
|
|
function autocheck(a) {
|
|
$('input[id='+a.id+']').prop("checked", a.checked);
|
|
linkage(a);
|
|
}
|
|
|
|
function linkage(a) {
|
|
var obj = $(a);
|
|
var parentName = obj.attr('data-parent');
|
|
var status = $(a).is(":checked");
|
|
var typeName = obj.attr('data-type');
|
|
var fname = obj.attr('lang');
|
|
if (parentName == "-") {
|
|
$(obj).next().css('display', 'none');
|
|
$('input[type="checkbox"][data-parent="{0}"][data-type="{1}"]'.template(fname, typeName)).prop("checked", status)
|
|
return;
|
|
}
|
|
var arr = $("input[type='checkbox'][data-parent='{0}'][data-type='{1}']".template(parentName, typeName));
|
|
var parSelector = 'input[type="checkbox"][lang="{0}"][data-type="{1}"]'.template(parentName, typeName);
|
|
$(parSelector).next().css('display', 'none');
|
|
var continueState = false;
|
|
$(arr).each(function (i, obj) {
|
|
if ($(obj).is(":checked") != status) {
|
|
$(parSelector).prop("checked", true);
|
|
$(parSelector).next().css('display', 'inline-block');
|
|
continueState = true;
|
|
return false;
|
|
}
|
|
});
|
|
if (!continueState) {
|
|
$(parSelector).prop("checked", status);
|
|
}
|
|
}
|
|
|
|
function showOrHide(res) {
|
|
if ($(res).text() == "-") {
|
|
$(res).parent().next().next().hide();
|
|
$(res).html("+");
|
|
} else {
|
|
$(res).parent().next().next().show();
|
|
$(res).html("-");
|
|
}
|
|
}
|
|
//实现iframe窗口中对roleEdit页面修改的提交
|
|
function RoleEditSubmit() {
|
|
var data = $("#roleFunctionEditForm").serialize();
|
|
main.post("/system/roleFunctionEditFormJson", data).done(
|
|
function (res) {
|
|
window.location.href = "/system/RoleView?id=" + res.obj.Id;
|
|
try {
|
|
if (window.parent) {
|
|
window.parent.SearchClick();
|
|
}
|
|
}
|
|
catch (e) { }
|
|
});
|
|
}
|
|
function modulePermissions() {
|
|
$(".tab-1").parent().addClass("active");
|
|
$(".tab-link").parent().removeClass("active");
|
|
|
|
$(".tab-content").removeClass("tab-none");
|
|
$(".tab-content2").addClass("tab-none");
|
|
$(".tab-content2").removeClass("tab-block");
|
|
}
|
|
function operationPeemissions() {
|
|
$(".tab-link").parent().addClass("active");
|
|
$(".tab-1").parent().removeClass("active");
|
|
$(".tab-content").addClass("tab-none");
|
|
$(".tab-content2").addClass("tab-block");
|
|
|
|
}
|
|
$(".spanleft").parent().addClass("spanleft-w");
|
|
|
|
$(document).ready(function () {
|
|
var parentArr = $("input[type='checkbox'][data-parent='-']");
|
|
$(parentArr).each(function (i, obj) {
|
|
var dataType = $(obj).attr("data-type")
|
|
var allCount = $('input[type="checkbox"][data-parent="{0}"][data-type="{1}"]'.template(obj.lang, dataType)).length;
|
|
var selectCount = $('input[type="checkbox"][data-parent="{0}"][data-type="{1}"]:checked'.template(obj.lang, dataType)).length;
|
|
if (allCount != selectCount && selectCount > 0) {
|
|
$(obj).next().css('display', 'inline-block');
|
|
}
|
|
});
|
|
modulePermissions();
|
|
});
|
|
</script>
|
|
}
|
|
<div style="min-width: 700px;">
|
|
|
|
<form id="roleFunctionEditForm" method="post" action="/system/roleFunctionEdit" autocomplete="off">
|
|
|
|
<div class="form-layout">
|
|
<input type="hidden" name="Id" value="@(Model.Role.Id)" />
|
|
<div class="form-group col-12">
|
|
<label class="form-label">角色名称</label>
|
|
<input type="text" class="form-input" name="Name" value="@(Model.Role.Name)" maxlength="50" required />
|
|
<span class="required">*</span>
|
|
</div>
|
|
|
|
<div class="form-group col-12">
|
|
<label class="form-label">备注</label>
|
|
<input type="text" class="form-input" name="Remark" value="@(Model.Role.Remark)" maxlength="200" />
|
|
<input type="button" class="mx-2 btn btn-primary" onclick="RoleEditSubmit()" value="保 存">
|
|
</div>
|
|
</div>
|
|
|
|
<div class="tabbable">
|
|
<ul id="myTab" class="nav-main dark">
|
|
<li class="active" style="min-width: 120px;text-align: center;">
|
|
<a href="#tab" class="tab-1" onclick="modulePermissions()">模块权限</a>
|
|
</li>
|
|
<li style="min-width: 120px;text-align: center;">
|
|
<a href="#tab2" class="tab-link" onclick="operationPeemissions()">操作权限</a>
|
|
</li>
|
|
</ul>
|
|
</div>
|
|
|
|
<div class="tab-content" style="background-color:#F5F5F5">
|
|
@await Html.PartialAsync("RoleFunctionEdit_Part1",(viewFunctionList,"-", 0, funcCheckSet))
|
|
</div>
|
|
<div class="tab-content2">
|
|
@await Html.PartialAsync("RoleFunctionEdit_Part1",(optFunctionList,"-", 0, funcCheckSet))
|
|
</div>
|
|
</form>
|
|
</div>
|