Browse Source

代码提交

hy 7 years ago
parent
commit
bb26061397

+ 36 - 15
frontend/saas-web/app/view/sale/sale/FormPanel.js

@@ -47,24 +47,45 @@ Ext.define('saas.view.sale.sale.FormPanel', {
                 allowBlank : false
                 allowBlank : false
             }, {
             }, {
                 name : "sa_toplace", 
                 name : "sa_toplace", 
-                xtype : "textfield", 
+                xtype : "remotecombo", 
                 fieldLabel : "交货地址", 
                 fieldLabel : "交货地址", 
+                editable:false,
                 allowBlank : false, 
                 allowBlank : false, 
                 columnWidth : 0.5,
                 columnWidth : 0.5,
-                hiddenBtn:false,//true 则会关闭新增按钮功能
-                addHandler:function(b){
-                    var form = this.ownerCmp.ownerCt;
-                    this.dialog = form.add({
-                        xtype: 'document-address-window',
-                        bind: {
-                            title: '新增交货地址'
-                        },
-                        _parent:form,
-                        _combo:this.ownerCmp,
-                        record:null,
-                        session: true
-                    });
-                    this.dialog.show();
+                storeUrl:'/api/document/customer/getAddressCombo',
+                hiddenBtn:true,//true 则会关闭新增按钮功能
+                setValue:function(value){
+                    var me = this,bind, valueBind;
+                    if(value&&value!=''){
+                        me.setDisabled(false);
+                    }else{
+                        me.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;
                 }
                 }
             }, {
             }, {
                 name : "detailGridField", 
                 name : "detailGridField", 

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

@@ -69,6 +69,26 @@ Ext.define('saas.view.sale.sale.FormPanelController', {
                     });
                     });
 
 
                 }
                 }
+            },
+            'remotecombo[name=sa_toplace]':{
+                focus:function(f){
+                    //获取客户ID
+                    var sa_custid = f.ownerCt.down('[name=sa_custid]').value;
+                    if(sa_custid&&sa_custid!=""){
+                        Ext.apply(f.store.proxy.extraParams, {
+                            id:sa_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())
+                    }
+                }
             }
             }
         });
         });