123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100 |
- Ext.QuickTips.init();
- Ext.define('erp.controller.ma.userGroupPower', {
- extend: 'Ext.app.Controller',
- requires: ['erp.util.FormUtil', 'erp.util.GridUtil', 'erp.util.BaseUtil'],
- views:[
- 'ma.userGroup.userGroupForm','ma.userGroup.userGroupGrid','core.trigger.DbfindTrigger'
- ],
- init:function(){
- var me = this;
- me.FormUtil = Ext.create('erp.util.FormUtil');
- me.BaseUtil = Ext.create('erp.util.BaseUtil');
- this.control({
- '#query':{
- click:function(){
- me.onQuery();
- }
- },
- '#save':{
- click:function(){
- me.save();
- }
- },
- 'field[name=eg_groupcode]':{
- aftertrigger:function(f){
- me.onQuery();
- }
- },
- '#sn_module':{
- select:function(){
- me.onQuery(true);
- }
- }
- });
- },
- onQuery:function(bool){
- var me = this;
- var eg_groupcode = Ext.getCmp('eg_groupcode').value;
- if(eg_groupcode==null || eg_groupcode == ''){
- if(!bool){
- showError('请先选择用户组!');
- }
- return;
- }
- var sn_module = Ext.getCmp('sn_module').value;
- var param;
- me.FormUtil.setLoading(true);
- Ext.Ajax.request({
- url : basePath + 'ma/queryCSPower.action',
- params: {
- eg_groupcode: eg_groupcode,
- sn_module : sn_module||''
- },
- method : 'post',
- callback : function(options,success,response){
- me.FormUtil.setLoading(false);
- var localJson = new Ext.decode(response.responseText);
- if(localJson.success){
- Ext.getCmp('grid').getStore().loadData(localJson.data);
- } else if(localJson.exceptionInfo){
- showError(localJson.exceptionInfo);
- return;
- }
- }
- });
- },
- save:function(){
- var me = this, grid = Ext.getCmp('grid');
- var eg_groupcode = Ext.getCmp('eg_groupcode').value;
- if(eg_groupcode==null || eg_groupcode == ''){
- showError('用户组必填!');
- return;
- }
- var param = grid.GridUtil.getGridStore();
- if(param==null || param == ''){
- showError('还未做任何修改!');
- return;
- }
- me.FormUtil.setLoading(true);
- Ext.Ajax.request({
- url : basePath + 'ma/saveCSPower.action',
- params: {
- groupcode: eg_groupcode,
- params: param
- },
- method : 'post',
- callback : function(options,success,response){
- me.FormUtil.setLoading(false);
- var localJson = new Ext.decode(response.responseText);
- if(localJson.success){
- Ext.Msg.alert('提示','保存成功',function(){
- me.onQuery();
- })
- } else if(localJson.exceptionInfo){
- showError(localJson.exceptionInfo);
- return;
- }
- }
- });
- }
- });
|