修改BUG:菜单配置无法弹出新窗口
This commit is contained in:
parent
f7681d02f0
commit
4a2e2046aa
|
@ -1,6 +1,10 @@
|
||||||
@media (min-width: 990px) {
|
@media (min-width: 992px) {
|
||||||
.modal-dialog {
|
.modal-dialog {
|
||||||
width: 800px;
|
width: 900px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.form-group .form-control-url {
|
||||||
|
width: 87%;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -11,6 +15,10 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
@media (max-width: 768px) {
|
@media (max-width: 768px) {
|
||||||
|
.form-group .form-control-url {
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
.sidebar {
|
.sidebar {
|
||||||
display: none;
|
display: none;
|
||||||
overflow-y: auto;
|
overflow-y: auto;
|
||||||
|
|
|
@ -66,6 +66,10 @@
|
||||||
vertical-align: middle;
|
vertical-align: middle;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.form-group .form-control-url {
|
||||||
|
width: 83%;
|
||||||
|
}
|
||||||
|
|
||||||
.modal-dialog .modal-body, .panel-body {
|
.modal-dialog .modal-body, .panel-body {
|
||||||
padding-bottom: 0;
|
padding-bottom: 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,6 +15,10 @@
|
||||||
text-align: left;
|
text-align: left;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.form-group .input-group .input-group-btn .btn i.fa-remove {
|
||||||
|
width: auto;
|
||||||
|
}
|
||||||
|
|
||||||
.icon-body {
|
.icon-body {
|
||||||
margin-right: 160px;
|
margin-right: 160px;
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,7 +28,8 @@
|
||||||
Order: "order",
|
Order: "order",
|
||||||
Icon: "icon",
|
Icon: "icon",
|
||||||
Url: "url",
|
Url: "url",
|
||||||
Category: "category"
|
Category: "category",
|
||||||
|
Target: "target"
|
||||||
}
|
}
|
||||||
}),
|
}),
|
||||||
click: {
|
click: {
|
||||||
|
@ -108,7 +109,29 @@
|
||||||
{ title: "菜单序号", field: "Order", sortable: true },
|
{ title: "菜单序号", field: "Order", sortable: true },
|
||||||
{ title: "菜单图标", field: "Icon", sortable: false },
|
{ title: "菜单图标", field: "Icon", sortable: false },
|
||||||
{ title: "菜单路径", field: "Url", sortable: false },
|
{ title: "菜单路径", field: "Url", sortable: false },
|
||||||
{ title: "菜单类别", field: "CategoryName", sortable: true }
|
{ title: "菜单类别", field: "CategoryName", sortable: true },
|
||||||
|
{
|
||||||
|
title: "目标", field: "Target", sortable: true, formatter: function (value, row, index) {
|
||||||
|
var ret = value;
|
||||||
|
switch (value) {
|
||||||
|
case "_self":
|
||||||
|
ret = "本窗口";
|
||||||
|
break;
|
||||||
|
case "_blank":
|
||||||
|
ret = "新窗口";
|
||||||
|
break;
|
||||||
|
case "_parent":
|
||||||
|
ret = "父级窗口";
|
||||||
|
break;
|
||||||
|
case "_top":
|
||||||
|
ret = "顶级窗口";
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
}
|
||||||
]
|
]
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -188,6 +211,10 @@
|
||||||
$dialogNew.show();
|
$dialogNew.show();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
$('#btnClearIcon, #btnMenuClearParent').on('click', function () {
|
||||||
|
$(this).parent().prev().val("");
|
||||||
|
});
|
||||||
|
|
||||||
$btnSubmitMenu.on('click', function () {
|
$btnSubmitMenu.on('click', function () {
|
||||||
var type = $(this).data('type');
|
var type = $(this).data('type');
|
||||||
switch (type) {
|
switch (type) {
|
||||||
|
|
|
@ -31,7 +31,7 @@
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group col-xs-12 col-sm-6 col-md-3 col-lg-3">
|
<div class="form-group col-xs-12 col-sm-6 col-md-3 col-lg-3">
|
||||||
<label class="control-label" for="sel_menus_category">菜单类别</label>
|
<label class="control-label" for="sel_menus_category">菜单类别</label>
|
||||||
<select class="selectpicker" data-width="auto" id="sel_menus_category">
|
<select class="form-control selectpicker" data-width="auto" id="sel_menus_category">
|
||||||
<option value="">全部</option>
|
<option value="">全部</option>
|
||||||
<option value="0">系统菜单</option>
|
<option value="0">系统菜单</option>
|
||||||
<option value="1">外部菜单</option>
|
<option value="1">外部菜单</option>
|
||||||
|
@ -65,35 +65,28 @@
|
||||||
<div class="modal-body">
|
<div class="modal-body">
|
||||||
<form class="form-inline" id="dataForm" name="dataForm" role="form">
|
<form class="form-inline" id="dataForm" name="dataForm" role="form">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="form-group col-lg-6">
|
<div class="form-group col-sm-6">
|
||||||
<input type="text" class="form-control hidden" id="parentId" name="parentId" />
|
<input type="text" class="form-control hidden" id="parentId" name="parentId" />
|
||||||
<label class="control-label" for="parentName">父级菜单</label>
|
<label class="control-label" for="parentName">父级菜单</label>
|
||||||
<div class="input-group">
|
<div class="input-group">
|
||||||
<input type="text" class="form-control" readonly id="parentName" name="parentName" placeholder="请选择...(可为空)" maxlength="50" />
|
<input type="text" class="form-control" readonly id="parentName" name="parentName" placeholder="请选择...(可为空)" maxlength="50" />
|
||||||
<span class="input-group-btn">
|
<span class="input-group-btn">
|
||||||
|
<button id="btnMenuClearParent" class="btn btn-default" type="button"><i class="fa fa-remove"></i></button>
|
||||||
<button id="btnMenuParent" class="btn btn-default" type="button"><i class="fa fa-hand-o-up"></i>选择</button>
|
<button id="btnMenuParent" class="btn btn-default" type="button"><i class="fa fa-hand-o-up"></i>选择</button>
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group col-lg-6">
|
<div class="form-group col-sm-6">
|
||||||
<input type="text" class="form-control hidden" id="menuID" name="menuID" />
|
|
||||||
<label class="control-label" for="name">菜单名称</label>
|
|
||||||
<input type="text" class="form-control" id="name" name="name" placeholder="不可为空" maxlength="50" />
|
|
||||||
</div>
|
|
||||||
<div class="form-group col-lg-6">
|
|
||||||
<label class="control-label" for="icon">菜单图标</label>
|
<label class="control-label" for="icon">菜单图标</label>
|
||||||
<div class="input-group">
|
<div class="input-group">
|
||||||
<input type="text" class="form-control" readonly id="icon" name="icon" placeholder="请选择...(可为空)" maxlength="50" />
|
<input type="text" class="form-control" readonly id="icon" name="icon" placeholder="请选择...(可为空)" maxlength="50" />
|
||||||
<span class="input-group-btn">
|
<span class="input-group-btn">
|
||||||
|
<button id="btnClearIcon" class="btn btn-default" type="button"><i class="fa fa-remove"></i></button>
|
||||||
<button id="btnIcon" class="btn btn-default" type="button"><i class="fa fa-dashboard"></i>选择</button>
|
<button id="btnIcon" class="btn btn-default" type="button"><i class="fa fa-dashboard"></i>选择</button>
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group col-lg-6">
|
<div class="form-group col-sm-6">
|
||||||
<label class="control-label" for="url">路径</label>
|
|
||||||
<input type="text" class="form-control" id="url" name="url" placeholder="不可为空" />
|
|
||||||
</div>
|
|
||||||
<div class="form-group col-lg-6">
|
|
||||||
<label class="control-label" for="order">菜单序号</label>
|
<label class="control-label" for="order">菜单序号</label>
|
||||||
<div class="input-group">
|
<div class="input-group">
|
||||||
<input type="text" class="form-control" id="order" name="order" data-default-val="10" placeholder="默认为10" maxlength="8" />
|
<input type="text" class="form-control" id="order" name="order" data-default-val="10" placeholder="默认为10" maxlength="8" />
|
||||||
|
@ -102,13 +95,31 @@
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group col-lg-6">
|
<div class="form-group col-sm-6">
|
||||||
|
<input type="text" class="form-control hidden" id="menuID" name="menuID" />
|
||||||
|
<label class="control-label" for="name">菜单名称</label>
|
||||||
|
<input type="text" class="form-control" id="name" name="name" placeholder="不可为空" maxlength="50" />
|
||||||
|
</div>
|
||||||
|
<div class="form-group col-xs-12">
|
||||||
|
<label class="control-label" for="url">路径</label>
|
||||||
|
<input type="text" class="form-control form-control-url" id="url" name="url" placeholder="不可为空" />
|
||||||
|
</div>
|
||||||
|
<div class="form-group col-xs-12">
|
||||||
<label class="control-label" for="category">菜单类别</label>
|
<label class="control-label" for="category">菜单类别</label>
|
||||||
<select class="selectpicker" data-width="auto" id="category" name="category" data-default-val="1">
|
<select class="selectpicker" data-style="btn-danger" data-width="auto" id="category" data-default-val="1">
|
||||||
<option value="0">系统菜单</option>
|
<option value="0">系统菜单</option>
|
||||||
<option value="1">外部菜单</option>
|
<option value="1">外部菜单</option>
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="form-group col-xs-12">
|
||||||
|
<label class="control-label" for="target">目标</label>
|
||||||
|
<select class="form-control-select selectpicker" data-style="btn-info" data-width="auto" id="target" data-default-val="_self">
|
||||||
|
<option value="_self">本窗口</option>
|
||||||
|
<option value="_blank">新窗口</option>
|
||||||
|
<option value="_parent">父级窗口</option>
|
||||||
|
<option value="_top">顶级窗口</option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
</li>
|
</li>
|
||||||
@foreach (var menu in Model.Menus)
|
@foreach (var menu in Model.Menus)
|
||||||
{
|
{
|
||||||
<li><a href="@Url.Content(menu.Url)" data-act="@menu.Url.StartsWith("~")"><i class="@menu.Icon"></i>@menu.Name</a></li>
|
<li><a href="@Url.Content(menu.Url)" target="@menu.Target"><i class="@menu.Icon"></i>@menu.Name</a></li>
|
||||||
}
|
}
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
|
|
|
@ -48,6 +48,10 @@ namespace Bootstrap.DataAccess
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string Active { get; set; }
|
public string Active { get; set; }
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
/// 获得/设置 链接目标
|
||||||
|
/// </summary>
|
||||||
|
public string Target { get; set; }
|
||||||
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public IEnumerable<Menu> Menus { get; set; }
|
public IEnumerable<Menu> Menus { get; set; }
|
||||||
|
|
|
@ -47,8 +47,9 @@ namespace Bootstrap.DataAccess
|
||||||
Icon = LgbConvert.ReadValue(reader[4], string.Empty),
|
Icon = LgbConvert.ReadValue(reader[4], string.Empty),
|
||||||
Url = LgbConvert.ReadValue(reader[5], string.Empty),
|
Url = LgbConvert.ReadValue(reader[5], string.Empty),
|
||||||
Category = (string)reader[6],
|
Category = (string)reader[6],
|
||||||
CategoryName = (string)reader[7],
|
Target = (string)reader[7],
|
||||||
ParentName = LgbConvert.ReadValue(reader[8], string.Empty)
|
CategoryName = (string)reader[8],
|
||||||
|
ParentName = LgbConvert.ReadValue(reader[9], string.Empty)
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -139,8 +140,8 @@ namespace Bootstrap.DataAccess
|
||||||
if (p.Icon != null && p.Icon.Length > 50) p.Icon.Substring(0, 50);
|
if (p.Icon != null && p.Icon.Length > 50) p.Icon.Substring(0, 50);
|
||||||
if (p.Url != null && p.Url.Length > 50) p.Url.Substring(0, 50);
|
if (p.Url != null && p.Url.Length > 50) p.Url.Substring(0, 50);
|
||||||
string sql = p.ID == 0 ?
|
string sql = p.ID == 0 ?
|
||||||
"Insert Into Navigations (ParentId, Name, [Order], Icon, Url, Category) Values (@ParentId, @Name, @Order, @Icon, @Url, @Category)" :
|
"Insert Into Navigations (ParentId, Name, [Order], Icon, Url, Category, Target) Values (@ParentId, @Name, @Order, @Icon, @Url, @Category, @Target)" :
|
||||||
"Update Navigations set ParentId = @ParentId, Name = @Name, [Order] = @Order, Icon = @Icon, Url = @Url, Category = @Category where ID = @ID";
|
"Update Navigations set ParentId = @ParentId, Name = @Name, [Order] = @Order, Icon = @Icon, Url = @Url, Category = @Category, Target = @Target where ID = @ID";
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
using (DbCommand cmd = DBAccessManager.SqlDBAccess.CreateCommand(CommandType.Text, sql))
|
using (DbCommand cmd = DBAccessManager.SqlDBAccess.CreateCommand(CommandType.Text, sql))
|
||||||
|
@ -152,6 +153,7 @@ namespace Bootstrap.DataAccess
|
||||||
cmd.Parameters.Add(DBAccessManager.SqlDBAccess.CreateParameter("@Icon", DBAccess.ToDBValue(p.Icon), ParameterDirection.Input));
|
cmd.Parameters.Add(DBAccessManager.SqlDBAccess.CreateParameter("@Icon", DBAccess.ToDBValue(p.Icon), ParameterDirection.Input));
|
||||||
cmd.Parameters.Add(DBAccessManager.SqlDBAccess.CreateParameter("@Url", DBAccess.ToDBValue(p.Url), ParameterDirection.Input));
|
cmd.Parameters.Add(DBAccessManager.SqlDBAccess.CreateParameter("@Url", DBAccess.ToDBValue(p.Url), ParameterDirection.Input));
|
||||||
cmd.Parameters.Add(DBAccessManager.SqlDBAccess.CreateParameter("@Category", p.Category, ParameterDirection.Input));
|
cmd.Parameters.Add(DBAccessManager.SqlDBAccess.CreateParameter("@Category", p.Category, ParameterDirection.Input));
|
||||||
|
cmd.Parameters.Add(DBAccessManager.SqlDBAccess.CreateParameter("@Target", p.Target, ParameterDirection.Input));
|
||||||
DBAccessManager.SqlDBAccess.ExecuteNonQuery(cmd);
|
DBAccessManager.SqlDBAccess.ExecuteNonQuery(cmd);
|
||||||
}
|
}
|
||||||
CacheCleanUtility.ClearCache(menuIds: p.ID == 0 ? string.Empty : p.ID.ToString());
|
CacheCleanUtility.ClearCache(menuIds: p.ID == 0 ? string.Empty : p.ID.ToString());
|
||||||
|
|
|
@ -173,6 +173,7 @@ CREATE TABLE [dbo].[Navigations](
|
||||||
[Icon] [varchar](50) NULL,
|
[Icon] [varchar](50) NULL,
|
||||||
[Url] [varchar](4000) NULL,
|
[Url] [varchar](4000) NULL,
|
||||||
[Category] [nvarchar](50) NOT NULL,
|
[Category] [nvarchar](50) NOT NULL,
|
||||||
|
[Target] [varchar](10) NOT NULL,
|
||||||
CONSTRAINT [PK_Navigations] PRIMARY KEY CLUSTERED
|
CONSTRAINT [PK_Navigations] PRIMARY KEY CLUSTERED
|
||||||
(
|
(
|
||||||
[ID] ASC
|
[ID] ASC
|
||||||
|
@ -359,6 +360,9 @@ GO
|
||||||
ALTER TABLE [dbo].[Users] ADD CONSTRAINT [DF_Users_Icon] DEFAULT ('default.jpg') FOR [Icon]
|
ALTER TABLE [dbo].[Users] ADD CONSTRAINT [DF_Users_Icon] DEFAULT ('default.jpg') FOR [Icon]
|
||||||
GO
|
GO
|
||||||
|
|
||||||
|
ALTER TABLE [dbo].[Navigations] ADD CONSTRAINT [DF_Navigations_Target] DEFAULT ('_self') FOR [Target]
|
||||||
|
GO
|
||||||
|
|
||||||
/****** Object: Table [dbo].[Tasks] Script Date: 11/16/2016 15:40:02 ******/
|
/****** Object: Table [dbo].[Tasks] Script Date: 11/16/2016 15:40:02 ******/
|
||||||
SET ANSI_NULLS ON
|
SET ANSI_NULLS ON
|
||||||
GO
|
GO
|
||||||
|
|
Loading…
Reference in New Issue