1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586 |
- <!DOCTYPE html>
- <html xmlns:th="http://www.thymeleaf.org">
- <head th:include="include/header_css::header('数据权限-角色管理')"></head>
- <body>
- <div id="dpLTE" class="container-fluid" v-cloak>
- <ul id="orgTree" class="ztree"></ul>
- </div>
- <div th:include="include/footer_js::footer"></div>
- <script type="text/javascript">
- var setting = {
- data : {
- simpleData : {
- enable : true,
- idKey : "orgId",
- pIdKey : "parentId",
- rootPId : 0
- },
- key : {
- url : "nourl"
- }
- },
- check:{
- enable:true,
- nocheckInherit:true,
- chkboxType:{ "Y" : "", "N" : "" }
- }
- };
- var ztree;
- var vm = new Vue({
- el : '#dpLTE',
- data : {
- role : {}
- },
- methods : {
- getOrg : function(menuId) {
- $.ajax({
- type: 'get',
- async: false,
- contentType : 'application/json',
- url: '../../sys/org/list?_' + $.now(),
- data: null,
- success: function(r) {
- ztree = $.fn.zTree
- .init($("#orgTree"), setting, r);
- ztree.expandAll(true);
- },
- dataType: 'json'
- });
- },
- setForm: function() {
- this.getOrg();
- $.SetForm({
- url: '../../sys/role/info',
- param: vm.role.roleId,
- success: function(data) {
- vm.role = data;
- //勾选角色所拥有的数据权限
- var orgIds = vm.role.orgIdList;
- for(var i=0; i<orgIds.length; i++) {
- var node = ztree.getNodeByParam("orgId", orgIds[i]);
- ztree.checkNode(node, true, false);
- }
- }
- });
- },
- acceptClick: function() {
- var nodes = ztree.getCheckedNodes(true);
- var orgIdList = new Array();
- for(var i=0; i<nodes.length; i++) {
- orgIdList.push(nodes[i].orgId);
- }
- vm.role.orgIdList = orgIdList;
- $.ConfirmForm({
- url: '../../sys/role/authorize/data?_' + $.now(),
- param: vm.role,
- success: function(data) {
-
- }
- });
- }
- }
- })
- </script>
- </body>
- </html>
|