完善事件权限管理
This commit is contained in:
@@ -115,6 +115,85 @@ namespace COMCMS.Web.Areas.AdminCP.Controllers
|
|||||||
|
|
||||||
return Json(tip);
|
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
|
#endregion
|
||||||
|
|
||||||
#region 后台栏目管理
|
#region 后台栏目管理
|
||||||
|
|||||||
@@ -78,7 +78,7 @@
|
|||||||
{
|
{
|
||||||
var l2 = Model.FindAll(s => s.PId == m1.Id && s.IsHide != 1);
|
var l2 = Model.FindAll(s => s.PId == m1.Id && s.IsHide != 1);
|
||||||
<li>
|
<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))
|
@if (!string.IsNullOrWhiteSpace(m1.ClassName))
|
||||||
{
|
{
|
||||||
<i class="fa @m1.ClassName"></i>
|
<i class="fa @m1.ClassName"></i>
|
||||||
|
|||||||
@@ -33,7 +33,7 @@
|
|||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label class="col-sm-3 control-label">禁用:</label>
|
<label class="col-sm-3 control-label">禁用:</label>
|
||||||
<div class="col-sm-8">
|
<div class="col-sm-8">
|
||||||
<label>
|
<label class="checkbox-inline i-checks">
|
||||||
<input type="checkbox" value="1" name="IsDisable" id="IsDisable"> 禁用
|
<input type="checkbox" value="1" name="IsDisable" id="IsDisable"> 禁用
|
||||||
</label>
|
</label>
|
||||||
</div>
|
</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, //是否显示详细视图
|
cardView: false, //是否显示详细视图
|
||||||
detailView: false, //是否显示父子表
|
detailView: false, //是否显示父子表
|
||||||
columns: [{
|
columns: [{
|
||||||
checkbox: true
|
|
||||||
}, {
|
|
||||||
field: 'EventName',
|
field: 'EventName',
|
||||||
title: '事件名称'
|
title: '事件名称'
|
||||||
}, {
|
}, {
|
||||||
@@ -80,8 +78,22 @@
|
|||||||
title: '排序'
|
title: '排序'
|
||||||
}, {
|
}, {
|
||||||
field: 'IsDisable',
|
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;
|
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 ButtonInit = function () {
|
||||||
var oInit = new Object();
|
var oInit = new Object();
|
||||||
|
|||||||
@@ -1,9 +1,10 @@
|
|||||||
# COMCMS_NETCORE
|
# COMCMS_NETCORE
|
||||||
COMCMS NETCORE版本,一个简单的CMS后台管理系统,带前台演示。
|
COMCMS NETCORE版本,一个简单的CMS后台管理系统,带前台演示。
|
||||||
主要是演示了.net core 一个系统后台如何搭建。前台如何使用。可以简单的完成一个企业站。通过二次开发,可以支持商城系统、小程序、app服务器端等...
|
主要是演示了.net 8 一个系统后台如何搭建。前台如何使用。可以简单的完成一个企业站。通过二次开发,可以支持商城系统、小程序、app服务器端等...
|
||||||
|
|
||||||
|
|
||||||
### 更新日志
|
### 更新日志
|
||||||
|
- 2024-06-26 升级到.net 8 调整后台UI,精简js插件
|
||||||
- 2022-11-23 升级到.net 7 和使用SkiaSharp 替换掉System.Drawing
|
- 2022-11-23 升级到.net 7 和使用SkiaSharp 替换掉System.Drawing
|
||||||
- 2021-02-02 升级组件,删除ZKWeb组件,增加文章Tag标签
|
- 2021-02-02 升级组件,删除ZKWeb组件,增加文章Tag标签
|
||||||
- 2020-12-02 升级到.net5;增加文章栏目、商品分类快速修改排序;增加jwt授权登录
|
- 2020-12-02 升级到.net5;增加文章栏目、商品分类快速修改排序;增加jwt授权登录
|
||||||
|
|||||||
Reference in New Issue
Block a user