feat(#I17UM5): 菜单维护中所属应用下拉框在适当情况下不可编辑

#Issue
link https://gitee.com/LongbowEnterprise/dashboard/issues?id=I17UM5
This commit is contained in:
Argo Zhang 2020-01-05 15:19:20 +08:00
parent bd3c725e4d
commit 2f33a5bbe6
No known key found for this signature in database
GPG Key ID: 152E398953DDF19F
1 changed files with 19 additions and 0 deletions

View File

@ -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;