From 69d22f2c78fb90a3a006469749f72fbd8e6a0318 Mon Sep 17 00:00:00 2001 From: xuxueli <931591021@qq.com> Date: Sat, 4 May 2019 21:51:05 +0800 Subject: [PATCH] =?UTF-8?q?=E7=94=A8=E6=88=B7=E7=AE=A1=E7=90=86=EF=BC=9A?= =?UTF-8?q?=E6=94=AF=E6=8C=81=E5=9C=A8=E7=BA=BF=E7=BB=B4=E6=8A=A4=E7=B3=BB?= =?UTF-8?q?=E7=BB=9F=E7=94=A8=E6=88=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/resources/static/js/user.index.1.js | 35 ++++++++++++++----- 1 file changed, 27 insertions(+), 8 deletions(-) diff --git a/xxl-job-admin/src/main/resources/static/js/user.index.1.js b/xxl-job-admin/src/main/resources/static/js/user.index.1.js index 7051ba0f..8ab17722 100644 --- a/xxl-job-admin/src/main/resources/static/js/user.index.1.js +++ b/xxl-job-admin/src/main/resources/static/js/user.index.1.js @@ -133,6 +133,17 @@ $(function() { }); }); + // add role + $("#addModal .form input[name=role]").change(function () { + var role = $(this).val(); + if (role == 1) { + $("#addModal .form input[name=permission]").parents('.form-group').hide(); + } else { + $("#addModal .form input[name=permission]").parents('.form-group').show(); + } + $("#addModal .form input[name='permission']").prop("checked",false); + }); + // add $(".add").click(function(){ $('#addModal').modal({backdrop: false, keyboard: false}).modal('show'); @@ -207,8 +218,21 @@ $(function() { addModalValidate.resetForm(); $("#addModal .form .form-group").removeClass("has-error"); $(".remote_panel").show(); // remote + + $("#addModal .form input[name=permission]").parents('.form-group').show(); }); + // update role + $("#updateModal .form input[name=role]").change(function () { + var role = $(this).val(); + if (role == 1) { + $("#updateModal .form input[name=permission]").parents('.form-group').hide(); + } else { + $("#updateModal .form input[name=permission]").parents('.form-group').show(); + } + $("#updateModal .form input[name='permission']").prop("checked",false); + }); + // update $("#user_list").on('click', '.update',function() { @@ -219,18 +243,11 @@ $(function() { $("#updateModal .form input[name='id']").val( row.id ); $("#updateModal .form input[name='username']").val( row.username ); $("#updateModal .form input[name='password']").val( '' ); - $("#updateModal .form input[name='role']").each(function () { - if($(this).val() == row.role) { - $(this).prop("checked",true); - } else { - $(this).prop("checked",false); - } - }); + $("#updateModal .form input[name='role'][value='"+ row.role +"']").click(); var permissionArr = []; if (row.permission) { permissionArr = row.permission.split(","); } - $("#updateModal .form input[name='permission']").removeProp('checked'); $("#updateModal .form input[name='permission']").each(function () { if($.inArray($(this).val(), permissionArr) > -1) { $(this).prop("checked",true); @@ -293,6 +310,8 @@ $(function() { updateModalValidate.resetForm(); $("#updateModal .form .form-group").removeClass("has-error"); $(".remote_panel").show(); // remote + + $("#updateModal .form input[name=permission]").parents('.form-group').show(); }); });