|
|
@@ -34,7 +34,6 @@ Ext.define('saas.view.core.dbfind.MultiDbfindTrigger', {
|
|
|
var sfield='';
|
|
|
var dbfinds=me.dbfinds;
|
|
|
var dbtpls=me.dbtpls;
|
|
|
- var dbCondition = me.dbCondition.replace(new RegExp("\\{0}","g"), queryString);
|
|
|
me.lastQueryValue=queryString;
|
|
|
if(queryString.trim()==''){
|
|
|
me.collapse( );
|
|
|
@@ -50,7 +49,7 @@ Ext.define('saas.view.core.dbfind.MultiDbfindTrigger', {
|
|
|
if(i==0){
|
|
|
span=span+'<span style="width:'+dbtpls[i].width+'px;overflow: hidden;white-space: nowrap;text-overflow: ellipsis;float:left;">{'+dbtpls[i].field+'}</span>';//display:block;
|
|
|
}else{
|
|
|
- span=span+'<span style="width:'+dbtpls[i].width+'px;overflow: hidden;white-space: nowrap;text-overflow: ellipsis;float:left;">{'+dbtpls[i].field+'}</span>';
|
|
|
+ span=span+'<span style="padding:0 0 0 20px;width:'+dbtpls[i].width+'px;overflow: hidden;white-space: nowrap;text-overflow: ellipsis;float:left;">{'+dbtpls[i].field+'}</span>';
|
|
|
}
|
|
|
if(dbtpls[i].dbField=="true"){
|
|
|
me.searchFieldArray=dbtpls[i].field;
|
|
|
@@ -75,12 +74,41 @@ Ext.define('saas.view.core.dbfind.MultiDbfindTrigger', {
|
|
|
}
|
|
|
}
|
|
|
//加载数据
|
|
|
- var data;
|
|
|
+ var data,dbCondition=[];
|
|
|
+ if(me.dbfinds){
|
|
|
+ var dbtplcondition = "";
|
|
|
+ for (let index = 0; index < dbfinds.length; index++) {
|
|
|
+ var item = dbfinds[index].from;
|
|
|
+ if(!dbfinds[index].ignore){
|
|
|
+ dbtplcondition+= "upper("+item+") like '%"+queryString.toUpperCase()+"%' or ";
|
|
|
+ }
|
|
|
+ }
|
|
|
+ dbtplcondition = "(" + dbtplcondition.substring(0,dbtplcondition.length-4) + ")";
|
|
|
+ if(dbtplcondition.length>0){
|
|
|
+ dbCondition = [{
|
|
|
+ type: 'condition',
|
|
|
+ value:dbtplcondition
|
|
|
+ }];
|
|
|
+ }
|
|
|
+ }
|
|
|
+ //添加默认条件
|
|
|
+ if(me.defaultCondition) {
|
|
|
+ dbCondition.push({
|
|
|
+ type: 'condition',
|
|
|
+ value: me.defaultCondition
|
|
|
+ });
|
|
|
+ }
|
|
|
Ext.Ajax.request({
|
|
|
url: me.dataUrl,
|
|
|
params: {
|
|
|
- keyword:dbCondition
|
|
|
+ number: 1,
|
|
|
+ size: 10,
|
|
|
+ condition:JSON.stringify(dbCondition),
|
|
|
+ page: 1,
|
|
|
+ start: 0,
|
|
|
+ limit: 10
|
|
|
},
|
|
|
+ method: 'GET',
|
|
|
success: function(response, opts) {
|
|
|
data = Ext.decode(response.responseText);
|
|
|
data = data.data.list;
|
|
|
@@ -88,7 +116,8 @@ Ext.define('saas.view.core.dbfind.MultiDbfindTrigger', {
|
|
|
me.store.loadData(data,false);
|
|
|
me.expand();
|
|
|
}else{
|
|
|
- me.collapse( );
|
|
|
+ me.store.removeAll();
|
|
|
+ me.collapse();
|
|
|
}
|
|
|
},
|
|
|
failure: function(response, opts) {}
|
|
|
@@ -138,6 +167,70 @@ Ext.define('saas.view.core.dbfind.MultiDbfindTrigger', {
|
|
|
},
|
|
|
|
|
|
listeners: {
|
|
|
+ blur:function(f,e){
|
|
|
+ var me = f;
|
|
|
+ var count = f.store.getCount();
|
|
|
+ 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(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(me.name==item.to){
|
|
|
+ me.column.getEditor().setValue('');
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }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){
|
|
|
+ if(field.xtype=='dbfindtrigger'){
|
|
|
+ field.setValue(null);
|
|
|
+ field.lastTriggerValue=null;
|
|
|
+ }else{
|
|
|
+ field.setValue(null);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
select:function(combo,record,eOpts){
|
|
|
var me = combo;
|
|
|
var dbfinds = me.dbfinds;
|