Ext.define('saas.view.money.othspendings.FormPanelController', { extend: 'saas.view.core.form.FormPanelController', alias: 'controller.money-othspendings-formpanel', init: function (form) { var me = this; this.control({ //放大镜赋值关系 以及 tpl模板 'vendorDbfindTrigger[name=os_vendname]': { beforerender: function (f) { Ext.apply(f, { dbColumns:[{ text: "供应商ID", hidden: true, dataIndex: "id", xtype: "numbercolumn" },{ text: "供应商编号", dataIndex: "ve_code", width: 150 }, { text: "供应商名称", dataIndex: "ve_name", width: 200 }, { text: "供应商类型", dataIndex: "ve_type", width: 110, }, { text: "税率(%)", dataIndex: "ve_taxrate", width: 80, xtype: 'numbercolumn', align:'end', renderer : function(v, m, r) { return saas.util.BaseUtil.numberFormat(v, 2, false); } }, { text: "应付款余额", dataIndex: "ve_leftamount", width:110, xtype: 'numbercolumn', renderer : function(v, m, r) { return saas.util.BaseUtil.numberFormat(v, 2, true); } },{ text: "结算天数", dataIndex: "ve_promisedays", width: 110, xtype: 'numbercolumn', align: 'end', renderer : function(v, m, r) { return Ext.util.Format.number(v, '0'); } }, { text: "纳税人识别号", dataIndex: "ve_nsrzh", width: 150 }, { text: "开户银行", dataIndex: "ve_bankcode", width: 150 }, { text: "银行账户", dataIndex: "ve_bankaccount", width: 200 }], dbfinds: [{ from: 'id', to: 'os_vendid', ignore:true }, { from: 've_code', to: 'os_vendcode' }, { from: 've_name', to: 'os_vendname' }, { from: 've_currency', to: 'os_currency' }, { from: 'cr_rate', to: 'os_rate' }], }); } }, //放大镜赋值关系 以及 tpl模板 'bandinfoDbfindTrigger[name=os_bankname]': { beforerender: function (f) { Ext.apply(f, { dbfinds: [{ from: 'bk_bankcode', to: 'os_bankcode' }, { from: 'bk_bankname', to: 'os_bankname' }, { from: 'id', to: 'os_bankid',ignore:true }, { from: 'bk_currency', to: 'os_currency' }, { from: 'cr_rate', to: 'os_rate' }], }); } }, // 'currencyDbfindTrigger[name=os_currency]':{ // beforerender:function(f){ // Ext.apply(f,{ // dbfinds:[{ // from:'cr_name',to:'os_currency' // },{ // from:'cr_rate',to:'os_rate' // }], // }) ; // } // } }); }, onSave: function() { var me = this, form = me.getView(), viewModel = me.getViewModel(), store1 = viewModel.get('detail0').detailStore; var valid = form.isValid(); if(!valid) { saas.util.BaseUtil.showErrorToast(form.invalidText); return false; } var sum_nowbalance = store1.sum('osd_nowbalance'); // 金额合计 viewModel.set('os_amount',sum_nowbalance); me.save(); }, myInitCopyData: function(formData) { var main = formData.main; main.os_auditman = ''; main.os_auditdate = null; return formData; } });