Jelajahi Sumber

多选下拉框bug

zhuth 7 tahun lalu
induk
melakukan
56c5eeaf5f
1 mengubah file dengan 37 tambahan dan 24 penghapusan
  1. 37 24
      frontend/saas-web/app/view/core/form/MultiCombo.js

+ 37 - 24
frontend/saas-web/app/view/core/form/MultiCombo.js

@@ -16,21 +16,24 @@ Ext.define('saas.view.core.form.MultiCombo', {
         me.callParent(arguments);
     },
     listeners:{
-        afterrender:function(f){
-            this.mon(f.el,{
-                mouseover: this.onMouseOver,
-                mouseleave:this.onMouseLeave,
-                scope:this
-            });
-        }
+        focus: function() {
+            this.showMenu();
+        },
+        // afterrender:function(f){
+        //     this.mon(f.el,{
+        //         mouseover: this.onMouseOver,
+        //         mouseleave:this.onMouseLeave,
+        //         scope:this
+        //     });
+        // }
 
     },
-    onMouseOver:function(){
-       this.showMenu();
-    },
-    onMouseLeave:function(a,b,c){
-        this.hideMenu(a.parentEvent?a:b);//el光标离开第二个参数为Event对象
-    },
+    // onMouseOver:function(){
+    //    this.showMenu();
+    // },
+    // onMouseLeave:function(a,b,c){
+    //     this.hideMenu(a.parentEvent?a:b);//el光标离开第二个参数为Event对象
+    // },
     onTriggerClick:function(){
         this.showMenu();
     },
@@ -42,10 +45,10 @@ Ext.define('saas.view.core.form.MultiCombo', {
             me.menu = Ext.create('Ext.menu.Menu',{
                 hideOnParentHide: false,
                 items: me.getMenuItems(),
-                listeners:{
-                    mouseleave:me.onMouseLeave,
-                    scope:me
-                }
+                // listeners:{
+                //     mouseleave:me.onMouseLeave,
+                //     scope:me
+                // }
             });
         }
         return me.menu;
@@ -93,17 +96,27 @@ Ext.define('saas.view.core.form.MultiCombo', {
         var me = this, rawV = '',
         datas = me.datas,
         menu = me.menu;
-        if(!Ext.isArray(items)) {
-            items = [items]
+        if(Ext.isString(items)) {
+            items = items.split(',');
         }
         items.map(function(item, index) {
             if(Ext.isString(item)) {
-                var data = datas.find(function(d) {
-                    return d[0] == item;
+                // var data = datas.find(function(d) {
+                //     return d[0] == item;
+                // });
+                var data = Ext.Array.findBy(datas, function(d) {
+                    return d[0] == item || d[1] == item;
                 });
-                items[index] = {
-                    text: data[1],
-                    value: data[0]
+                if(data) {
+                    items[index] = {
+                        text: data[1],
+                        value: data[0]
+                    }
+                }else {
+                    items[index] = {
+                        text: item,
+                        value: item
+                    }
                 }
             }
         })