123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308 |
- Ext.define('make.view.osmake.osMake.ModifyVendInfoWin', {
- extend: 'Ext.window.Window',
- xtype: 'osmake-osmake-modifyvendinfowin',
-
- cls: 'x-window-dbfind',
- modal: true,
- width: 1000,
- minHeight: 300,
- scrollable: true,
- bodyPadding: 10,
- constrain: true,
- closable: true,
- layout: 'fit',
- title: '外协信息更新',
- viewModel: {
- data: {
- form : {
- id:null,
- ma_vendid:null,
- ma_vendcode:null,
- ma_vendname:null,
- ma_contact:null,
- ma_shipaddresscode:null,
- ma_tel:null,
- ma_paymentscode:null,
- ma_paymentsid:null,
- ma_payments:null,
- ma_currency:null,
- ma_taxrate:null,
- ma_taxprice:null,
- ma_ipdid:null
- }
- },
-
- },
-
- items: [{
- xtype: 'form',
- layout: 'column',
- autoScroll: true,
- buttonAlign : 'center',
- defaults:{
- columnWidth:0.3 ,
- margin: '0 0 10 0',
- labelAlign: 'right',
- labelWidth: 90
- },
- bodyPadding: '8 12 8 12',
- _saveUrl: '/api/make/make/modifyVendInfo',
- _getVendPrice:'/api/make/make/getVendPrice',
- items:[{
- xtype: 'hidden',
- name: 'id',
- fieldLabel: 'id',
- allowBlank: true,
- columnWidth: 0,
- bind:'{form.id}',
- },{
- xtype: "vendorDbfindTrigger",
- name: "ma_vendname",
- fieldLabel: "外协厂商",
- allowBlank: false,
- bind:'{form.ma_vendname}',
- }, {
- xtype: "hidden",
- name: "ma_vendid",
- fieldLabel: "外协厂商ID",
- bind:'{form.ma_vendid}',
- }, {
- xtype: "hidden",
- name: "ma_vendcode",
- fieldLabel: "外协厂商编号",
- bind:'{form.ma_vendcode}',
- },{
- xtype: "textfield",
- name: "ma_contact",
- fieldLabel: "联系人",
- bind:'{form.ma_contact}',
- }, {
- xtype: "textfield",
- name: "ma_shipaddresscode",
- fieldLabel: "交货地址",
- bind:'{form.ma_shipaddresscode}',
- },{
- xtype: "textfield",
- name: "ma_tel",
- fieldLabel: "联系电话",
- bind:'{form.ma_tel}',
- }, {
- xtype: 'hidden',
- name: 'ma_paymentscode',
- fieldLabel: '付款方式编号',
- bind:'{form.ma_paymentscode}',
- }, {
- xtype: 'hidden',
- fieldLabel: '付款方式编号',
- name: "ma_paymentsid",
- bind:'{form.ma_paymentsid}',
- },{
- xtype: "remotecombo",
- name: "ma_payments",
- fieldLabel: "付款方式",
- storeUrl:'/api/document/paymentspay/list/enable',
- valueField:'pa_name',
- displayField: 'pa_name',
- allowBlank: false,
- bind:'{form.ma_payments}',
- addHandler: function (b) {
- var document = Ext.create('saas.view.document.paymentspay.DataList', {});
- var form = this.ownerCmp.ownerCt;
- this.dialog = form.getController().getView().add({
- xtype: 'document-paymentspay-window',
- bind: {
- title: '新增付款方式'
- },
- dataKind: 'paymentspay',
- belong: document.etc['paymentspay'],
- _parent: form,
- _combo: this.ownerCmp,
- record: null,
- session: true
- });
- this.dialog.show();
- },
- editHandler:function(btn,type){
- saas.util.BaseUtil.openTab('document-paymentspay-datalist', '付款方式设置','maintab--document-paymentspay-datalist');
- var combo = btn.ownerCt.up('remotecombo');
- if(combo){
- combo.collapse();
- }
- }
- }, {
- xtype: 'hidden',
- name:'ma_tasktype',
- fieldLabel: '单据类型',
- allowBlank: false,
- defaultValue:'OS',
- bind:'{form.ma_tasktype}',
- },{
- xtype: 'currencyCombo',
- name:'ma_currency',
- fieldLabel: '币种',
- allowBlank: false,
- rateField:'ma_rate',
- bind:'{form.ma_currency}',
- },{
- xtype: 'hidden',
- fieldLabel: '汇率',
- name:'ma_rate',
- allowBlank: false,
- bind:'{form.ma_rate}',
- },{
- xtype: 'numberfield',
- fieldLabel: '税率',
- name:'ma_taxrate',
- allowBlank: true,
- bind:'{form.ma_taxrate}',
- },{
- xtype: 'numberfield',
- fieldLabel: '含税单价',
- name:'ma_taxprice',
- fixDecimal:false,
- decimalPrecision:8,
- bind:'{form.ma_taxprice}',
- thousandSeparator: ',',
- renderer: function (v){
- if(!v){
- v=0;
- }
- return '<p class="money-rtl"><B>'+saas.util.BaseUtil.numberFormat(v, 8, true)+''
- }
- },{
- xtype: 'numberfield',
- fieldLabel: '明细id',
- name:'ma_ipdid',
- hidden:true,
- bind:'{form.ma_ipdid}'
- },{
- xtype: 'numberfield',
- fieldLabel: 'qty',
- name:'ma_qty',
- hidden:true,
- bind:'{form.ma_qty}'
- },{
- xtype: 'textfield',
- fieldLabel: 'ma_prodcode',
- name:'ma_prodcode',
- hidden:true,
- bind:'{form.ma_prodcode}'
- }],
- buttons: [{
- text:'保存',
- disabled: true,
- formBind: true,
- handler:function(){
- this.up('window').onSave();
- }
- }, {
- text:'按供应商取价',
- disabled: true,
- formBind: true,
- bind: {
- disabled: '{form.ma_vendcode}'
- },
- handler:function(){
- this.up('window').getVendPrice(window);
- }
- },{
- text: '关闭',
- handler:function(){
- this.up('window').onClose();
- }
- }]
- }],
- initComponent: function () {
- var me = this;
- me.callParent();
- },
- /**
- * 保存
- */
- onSave: function(){
- var me = this,
- form = me.down('form'),
- vm = me.getViewModel();
- params = Ext.clone(vm.get('form'));
- form.setLoading(true);
- saas.util.BaseUtil.request({
- url: form._saveUrl,
- params: JSON.stringify(params),
- method: 'POST',
- })
- .then(function(localJson) {
- form.setLoading(false);
- if(localJson.success){
- //刷新查询页面
- saas.util.FormUtil.loadData(me._parent);
- saas.util.BaseUtil.showSuccessToast('保存成功');
- me.onClose();
- }
- })
- .catch(function(e) {
- form.setLoading(false);
- saas.util.BaseUtil.showErrorToast('保存失败: ' + e.message);
- });
- },
- getVendPrice:function(win){
- var me = this,
- form = me.down('form'),
- vm = me.getViewModel(),
- formparams = Ext.clone(vm.get('form'));
- if(!formparams.ma_vendcode){
- saas.util.BaseUtil.showErrorToast('请先选择供应商.');
- return false;
- }
- if(!formparams.ma_currency){
- saas.util.BaseUtil.showErrorToast('请先选择币别.');
- return false;
- }
- if(!formparams.ma_prodcode){
- saas.util.BaseUtil.showErrorToast('请先选择产品.');
- return false;
- }
- var params = {
- vendId:formparams.ma_vendid,
- currency:formparams.ma_currency,
- prodCode:formparams.ma_prodcode,
- qty:formparams.ma_qty
- };
- form.setLoading(true);
- saas.util.BaseUtil.request({
- url: form._getVendPrice,
- params: JSON.stringify(params),
- method: 'POST',
- })
- .then(function(localJson) {
- form.setLoading(false);
- if(localJson.success){
- //刷新查询页面
- if(localJson.data){
- if(localJson.data.ipdId){
- form.down('[name=ma_taxprice]').setValue(localJson.data.price);
- form.down('[name=ma_ipdid]').setValue(localJson.data.ipdId);
- saas.util.BaseUtil.showSuccessToast('取价成功');
- }else{
- form.down('[name=ma_ipdid]').setValue(-1);
- saas.util.BaseUtil.showSuccessToast('取价失败 无产品价格信息。');
- }
- }
- }
- })
- .catch(function(e) {
- form.setLoading(false);
- saas.util.BaseUtil.showErrorToast('保取价失败: ' + e.message);
- });
-
- },
- onClose:function(){
- this.close();
- }
- })
|