|
本帖最后由 wiyos 于 2018-1-30 16:28 编辑
3.7.2,popup控件,当字典Text为多个值时,查询条件的input框undefined
bug文件有4个,路径:
1. /jeecg/src/main/webapp/plug-in/tools/curdtools_zh-cn.js
2. /jeecg/src/main/java/org/jeecgframework/web/cgform/controller/autolist/CgAutoListController.java
3. /jeecg/src/main/java/org/jeecgframework/web/cgform/common/CgAutoListConstant.java
4. /jeecg/src/main/resources/online/template/模板名称/html/autolist.ftl (online开发模板文件)
将第一个js文件 inputClick函数结尾初新增一行 复制下面内容
//popup
//object: this name:需要选择的列表的字段 code:动态报表的code
//tablefield:对应字典TEXT,要从popup报表中获取的字段.
function inputClickMult(obj,name,code,tablefield) {
if(name==""||code==""){
alert("popup参数配置不全");
return;
}
var inputClickUrl = basePath + "/cgReportController.do?popup&id="+code;
if(typeof(windowapi) == 'undefined'){
$.dialog({
content: "url:"+inputClickUrl,
zIndex: getzIndex(),
lock : true,
title:"选择",
width:800,
height: 400,
cache:false,
ok: function(){
iframe = this.iframe.contentWindow;
var selected = iframe.getSelectRows();
console.log(selected);
if (selected == '' || selected == null ){
alert("请选择");
return false;
}else {
var str = "";
var names = name.split(",");
var fields = tablefield.split(",");
if (names.length>0){
for(var i1=0;i1<names.length;i1++){
$.each( selected, function(i, n){
if (i==0){
if($(obj).attr("name") == names[i1]){
str+= n[fields[i1]];
}
}else{
str+= ",";
str+=n[fields[i1]];
}
});
}
}else{
$.each( selected, function(i, n){
if (i==0){
str+= n[name];
}else{
str+= ","+n[name];
}
});
}
$(obj).val("");
//$('#myText').searchbox('setValue', str);
$(obj).val(str);
return true;
}
},
cancelVal: '关闭',
cancel: true //为true等价于function(){}
});
}else{
$.dialog({
content: "url:"+inputClickUrl,
zIndex: getzIndex(),
lock : true,
title:"选择",
width:800,
height: 400,
parent:windowapi,
cache:false,
ok: function(){
iframe = this.iframe.contentWindow;
var selected = iframe.getSelectRows();
if (selected == '' || selected == null ){
alert("请选择");
return false;
}else {
var str = "";
$.each( selected, function(i, n){
if (i==0)
str+= n[name];
else
str+= ","+n[name];
});
$(obj).val("");
//$('#myText').searchbox('setValue', str);
$(obj).val(str);
return true;
}
},
cancelVal: '关闭',
cancel: true //为true等价于function(){}
});
}
}
将第二个文件 第474行 fmq.put(CgAutoListConstant.FIELD_DICTTABLE, bean.getDictTable());结尾处新增一行复制
fmq.put(CgAutoListConstant.FIELD_DICTTEXT, bean.getDictText());
将第三个文件 第72行 public static final String FIELD_DICTFIELD = "field_dictField"; 结尾处新增一行复制
/** 字典text */
public static final String FIELD_DICTTEXT = "field_dictText";
将第四个文件 找到 inputClick(this,'${x['field_dictField']?if_exists?html}' ....... 字样
替换成 inputClickMult(this,'${x['field_dictField']?if_exists?html}','${x['field_dictTable']?if_exists?html}','${x['field_dictText']?if_exists?html}');"
重启tomcat后 即可解决此bug |
|