Ext.define('make.view.make.bom.FormPanelController', { extend: 'saas.view.core.form.FormPanelController', alias: 'controller.make-bom-formpanel', init: function (form) { var me = this; this.control({ //从表多选放大镜赋值关系 以及 tpl模板 'dbfindtrigger[name=bo_mothercode]': { beforerender: function (f) { Ext.apply(f, { //放大镜赋值设置 dbfinds: [{ from: 'id', to: 'bo_motherid', ignore: true }, { from: 'pr_code', to: 'bo_mothercode' }, { from: 'pr_detail', to: 'bo_mothername' }, { from: 'pr_spec', to: 'pr_spec' }, { from: 'pr_brand', to: 'pr_brand' }, { from: 'pr_orispeccode', to: 'pr_orispeccode' }, { from: 'pr_unit', to: 'pr_unit' }], }); } }, 'multidbfindtrigger[name=bd_soncode]': { beforerender: function (f) { Ext.apply(f, { //放大镜赋值设置 dbfinds: [{ from: 'id', to: 'bd_sonid', ignore: true }, { from: 'pr_code', to: 'bd_soncode' }, { 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_lossrate', to: 'pr_lossrate' }], }); } }, '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' }], }); } } }); }, /** * 修改BOM明细 */ modifyBomDetail: function (button) { //需要先选中行 var me = this, form = me.getView(), grid = form.down('detailGridField'), record = grid.selModel.getLastSelected(), vm = form.getViewModel(); if (null == record || record.get('bd_id')) { saas.util.BaseUtil.showErrorToast('请先选择明细行'); } else { me.materialDialog = form.add({ xtype: 'make-bom-modifybomdetailwin', _parent: form, }); me.materialDialog.getViewModel().set('form', { id: record.get('id'), bd_detno: record.get('bd_detno'), bd_sonid: record.get('bd_sonid'), bd_soncode: record.get('bd_soncode'), bd_baseqty: record.get('bd_baseqty'), bd_location: record.get('bd_location'), bd_remark: record.get('bd_remark'), companyId: record.get('companyId'), creatorId: record.get('creatorId'), pr_detail: record.get('pr_detail'), pr_orispeccode: record.get('pr_orispeccode'), pr_brand: record.get('pr_brand'), pr_spec: record.get('pr_spec') }); me.materialDialog.getViewModel().set('bo_id', vm.get('id')); me.materialDialog.getViewModel().set('bo_mothercode', vm.get('bo_mothercode')); me.materialDialog.show(); } }, modifyBomDetail2: function (v, rowIndex, q, fn, eOpts, record, dom) { var me = this, view = this.getView(), vm = view.getViewModel(); if (vm && vm.get('bo_statuscode') == 'AUDITED') { me.materialDialog = view.add({ xtype: 'make-bom-modifybomdetailwin', _parent: view, }); me.materialDialog.getViewModel().set('form', { id: record.get('id'), bd_detno: record.get('bd_detno'), bd_sonid: record.get('bd_sonid'), bd_soncode: record.get('bd_soncode'), bd_baseqty: record.get('bd_baseqty'), bd_location: record.get('bd_location'), bd_remark: record.get('bd_remark'), companyId: record.get('companyId'), creatorId: record.get('creatorId'), pr_detail: record.get('pr_detail'), pr_orispeccode: record.get('pr_orispeccode'), pr_brand: record.get('pr_brand'), pr_spec: record.get('pr_spec') }); me.materialDialog.getViewModel().set('bo_id', vm.get('id')); me.materialDialog.getViewModel().set('bo_mothercode', vm.get('bo_mothercode')); me.materialDialog.show(); } else { return false } }, bomStruct: function () { var me = this, form = me.getView(), vm = form.getViewModel(), prodcode = vm.get('bo_mothercode'); me.bomStructDialog = form.add( Ext.create('Ext.window.Window', { modal: true, cls: 'x-window-dbfind', height: form.getHeight() * 0.8, width: form.getWidth() * 0.8, title: 'BOM多级展开', constrain: true, closable: true, resizable: false, layout: 'fit', items: [{ xtype: 'make-bomcomposite-querypanel-bomexpand', _code: prodcode, hideRadio: true }] }) ), me.bomStructDialog.show(); } });