|
本帖最后由 584780060 于 2017-6-2 09:55 编辑
在jeecg提供的popup多选框,只能实现赋值一个input框,如图
赋值一个
但有时候需要赋值多个input框,如图
赋值多个
我们就可以在增强JS中写下如下代码就可以实现以上的赋值多个input的需求
function inputClick(obj, name, code) {
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();
if (selected == '' || selected == null) {
alert("请选择");
return false;
} else {
var str = "";
var str1 = "";
$.each(selected, function(i, n) {
if (i == 0) {
str += n.realname;
str1 += n.account;
} else {
str += "," + n.realname;
str1 += "," + n.account;
}
});
var xh = $(obj).attr('name').split('.')[0];
document.getElementsByName(xh + '.name')[0].value = str;
document.getElementsByName(xh + '.money')[0].value = str1;
//name为变量,因此在添加明细中不能使用
//$('#formobj').form('load',{
// b:str,
// 'jform_order_customer[0].money':str1,
//});
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 = "";
var str1 = "";
$.each(selected, function(i, n) {
if (i == 0) {
str += n.realname;
str1 += n.account;
} else {
str += "," + n.realname;
str1 += "," + n.account;
}
});
var xh = $(obj).attr('name').split('.')[0];
document.getElementsByName(xh + '.name')[0].value = str;
document.getElementsByName(xh + '.money')[0].value = str1;
//name为变量,因此在添加明细中不能使用
//$('#formobj').form('load',{
// b:str,
// 'jform_order_customer[0].money':str1,
//});
return true;
}
},
cancelVal : '关闭',
cancel : true
//为true等价于function(){}
});
}
}
|
|