| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115 |
- Ext.QuickTips.init();
- Ext.define('erp.controller.fa.fp.FixedCharge', {
- 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','fa.fp.FixedCharge','core.grid.Panel2','core.toolbar.Toolbar',
- 'core.button.Submit','core.button.ResSubmit','core.button.Audit','core.button.ResAudit',
- 'core.button.Save','core.button.Add','core.button.Close','core.button.Delete','core.button.Update','core.button.DeleteDetail',
- 'core.trigger.DbfindTrigger','core.trigger.TextAreaTrigger','core.form.YnField','core.form.ColorField'
- ],
- init:function(){
- var me = this;
- me.gridLastSelected = null;
- this.control({
- 'erpGridPanel2': {
- itemclick: this.onGridItemClick
- },
- 'erpSaveButton': {
- click: function(btn){
- var form = me.getForm(btn);
- //保存之前的一些前台的逻辑判定
- this.FormUtil.beforeSave(this);
- }
- },
- 'erpDeleteButton' : {
- click: function(btn){
- me.FormUtil.onDelete(Ext.getCmp('fc_id').value);
- }
- },
- 'erpUpdateButton': {
- click: function(btn){
- this.FormUtil.onUpdate(this);
- }
- },
- 'erpAddButton': {
- click: function(){
- me.FormUtil.onAdd('addFixedCharge', '新增其他收入单', 'jsps/fa/fp/FixedCharge.jsp');
- }
- },
- 'erpCloseButton': {
- click: function(btn){
- this.FormUtil.beforeClose(this);
- }
- },
- 'erpSubmitButton': {
- afterrender: function(btn){
- var status = Ext.getCmp('fc_statuscode');
- if(status && status.value != 'ENTERING'){
- btn.hide();
- }
- },
- click: function(btn){
- me.beforeSubmit(btn);
- }
- },
- 'erpResSubmitButton': {
- afterrender: function(btn){
- var status = Ext.getCmp('fc_statuscode');
- if(status && status.value != 'COMMITED'){
- btn.hide();
- }
- },
- click: function(btn){
- me.FormUtil.onResSubmit(Ext.getCmp('fc_id').value);
- }
- },
- 'erpAuditButton': {
- afterrender: function(btn){
- var status = Ext.getCmp('fc_statuscode');
- if(status && status.value != 'COMMITED'){
- btn.hide();
- }
- },
- click: function(btn){
- me.FormUtil.onAudit(Ext.getCmp('fc_id').value);
- }
- },
- 'erpResAuditButton': {
- afterrender: function(btn){
- var status = Ext.getCmp('fc_statuscode');
- if(status && status.value != 'AUDITED'){
- btn.hide();
- }
- },
- click: function(btn){
- me.FormUtil.onResAudit(Ext.getCmp('fc_id').value);
- }
- },
- 'field[name=fc_enddate]': {
- change: function(f){
- if(f.value == null || f.value == ''){
- f.value = 0;
- }
- if(Ext.getCmp('fc_startdate')){
- var e = Ext.util.Format.date(Ext.getCmp('fc_startdate').value, 'Y-m-d');// 格式化日期控件值
- var s= Ext.util.Format.date(Ext.getCmp('fc_enddate').value, 'Y-m-d');// 格式化日期控件值
- var end = new Date(s);
- var start = new Date(e);
- var elapsed = Math.ceil((end.getTime() - start.getTime())/(86400000*30)); // 计算间隔月数
- Ext.getCmp('fc_month').setValue(elapsed);
- }
- }
- }
- });
- },
- beforeSubmit:function(btn){
- var me = this;
- me.FormUtil.onSubmit(Ext.getCmp('fc_id').value);
- },
- getForm: function(btn){
- return btn.ownerCt.ownerCt;
- }
- });
|