| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110 |
- Ext.QuickTips.init();
- Ext.define('erp.controller.co.cost.MakeFeeClose', {
- extend : 'Ext.app.Controller',
- FormUtil : Ext.create('erp.util.FormUtil'),
- BaseUtil : Ext.create('erp.util.BaseUtil'),
- views : [ 'co.cost.MakeFeeClose', 'core.trigger.DbfindTrigger',
- 'core.button.MakeFeeClose', 'core.button.Close' ],
- init : function() {
- var me = this;
- this.control({
- 'erpCloseButton' : {
- click : function(btn) {
- me.FormUtil.onClose();
- }
- },
- 'erpMakeFeeCloseButton' : {
- click : function(btn) {
- var form = btn.ownerCt.ownerCt,
- makeCatecode = form.down('#makeCatecode').value,
- makeToCatecode = form.down('#makeToCatecode').value,
- account = form.down('#account').value;
- if (!Ext.isEmpty(makeCatecode) && !Ext.isEmpty(makeToCatecode)) {
- this.deal(makeCatecode, makeToCatecode, account);
- } else {
- alert('请先选择制造成本科目.');
- }
- }
- },
- 'displayfield[name=yearmonth]' : {
- afterrender: function(f) {
- this.getMonth(f);
- }
- },
- '#makeCatecode' : {
- afterrender: function(f) {
- this.getSetting('MakeCatecode', function(d){
- f.setValue(d);
- (typeof f.autoDbfind === 'function') && f.autoDbfind('form', null, 'ca_code', 'ca_code=\'' + d + '\'');
- });
- }
- },
- '#makeToCatecode' : {
- afterrender: function(f) {
- this.getSetting('MakeToCatecode', function(d){
- f.setValue(d);
- (typeof f.autoDbfind === 'function') && f.autoDbfind('form', null, 'ca_code', 'ca_code=\'' + d + '\'');
- });
- }
- }
- });
- },
- getForm : function(btn) {
- return btn.ownerCt.ownerCt;
- },
- deal : function(makeCatecode, makeToCatecode, account) {
- var tab = this.BaseUtil.getActiveTab();
- tab.setLoading(true);
- Ext.Ajax.request({
- url : basePath + 'co/cost/makeCreate.action',
- params : {
- makeCatecode : makeCatecode,
- makeToCatecode : makeToCatecode,
- account : account
- },
- timeout: 120000,
- callback : function(opt, s, r) {
- tab.setLoading(false);
- var rs = Ext.decode(r.responseText);
- if(rs.data) {
- showMessage('提示', rs.data);
- } else if(rs.exceptionInfo) {
- showMessage('错误', rs.exceptionInfo);
- }
- }
- });
- },
- getMonth: function(f) {
- Ext.Ajax.request({
- url: basePath + 'fa/getMonth.action',
- params: {
- type: 'MONTH-A'
- },
- callback: function(opt, s, r) {
- var rs = Ext.decode(r.responseText);
- if(rs.data) {
- f.setValue(rs.data.PD_DETNO);
- }
- }
- });
- },
- getSetting: function(code, fn) {
- Ext.Ajax.request({
- url : basePath + 'common/getFieldData.action',
- params: {
- caller: 'Setting',
- field: 'se_value',
- condition: 'se_what=\'' + code + '\''
- },
- method : 'post',
- callback : function(opt, s, res){
- var r = new Ext.decode(res.responseText);
- if(r.exceptionInfo){
- showError(r.exceptionInfo);return;
- } else if(r.success && r.data){
- fn.call(null, r.data);
- }
- }
- });
- }
- });
|