| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596 |
- /**
- * 更新交样日期
- */
- Ext.define('erp.view.core.button.UpdateJYDate', {
- extend : 'Ext.Button',
- alias : 'widget.erpUpdateJYDateButton',
- iconCls : 'x-button-icon-submit',
- cls : 'x-btn-gray',
- text : '更新交样日期',
- style : {
- marginLeft : '10px'
- },
- width : 120,
- initComponent : function() {
- this.callParent(arguments);
- },
- listeners: {
- afterrender: function(btn) {
- var status = Ext.getCmp('ct_statuscode');
- if(status && status.value != 'AUDITED'){
- btn.hide();
- }
- }
- },
- handler: function() {
- var me = this, win = Ext.getCmp('prlevel-win');
- if(!win) {
- var f = Ext.getCmp('ct_date_4'), a = Ext.getCmp('ct_date_5'),
- val = f ? f.value : '', val1 = a ? a.value : '';
- win = Ext.create('Ext.Window', {
- id: 'prlevel-win',
- title: '更新交样日期',
- height: 200,
- width: 400,
- items: [{
- margin: '10 0 0 0',
- xtype: 'datefield',
- fieldLabel: '更新交样日期',
- name:'ct_date_4',
- value: val,
- format:'Y-m-d',
- },{
- margin: '10 0 0 0',
- xtype: 'datefield',
- fieldLabel: '实际交样日期',
- name:'ct_date_5',
- value: val1,
- format:'Y-m-d',
- }],
- closeAction: 'hide',
- buttonAlign: 'center',
- layout: {
- type: 'vbox',
- align: 'center'
- },
- buttons: [{
- text: $I18N.common.button.erpConfirmButton,
- cls: 'x-btn-blue',
- handler: function(btn) {
- var date1=btn.ownerCt.ownerCt.down('textfield[name=ct_date_4]'),
- date2=btn.ownerCt.ownerCt.down('textfield[name=ct_date_5]');
- if((date1.isDirty() && !Ext.isEmpty(date1.value))|| (date2.isDirty() && !Ext.isEmpty(date2.value))) {
- me.updateJYDate(Ext.getCmp('ct_id').value, date1.value, date2.value);
- }
- }
- }, {
- text: $I18N.common.button.erpCloseButton,
- cls: 'x-btn-blue',
- handler: function(btn) {
- btn.ownerCt.ownerCt.hide();
- }
- }]
- });
- }
- win.show();
- },
- updateJYDate: function(id, val1, val2) {
- Ext.Ajax.request({
- url: basePath + 'scm/sale/updateYJDate.action',
- params: {
- id: id,
- date1: val1 ,
- date2: val2
- },
- callback: function(opt, s, r) {
- var rs = Ext.decode(r.responseText);
- if(rs.exceptionInfo) {
- showError(rs.exceptionInfo);
- } else {
- alert('设置成功!');
- window.location.reload();
- }
- }
- });
- }
- });
|