Browse Source

代码提交

hy 7 years ago
parent
commit
cf5554b50b

+ 49 - 34
frontend/saas-web/app/view/core/dbfind/DbfindTrigger.js

@@ -104,7 +104,7 @@ Ext.define('saas.view.core.dbfind.DbfindTrigger', {
                     method: 'GET',
                     success: function(response, opts) {
                         data = Ext.decode(response.responseText);
-                        data = data.data.list;
+                        data = data.data?data.data.list:[];
                         if(data!=null && data.length>0 && me.store && field.length>0){
                             me.store.loadData(data,false);
                             me.expand();
@@ -122,6 +122,7 @@ Ext.define('saas.view.core.dbfind.DbfindTrigger', {
     	}
     },
     onTriggerClick:function(f){
+        f.blur(f);
         //判断dbfindtrigger归属
         f.judge(f);//form
         var panel = f.up('core-tab-panel'),panelEl;
@@ -176,46 +177,60 @@ Ext.define('saas.view.core.dbfind.DbfindTrigger', {
         blur:function(f,e){
             var me = f;
             var count = f.store.getCount();
+            var searchCount = false;//校验数据库是否有该字段
             var dbfinds = me.dbfinds;
-            // if(count==1){
-            //     record = f.store.data.items[0];
-            //     if(dbfinds&&dbfinds.length>0){
-            //         if(me.belong=='grid'){
-            //             for (let index = 0; index < dbfinds.length; index++) {
-            //                 var item = dbfinds[index];
-            //                 var rec = me.column.ownerCt.ownerCt.selModel.getLastSelected();
-            //                 var nowRec = me.column.ownerCt.ownerCt.store.getData().getByKey(rec.id);
-            //                 nowRec.set(item.to,record.get(item.from));
-            //                 if(me.name==item.to){
-            //                     me.column.getEditor().setValue(record.get(item.from));
-            //                 }
-            //             }
-            //         }else if(me.belong=='form'){
-            //             for (let index = 0; index < dbfinds.length; index++) {
-            //                 var item = dbfinds[index];
-            //                 var field = me.ownerCt.down('[name='+item.to+']');
-            //                 if(field){
-            //                     var val = record.get(item.from);
-            //                     if(field.xtype=='dbfindtrigger'){
-            //                         field.setRawValue(val);
-            //                         field.value = val;
-            //                         field.lastTriggerValue=val;
-            //                     }else{
-            //                         field.setValue(val);
-            //                     }    
-            //                 }
-            //             }
-            //         }
-            //     }
-            // }else 
-            if(!f.value||f.value==''){
+            if(count>0){
+                //添加默认条件
+                var searchField = null;
+                var dbCondition = [];
+                if(me.defaultCondition) {
+                    dbCondition.push({
+                        type: 'condition',
+                        value: me.defaultCondition
+                    });
+                }
+                for (let index = 0; index < dbfinds.length; index++) {
+                    var item = dbfinds[index].to;
+                    if(item==me.name){
+                        searchField = dbfinds[index].from;
+                    }
+                }
+                dbCondition.push({
+                    type: 'condition',
+                    value: searchField + "='"+me.value+"'"
+                });
+                Ext.Ajax.request({
+                    url: me.dataUrl,
+                    async:false,
+                    params: {
+                        number: 1,
+                        size: 1,
+                        condition:JSON.stringify(dbCondition),
+                        page: 1,
+                        start: 0,
+                        limit: 10
+                    },
+                    method: 'GET',
+                    success: function(response, opts) {
+                        data = Ext.decode(response.responseText);
+                        data = data.data?data.data.list:[];
+                        if(data.length>0){
+                            searchCount = true
+                        }
+                    },
+                    failure: function(response, opts) {}
+                }); 
+            }
+            if(!f.value||f.value==''||count==0||!searchCount){
                 if(dbfinds&&dbfinds.length>0){
                     if(me.belong=='grid'){
                         for (let index = 0; index < dbfinds.length; index++) {
                             var item = dbfinds[index];
                             var rec = me.column.ownerCt.ownerCt.selModel.getLastSelected();
                             var nowRec = me.column.ownerCt.ownerCt.store.getData().getByKey(rec.id);
-                            nowRec.set(item.to,'');
+                            if(nowRec.get(item.to)&&nowRec.get(item.to)!=""){
+                                nowRec.set(item.to,'');
+                            }
                             if(me.name==item.to){
                                 me.column.getEditor().setValue('');
                             }

+ 49 - 34
frontend/saas-web/app/view/core/dbfind/MultiDbfindTrigger.js

@@ -111,7 +111,7 @@ Ext.define('saas.view.core.dbfind.MultiDbfindTrigger', {
                     method: 'GET',
                     success: function(response, opts) {
                         data = Ext.decode(response.responseText);
-                        data = data.data.list;
+                        data = data.data?data.data.list:[];
                         if(data!=null && data.length>0 && me.store && field.length>0){
                             me.store.loadData(data,false);
                             me.expand();
@@ -129,6 +129,7 @@ Ext.define('saas.view.core.dbfind.MultiDbfindTrigger', {
     	}
     },
     onTriggerClick:function(f){
+        f.blur(f);
         //判断dbfindtrigger归属
         f.judge(f);
         var panel = f.up('core-tab-panel'),panelEl;
@@ -170,46 +171,60 @@ Ext.define('saas.view.core.dbfind.MultiDbfindTrigger', {
         blur:function(f,e){
             var me = f;
             var count = f.store.getCount();
+            var searchCount = false;//校验数据库是否有该字段
             var dbfinds = me.dbfinds;
-            // if(count==1){
-            //     record = f.store.data.items[0];
-            //     if(dbfinds&&dbfinds.length>0){
-            //         if(me.belong=='grid'){
-            //             for (let index = 0; index < dbfinds.length; index++) {
-            //                 var item = dbfinds[index];
-            //                 var rec = me.column.ownerCt.ownerCt.selModel.getLastSelected();
-            //                 var nowRec = me.column.ownerCt.ownerCt.store.getData().getByKey(rec.id);
-            //                 nowRec.set(item.to,record.get(item.from));
-            //                 if(me.name==item.to){
-            //                     me.column.getEditor().setValue(record.get(item.from));
-            //                 }
-            //             }
-            //         }else if(me.belong=='form'){
-            //             for (let index = 0; index < dbfinds.length; index++) {
-            //                 var item = dbfinds[index];
-            //                 var field = me.ownerCt.down('[name='+item.to+']');
-            //                 if(field){
-            //                     var val = record.get(item.from);
-            //                     if(field.xtype=='dbfindtrigger'){
-            //                         field.setRawValue(val);
-            //                         field.value = val;
-            //                         field.lastTriggerValue=val;
-            //                     }else{
-            //                         field.setValue(val);
-            //                     }    
-            //                 }
-            //             }
-            //         }
-            //     }
-            // }else 
-            if(!f.value||f.value==''){
+            if(count>0){
+                //添加默认条件
+                var searchField = null;
+                var dbCondition = [];
+                if(me.defaultCondition) {
+                    dbCondition.push({
+                        type: 'condition',
+                        value: me.defaultCondition
+                    });
+                }
+                for (let index = 0; index < dbfinds.length; index++) {
+                    var item = dbfinds[index].to;
+                    if(item==me.name){
+                        searchField = dbfinds[index].from;
+                    }
+                }
+                dbCondition.push({
+                    type: 'condition',
+                    value: searchField + "='"+me.value+"'"
+                });
+                Ext.Ajax.request({
+                    url: me.dataUrl,
+                    async:false,
+                    params: {
+                        number: 1,
+                        size: 1,
+                        condition:JSON.stringify(dbCondition),
+                        page: 1,
+                        start: 0,
+                        limit: 10
+                    },
+                    method: 'GET',
+                    success: function(response, opts) {
+                        data = Ext.decode(response.responseText);
+                        data = data.data?data.data.list:[];
+                        if(data.length>0){
+                            searchCount = true
+                        }
+                    },
+                    failure: function(response, opts) {}
+                }); 
+            }
+            if(!f.value||f.value==''||count==0||!searchCount){
                 if(dbfinds&&dbfinds.length>0){
                     if(me.belong=='grid'){
                         for (let index = 0; index < dbfinds.length; index++) {
                             var item = dbfinds[index];
                             var rec = me.column.ownerCt.ownerCt.selModel.getLastSelected();
                             var nowRec = me.column.ownerCt.ownerCt.store.getData().getByKey(rec.id);
-                            nowRec.set(item.to,'');
+                            if(nowRec.get(item.to)&&nowRec.get(item.to)!=""){
+                                nowRec.set(item.to,'');
+                            }
                             if(me.name==item.to){
                                 me.column.getEditor().setValue('');
                             }

+ 1 - 0
frontend/saas-web/app/view/document/kind/ChildForm.js

@@ -255,6 +255,7 @@ Ext.define('KitchenSink.view.binding.ChildForm', {
                 hideTrigger : true, 
                 fieldLabel: '流水长度',
                 name: 'mn_number',
+                minValue : 0, 
                 allowBlank:false
             }]
         }

+ 1 - 1
frontend/saas-web/app/view/document/product/FormController.js

@@ -12,7 +12,7 @@ Ext.define('saas.view.document.product.FormController', {
                         dataUrl:'/api/document/vendor/getVendorsByCondition',
                         //赋值 
                         dbfinds:[{
-                            from:'id',to:'pr_vendid'
+                            from:'id',to:'pr_vendid',ignore:true
                         },{
                             from:'ve_code',to:'pr_vendcode'
                         },{

+ 1 - 1
frontend/saas-web/app/view/sys/messagelog/DataList.js

@@ -78,7 +78,7 @@ Ext.define('saas.view.sys.messagelog.DataList', {
         width : 120.0, 
     }, 
     {
-        text : "处理人", 
+        text : "操作人员", 
         dataIndex : "ml_man", 
         width : 200, 
     }],