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: [{ conditionCode: 'id', text: "客户ID", dataIndex: "id", hidden:true, xtype: "", }, { conditionCode: 'cu_code', text: "客户编号", dataIndex: "cu_code", width: 150, xtype: "", }, { conditionCode: 'cu_name', text: "客户名称", dataIndex: "cu_name", width: 200, xtype: "", }, { conditionCode: 'cu_type', text: "客户类型", dataIndex: "cu_type", width: 110, xtype: "", }, { text: "业务员编号", dataIndex: "cu_sellercode", width:110 }, { text: "业务员", dataIndex: "cu_sellername", width:110 }, { text: "税率", dataIndex: "cu_taxrate", xtype: 'numbercolumn', width:80, renderer: function (v) { return Ext.util.Format.number(v, '0'); } },{ text: "应收款余额", dataIndex: "cu_leftamount", width:110, xtype: 'numbercolumn', renderer : function(v) { if(!v) { return 0; } var arr = (v + '.').split('.'); var xr = (new Array(arr[1].length > 3 ? 3 : arr[1].length)).fill('0'); var format = '0.' + xr.join(); return Ext.util.Format.number(v, format); } }, { text: "结算天数", dataIndex: "cu_promisedays", width:110, xtype: 'numbercolumn', renderer: function (v) { return Ext.util.Format.number(v, '0'); } }, { text: "额度", dataIndex: "cu_credit", width:110, xtype: 'numbercolumn', }, { text: "客户地址", dataIndex: "ca_address", width: 250 }], dbfinds: [{ from: 'id', to: 'os_vendid', ignore:true }, { from: 've_code', to: 'os_vendcode' }, { from: 've_name', to: 'os_vendname' }], }); } }, //放大镜赋值关系 以及 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 }], }); } } }); }, 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; } });