grant_organization.html 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  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/syuser!grantOrganization.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/syorganization!doNotNeedSecurity_getSyorganizationsTree.action',
  30. parentField : 'pid',
  31. checkbox : true,
  32. cascadeCheck : false,
  33. formatter : function(node) {
  34. return node.name;
  35. },
  36. onLoadSuccess : function(node, data) {
  37. $.post(sy.contextPath + '/base/syorganization!doNotNeedSecurity_getSyorganizationByUserId.action', {
  38. id : $(':input[name="data.id"]').val()
  39. }, function(result) {
  40. if (result) {
  41. for (var i = 0; i < result.length; i++) {
  42. var node = $('#tree').tree('find', result[i].id);
  43. if (node) {
  44. $('#tree').tree('check', node.target);
  45. }
  46. }
  47. }
  48. parent.$.messager.progress('close');
  49. }, 'json');
  50. }
  51. });
  52. });
  53. </script>
  54. {% endblock %}
  55. {% block body %}
  56. <body>
  57. <input name="data.id" value="{{ id }}" readonly="readonly" type="hidden" />
  58. <fieldset>
  59. <legend>所属机构</legend>
  60. <ul id="tree"></ul>
  61. </fieldset>
  62. </body>
  63. {% endblock %}