Index: ssts-web/src/main/webapp/systemmanage/operationFormByExt.jsp =================================================================== diff -u -r20467 -r20478 --- ssts-web/src/main/webapp/systemmanage/operationFormByExt.jsp (.../operationFormByExt.jsp) (revision 20467) +++ ssts-web/src/main/webapp/systemmanage/operationFormByExt.jsp (.../operationFormByExt.jsp) (revision 20478) @@ -101,7 +101,13 @@ hideLabel:true, checked: hid, itemCls:'float-left', - clearCls:'stop-float' + clearCls:'stop-float', + listeners : { + "check" : function(obj,ischecked){ + //父模块复选框是否选中方法 , param:父模块名 + checkBoxReverse('${modelNameBean.modleName }',ischecked) + } + } }); var rightColumn = Ext.getCmp(root + "_" + i%4) rightColumn.add(myCheckBox); @@ -138,6 +144,34 @@ } } } + +//当某个权限模块下的所有权限被选中时,使对应的模块选中 +function checkBoxReverse(value,ischecked){ + //得到点击的子权限的父模块复选框 + var modleNameCheckBox = document.getElementById(value); + //如果取消了勾选子权限,就直接将父模块复选框取消选中 + if(ischecked==false){ + modleNameCheckBox.checked = false; + return; + } + //遍历点击的模块权限 + for(var i = 0;i < systemNameBeanJsonArray.length;i++){ + if(value == systemNameBeanJsonArray[i].name){ + var operationIds = systemNameBeanJsonArray[i].operationIds; + //遍历该模块下的所有子权限 + for(var j = 0;j < operationIds.length;j++){ + //只有当全部子权限选中,isChecked才等于true + var isChecked = Ext.getCmp(operationIds[j]).getValue(); + } + //如果子权限都选中了,那么就将父模块复选框设为选中状态 + if(isChecked){ + modleNameCheckBox.checked = true; + } + break; + } + } +} + var operationIds = ";" + '${operationIds}' + ";"; function isChecked(operationId){ if(operationIds.lastIndexOf(";" + operationId + ";") != -1){