mirror of
https://gitee.com/dotnetchina/OpenAuth.Net.git
synced 2025-07-15 14:04:41 +08:00
调整按钮数据
This commit is contained in:
parent
238550f415
commit
d5db368a2f
BIN
DOC/核心设计.EAP
BIN
DOC/核心设计.EAP
Binary file not shown.
@ -86,5 +86,10 @@ namespace OpenAuth.App
|
||||
}
|
||||
#endregion
|
||||
|
||||
public void UpdateMenu(ModuleElement model)
|
||||
{
|
||||
UnitWork.Update<ModuleElement>(u =>u.Id, model);
|
||||
UnitWork.Save();
|
||||
}
|
||||
}
|
||||
}
|
@ -177,6 +177,24 @@ namespace OpenAuth.Mvc.Controllers
|
||||
return JsonHelper.Instance.Serialize(Result);
|
||||
}
|
||||
|
||||
//添加菜单
|
||||
[HttpPost]
|
||||
[ValidateInput(false)]
|
||||
public string UpdateMenu(ModuleElement model)
|
||||
{
|
||||
try
|
||||
{
|
||||
App.UpdateMenu(model);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Result.Code = 500;
|
||||
Result.Message = ex.Message;
|
||||
}
|
||||
return JsonHelper.Instance.Serialize(Result);
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 删除菜单
|
||||
/// </summary>
|
||||
|
@ -5,68 +5,63 @@
|
||||
<blockquote class="layui-elem-quote news_search toolList" id="menus">
|
||||
</blockquote>
|
||||
|
||||
<div style="display: flex;">
|
||||
<ul id="tree" class="ztree" style="display: inline-block; width: 180px; padding: 10px; border: 1px solid #ddd; overflow: auto;"></ul>
|
||||
<table class="layui-table"
|
||||
lay-data="{height: 'full-80', id:'mainList'}"
|
||||
lay-filter="list" lay-size="sm">
|
||||
<thead>
|
||||
<tr>
|
||||
<th lay-data="{checkbox:true, fixed: true}"></th>
|
||||
<th lay-data="{field:'Name', width:120, sort: true, fixed: true}">模块名称</th>
|
||||
<th lay-data="{field:'CascadeId', width:80}">层级ID</th>
|
||||
<th lay-data="{field:'Code', width:80}">模块标识</th>
|
||||
<th lay-data="{field:'Url', width:200}">Url</th>
|
||||
<th lay-data="{field:'IconName', width:60,templet: '#iconTpl'}">图标</th>
|
||||
<th lay-data="{field:'ParentName', width:135}">父节点名称</th>
|
||||
<th lay-data="{field:'SortNo', width:80}">排序号</th>
|
||||
<th lay-data="{fixed: 'right', width:100, toolbar: '#barList'}"></th>
|
||||
</tr>
|
||||
</thead>
|
||||
</table>
|
||||
<!--列表右边的按钮-->
|
||||
<script type="text/html" id="barList">
|
||||
<a class="layui-btn layui-btn-primary layui-btn-xs" lay-event="detail">查看菜单</a>
|
||||
</script>
|
||||
<script type="text/html" id="iconTpl">
|
||||
{{# if( d.IconName != null && d.IconName != ''){ }}
|
||||
<i class="layui-icon">{{ d.IconName }}</i>
|
||||
{{# } else { }}
|
||||
{{ d.IconName }}
|
||||
{{# } }}
|
||||
</script>
|
||||
<div class="layui-row">
|
||||
<div class="layui-col-xs2">
|
||||
<ul id="tree" class="ztree"
|
||||
style="padding: 2px; border: 1px solid #ddd; overflow: auto;">
|
||||
</ul>
|
||||
</div>
|
||||
<div class="layui-col-xs7">
|
||||
<table class="layui-table"
|
||||
lay-data="{height: 'full-80', id:'mainList'}"
|
||||
lay-filter="list" lay-size="sm">
|
||||
<thead>
|
||||
<tr>
|
||||
<th lay-data="{checkbox:true, fixed: true}"></th>
|
||||
<th lay-data="{field:'Name', width:120, sort: true, fixed: true}">模块名称</th>
|
||||
<th lay-data="{field:'CascadeId', width:80}">层级ID</th>
|
||||
<th lay-data="{field:'Code', width:80}">模块标识</th>
|
||||
<th lay-data="{field:'Url', width:200}">Url</th>
|
||||
<th lay-data="{field:'IconName', width:60,templet: '#iconTpl'}">图标</th>
|
||||
<th lay-data="{field:'ParentName', width:135}">父节点名称</th>
|
||||
<th lay-data="{field:'SortNo', width:80}">排序号</th>
|
||||
<th lay-data="{fixed: 'right', width:100, toolbar: '#barList'}"></th>
|
||||
</tr>
|
||||
</thead>
|
||||
</table>
|
||||
<!--列表右边的按钮-->
|
||||
<script type="text/html" id="barList">
|
||||
<a class="layui-btn layui-btn-primary layui-btn-xs" lay-event="detail">查看菜单</a>
|
||||
</script>
|
||||
<script type="text/html" id="iconTpl">
|
||||
{{# if( d.IconName != null && d.IconName != ''){ }}
|
||||
<i class="layui-icon">{{ d.IconName }}</i>
|
||||
{{# } else { }}
|
||||
{{ d.IconName }}
|
||||
{{# } }}
|
||||
</script>
|
||||
</div>
|
||||
|
||||
|
||||
<!--菜单列表-->
|
||||
<table class="layui-table"
|
||||
lay-data="{height: 'full-80', id:'menuList'}"
|
||||
lay-filter="menulist" lay-size="sm">
|
||||
<thead>
|
||||
<tr>
|
||||
<th lay-data="{field:'Name', width:120, sort: true, fixed: true}">名称</th>
|
||||
<th lay-data="{field:'DomId', width:80}">DomId</th>
|
||||
<th lay-data="{field:'Class', width:80}">样式</th>
|
||||
<th lay-data="{field:'Icon', width:60,templet: '#miconTpl'}">图标</th>
|
||||
<th lay-data="{field:'SortNo', width:80}">排序号</th>
|
||||
<th lay-data="{fixed: 'right', width:80, align:'center', toolbar: '#menuBar'}"></th>
|
||||
</tr>
|
||||
</thead>
|
||||
</table>
|
||||
<!--列表右边的按钮-->
|
||||
<script type="text/html" id="menuBar">
|
||||
<a class="layui-btn layui-btn-primary layui-btn-xs" lay-event="del">删除</a>
|
||||
</script>
|
||||
<script type="text/html" id="miconTpl">
|
||||
{{# if( d.Icon != null && d.Icon != ''){ }}
|
||||
<i class="layui-icon">{{ d.Icon }}</i>
|
||||
{{# } else { }}
|
||||
{{ d.Icon }}
|
||||
{{# } }}
|
||||
</script>
|
||||
<div class="layui-col-xs3">
|
||||
<!--菜单列表-->
|
||||
<table class="layui-table"
|
||||
lay-data="{height: 'full-80', id:'menuList'}"
|
||||
lay-filter="menulist" lay-size="sm">
|
||||
<thead>
|
||||
<tr>
|
||||
<th lay-data="{checkbox:true, fixed: true}"></th>
|
||||
<th lay-data="{field:'Icon', width:150,templet: '#menuTpl'}">已有菜单</th>
|
||||
</tr>
|
||||
</thead>
|
||||
</table>
|
||||
|
||||
<script type="text/html" id="menuTpl">
|
||||
<button class="layui-btn layui-btn-xs {{ d.Class }} layui-btn-fluid" alt="{{ d.DomId }}">{{ d.Name }}</button>
|
||||
</script>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<!--模块添加/编辑窗口-->
|
||||
<div id="divEdit" style="display: none">
|
||||
<form class="layui-form layui-form-pane" action="" id="formEdit">
|
||||
@ -131,7 +126,7 @@
|
||||
|
||||
<!--添加菜单窗口-->
|
||||
<div id="divMenuEdit" style="display: none">
|
||||
<form class="layui-form" action="" id="mfromEdit">
|
||||
<form class="layui-form layui-form-pane" action="" id="mfromEdit">
|
||||
|
||||
<input type="hidden" name="Id" v-model="Id" />
|
||||
<input type="hidden" name="ModuleId" v-model="ModuleId" />
|
||||
@ -152,16 +147,16 @@
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">图标</label>
|
||||
<label class="layui-form-label">样式</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="text" name="Icon" v-model="Icon"
|
||||
placeholder="请选择图标" autocomplete="off" class="layui-input">
|
||||
<input type="text" name="Class" v-model="Class"
|
||||
placeholder="菜单的样式,如:layui-btn-danger" autocomplete="off" class="layui-input">
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">排序号</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="text" name="SortNo" v-model="SortNo" required lay-verify="required"
|
||||
<input type="text" name="Sort" v-model="Sort" required lay-verify="required"
|
||||
placeholder="请输入排序号" autocomplete="off" class="layui-input">
|
||||
</div>
|
||||
</div>
|
||||
|
@ -73,7 +73,7 @@ layui.config({
|
||||
reload: load
|
||||
}
|
||||
}();
|
||||
|
||||
$("#tree").height($("div.layui-table-view").height());
|
||||
//添加(编辑)模块对话框
|
||||
var editDlg = function() {
|
||||
var vm = new Vue({
|
||||
@ -163,7 +163,7 @@ layui.config({
|
||||
show({
|
||||
Id: "",
|
||||
ModuleId:moduleId,
|
||||
SortNo: 1
|
||||
Sort: 1
|
||||
});
|
||||
},
|
||||
update: function (data) { //弹出编辑框
|
||||
@ -182,25 +182,22 @@ layui.config({
|
||||
}
|
||||
});
|
||||
|
||||
//监听菜单表格内部按钮
|
||||
table.on('tool(menulist)', function (obj) {
|
||||
var data = obj.data;
|
||||
if (obj.event === 'del') { //删除菜单
|
||||
openauth.del("/moduleManager/delMenu",
|
||||
data.Id,menuList);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
//监听页面主按钮操作
|
||||
var active = {
|
||||
btnDel: function () { //批量删除
|
||||
btnDel: function () { //删除模块
|
||||
var checkStatus = table.checkStatus('mainList')
|
||||
, data = checkStatus.data;
|
||||
openauth.del("/moduleManager/Delete",
|
||||
data.map(function (e) { return e.Id; }),
|
||||
mainList);
|
||||
}
|
||||
, btnDelMenu: function () { //删除菜单
|
||||
var checkStatus = table.checkStatus('menuList')
|
||||
, data = checkStatus.data;
|
||||
openauth.del("/moduleManager/DelMenu",
|
||||
data.map(function (e) { return e.Id; }),
|
||||
menuList);
|
||||
}
|
||||
, btnAdd: function () { //添加模块
|
||||
editDlg.add();
|
||||
}
|
||||
@ -223,22 +220,22 @@ layui.config({
|
||||
editDlg.update(data[0]);
|
||||
}
|
||||
|
||||
, btnEditMenu: function () { //编辑菜单
|
||||
var checkStatus = table.checkStatus('menuList')
|
||||
, data = checkStatus.data;
|
||||
if (data.length != 1) {
|
||||
layer.msg("请选择编辑的菜单");
|
||||
return;
|
||||
}
|
||||
meditDlg.update(data[0]);
|
||||
}
|
||||
|
||||
, search: function () { //搜索
|
||||
mainList({ key: $('#key').val() });
|
||||
}
|
||||
, btnRefresh: function() {
|
||||
mainList();
|
||||
}
|
||||
, btnAccessModule: function () {
|
||||
var index = layer.open({
|
||||
title: "为用户分配模块",
|
||||
type: 2,
|
||||
content: "newsAdd.html",
|
||||
success: function(layero, index) {
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
$('.toolList .layui-btn').on('click', function () {
|
||||
|
BIN
建表&初始化数据.sql
BIN
建表&初始化数据.sql
Binary file not shown.
Loading…
Reference in New Issue
Block a user