From ce33674edd9bda7b23603476e328db79faf2a839 Mon Sep 17 00:00:00 2001 From: Argo-Lenovo Date: Mon, 14 Nov 2016 22:12:23 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9BUG=EF=BC=9A=E8=A7=92?= =?UTF-8?q?=E8=89=B2=E6=8C=87=E5=AE=9A=E8=8F=9C=E5=8D=95=E5=BC=B9=E5=87=BA?= =?UTF-8?q?=E6=A1=86=E5=86=85=E6=97=A0=E6=B3=95=E7=82=B9=E5=87=BB=E8=8F=9C?= =?UTF-8?q?=E5=8D=95=E5=90=8D=E5=AD=97=E9=80=89=E6=8B=A9=E5=A4=8D=E9=80=89?= =?UTF-8?q?=E6=A1=86=EF=BC=8C=E5=A2=9E=E5=8A=A0=E8=8F=9C=E5=8D=95=E5=9B=BE?= =?UTF-8?q?=E6=A0=87?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Content/css/jquery.nestable.css | 6 ++++ Bootstrap.Admin/Scripts/Menus.js | 35 ++++++++++--------- Bootstrap.Admin/Scripts/Roles.js | 7 ++-- .../Views/Shared/SubMenuTree.cshtml | 2 +- 4 files changed, 30 insertions(+), 20 deletions(-) diff --git a/Bootstrap.Admin/Content/css/jquery.nestable.css b/Bootstrap.Admin/Content/css/jquery.nestable.css index c3e29473..ba524c88 100644 --- a/Bootstrap.Admin/Content/css/jquery.nestable.css +++ b/Bootstrap.Admin/Content/css/jquery.nestable.css @@ -152,6 +152,7 @@ box-sizing: border-box; -moz-box-sizing: border-box; border-radius: 3px; + cursor: pointer; } .dd3-content:hover { @@ -166,12 +167,17 @@ .dd3-content label span { position: absolute; + padding-left: 2px; } .dd3-content label span.active { color: darkred; } + .dd3-content label span i { + width: 22px; + } + .dd3-content label input { margin-right: 6px; cursor: pointer; diff --git a/Bootstrap.Admin/Scripts/Menus.js b/Bootstrap.Admin/Scripts/Menus.js index 00703b81..9d39159b 100644 --- a/Bootstrap.Admin/Scripts/Menus.js +++ b/Bootstrap.Admin/Scripts/Menus.js @@ -80,6 +80,9 @@ var $btnSubmitMenu = $('btnSubmitMenu'); var $btnPickIcon = $('#btnIcon'); var $inputIcon = $('#icon'); + var $nestMenu = $('#nestable_menu'); + var $nestMenuInput = $nestMenu.find('div.dd3-content'); + $nestMenuInput.find('label:first').hide(); $iconList.find('ul li').addClass('col-md-3 col-sm-4 col-sm-6'); $iconList.on('click', 'div.fa-hover a, ul li', function () { @@ -105,19 +108,19 @@ $('#btnMenuOrder').on('click', function () { $dialogNew.hide(); $btnSubmitMenu.data('type', 'order'); + $nestMenuInput.find('label:last').find('input').hide(); + $nestMenu.find('li.dd-item').hide().remove('[data-id="0"]'); + $nestMenu.find('li[data-category="' + $('#category').selectpicker('val') + '"]').show(); // handler new menu - if ($('#menuID').val() == "") { - var menuName = $('#name').val(); - if (menuName == "") menuName = "新建菜单-未命名"; - $('div.dd > ol.dd-list').append($.format('
  • ', menuName)); - } var did = $('#menuID').val(); if (did == "") did = 0; - $('div.dd input').hide(); - $('div.dd li[data-id="' + did + '"] span').addClass('active'); - $('div.dd > ol.dd-list > li.dd-item').remove('[data-id="0"]'); - $('div.dd > ol.dd-list > li.dd-item').hide(); - $('div.dd > ol.dd-list > li[data-category="' + $('#category').selectpicker('val') + '"]').show(); + if (did == 0) { + var menuName = $('#name').val(); + var menuCate = $('select').selectpicker('val'); + if (menuName == "") menuName = "新建菜单-未命名"; + $nestMenu.find('ol.dd-list:first').append($.format('
  • ', menuName, menuCate)); + } + $nestMenu.find('li[data-id="' + did + '"] span').addClass('active'); $dialogMenu.show().adjustDialog(); }); @@ -125,17 +128,15 @@ $('#btnMenuParent').on('click', function () { $dialogNew.hide(); $btnSubmitMenu.data('type', 'parent'); + $nestMenuInput.find('label:last').find('input').show(); + $nestMenu.find('li.dd-item').hide().remove('[data-id="0"]'); + $nestMenu.find('li[data-category="' + $('#category').selectpicker('val') + '"]').show(); $dialogMenu.show().adjustDialog(); - $('li.dd-item').remove('[data-id="0"]'); - $('div.dd :checkbox').hide(); - $('div.dd > ol.dd-list > li.dd-item').hide(); - $('div.dd > ol.dd-list > li[data-category="' + $('#category').selectpicker('val') + '"]').show(); - $('div.dd :radio').show(); }); $dialogMenu.find('div.modal-header, div.modal-footer').on('click', 'button', function () { // remove active css - $('div.dd li span').removeClass('active'); + $nestMenu.find('li span').removeClass('active'); $dialogMenu.hide(); $dialogNew.show(); }); @@ -169,7 +170,7 @@ $btnPickIcon.find('i').attr('class', icon); }); - $('#nestable_menu').nestable(); + $nestMenu.nestable(); // select $('select').selectpicker(); diff --git a/Bootstrap.Admin/Scripts/Roles.js b/Bootstrap.Admin/Scripts/Roles.js index d8ca23dd..4fd97704 100644 --- a/Bootstrap.Admin/Scripts/Roles.js +++ b/Bootstrap.Admin/Scripts/Roles.js @@ -62,7 +62,6 @@ }); $('#dialogMenu').modal('show'); $('.menu-content').show(); - $('div.dd3-content :radio').hide(); }) } }, @@ -86,7 +85,11 @@ } }); - $('#nestable_menu').nestable(); + var $nestMenu = $('#nestable_menu'); + var $nestMenuInput = $nestMenu.find('div.dd3-content'); + $nestMenuInput.find('label:last').hide(); + + $nestMenu.nestable(); $('table').smartTable({ url: '../api/Roles', //请求后台的URL(*) diff --git a/Bootstrap.Admin/Views/Shared/SubMenuTree.cshtml b/Bootstrap.Admin/Views/Shared/SubMenuTree.cshtml index 41197291..cdca5f6f 100644 --- a/Bootstrap.Admin/Views/Shared/SubMenuTree.cshtml +++ b/Bootstrap.Admin/Views/Shared/SubMenuTree.cshtml @@ -4,7 +4,7 @@ {
  • -
    +
    @if (menu.Menus.Count() > 0) { @Html.Partial("SubMenuTree", menu.Menus)