diff --git a/Bootstrap.Admin/Views/Admin/Menus.cshtml b/Bootstrap.Admin/Views/Admin/Menus.cshtml index 2d96f372..292437fb 100644 --- a/Bootstrap.Admin/Views/Admin/Menus.cshtml +++ b/Bootstrap.Admin/Views/Admin/Menus.cshtml @@ -11,6 +11,7 @@ + } @section javascript { @@ -26,6 +27,7 @@ + } @section query { @@ -39,41 +41,48 @@ -
+
- -
+
-
-
+
-
@@ -151,47 +160,60 @@
-
+
-
- +
-
+
- -
+
-
- +
+ + + +
-
+
-
- +
+ + + +
diff --git a/Bootstrap.Admin/wwwroot/js/menus.js b/Bootstrap.Admin/wwwroot/js/menus.js index 43a020f1..63dedf53 100644 --- a/Bootstrap.Admin/wwwroot/js/menus.js +++ b/Bootstrap.Admin/wwwroot/js/menus.js @@ -22,7 +22,6 @@ $(function () { }; var state = []; - var menuResource = ['菜单', '资源', '按钮']; var $table = $('table'); $table.lgbTable({ url: Menu.url, @@ -106,34 +105,17 @@ $(function () { { 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; + return $('#target').getTextByValue(value); } }, { title: "菜单类型", field: "IsResource", sortable: true, formatter: function (value, row, index) { - return menuResource[value]; + return $('#isRes').getTextByValue(value); } }, { title: "所属应用", field: "Application", sortable: true, formatter: function (value, row, index) { - return $('#app').next().find('[data-val="' + value + '"]:first').text(); + return $('#app').getTextByValue(value); } } ], diff --git a/Bootstrap.Admin/wwwroot/lib/longbow-select/longbow-select.js b/Bootstrap.Admin/wwwroot/lib/longbow-select/longbow-select.js index b3f7e419..71a709e3 100644 --- a/Bootstrap.Admin/wwwroot/lib/longbow-select/longbow-select.js +++ b/Bootstrap.Admin/wwwroot/lib/longbow-select/longbow-select.js @@ -50,6 +50,13 @@ if (this.$element.prop('nodeName') === 'SELECT') this.initBySelect(); else this.init(); + if (this.options.borderClass) { + this.$input.addClass(this.options.borderClass); + } + this.$input.attr('placeholder', this.options.placeholder); + + this.$element.data(lgbSelect.DataKey, this); + // bind event this.$ctl.on('click', '.form-select-input', function (e) { e.preventDefault(); @@ -72,7 +79,20 @@ that.closeMenu(); }); - this.$element.data(lgbSelect.DataKey, this); + var getUID = function (prefix) { + if (!prefix) prefix = 'lgb'; + do prefix += ~~(Math.random() * 1000000); + while (document.getElementById(prefix)); + return prefix; + }; + + // init for + var $for = this.$ctl.parent().find('[for="' + this.$element.attr('id') + '"]'); + if ($for.length > 0) { + var id = getUID(); + this.$input.attr('id', id); + $for.attr('for', id); + } }; _proto.init = function () { @@ -83,10 +103,6 @@ this.$input = this.$ctl.find('.form-select-input'); this.$menus = this.$ctl.find('.dropdown-menu'); - if (this.options.borderClass) { - this.$input.addClass(this.options.borderClass); - } - this.source = this.$menus.children().map(function (index, ele) { return { value: $(ele).attr('data-val'), text: $(ele).text(), selected: $(ele).selected }; }); @@ -102,13 +118,6 @@ }; _proto.initBySelect = function () { - var getUID = function (prefix) { - if (!prefix) prefix = 'lgb'; - do prefix += ~~(Math.random() * 1000000); - while (document.getElementById(prefix)); - return prefix; - }; - var that = this; // 原有控件 @@ -121,19 +130,6 @@ this.$input = this.$ctl.find('.form-select-input'); this.$menus = this.$ctl.find('.dropdown-menu'); - // init for - var $for = this.$element.parent().find('[for="' + this.$element.attr('id') + '"]'); - if ($for.length > 0) { - var id = getUID(); - this.$input.attr('id', id); - $for.attr('for', id); - } - - if (this.options.borderClass) { - this.$input.addClass(this.options.borderClass); - } - this.$input.attr('placeholder', this.options.placeholder); - // init dropdown-menu data var data = this.$element.find('option').map(function () { return { value: this.value, text: this.text, selected: this.selected } @@ -154,7 +150,7 @@ // replace element select -> input hidden this.$element.remove(); - this.$element = $('').val(that.val()).insertBefore(this.$input); + this.$element = $('').val(that.val()).insertBefore(this.$input); // bind ori atts attrs.forEach(function (v) {