8f84067b104c735fcd4eff1eda4512a39104f72a.svn-base 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146
  1. com.sinosoft.lz.system.Button = function(){
  2. var _this = this;
  3. /** treegrid组件 **/
  4. var $treegrid;
  5. var moduleIdForm;
  6. var loadGrid= function(){
  7. $treegrid = $('#cxdmfff').treegrid({
  8. url:'/gzfw/ws/button/FunctionService/getFunctionList',
  9. idField : 'id',
  10. treeField : 'module_id',
  11. toolbar:"#tb",
  12. fit :true,
  13. width: 'auto',
  14. rownumbers: true,
  15. fitColumns:true,
  16. columns : [ [ {
  17. title : '所属模块',
  18. field : 'module_id'
  19. }, {
  20. field : 'id',
  21. title : '功能点编号'
  22. }, {
  23. field : 'name',
  24. title : '功能点名称'
  25. }, {
  26. field : 'operate',
  27. title : '操作'
  28. }, {
  29. field : 'button',
  30. title : '已分配按钮'
  31. } ] ]
  32. });
  33. };
  34. var moduleIdCombox =function(){
  35. moduleIdForm = $('#Module_Id').combotree({
  36. url:'/gzfw/page/system/button/divTreeService.jsp?nodeID=mdpModules&buildSelf=false',
  37. required: true
  38. });
  39. };
  40. var saveFunction = function(){
  41. $('#fm').form('submit',{
  42. url: '/gzfw/ws/button/FunctionService/saveFunction/',
  43. onSubmit: function(){
  44. return $(this).form('validate');
  45. },
  46. success: function(result){
  47. var result = eval('('+result+')');
  48. if (!result.success){
  49. $.messager.show({
  50. title: 'Error',
  51. msg: result.success
  52. });
  53. } else {
  54. $('#tb').form('clear');
  55. $treegrid.treegrid('reload'); // reload the user data
  56. }
  57. }
  58. });
  59. };
  60. var saveFunctionButton = function(){
  61. $('#formButton').form('submit',{
  62. url: '/gzfw/ws/button/FunctionService/saveFunctionButton/',
  63. onSubmit: function(){
  64. return $(this).form('validate');
  65. },
  66. success: function(result){
  67. var result = eval('('+result+')');
  68. if (result.success){
  69. parent.$('#dd').dialog('close');
  70. parent.$treegrid.treegrid('reload'); // reload the user data
  71. } else {
  72. $.messager.show({
  73. title: 'Error',
  74. msg: result.success
  75. });
  76. }
  77. }
  78. });
  79. };
  80. var OpenFrame = function(id) {
  81. $('#dd').dialog('clear');
  82. var trUrl = "functionbutton.jsp?fun_id="+id;
  83. $('#dd').append("<iframe src='"+trUrl+"' height='380' width='630' frameborder='0'></iframe>");
  84. $('#dd').dialog('open').dialog('setTitle','按钮权限分配');
  85. };
  86. var submitAction = function(codeId){
  87. $.messager.confirm('按钮删除','确定要删除功能模块吗?',
  88. function(r){
  89. if (r){
  90. $.post('/gzfw/ws/button/FunctionService/deleteFunction/',{fd_objectid:codeId},function(result){
  91. if (result.success){
  92. $treegrid.treegrid('reload'); // reload the user data
  93. } else {
  94. $.messager.show({ // show error message
  95. title: 'Error',
  96. msg: result.success
  97. });
  98. }
  99. },'json');
  100. }
  101. });
  102. };
  103. var deleteFunctionButton = function(codeId,funId){
  104. $.messager.confirm('按钮删除','确定要删除功能按钮吗?',
  105. function(r){
  106. if (r){
  107. $.post('/gzfw/ws/button/FunctionService/deleteFunctionButton/',{fd_objectid:codeId,funId:funId},function(result){
  108. if (result.success){
  109. $treegrid.treegrid('reload'); // reload the user data
  110. } else {
  111. $.messager.show({ // show error message
  112. title: 'Error',
  113. msg: result.success
  114. });
  115. }
  116. },'json');
  117. }
  118. });
  119. };
  120. return {
  121. /**
  122. * 功能:初始化
  123. */
  124. init : function(){
  125. loadGrid();
  126. moduleIdCombox();
  127. }
  128. };
  129. }();
  130. $(function(){
  131. com.sinosoft.lz.system.Button.init();
  132. });