Browse Source

客户交货地址修改

hy 7 years ago
parent
commit
9ea1cb668a

+ 44 - 5
frontend/saas-web/app/view/sale/saleIn/FormPanel.js

@@ -50,6 +50,50 @@ Ext.define('saas.view.sale.saleIn.FormPanel', {
         name : "pi_custname", 
         fieldLabel : "客户名称",
         allowBlank:false,
+        setValue:function(value){
+            var me = this,bind, valueBind;
+            var form = me.ownerCt;
+            var c = form.down('[name=pi_address]');
+            if(value&&value!=''){
+                c.setDisabled(false);
+            }else{
+                c.setDisabled(true);
+            }
+            if (me.hasFocus) {
+                bind = me.getBind();
+                valueBind = bind && bind.value;
+                if (valueBind && valueBind.syncing) {
+                    if ((Ext.isEmpty(value) && Ext.isEmpty(me.value)) || value === me.value) {
+                        return me;
+                    } else if (Ext.isArray(value) && Ext.isArray(me.value) && Ext.Array.equals(value, me.value)) {
+                        return me;
+                    }
+                }
+            } else {
+                me.lastSelectedRecords = null;
+            }
+    
+            if (value != null) {
+                me.doSetValue(value);
+            }
+            else {
+                me.suspendEvent('select');
+                me.valueCollection.beginUpdate();
+                me.pickerSelectionModel.deselectAll();
+                me.valueCollection.endUpdate();
+                me.resumeEvent('select');
+            }
+            return me;
+        }
+    }, {
+        columnWidth : 0.5,
+        name : "pi_address", 
+        xtype : "remotecombo", 
+        fieldLabel : "交货地址", 
+        editable:false,
+        allowBlank : false, 
+        storeUrl:'/api/document/customer/getAddressCombo',
+        hiddenBtn:true,//true 则会关闭新增按钮功能
     }, {
         xtype : "datefield", 
         name : "pi_date", 
@@ -57,11 +101,6 @@ Ext.define('saas.view.sale.saleIn.FormPanel', {
         allowBlank : false, 
         columnWidth : 0.25,
         defaultValue: new Date()
-    }, {
-        xtype : "textfield", 
-        name : "pi_address", 
-        fieldLabel : "交货地址", 
-        columnWidth : 0.5
     }, {
         name : "detailGridField", 
         xtype : "detailGridField", 

+ 20 - 0
frontend/saas-web/app/view/sale/saleIn/FormPanelController.js

@@ -67,6 +67,26 @@ Ext.define('saas.view.sale.saleIn.FormPanelController', {
                     });
 
                 }
+            },
+            'remotecombo[name=pi_address]':{
+                focus:function(f){
+                    //获取客户ID
+                    var pi_custid = f.ownerCt.down('[name=pi_custid]').value;
+                    if(pi_custid&&pi_custid!=""){
+                        Ext.apply(f.store.proxy.extraParams, {
+                            id:pi_custid
+                        });
+                        f.store.load();
+                    }else{
+                        saas.util.BaseUtil.showErrorToast('请先选择客户后在维护交货地址');
+                        f.setDisabled(true);
+                    }
+                },
+                expand:function(f){
+                    if(f.picker&&f.isExpanded){
+                        f.picker.setHeight(33*f.store.getCount())
+                    }
+                }
             }
         });
     }

+ 44 - 5
frontend/saas-web/app/view/sale/saleOut/FormPanel.js

@@ -59,6 +59,50 @@ Ext.define('saas.view.sale.saleout.FormPanel', {
         name : "pi_custname", 
         fieldLabel : "客户名称",
         allowBlank:false,
+        setValue:function(value){
+            var me = this,bind, valueBind;
+            var form = me.ownerCt;
+            var c = form.down('[name=pi_address]');
+            if(value&&value!=''){
+                c.setDisabled(false);
+            }else{
+                c.setDisabled(true);
+            }
+            if (me.hasFocus) {
+                bind = me.getBind();
+                valueBind = bind && bind.value;
+                if (valueBind && valueBind.syncing) {
+                    if ((Ext.isEmpty(value) && Ext.isEmpty(me.value)) || value === me.value) {
+                        return me;
+                    } else if (Ext.isArray(value) && Ext.isArray(me.value) && Ext.Array.equals(value, me.value)) {
+                        return me;
+                    }
+                }
+            } else {
+                me.lastSelectedRecords = null;
+            }
+    
+            if (value != null) {
+                me.doSetValue(value);
+            }
+            else {
+                me.suspendEvent('select');
+                me.valueCollection.beginUpdate();
+                me.pickerSelectionModel.deselectAll();
+                me.valueCollection.endUpdate();
+                me.resumeEvent('select');
+            }
+            return me;
+        }
+    }, {
+        columnWidth : 0.5,
+        name : "pi_address", 
+        xtype : "remotecombo", 
+        fieldLabel : "交货地址", 
+        editable:false,
+        allowBlank : false, 
+        storeUrl:'/api/document/customer/getAddressCombo',
+        hiddenBtn:true,//true 则会关闭新增按钮功能
     }, {
         xtype : "datefield", 
         name : "pi_date", 
@@ -66,11 +110,6 @@ Ext.define('saas.view.sale.saleout.FormPanel', {
         allowBlank : false, 
         columnWidth : 0.25,
         defaultValue: new Date()
-    }, {
-        xtype : "textfield", 
-        name : "pi_address", 
-        fieldLabel : "交货地址", 
-        columnWidth : 0.5
     }, {
         name : "detailGridField", 
         xtype : "detailGridField", 

+ 20 - 0
frontend/saas-web/app/view/sale/saleOut/FormPanelController.js

@@ -59,6 +59,26 @@ Ext.define('saas.view.sale.saleout.FormPanelController', {
                     }) ;   
 
                 }
+            },
+            'remotecombo[name=pi_address]':{
+                focus:function(f){
+                    //获取客户ID
+                    var pi_custid = f.ownerCt.down('[name=pi_custid]').value;
+                    if(pi_custid&&pi_custid!=""){
+                        Ext.apply(f.store.proxy.extraParams, {
+                            id:pi_custid
+                        });
+                        f.store.load();
+                    }else{
+                        saas.util.BaseUtil.showErrorToast('请先选择客户后在维护交货地址');
+                        f.setDisabled(true);
+                    }
+                },
+                expand:function(f){
+                    if(f.picker&&f.isExpanded){
+                        f.picker.setHeight(33*f.store.getCount())
+                    }
+                }
             }
         });
     },