data.html 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. <!DOCTYPE html>
  2. <html xmlns:th="http://www.thymeleaf.org">
  3. <head th:include="include/header_css::header('数据权限-角色管理')"></head>
  4. <body>
  5. <div id="dpLTE" class="container-fluid" v-cloak>
  6. <ul id="orgTree" class="ztree"></ul>
  7. </div>
  8. <div th:include="include/footer_js::footer"></div>
  9. <script type="text/javascript">
  10. var setting = {
  11. data : {
  12. simpleData : {
  13. enable : true,
  14. idKey : "orgId",
  15. pIdKey : "parentId",
  16. rootPId : 0
  17. },
  18. key : {
  19. url : "nourl"
  20. }
  21. },
  22. check:{
  23. enable:true,
  24. nocheckInherit:true,
  25. chkboxType:{ "Y" : "", "N" : "" }
  26. }
  27. };
  28. var ztree;
  29. var vm = new Vue({
  30. el : '#dpLTE',
  31. data : {
  32. role : {}
  33. },
  34. methods : {
  35. getOrg : function(menuId) {
  36. $.ajax({
  37. type: 'get',
  38. async: false,
  39. contentType : 'application/json',
  40. url: '../../sys/org/list?_' + $.now(),
  41. data: null,
  42. success: function(r) {
  43. ztree = $.fn.zTree
  44. .init($("#orgTree"), setting, r);
  45. ztree.expandAll(true);
  46. },
  47. dataType: 'json'
  48. });
  49. },
  50. setForm: function() {
  51. this.getOrg();
  52. $.SetForm({
  53. url: '../../sys/role/info',
  54. param: vm.role.roleId,
  55. success: function(data) {
  56. vm.role = data;
  57. //勾选角色所拥有的数据权限
  58. var orgIds = vm.role.orgIdList;
  59. for(var i=0; i<orgIds.length; i++) {
  60. var node = ztree.getNodeByParam("orgId", orgIds[i]);
  61. ztree.checkNode(node, true, false);
  62. }
  63. }
  64. });
  65. },
  66. acceptClick: function() {
  67. var nodes = ztree.getCheckedNodes(true);
  68. var orgIdList = new Array();
  69. for(var i=0; i<nodes.length; i++) {
  70. orgIdList.push(nodes[i].orgId);
  71. }
  72. vm.role.orgIdList = orgIdList;
  73. $.ConfirmForm({
  74. url: '../../sys/role/authorize/data?_' + $.now(),
  75. param: vm.role,
  76. success: function(data) {
  77. }
  78. });
  79. }
  80. }
  81. })
  82. </script>
  83. </body>
  84. </html>