Ext.define('make.view.make.makePick.FormPanelController', { extend: 'saas.view.core.form.FormPanelController', alias: 'controller.make-makepick-formpanel', init: function (form) { var me = this; this.control({ 'departDbfindTrigger[name=pi_departmentname]':{ beforerender: function (f) { Ext.apply(f, { dbfinds: [{ from: 'dp_name', to: 'pi_departmentname' },{ from: 'dp_code', to: 'pi_departmentcode' }] }); } }, //从表多选放大镜赋值关系 以及 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_brand', to: 'pr_brand' },{ from: 'pr_orispeccode', to: 'pr_orispeccode' },{ from: 'pr_unit', to: 'pr_unit' }, { from:'pr_purcprice',to:'pd_lastprice' },{ from:'pr_zxbzs',to:'pr_zxbzs' }], }); } }, 'multidbfindtrigger[name=pr_detail]': { 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_brand', to: 'pr_brand' },{ from: 'pr_orispeccode', to: 'pr_orispeccode' },{ from: 'pr_unit', to: 'pr_unit' }, { from:'pr_purcprice',to:'pd_lastprice' },{ from:'pr_zxbzs',to:'pr_zxbzs' }], }); } }, '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' }] }) ; }, beforequery: function(f) { var me = this, viewModel = me.getViewModel(); var s= f.ownerCt.ownerCmp.getSelectionModel(), id = s.lastSelected.id, record = s.store.getById(id), pd_prodid = record.get("pd_prodid"); if(pd_prodid) { Ext.apply(f, { efaultCondition:"wh_statuscode='ENABLE' and (pw_prodid ="+pd_prodid+" OR IFNULL(pw_prodid,-1) = -1)", queryListMode:'OUT', dbColumns: [{ text: "仓库ID", flex: 0, dataIndex: "id", hidden:true }, { text: "仓库编号", dataIndex: "wh_code", width: 150 }, { text: "仓库名称", dataIndex: "wh_description", width: 200 }, { text: "仓库类型", dataIndex: "wh_type", width: 110 }, { text: "库存", dataIndex: "pw_onhand", width: 100, xtype: 'numbercolumn', renderer : function(v, m, r) { return saas.util.BaseUtil.numberFormat(v, 6, true); } }, { dataIndex: '', flex: 1 }] }); }else{ Ext.apply(f, { efaultCondition:"wh_statuscode='ENABLE'", queryListMode:'', dbColumns: [{ text: "仓库ID", flex: 0, dataIndex: "id", hidden:true }, { text: "仓库编号", dataIndex: "wh_code", width: 150 }, { text: "仓库名称", dataIndex: "wh_description", width: 200 }, { text: "仓库类型", dataIndex: "wh_type", width: 110 }, { dataIndex: '', flex: 1 }] }); } }, beforetriggerclick: function(f) { var me = this, viewModel = me.getViewModel(); var s= f.ownerCt.ownerCmp.getSelectionModel(), id = s.lastSelected.id, record = s.store.getById(id), pd_prodid = record.get("pd_prodid"); if(pd_prodid) { Ext.apply(f, { defaultCondition:"wh_statuscode='ENABLE' and (pw_prodid ="+pd_prodid+" OR IFNULL(pw_prodid,-1) = -1)", queryListMode:'OUT', dbColumns: [{ text: "仓库ID", flex: 0, dataIndex: "id", hidden:true }, { text: "仓库编号", dataIndex: "wh_code", width: 150 }, { text: "仓库名称", dataIndex: "wh_description", width: 200 }, { text: "仓库类型", dataIndex: "wh_type", width: 110 }, { text: "库存", dataIndex: "pw_onhand", width: 100, xtype: 'numbercolumn', renderer : function(v, m, r) { return saas.util.BaseUtil.numberFormat(v, 6, true); } }, { dataIndex: '', flex: 1 }] }); }else{ Ext.apply(f, { defaultCondition:"wh_statuscode='ENABLE'", queryListMode:'', dbColumns: [{ text: "仓库ID", flex: 0, dataIndex: "id", hidden:true }, { text: "仓库编号", dataIndex: "wh_code", width: 150 }, { text: "仓库名称", dataIndex: "wh_description", width: 200 }, { text: "仓库类型", dataIndex: "wh_type", width: 110 }, { dataIndex: '', flex: 1 }] }); } } } }); }, });