| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266 |
- /**
- * 委外信息修改按钮
- */
- Ext.define('erp.view.core.button.OSUpdate',{
- extend : 'Ext.Button',
- alias : 'widget.erpOSUpdateButton',
- iconCls : 'x-button-icon-submit',
- cls : 'x-btn-gray',
- text : $I18N.common.button.erpOSVendorUpdateButton,
- style : {
- marginLeft : '10px'
- },
- width : 140,
- initComponent : function() {
- this.callParent(arguments);
- },
- listeners: {
- afterrender: function(btn) {
- var me = this;
- var res = me.getSetting('makeos.check'),
- status = Ext.getCmp('ma_statuscode'),
- checkstatus = Ext.getCmp('ma_checkstatus');
- if(status && status.value == 'ENTERING'){
- 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 : [
- {"abbr":"光明委外", "name":"光明委外"},
- {"abbr":"白芒委外", "name":"白芒委外"}
- ]
- });
- if(!win) {
- var vc = Ext.getCmp('ma_vendcode'), vn = Ext.getCmp('ma_vendname'),
- pr = Ext.getCmp('ma_price'), cr = Ext.getCmp('ma_currency'),tr = Ext.getCmp('ma_taxrate'),
- pac = Ext.getCmp('ma_paymentscode'), pan = Ext.getCmp('ma_payments'),ser=Ext.getCmp('ma_servicer'),
- flowstyle = Ext.getCmp('ma_flowstyle').value,remark = Ext.getCmp('ma_remark').value,
- val1 = vc ? vc.value : '', val2 = vn ? vn.value : '', val3 = pr ? pr.value : '',
- val4 = cr ? cr.value : '', val5 = tr ? tr.value : '', val6 = pac ? pac.value : '',
- val7 = pan ? pan.value : '',val8 = ser ? ser.value : '',val9 = remark ? remark.value : '';
- win = Ext.create('Ext.Window', {
- id: 'Complaint-win',
- title: '更新委外单 ' + Ext.getCmp('ma_code').value + ' 的委外信息',
- height: 400,
- width: 400,
- items: [{
- xtype: 'form',
- height: '100%',
- width: '100%',
- bodyStyle: 'background:#f1f2f5;',
- items: [{
- margin: '10 0 0 0',
- xtype: 'dbfindtrigger',
- fieldLabel: '委外商号',
- name:'ma_vendcode',
- allowBlank: false,
- value: val1,
- listeners:{
- aftertrigger:function(t, d){
- t.ownerCt.down('textfield[name=ma_vendname]').setValue(d.get('ve_name'));
- t.ownerCt.down('textfield[name=ma_currency]').setValue(d.get('ppd_currency'));
- t.ownerCt.down('textfield[name=ma_taxrate]').setValue(d.get('ppd_rate'));
- t.ownerCt.down('textfield[name=ma_price]').setValue(d.get('ppd_price'));
- t.ownerCt.down('textfield[name=ma_paymentscode]').setValue(d.get('ve_paymentcode'));
- t.ownerCt.down('textfield[name=ma_payments]').setValue(d.get('ve_payment'));
- },
- afterrender:function(trigger){
- trigger.dbKey='ma_prodcode';
- trigger.mappingKey='ppd_prodcode';
- trigger.dbMessage='请先选物料编号!';
- }
- }
- },{
- margin: '3 0 0 0',
- xtype: 'textfield',
- fieldLabel: '委外商名',
- readOnly:true,
- name:'ma_vendname',
- allowBlank: false,
- value: val2
- },{
- margin: '3 0 0 0',
- xtype: 'dbfindtrigger',
- fieldLabel: '币别',
- name:'ma_currency',
- readOnly:true,
- allowBlank: false,
- value: val4
- },{
- margin: '3 0 0 0',
- xtype: 'textfield',
- fieldLabel: '税率',
- name:'ma_taxrate',
- readOnly:true,
- allowBlank: false,
- value: val5
- },{
- margin: '3 0 0 0',
- xtype: 'textfield',
- fieldLabel: '加工单价',
- name:'ma_price',
- readOnly:true,
- allowBlank: false,
- value: val3,
- listeners:{
- afterrender:function(t, d){
- var res = me.getSetting('makeos.price');
- if(res) {
- t.ownerCt.down('textfield[name=ma_price]').setReadOnly(true);
- }
- }
- }
- },{
- margin: '3 0 0 0',
- xtype: 'erpYnField',
- fieldLabel: '是否免费加工',
- name:'ma_servicer',
- value: val8,
- hidden:!ser
- },{
- margin: '3 0 0 0',
- xtype: 'dbfindtrigger',
- fieldLabel: '付款方式编号',
- name:'ma_paymentscode',
- allowBlank: false,
- readOnly:true,
- value: val6
- },{
- margin: '3 0 0 0',
- xtype: 'textfield',
- fieldLabel: '付款方式',
- name:'ma_payments',
- allowBlank: false,
- readOnly:true,
- value: val7
- },{
- margin: '3 0 0 0',
- xtype: 'combo',
- name:'ma_flowstyle',
- fieldLabel: '委外单位',
- store: states,
- queryMode: 'local',
- displayField: 'name',
- valueField: 'abbr',
- value:flowstyle
- },{
- margin: '3 0 0 0',
- xtype: 'textfield',
- name:'ma_remark',
- fieldLabel: '备注',
- value: val9
- }],
- closeAction: 'hide',
- buttonAlign: 'center',
- layout: {
- type: 'vbox',
- align: 'center'
- },
- buttons: [{
- text: "自动获取",
- cls: 'x-btn-blue',
- handler: function(btn) {
- Ext.Ajax.request({
- url: basePath + '/scm/purchase/getMakeVendorPrice.action',
- params: {
- id: Ext.getCmp('ma_id').value
- },
- callback: function(opt, s, r) {
- var rs = Ext.decode(r.responseText);
- if(rs.exceptionInfo) {
- showError(rs.exceptionInfo);
- } else {
- Ext.Msg.alert("提示","获取成功!");
- window.location.reload();
- }
- }
- });
- }
- },{
- text: $I18N.common.button.erpConfirmButton,
- cls: 'x-btn-blue',
- handler: function(btn) {
- var form = btn.ownerCt.ownerCt,
- a = form.down('dbfindtrigger[name=ma_vendcode]'),
- b = form.down('dbfindtrigger[name=ma_currency]'),
- c = form.down('textfield[name=ma_taxrate]'),
- d = form.down('textfield[name=ma_price]'),
- e = form.down('textfield[name=ma_paymentscode]'),
- f = form.down('textfield[name=ma_payments]');
- g = form.down('textfield[name=ma_servicer]');
- h = form.down('textfield[name=ma_flowstyle]');
- i = form.down('textfield[name=ma_remark]');
- if(form.getForm().isDirty()) {
- me.updateOSVendor(Ext.getCmp('ma_id').value, a.value, b.value, c.value, d.value, e.value, f.value,g.value,h.value,i.value);
- }
- }
- }, {
- text: $I18N.common.button.erpCloseButton,
- cls: 'x-btn-blue',
- handler: function(btn) {
- btn.up('window').hide();
- }
- }]
- }]
- });
- }
- win.show();
- },
- updateOSVendor: function(id, val1, val2, val3, val4, val5, val6,ser,h,i) {
- Ext.Ajax.request({
- url: basePath + 'pm/make/updateOSVendor.action',
- params: {
- id: id,
- vend: val1,
- curr: val2,
- taxr: val3,
- price: val4,
- paymc: val5,
- paym: val6,
- ma_servicer: ser,
- maflowstyle:h,
- remark: i
- },
- callback: function(opt, s, r) {
- var rs = Ext.decode(r.responseText);
- if(rs.exceptionInfo) {
- showError(rs.exceptionInfo);
- } else {
- Ext.Msg.alert("提示","更新成功!");
- window.location.reload();
- }
- }
- });
- },
- 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 + '\''
- },
- 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){
- result = r.data == 'true';
- }
- }
- });
- return result;
- }
- });
|