180 lines
8.2 KiB
Plaintext
180 lines
8.2 KiB
Plaintext
@model NP.Model.VMMM
|
|
@{
|
|
var cnt= 1;
|
|
}
|
|
<div class="row">
|
|
<div class="col-sm-5">
|
|
<section class="panel panel-default">
|
|
<header class="panel-heading font-bold">
|
|
권한목록
|
|
|
|
<a href="#" onclick="javascript:reg();" class="btn btn-xs btn-info">+추가</a>
|
|
</header>
|
|
<div class="panel-body" id="treebox" style="overflow: auto; max-height:250px;" >
|
|
<ul class="box left cap header">
|
|
<li style="width:20%;">No</li>
|
|
<li style="width:65%;">권한명</li>
|
|
</ul>
|
|
<ul class="box left cap" id="auths">
|
|
@*<li><a href="#" onclick="javascript:bind(11, this);" id="alink31"><span class="glyphicon glyphicon-asterisk"></span>강사</a></li>
|
|
<li><a href="#" onclick="javascript:bind(81, this);" id="alink32"><span class="glyphicon glyphicon-asterisk"></span>고객사관리자</a></li>
|
|
<li><a href="#" onclick="javascript:bind(91, this);" id="alink33"><span class="glyphicon glyphicon-asterisk"></span>통합관리자</a></li>
|
|
<li><a href="#" onclick="javascript:bind(92, this);" id="alink34"><span class="glyphicon glyphicon-asterisk"></span>일반관리자</a></li>*@
|
|
@foreach(var a in Model.userauths)
|
|
{
|
|
<li style="width:20%;" onclick="javascript: bind(@a.usertype,'@a.authname', this);" >@(cnt++)</li>
|
|
<li style="width:65%; text-align:left;" onclick="javascript: bind(@a.usertype,'@a.authname', this);">
|
|
<input type="text" class="authname" data-org="@a.authname" value="@a.authname" style="text-align: center; width:50%; height: 25px; line-height: 25px; border: 1px solid #ccc; margin-top: 3px;" />
|
|
<a href="#" class="btn btn-primary btn-xs" onclick="saveauthname(@a.usertype,this);" style="margin-top: -4px; @(a.usertype > 91 ? "":"display:none;")">수정</a>
|
|
@if (false)
|
|
{
|
|
<a href="#" class="btn btn-danger btn-xs" onclick="deluserauth(@a.usertype,'@a.authname');" style=" margin-top: -4px; @(a.usertype > 91 ? "" : "display:none;")">삭제</a>
|
|
}
|
|
</li>
|
|
}
|
|
</ul>
|
|
</div>
|
|
</section>
|
|
</div>
|
|
<div class="col-sm-7">
|
|
<section class="panel panel-default">
|
|
<header class="panel-heading font-bold">메뉴매핑</header>
|
|
<div class="panel-body">
|
|
<form id="mform" method="post">
|
|
<input type="hidden" id="ano" name="ano" />
|
|
<input type="hidden" id="aName" name="aName" />
|
|
@Html.HiddenFor(m => m.tabidx)
|
|
@Html.HiddenFor(m => m.savedata)
|
|
@Html.HiddenFor(m => m.intval)
|
|
@Html.HiddenFor(m=>m.stringval)
|
|
@Html.AntiForgeryToken()
|
|
<ul class="box" id="menutree">
|
|
@foreach (var m in Model.menus)
|
|
{
|
|
<li data-id="@m.menuno" data-pid="@m.pmenuno" class="@(m.ccount > 0 ? "isparent opened" : "") mg-l-@(m.menulevel) @(m.menulevel > 0 ? "initdata":"")">
|
|
<a href="#" class="navicon"><span class="glyphicon glyphicon-@(m.ccount > 0 ? "minus-sign" : "asterisk")"></span></a>
|
|
<input type="checkbox" value="@m.menuno" id="chk@(m.menuno)" /> <label for="chk@(m.menuno)">@m.menuname</label>
|
|
</li>
|
|
}
|
|
</ul>
|
|
</form>
|
|
<div class="line line-dashed line-lg pull-in"></div>
|
|
</div>
|
|
</section>
|
|
</div>
|
|
</div>
|
|
<div id="thisbox" class="findbox draggable regbox summernoteparentfixedbox" style="width: 500px; height:250px; z-index: 1041; top: 30%; bottom: 30px; overflow: auto;">
|
|
<h4><i class="fa fa-bars"></i> <span id="pcap">권한 등록</span><a href="#" class="btn btn-default btn-xs f-r closethisbox">닫기</a></h4>
|
|
<table class="regtable">
|
|
<colgroup><col style="width:150px;" /><col /></colgroup>
|
|
<tr id="trndepth">
|
|
<th>권한이름</th>
|
|
<td>@Html.TextBox("authname","" , new { @class = "form-control ff", @maxlength = "20" })</td>
|
|
</tr>
|
|
</table>
|
|
<div class="findboxbtnbox">
|
|
<a href="#" class="btn btn-primary" onclick="save2();">저장</a>
|
|
</div>
|
|
</div>
|
|
<div class="botfix">
|
|
<a href="#" class="btn btn-primary" onclick="save();" style="margin-left: 100px">저장</a>
|
|
</div>
|
|
<style type="text/css">
|
|
#auths li {line-height: 25px;font-size: 14px; padding: 2px 10px; border-radius: 5px;}
|
|
#auths li:hover{background-color: #fee453}
|
|
#auths li.focus{background-color: #fff09c}
|
|
</style>
|
|
<script>
|
|
$(document).ready(function () {
|
|
$("#menutree li.isparent a.navicon").on("click", function () {
|
|
if ($(this).parent().hasClass("opened")) {
|
|
hideli("menutree", $(this).parent().attr("data-id"));
|
|
}
|
|
else {
|
|
showli("menutree", $(this).parent().attr("data-id"));
|
|
}
|
|
});
|
|
var rAno = getint('@(ViewBag.ANO)');
|
|
if (rAno > 0) {
|
|
$("#alink" + rAno).click();
|
|
}
|
|
//$("li.initdata").hide();
|
|
});
|
|
function reg() {
|
|
bglayer();
|
|
$("#thisbox").show();
|
|
}
|
|
function save2() {
|
|
if (confirm("권한을 추가하시겠습니까?")) {
|
|
capp("/acommon/SaveUserAuth", { authname: $("#authname").val() }, "cbsave2");
|
|
}
|
|
}
|
|
function cbsave2() {
|
|
if (capResult.code == 1000) {
|
|
msg("권한이 추가됐습니다.");
|
|
timesubmit();
|
|
} else {
|
|
msgdev()
|
|
bglayer(false);
|
|
$("#thisbox").hide();
|
|
}
|
|
}
|
|
function saveauthname(no, a) {
|
|
var _authname = $.trim($(a).closest("li").find("input.authname").val())
|
|
if (confirm("권한명을 수정하시겠습니까?")) {
|
|
capp("/acommon/SaveAuthName", { authname: _authname, usertype: no }, "cbsave");
|
|
}
|
|
}
|
|
function save() {
|
|
if ($("#ano").val() == "") {
|
|
msg("선택된 권한이 없습니다.");
|
|
}
|
|
else if (confirm("저장하시겠습니까?")) {
|
|
if (confirm("저장하면 권한이 재구성됩니다. 정말 저장하시겠습니까?")) {
|
|
$("#intval").val($("#ano").val());
|
|
var sd = "";
|
|
$.each($("#menutree li input[type=checkbox]:checked"), function (i, r) {
|
|
sd += "," + $(r).val();
|
|
});
|
|
$("#savedata").val(sd);
|
|
$("#stringval").val($("#aName").val());
|
|
cap("/acommon/SaveMenuAuth", "mform", "cbsave", null, true);
|
|
}
|
|
}
|
|
}
|
|
function cbsave() {
|
|
if (capOK) {
|
|
timesubmit();
|
|
}
|
|
}
|
|
function deluserauth(no,_authname) {
|
|
if (confirm("권한을 삭제하시겠습니까?")) {
|
|
setTimeout(function () {
|
|
capp("/acommon/DelUserAuth", { usertype: no,authname:_authname }, "cbdeluserauth");
|
|
},500);
|
|
}
|
|
}
|
|
function cbdeluserauth() {
|
|
if (capResult.code == 1000) {
|
|
msg("권한이 삭제되었습니다.");
|
|
timesubmit();
|
|
} else {
|
|
msg("권한이 할당된 사용자가 있어 삭제할 수 없습니다.");
|
|
}
|
|
}
|
|
function bind(_no,_authname, a) {
|
|
$("ul#auths li").removeClass("focus");
|
|
$(a).parents().addClass("focus");
|
|
$("#ano").val(_no);
|
|
$("#aName").val(_authname);
|
|
$("#menutree li input[type=checkbox]").prop("checked", false);
|
|
cap("/acommon/GetAuthMenu", "mform", "cbget", null, true);
|
|
}
|
|
function cbget() {
|
|
if (capOK) {
|
|
$.each(capResult.obj, function (i, r) {
|
|
$("#chk" + r.menuno).prop("checked", true);
|
|
});
|
|
}
|
|
}
|
|
</script> |