| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181 |
- Ext.QuickTips.init();
- Ext.define('erp.controller.pm.atp.ATPMain', {
- extend: 'Ext.app.Controller',
- FormUtil: Ext.create('erp.util.FormUtil'),
- GridUtil: Ext.create('erp.util.GridUtil'),
- BaseUtil: Ext.create('erp.util.BaseUtil'),
- views:[
- 'core.form.Panel','pm.atp.ATPMain','core.grid.Panel2','core.toolbar.Toolbar','core.form.MultiField',
- 'core.button.Save','core.button.Add','core.button.Submit','core.button.Print','core.button.ResAudit',
- 'core.button.Audit','core.button.Close','core.button.Delete','core.button.Update','core.button.DeleteDetail',
- 'core.button.ResSubmit','core.button.Flow','core.trigger.MultiDbfindTrigger','core.button.Post','core.button.ResPost',
- 'core.trigger.DbfindTrigger','core.trigger.TextAreaTrigger','core.form.YnField','core.button.ExecuteOperation','core.button.SupplyScan'
- ],
- init:function(){
- var me = this;
- this.control({
- 'erpGridPanel2': {
- itemclick: this.onGridItemClick
- },
- 'erpSaveButton': {
- click: function(btn){
- var form = me.getForm(btn);
- if(Ext.getCmp(form.codeField).value == null || Ext.getCmp(form.codeField).value == ''){
- me.BaseUtil.getRandomNumber();//自动添加编号
- }
- this.FormUtil.beforeSave(this);
- }
- },
- 'erpDeleteButton' : {
- click: function(btn){
- me.FormUtil.onDelete(Ext.getCmp('am_id').value);
- }
- },
- 'erpUpdateButton': {
- click: function(btn){
- this.FormUtil.onUpdate(this);
- }
- },
- 'erpAddButton': {
- click: function(){
- me.FormUtil.onAdd('addATPMain', '新增应付开票记录', 'jsps/pm/atp/ATPMain.jsp');
- }
- },
- 'erpCloseButton': {
- click: function(btn){
- me.FormUtil.beforeClose(me);
- }
- },
- 'erpSubmitButton': {
- afterrender: function(btn){
- var status = Ext.getCmp('am_statuscode');
- if(status && status.value != 'ENTERING'){
- btn.hide();
- }
- },
- click: function(btn){
- me.FormUtil.onSubmit(Ext.getCmp('am_id').value);
- }
- },
- 'erpResSubmitButton': {
- afterrender: function(btn){
- var status = Ext.getCmp('am_statuscode');
- if(status && status.value != 'COMMITED'){
- btn.hide();
- }
- },
- click: function(btn){
- me.FormUtil.onResSubmit(Ext.getCmp('am_id').value);
- }
- },
- 'erpAuditButton': {
- afterrender: function(btn){
- var status = Ext.getCmp('am_statuscode');
- if(status && status.value != 'COMMITED'){
- btn.hide();
- }
- },
- click: function(btn){
- me.FormUtil.onAudit(Ext.getCmp('am_id').value);
- }
- },
- 'erpResAuditButton': {
- afterrender: function(btn){
- var status = Ext.getCmp('am_statuscode');
- if(status && status.value != 'AUDITED'){
- btn.hide();
- }
- },
- click: function(btn){
- me.FormUtil.onResAudit(Ext.getCmp('am_id').value);
- }
- },
- 'erpPrintButton': {
- click: function(btn){
- me.FormUtil.onPrint(Ext.getCmp('am_id').value);
- }
- },
- 'erpExecuteOperationButton':{
- click: function(btn){
- me.FormUtil.setLoading(true);//loading...
- Ext.Ajax.request({
- url : basePath + 'pm/atp/executeOperation.action',
- params: {
- id: Ext.getCmp('am_id').value
- },
- method : 'post',
- timeout: 600000,
- callback : function(options,success,response){
- me.FormUtil.setLoading(false);
- var localJson = new Ext.decode(response.responseText);
- if(localJson.exceptionInfo){
- showError(localJson.exceptionInfo);
- }
- if(localJson.success){
- //resAudit成功后刷新页面进入可编辑的页面
- showMessage('提示', '执行运算成功!', 2000);
- window.location.reload();
- }
- }
- });
- }
- },
- 'erpSupplyScanButton':{
- click: function(btn){
- var form=Ext.getCmp('form');
- var keyField=form.keyField;
- var KeyValue=Ext.getCmp(keyField).value;
- if(KeyValue==null||KeyValue==''){
- showError('请先保存记录');
- }
- var me = this;
- var url=basePath+"jsps/common/queryDetail.jsp";
- var panel = Ext.getCmp("lackResultid=" +KeyValue);
- var main = parent.Ext.getCmp("content-panel");
- var urlCondition='ad_atpid='+KeyValue;
- main.getActiveTab().currentGrid = Ext.getCmp('grid');
- if(!panel){
- var title = "";
- if (KeyValue.toString().length>4) {
- title = KeyValue.toString().substring(KeyValue.toString().length-4);
- } else {
- title = KeyValue;
- }
- panel = {
- title:'供需查询('+KeyValue+')',
- tag : 'iframe',
- tabConfig:{tooltip:'供需查询('+title+')'},
- frame : true,
- border : false,
- layout : 'fit',
- iconCls : 'x-tree-icon-tab-tab',
- html : '<iframe id="iframe_maindetail_'+caller+"_"+KeyValue+'" src="'+url+'?whoami=ATPDATA&_noc=1&urlcondition='+urlCondition+'" height="100%" width="100%" frameborder="0" scrolling="no"></iframe>',
- closable : true,
- listeners : {
- close : function(){
- main.setActiveTab(main.getActiveTab().id);
- }
- }
- };
- me.FormUtil.openTab(panel,"lackResultid=" + KeyValue);
- }else{
- main.setActiveTab(panel);
- }
- }
- }
- });
- },
- beforeSubmit:function(btn){
- var me = this;
- var grid = Ext.getCmp('grid'),items=grid.store.data.items;
- me.FormUtil.onSubmit(Ext.getCmp('am_id').value);
- },
- onGridItemClick: function(selModel, record){//grid行选择
- this.GridUtil.onGridItemClick(selModel, record);
- },
- getForm: function(btn){
- return btn.ownerCt.ownerCt;
- }
- });
|