From 2f33a5bbe6a5701630d1856b21ba87413d978269 Mon Sep 17 00:00:00 2001 From: Argo Zhang Date: Sun, 5 Jan 2020 15:19:20 +0800 Subject: [PATCH] =?UTF-8?q?feat(#I17UM5):=20=E8=8F=9C=E5=8D=95=E7=BB=B4?= =?UTF-8?q?=E6=8A=A4=E4=B8=AD=E6=89=80=E5=B1=9E=E5=BA=94=E7=94=A8=E4=B8=8B?= =?UTF-8?q?=E6=8B=89=E6=A1=86=E5=9C=A8=E9=80=82=E5=BD=93=E6=83=85=E5=86=B5?= =?UTF-8?q?=E4=B8=8B=E4=B8=8D=E5=8F=AF=E7=BC=96=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit #Issue link https://gitee.com/LongbowEnterprise/dashboard/issues?id=I17UM5 --- src/admin/Bootstrap.Admin/wwwroot/js/menus.js | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/src/admin/Bootstrap.Admin/wwwroot/js/menus.js b/src/admin/Bootstrap.Admin/wwwroot/js/menus.js index 070266d2..32c7ffb0 100644 --- a/src/admin/Bootstrap.Admin/wwwroot/js/menus.js +++ b/src/admin/Bootstrap.Admin/wwwroot/js/menus.js @@ -67,6 +67,21 @@ $(function () { } }, callback: function (result) { + if (result.oper === "create") { + $('#app').lgbSelect('enable'); + } + if (result.oper === "edit") { + var valid = result.data && result.data.ParentId === "0"; + // 判断是否有子项 + if (valid) { + var idValue = result.data.Id; + var nodes = $table.bootstrapTable('getData').filter(function (row, index, data) { + return idValue == row["ParentId"]; + }); + valid = nodes.length === 0; + } + $('#app').lgbSelect(valid ? 'enable' : 'disabled'); + } if (!result.success) return; if ((result.oper === "save") || result.oper === "del") { if (result.data.filter(function (element) { @@ -160,6 +175,9 @@ $(function () { switch ($this.attr('data-method')) { case 'clear': $input.val(""); + if ($input.attr('id') === 'parentName') { + $('#app').lgbSelect('enable'); + } break; case 'sel': $input.select(); @@ -247,6 +265,7 @@ $(function () { if (check) { $parentMenuID.val(pId); $parentMenuName.val($('.dd3-content :radio:checked').next('span').text()); + $('#app').lgbSelect('disabled'); } else { return false;