|
@@ -31,105 +31,101 @@ Ext.define('saas.view.core.dbfind.MultiDbfindTrigger', {
|
|
|
};
|
|
};
|
|
|
queryString = queryString || '';
|
|
queryString = queryString || '';
|
|
|
var me = this;
|
|
var me = this;
|
|
|
- if(me.lastQueryValue!=queryString){
|
|
|
|
|
- me.judge(me);
|
|
|
|
|
- var field=[];
|
|
|
|
|
- var sfield='';
|
|
|
|
|
- var dbfinds=me.dbfinds;
|
|
|
|
|
- var dbtpls=me.dbtpls;
|
|
|
|
|
- me.lastQueryValue=queryString;
|
|
|
|
|
- if(queryString.trim()==''){
|
|
|
|
|
|
|
+ me.judge(me);
|
|
|
|
|
+ var field=[];
|
|
|
|
|
+ var sfield='';
|
|
|
|
|
+ var dbfinds=me.dbfinds;
|
|
|
|
|
+ var dbtpls=me.dbtpls;
|
|
|
|
|
+ me.lastQueryValue=queryString;
|
|
|
|
|
+ if(queryString.trim()==''){
|
|
|
|
|
+ me.collapse( );
|
|
|
|
|
+ }else{
|
|
|
|
|
+ if(!dbfinds||!dbtpls){
|
|
|
me.collapse( );
|
|
me.collapse( );
|
|
|
- }else{
|
|
|
|
|
- if(!dbfinds||!dbtpls){
|
|
|
|
|
- me.collapse( );
|
|
|
|
|
- }else{
|
|
|
|
|
- //加载tpl模板
|
|
|
|
|
- if(dbtpls.length>0){
|
|
|
|
|
- var span="";
|
|
|
|
|
- var width=0;
|
|
|
|
|
- for(var i=0;i<dbtpls.length;i++){
|
|
|
|
|
- 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="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;
|
|
|
|
|
- }
|
|
|
|
|
- width=width+dbtpls[i].width+20;
|
|
|
|
|
- field.push(dbtpls[i].field);
|
|
|
|
|
- sfield=sfield+dbtpls[i].field+',';
|
|
|
|
|
|
|
+ }else{
|
|
|
|
|
+ //加载tpl模板
|
|
|
|
|
+ if(dbtpls.length>0){
|
|
|
|
|
+ var span="";
|
|
|
|
|
+ var width=0;
|
|
|
|
|
+ for(var i=0;i<dbtpls.length;i++){
|
|
|
|
|
+ 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="padding:0 0 0 20px;width:'+dbtpls[i].width+'px;overflow: hidden;white-space: nowrap;text-overflow: ellipsis;float:left;">{'+dbtpls[i].field+'}</span>';
|
|
|
}
|
|
}
|
|
|
- me.defaultListConfig.minWidth=width+10;
|
|
|
|
|
- me.defaultListConfig.maxHeight=210;
|
|
|
|
|
- me.defaultListConfig.autoScroll=true;
|
|
|
|
|
- me.searchField=sfield.substring(0,sfield.length-1);
|
|
|
|
|
- me.tpl=Ext.create('Ext.XTemplate',
|
|
|
|
|
- '<ul style="padding-left: 0px;"><tpl for=".">',
|
|
|
|
|
- '<li role="option" class="x-boundlist-item" style="list-style:none;">' ,
|
|
|
|
|
- '<div style="height:30px;">',
|
|
|
|
|
- ''+span+'',
|
|
|
|
|
- '</li>',
|
|
|
|
|
- '</tpl></ul>'
|
|
|
|
|
- );
|
|
|
|
|
- me.store.setFields(field);
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
- //加载数据
|
|
|
|
|
- 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 ";
|
|
|
|
|
|
|
+ if(dbtpls[i].dbField=="true"){
|
|
|
|
|
+ me.searchFieldArray=dbtpls[i].field;
|
|
|
}
|
|
}
|
|
|
|
|
+ width=width+dbtpls[i].width+20;
|
|
|
|
|
+ field.push(dbtpls[i].field);
|
|
|
|
|
+ sfield=sfield+dbtpls[i].field+',';
|
|
|
}
|
|
}
|
|
|
- dbtplcondition = "(" + dbtplcondition.substring(0,dbtplcondition.length-4) + ")";
|
|
|
|
|
- if(dbtplcondition.length>0){
|
|
|
|
|
- dbCondition = [{
|
|
|
|
|
- type: 'condition',
|
|
|
|
|
- value:dbtplcondition
|
|
|
|
|
- }];
|
|
|
|
|
|
|
+ me.defaultListConfig.minWidth=width+10;
|
|
|
|
|
+ me.defaultListConfig.maxHeight=210;
|
|
|
|
|
+ me.defaultListConfig.autoScroll=true;
|
|
|
|
|
+ me.searchField=sfield.substring(0,sfield.length-1);
|
|
|
|
|
+ me.tpl=Ext.create('Ext.XTemplate',
|
|
|
|
|
+ '<ul style="padding-left: 0px;"><tpl for=".">',
|
|
|
|
|
+ '<li role="option" class="x-boundlist-item" style="list-style:none;">' ,
|
|
|
|
|
+ '<div style="height:30px;">',
|
|
|
|
|
+ ''+span+'',
|
|
|
|
|
+ '</li>',
|
|
|
|
|
+ '</tpl></ul>'
|
|
|
|
|
+ );
|
|
|
|
|
+ me.store.setFields(field);
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ //加载数据
|
|
|
|
|
+ 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 ";
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
- //添加默认条件
|
|
|
|
|
- if(me.defaultCondition) {
|
|
|
|
|
- dbCondition.push({
|
|
|
|
|
|
|
+ dbtplcondition = "(" + dbtplcondition.substring(0,dbtplcondition.length-4) + ")";
|
|
|
|
|
+ if(dbtplcondition.length>0){
|
|
|
|
|
+ dbCondition = [{
|
|
|
type: 'condition',
|
|
type: 'condition',
|
|
|
- value: me.defaultCondition
|
|
|
|
|
- });
|
|
|
|
|
|
|
+ value:dbtplcondition
|
|
|
|
|
+ }];
|
|
|
}
|
|
}
|
|
|
- Ext.Ajax.request({
|
|
|
|
|
- url: me.dataUrl,
|
|
|
|
|
- params: {
|
|
|
|
|
- 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?data.data.list:[];
|
|
|
|
|
- if(data!=null && data.length>0 && me.store && field.length>0){
|
|
|
|
|
- me.store.loadData(data,false);
|
|
|
|
|
- me.expand();
|
|
|
|
|
- }else{
|
|
|
|
|
- me.store.removeAll();
|
|
|
|
|
- me.collapse();
|
|
|
|
|
- }
|
|
|
|
|
- },
|
|
|
|
|
- failure: function(response, opts) {}
|
|
|
|
|
- });
|
|
|
|
|
}
|
|
}
|
|
|
- return true;
|
|
|
|
|
- }else{
|
|
|
|
|
- return false;
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ //添加默认条件
|
|
|
|
|
+ if(me.defaultCondition) {
|
|
|
|
|
+ dbCondition.push({
|
|
|
|
|
+ type: 'condition',
|
|
|
|
|
+ value: me.defaultCondition
|
|
|
|
|
+ });
|
|
|
|
|
+ }
|
|
|
|
|
+ Ext.Ajax.request({
|
|
|
|
|
+ url: me.dataUrl,
|
|
|
|
|
+ params: {
|
|
|
|
|
+ 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?data.data.list:[];
|
|
|
|
|
+ if(data!=null && data.length>0 && me.store && field.length>0){
|
|
|
|
|
+ me.store.loadData(data,false);
|
|
|
|
|
+ me.expand();
|
|
|
|
|
+ }else{
|
|
|
|
|
+ me.store.removeAll();
|
|
|
|
|
+ me.collapse();
|
|
|
|
|
+ }
|
|
|
|
|
+ },
|
|
|
|
|
+ failure: function(response, opts) {}
|
|
|
|
|
+ });
|
|
|
|
|
+ }
|
|
|
|
|
+ return true;
|
|
|
},
|
|
},
|
|
|
onTriggerClick:function(f){
|
|
onTriggerClick:function(f){
|
|
|
if(!this.fireEvent('beforetriggerclick', this)) {
|
|
if(!this.fireEvent('beforetriggerclick', this)) {
|