| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172 |
- Ext.QuickTips.init();
- Ext.define('erp.controller.scm.sale.CustomerProduct', {
- extend: 'Ext.app.Controller',
- FormUtil: Ext.create('erp.util.FormUtil'),
- GridUtil: Ext.create('erp.util.GridUtil'),
- BaseUtil: Ext.create('erp.util.BaseUtil'),
- views:[
- 'scm.sale.CustomerProduct','core.form.Panel','core.grid.Panel2','core.toolbar.Toolbar',
- 'core.button.Save','core.button.Add','core.button.Upload',
- 'core.button.Close','core.button.Update','core.button.DeleteDetail',
- 'core.trigger.DbfindTrigger','core.trigger.TextAreaTrigger','core.form.YnField'
- ],
- init:function(){
- var me = this;
- this.control({
- 'erpGridPanel2': {
- itemclick: this.onGridItemClick
- },
- 'erpSaveButton': {
- click: function(btn){
- this.FormUtil.onUpdate(this);
- }
- },
- 'erpUpdateButton': {
- click: function(btn){
- this.FormUtil.onUpdate(this);
- }
- },
- 'erpAddButton': {
- click: function(){
- me.FormUtil.onAdd('addCustomerProduct', '新增客户物料', 'jsps/scm/sale/customerProduct.jsp');
- }
- },
- 'erpCloseButton': {
- click: function(btn){
- me.FormUtil.beforeClose(me);
- }
- },
- 'textfield[name=cu_code]':{
- change: function(field){
- if(field.value != null && field.value != ''){
- var grid = Ext.getCmp('grid');
- var id = Ext.getCmp('cu_id').value;
- var insert = true;//是否需要加入到grid
- var num = 0;//grid的有效数据有多少行
- Ext.each(grid.getStore().data.items, function(){
- if(this.data['pc_custid'] != null && this.data['pc_custid'] != '0'){
- num++;
- if(this.data['pc_custid'] == id){
- insert = false;
- }
- }
- });
- if(num == grid.getStore().data.items.length){
- me.GridUtil.add10EmptyItems(grid);
- }
- if(insert){
- grid.getStore().data.items[num].set('pc_custid', id);
- }
- }
- }
- }
-
- });
- },
- onGridItemClick: function(selModel, record){//grid行选择
- this.GridUtil.onGridItemClick(selModel, record);
- },
- getForm: function(btn){
- return btn.ownerCt.ownerCt;
- }
- });
|