Ext.define('saas.view.purchase.purchaseIn.FormPanelController', { extend: 'saas.view.core.form.FormPanelController', alias: 'controller.purchase-purchasein-formpanel', init: function (form) { var me = this; this.control({ /**放大镜新增demo*/ "field[name=combo]":{ beforerender:function(f){ f.addHandler=me.addCombo; } }, //放大镜赋值关系 以及 tpl模板 'dbfindtrigger[name=pi_vendname]':{ beforerender:function(f){ Ext.apply(f,{ dbfinds:[{ from:'id',to:'pi_vendid',ignore:true },{ from:'ve_code',to:'pi_vendcode' },{ from:'ve_name',to:'pi_vendname' }], }) ; } }, //放大镜赋值关系 以及 tpl模板 'multidbfindtrigger[name=pd_prodcode]':{ beforerender:function(f){ Ext.apply(f,{ dbfinds:[{ from:'id',to:'pd_prodid',ignore:true },{ from:'pr_code',to:'pd_prodcode' },{ from:'pr_detail',to:'pr_detail' },{ from:'pr_spec',to:'pr_spec' },{ from:'pr_whid',to:'pd_whid' },{ from:'pr_whcode',to:'pd_whcode' },{ from:'pr_whname',to:'pd_whname' },{ from:'pr_purcprice',to:'pd_orderprice' }], }); } }, //放大镜赋值关系 以及 tpl模板 'dbfindtrigger[name=pd_whname]':{ beforerender:function(f){ Ext.apply(f,{ dbfinds:[{ from:'id',to:'pd_whid',ignore:true },{ from:'wh_code',to:'pd_whcode' },{ from:'wh_description',to:'pd_whname' }], }) ; } } }); }, addCombo:function(){ var combo=this.ownerCmp; Ext.create('Ext.window.Window',{ layout:'vbox', bodyPadding: 15, width:500, items:[{ fieldLabel:'实际值', xtype:'textfield' },{ fieldLabel:'显示值', xtype:'textfield' }], buttons:[{ text:'确认', handler:function(b){ combo.setValue('ok'); b.up('window').close(); } }], renderTo:this.ownerCmp.ownerCt.getEl() }).show(); }, turnOut: function() { var me = this, form = me.getView(), id = form.getForm().findField(form._idField); saas.util.BaseUtil.request({ url: form._turnOutUrl+id.value, method: 'POST', }) .then(function(localJson) { if(localJson.success){ var intValue = localJson.data.id, codeValue= localJson.data.code, name = localJson.data.name; saas.util.BaseUtil.openTab('purchase-purchaseout-formpanel',name+"("+codeValue+")",codeValue+intValue, { initId: intValue }); saas.util.BaseUtil.showSuccessToast('转单成功'); } }) .catch(function(res) { console.error(res); saas.util.BaseUtil.showErrorToast('转单失败: ' + res.message); }); } });