完善事件权限管理
This commit is contained in:
@@ -115,6 +115,85 @@ namespace COMCMS.Web.Areas.AdminCP.Controllers
|
||||
|
||||
return Json(tip);
|
||||
}
|
||||
|
||||
#region 编辑事件详情
|
||||
[HttpGet]
|
||||
[MyAuthorize("add", "eventkey")]
|
||||
public IActionResult EditEventKey(int id)
|
||||
{
|
||||
TargetEvent entity = TargetEvent.Find(TargetEvent._.Id == id);
|
||||
if (entity == null)
|
||||
{
|
||||
return EchoTipPage("系统找不到本记录!");
|
||||
}
|
||||
Admin.WriteLogActions("查看/编辑事件详情(id:" + entity.Id + ");");
|
||||
return View(entity);
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
[MyAuthorize("add", "eventkey","JSON")]
|
||||
public IActionResult EditEventKey(TargetEvent model)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(model.EventKey))
|
||||
{
|
||||
tip.Message = "请填写事件KEY";
|
||||
return Json(tip);
|
||||
}
|
||||
if (string.IsNullOrWhiteSpace(model.EventName))
|
||||
{
|
||||
tip.Message = "请填写事件名称";
|
||||
return Json(tip);
|
||||
}
|
||||
TargetEvent entity = TargetEvent.Find(TargetEvent._.Id == model.Id);
|
||||
if (entity == null)
|
||||
{
|
||||
tip.Message = "系统找不到本记录!";
|
||||
return Json(tip);
|
||||
}
|
||||
if (entity.EventKey != model.EventKey)
|
||||
{
|
||||
if (TargetEvent.FindCount(TargetEvent._.EventKey == model.EventKey, null, null, 0, 0) > 0)
|
||||
{
|
||||
tip.Message = "事件key已经存在,请重新填写一个";
|
||||
return Json(tip);
|
||||
}
|
||||
}
|
||||
entity.EventKey = model.EventKey;
|
||||
entity.EventName = model.EventName;
|
||||
entity.Rank = model.Rank;
|
||||
if (string.IsNullOrWhiteSpace(Request.Form["IsDisable"]) || Request.Form["IsDisable"] != "1")
|
||||
entity.IsDisable = 0;
|
||||
else
|
||||
entity.IsDisable = 1;
|
||||
entity.Update();
|
||||
Admin.WriteLogActions("编辑事件详情(id:" + entity.Id + ");");
|
||||
tip.Status = JsonTip.SUCCESS;
|
||||
tip.Message = "编辑事件权限详情成功";
|
||||
tip.ReturnUrl = "close";
|
||||
return Json(tip);
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 删除事件权限
|
||||
[HttpPost]
|
||||
[MyAuthorize("del", "eventkey", "JSON")]
|
||||
public JsonResult DelEventKey(int id)
|
||||
{
|
||||
TargetEvent entity = TargetEvent.Find(TargetEvent._.Id == id);
|
||||
if (entity == null)
|
||||
{
|
||||
tip.Message = "系统找不到本记录!";
|
||||
return Json(tip);
|
||||
}
|
||||
Admin.WriteLogActions("删除事件详情(" + JsonConvert.SerializeObject(entity) + ");");
|
||||
entity.Delete();
|
||||
tip.Status = JsonTip.SUCCESS;
|
||||
tip.Message = "删除事件权限详情成功";
|
||||
return Json(tip);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
|
||||
#region 后台栏目管理
|
||||
|
||||
@@ -78,7 +78,7 @@
|
||||
{
|
||||
var l2 = Model.FindAll(s => s.PId == m1.Id && s.IsHide != 1);
|
||||
<li>
|
||||
<a href="/AdminCP/@(m1.Link)" id="@m1.MenuKey" @(m1.Link != "#" ? "class=J_menuItem" : "") >
|
||||
<a href="@(m1.Link=="#"?"javascript:;":"/AdminCP/"+m1.Link)" id="@m1.MenuKey" @(m1.Link != "#" ? "class=J_menuItem" : "")>
|
||||
@if (!string.IsNullOrWhiteSpace(m1.ClassName))
|
||||
{
|
||||
<i class="fa @m1.ClassName"></i>
|
||||
|
||||
@@ -33,7 +33,7 @@
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">禁用:</label>
|
||||
<div class="col-sm-8">
|
||||
<label>
|
||||
<label class="checkbox-inline i-checks">
|
||||
<input type="checkbox" value="1" name="IsDisable" id="IsDisable"> 禁用
|
||||
</label>
|
||||
</div>
|
||||
|
||||
@@ -0,0 +1,56 @@
|
||||
@model TargetEvent
|
||||
@{
|
||||
ViewBag.title = "查看/编辑权限事件";
|
||||
}
|
||||
|
||||
<div class="wrapper wrapper-content">
|
||||
<div class="ibox float-e-margins">
|
||||
<div class="ibox-title">
|
||||
<h5>@(ViewBag.title)</h5>
|
||||
<div class="ibox-tools">
|
||||
</div>
|
||||
</div>
|
||||
<div class="ibox-content">
|
||||
@using (Html.BeginForm(null, null, FormMethod.Post, new { id = "editEventKeyForm", @class = "form-horizontal m-t" }))
|
||||
{
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">事件key:</label>
|
||||
<div class="col-sm-8">
|
||||
<input id="EventKey" name="EventKey" minlength="2" maxlength="50" type="text" class="form-control" required aria-required="true" value="@Model.EventKey">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">事件名称:</label>
|
||||
<div class="col-sm-8">
|
||||
<input id="EventName" type="text" class="form-control" name="EventName" required aria-required="true" value="@Model.EventName">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">排序:</label>
|
||||
<div class="col-sm-8">
|
||||
<input id="Rank" type="number" class="form-control" name="Rank" value="@Model.Rank" required aria-required="true">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">禁用:</label>
|
||||
<div class="col-sm-8">
|
||||
<label class="checkbox-inline i-checks">
|
||||
<input type="checkbox" value="1" name="IsDisable" id="IsDisable" @(Model.IsDisable == 1 ? "checked" : "")> 禁用
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<div class="col-sm-4 col-sm-offset-3">
|
||||
<button class="btn btn-primary" type="submit"><i class="fa fa-save"></i> 提交 </button>
|
||||
<button class="btn btn-default" type="button" onclick="closethisdialog();"><i class="fa fa-close"></i> 取消 </button>
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<script>
|
||||
$(function () {
|
||||
DoPost("editEventKeyForm");
|
||||
})
|
||||
</script>
|
||||
@@ -68,8 +68,6 @@
|
||||
cardView: false, //是否显示详细视图
|
||||
detailView: false, //是否显示父子表
|
||||
columns: [{
|
||||
checkbox: true
|
||||
}, {
|
||||
field: 'EventName',
|
||||
title: '事件名称'
|
||||
}, {
|
||||
@@ -80,8 +78,22 @@
|
||||
title: '排序'
|
||||
}, {
|
||||
field: 'IsDisable',
|
||||
title: '是否禁用'
|
||||
}, ]
|
||||
title: '是否禁用',
|
||||
formatter: function (value, row, index) {
|
||||
if (value == 0) {
|
||||
return '<span class="label label-primary">启用</span>';
|
||||
} else {
|
||||
return '<span class="label label-danger">禁用</span>';
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
field: 'Id',
|
||||
title: '操作',
|
||||
formatter: 'actionFormatter',
|
||||
width: 140
|
||||
}
|
||||
]
|
||||
});
|
||||
};
|
||||
|
||||
@@ -96,7 +108,12 @@
|
||||
};
|
||||
return oTableInit;
|
||||
};
|
||||
|
||||
function actionFormatter(value, row, index) {
|
||||
return [
|
||||
'<a href="javascript:;" class="btn btn-xs btn-primary" title="编辑" onclick="top.showDialog(\'eidtEventKey\', \'编辑事件权限详情\', \'/AdminCP/Permission/EditEventKey/' + value + '\', 0, 0)"><i class="fa fa-edit"></i> 编辑</a>',
|
||||
'<a href="javascript:;" class="btn btn-xs btn-danger m-l-xs" title="删除" onclick="doDel(\'/AdminCP/Permission/DelEventKey\',' + value + ');"><i class="fa fa-close"></i> 删除</a>',
|
||||
].join('');
|
||||
}
|
||||
|
||||
var ButtonInit = function () {
|
||||
var oInit = new Object();
|
||||
|
||||
Reference in New Issue
Block a user