日期:2014-05-16 浏览次数:20444 次
Ext.namespace('Ext.role'); Ext.role.rights = function() { /* ----------------------- private属性 ----------------------- */ var win, okBtn, cancelBtn, nav, tn = 1, sysId; /* ----------------------- private方法 ----------------------- */ // 创建表格 function createGrid(){ var store = new Ext.data.Store({ proxy: new Ext.data.HttpProxy({ url: attrCurrMgr.Contants.selectOrgGridLoadUrl }), // 返回数据解析器配置 reader: new Ext.data.JsonReader( { root:'data', totalProperty:'totalCount', id: 'roleId' }, [ {name: 'roleId', mapping: 'roleId'}, {name: 'roleName', mapping: 'roleName'} ] ) }); attrCurrMgr.Contants.selectOrgGrid = new Ext.grid.GridPanel({ el: 'selectOrgGrid_div', store: store, loadMask: true, //bodyStyle:'width:100%', //height: 400, cm: new Ext.grid.ColumnModel([ {header: "角色名称", id:'orgName', width: 200, sortable: true, locked:false, dataIndex: 'roleName'} ]), tbar: new Ext.Toolbar({items:[{id:'delrightbutton',text:"删除角色",handler: delRightClick},'-']}), sm: new Ext.grid.RowSelectionModel({singleSelect:false}) }); attrCurrMgr.Contants.selectOrgGrid.render(); } //删除角色权限 function delRightClick(){ var c = attrCurrMgr.Contants.selectOrgGrid.getSelectionModel().getSelections(); if (c.length > 0) Ext.MessageBox.confirm('消息', '确认要删除所选记录?', doDelete); else Ext.MessageBox.alert('警告', '最少需要选择一条记录!'); } function doDelete(btn){ if(btn == 'yes') { var m = attrCurrMgr.Contants.selectOrgGrid.getSelectionModel().getSelections(); var jsonData =""; for(var i = 0, len = m.length; i < len; i++){ var ss = m[i].get('roleId'); if(i==0) jsonData = jsonData + ss ; else jsonData = jsonData + "," + ss; } // 提交删除的参数配置 var config = { url : attrCurrMgr.Contants.SelectOrgDelUrl, failure: function() { Ext.MessageBox.alert('错误信息', '删除选择的角色失败!'); }, success: function(){ Ext.MessageBox.alert('消息', '删除选择的角色成功!'); }, callback: function(){ attrCurrMgr.Contants.selectOrgGrid.store.load(); }, method: 'POST', params:{delData:jsonData} }; this.transId = Ext.Ajax.request(config); } } // 创建窗口 function createWindow() { if (win) return; attrCurrMgr.Contants.treePanel = new RoleTreePanel(); win = new Ext.Window( { minimizable: true, iconCls : 'bdSelector', header:true, title:'角色设置', shadow:true, closable:true, resizable:false, animCollapse: true, closeAction: 'hide', width: 580, height: 530, layout : 'border', plain : true, modal : true, items : [ attrCurrMgr.Contants.treePanel, { region: 'center', split:false, border:false, layout:'fit', items:[{contentEl: 'right-center'}] }, { region:"east", contentEl:'right-east', width: 225, layout:'fit', items:attrCurrMgr.Contants.selectOrgGrid }] }); win.on('show', function() { attrCurrMgr.Contants.treePanel.reset(); attrCurrMgr.Contants.selectOrgGrid.store.baseParams={sysId:sysId}; attrCurrMgr.Contants.selectOrgGrid.store.load(); }); win.on('minimize', function(){ win.toggleCollapse(); }); cancelBtn = win.addButton( { text : '关闭', tabIndex : tn++ }, onWinHide, this); } // 隐藏窗口 function onWinHide() { win.hi