| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475 |
- /*
- * 描 述:权限验证模块
- */
- (function ($, learun) {
- "use strict";
- //$.fn.lrAuthorizeJfGrid = function (op) {
- // var _headData = [];
- // $.each(op.headData, function (id, item) {
- // if (!!lrModuleColumnList[item.name.toLowerCase()]) {
- // _headData.push(item);
- // }
- // });
- // op.headData = _headData;
- // $(this).jfGrid(op);
- //}
-
- $(function () {
- function btnAuthorize() {
- var AuthorizeUser = learun.clientdata.get(['useracl']);
- var loginInfo = learun.clientdata.get(['userinfo']);
- var mid = learun.frameTab.iframeId;
- var $container = $('[wms-authorize="yes"]');
- if (loginInfo.LOGINUSER.UserType == 4) {
- if (!!AuthorizeUser) {
- $container.find('[id]').each(function () {
- var $this = $(this);
- var id = mid + "_" + $this.attr('id');
- if (!AuthorizeUser[id]) {
- $this.remove();
- }
- });
- $container.find('.dropdown-menu').each(function () {
- var $this = $(this);
- if ($this.find('li').length == 0) {
- $this.remove();
- }
- });
- }
- else {
- setTimeout(btnAuthorize, 100);
- }
- }
- if (loginInfo.LOGINUSER.UserType == 1) {
- var $layouttool = $('.lr-layout-tool-right');
- var $btnGroup = $('<div class=" btn-group btn-group-sm"></div>');
- var $btn = $('<a id="AddAclBtn" class="btn btn-default"><i class="fa fa-sign-in"></i> 添加权限</a>');
- $btn.on('click', function () {
- var m8 = learun.frameTab.iframeId;
- var exportField = [];
- $container.find('[id]').each(function () {
- var value = $(this).attr('id');
- if (value != '') {
- var ac = $(this).find("#" + value);
- exportField.push({ ACLItem: m8 + "_" + value, PNO: m8, Name: ac.context.innerText });
- }
- });
-
- learun.httpPost(top.$.rootUrl + "/UserCenterManager/ACLConst/SaveWebACLBtnConst",
- { KeyValue: m8, acllist: JSON.stringify(exportField) },
- function (res) {
- learun.alert_res(res);
- });
- });
- $btnGroup.append($btn);
- $layouttool.append($btnGroup);
- }
- $container.css({ 'display': 'inline-block' });
- }
- btnAuthorize();
- });
- })(window.jQuery, top.learun);
|