| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189 |
- /**
- * 委外信息修改按钮
- */
- Ext.define('erp.view.core.button.OSInfoVendReply',{
- extend : 'Ext.Button',
- alias : 'widget.erpOSInfoVendReplyButton',
- iconCls : 'x-button-icon-submit',
- cls : 'x-btn-gray',
- text : $I18N.common.button.erpOSInfoVendReplyButton,
- style : {
- marginLeft : '10px'
- },
- width : 140,
- initComponent : function() {
- this.callParent(arguments);
- },
- listeners: {
- afterrender: function(btn) {
- var me = this;
- //var res = me.getSetting('makeOSInfo.check'),
- status = Ext.getCmp('ma_statuscode'),
- checkstatus = Ext.getCmp('ma_checkstatus');
- if(status && (status.value == 'ENTERING' || status.value == 'FINISH')){
- btn.hide();
- }
- /*if(res) {
- if(checkstatus && checkstatus.value == 'APPROVE'){
- btn.hide();
- }
- }*/
- }
- },
- handler: function() {
- var me = this, win = Ext.getCmp('Complaint-win');
- var states = Ext.create('Ext.data.Store', {
- fields: ['abbr', 'name'],
- data : me.getFlowStyle()
- });
- if(!win) {
- var vc = Ext.getCmp('ma_vendorreplydate'), vn = Ext.getCmp('ma_replyqty'),
- pr = Ext.getCmp('ma_isok'), cr = Ext.getCmp('ma_vendorreply'),
- val1 = vc ? vc.value : '', val2 = vn ? vn.value : '', val3 = pr ? pr.value : '',
- val4 = cr ? cr.value : '';
- win = Ext.create('Ext.Window', {
- width: 430,
- height: 250,
- closeAction: 'destroy',
- cls: 'custom-blue',
- title: '<h1>更新供应商回信息</h1>',
- layout: {
- type: 'vbox'
- },
- items: [
- {
- margin: '5 0 0 5',
- xtype: 'datefield',
- fieldLabel: '回复交期',
- name: 'DELIVERYREPLY',
- format: 'Y-m-d',
- value: val1,
- id: 'DELIVERYREPLY'
- },
- {
- margin: '5 0 0 5',
- xtype: 'numberfield',
- fieldLabel: '回复数量',
- name: 'QTYREPLY',
- hideTrigger: true,
- value: val2,
- id: 'QTYREPLY'
- },{
- margin: '5 0 0 5',
- xtype: 'checkbox',
- columnidth: 0.4,
- fieldLabel: '能否按时交货',
- name: 'isok',
- value:val3,
- id: 'isok'
- },
- {
- margin: '5 0 0 5',
- xtype: 'textareatrigger',
- columnidth: 0.4,
- fieldLabel: '回复明细',
- name: 'replydetail',
- value:val4,
- id: 'replydetail'
- }
- ],
- buttonAlign: 'center',
- buttons: [{
- xtype: 'button',
- text: '保存',
- width: 60,
- iconCls: 'x-button-icon-save',
- handler: function(btn) {
- var w = btn.up('window');
- me.saveVendorInfo(w);
- win.close();
- win.destroy();
- }
- },
- {
- xtype: 'button',
- columnWidth: 0.1,
- text: '关闭',
- width: 60,
- iconCls: 'x-button-icon-close',
- margin: '0 0 0 10',
- handler: function(btn) {
- var win = btn.up('window');
- win.close();
- win.destroy();
- }
- }]
- });
- }
- win.show();
- },
- saveVendorInfo: function(w) {
- var deliveryreply = w.down('field[name=DELIVERYREPLY]').getValue();
- var qty = w.down('field[name=QTYREPLY]').getValue();
- if (!deliveryreply && !qty && !Ext.getCmp('replydetail').value) {
- showError('请先设置回复信息');
- return;
- } else {
- var isok = w.down('field[name=isok]').getValue();
- var dd = {
- ma_id:Ext.getCmp('ma_id').getValue() ,
- ma_replyqty: qty ? qty: 0,
- ma_vendorreplydate: deliveryreply ? Ext.Date.format(deliveryreply, 'Y-m-d') : null,
- ma_isok: isok ? '是': '否',
- ma_vendorreply:Ext.getCmp('replydetail').value
- };
- Ext.Ajax.request({
- url: basePath + 'pm/make/updateVendorInfo.action',
- params: {
- data: unescape(Ext.JSON.encode(dd)),
- caller: caller
- },
- method: 'post',
- callback: function(opt, s, res) {
- var r = new Ext.decode(res.responseText);
- if (r.success) {
- showMessage('提示', '更新成功!', 1000);
- window.location.reload();
- } else if (r.exceptionInfo) {
- showError(r.exceptionInfo);
- } else {
- saveFailure();
- }
- }
- });
- }
- },
- getFlowStyle: function() {
- var field = Ext.getCmp('ma_flowstyle'), datas = [];
- if(field && field.store) {
- field.store.each(function(item){
- datas.push({
- name: item.get('display'),
- abbr: item.get('value')
- });
- });
- }
- return datas;
- },
- getSetting: function(type) {
- var result = false;
- Ext.Ajax.request({
- url : basePath + 'common/getFieldData.action',
- async: false,
- params: {
- caller: 'Setting',
- field: 'se_value',
- condition: 'se_what=\'' + type + '\''
- },
- 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){
- result = r.data == 'true';
- }
- }
- });
- return result;
- }
- });
|