grant.html 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. {% extends "base.html" %}
  2. {% block title %}
  3. {% endblock %}
  4. {% block head %}
  5. <script type="text/javascript">
  6. var submitForm = function($dialog, $grid, $pjq) {
  7. var nodes = $('#tree').tree('getChecked', [ 'checked', 'indeterminate' ]);
  8. var ids = [];
  9. for (var i = 0; i < nodes.length; i++) {
  10. ids.push(nodes[i].id);
  11. }
  12. $.post(sy.contextPath + '/base/syorganization!grant.action', {
  13. id : $(':input[name="data.id"]').val(),
  14. ids : ids.join(',')
  15. }, function(result) {
  16. if (result.success) {
  17. $dialog.dialog('destroy');
  18. } else {
  19. $pjq.messager.alert('提示', result.msg, 'error');
  20. }
  21. $pjq.messager.alert('提示', '授权成功!', 'info');
  22. }, 'json');
  23. };
  24. $(function() {
  25. parent.$.messager.progress({
  26. text : '数据加载中....'
  27. });
  28. $('#tree').tree({
  29. url : sy.contextPath + '/base/syresource!doNotNeedSecurity_getResourcesTree.action',
  30. parentField : 'pid',
  31. checkbox : true,
  32. formatter : function(node) {
  33. return node.name;
  34. },
  35. onLoadSuccess : function(node, data) {
  36. $.post(sy.contextPath + '/base/syresource!doNotNeedSecurity_getOrganizationResources.action', {
  37. id : $(':input[name="data.id"]').val()
  38. }, function(result) {
  39. if (result) {
  40. for (var i = 0; i < result.length; i++) {
  41. var node = $('#tree').tree('find', result[i].id);
  42. if (node) {
  43. var isLeaf = $('#tree').tree('isLeaf', node.target);
  44. if (isLeaf) {
  45. $('#tree').tree('check', node.target);
  46. }
  47. }
  48. }
  49. }
  50. parent.$.messager.progress('close');
  51. }, 'json');
  52. }
  53. });
  54. });
  55. </script>
  56. {% endblock %}
  57. {% block body %}
  58. <body>
  59. <input name="data.id" value="{{id}}" readonly="readonly" type="hidden" />
  60. <fieldset>
  61. <legend>机构授权</legend>
  62. <ul id="tree"></ul>
  63. </fieldset>
  64. </body>
  65. {% endblock %}