修复BUG:菜单弹框中选择父级菜单初始化一直未空

This commit is contained in:
Argo-Lenovo 2016-11-15 11:03:07 +08:00
parent 6a95700709
commit 5554995884
1 changed files with 12 additions and 3 deletions

View File

@ -5,6 +5,7 @@
map: { map: {
ID: "menuID", ID: "menuID",
ParentId: "parentId", ParentId: "parentId",
ParentName: "parentName",
Name: "name", Name: "name",
Order: "order", Order: "order",
Icon: "icon", Icon: "icon",
@ -77,11 +78,13 @@
var $dialogNew = $dialog.find('div.modal-dialog'); var $dialogNew = $dialog.find('div.modal-dialog');
var $dialogIcon = $('#dialogIcon'); var $dialogIcon = $('#dialogIcon');
var $dialogMenu = $('#dialogSubMenu').find('.modal-content'); var $dialogMenu = $('#dialogSubMenu').find('.modal-content');
var $btnSubmitMenu = $('btnSubmitMenu'); var $btnSubmitMenu = $('#btnSubmitMenu');
var $btnPickIcon = $('#btnIcon'); var $btnPickIcon = $('#btnIcon');
var $inputIcon = $('#icon'); var $inputIcon = $('#icon');
var $nestMenu = $('#nestable_menu'); var $nestMenu = $('#nestable_menu');
var $nestMenuInput = $nestMenu.find('div.dd3-content'); var $nestMenuInput = $nestMenu.find('div.dd3-content');
var $parentMenuID = $('#parentId');
var $parentMenuName = $('#parentName');
$nestMenuInput.find('label:first').hide(); $nestMenuInput.find('label:first').hide();
$iconList.find('ul li').addClass('col-md-3 col-sm-4 col-sm-6'); $iconList.find('ul li').addClass('col-md-3 col-sm-4 col-sm-6');
@ -131,6 +134,12 @@
$nestMenuInput.find('label:last').find('input').show(); $nestMenuInput.find('label:last').find('input').show();
$nestMenu.find('li.dd-item').hide().remove('[data-id="0"]'); $nestMenu.find('li.dd-item').hide().remove('[data-id="0"]');
$nestMenu.find('li[data-category="' + $('#category').selectpicker('val') + '"]').show(); $nestMenu.find('li[data-category="' + $('#category').selectpicker('val') + '"]').show();
var pid = $parentMenuID.val();
if (pid != "") {
// set active class
var radio = $nestMenuInput.find('input[value=' + pid + ']').filter(':radio');
radio.next('span').addClass('active');
}
$dialogMenu.show().adjustDialog(); $dialogMenu.show().adjustDialog();
}); });
@ -145,8 +154,8 @@
var type = $(this).data('type'); var type = $(this).data('type');
switch (type) { switch (type) {
case "parent": case "parent":
$('#parentId').val($('.dd3-content :radio:checked').val()); $parentMenuID.val($nestMenuInput.find('input').filter(':radio:checked').val());
$('#parentName').val($('.dd3-content :radio:checked').next('span').text()); $parentMenuName.val($nestMenuInput.find('input').filter(':radio:checked').next('span').text());
break; break;
case "order": case "order":
var data = $('#nestable_menu').nestable('serialize'); var data = $('#nestable_menu').nestable('serialize');