CommonMultiBrowser_wev8.js
4.76 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
function showMultiDocDialog(selectids,srchead,titleviewtype,detailtable,pkfield){
var config = null;
config= rightsplugingForBrowser.createConfig();
config.srchead=srchead;
config.container =$("#colShow");
config.searchLabel="";
//config.hiddenfield="id"; //原来只有主表的时候用id 现在加入明细表后用id_did 主表id_明细表id 别名取为hiddenfield
config.hiddenfield="hiddenfield";
config.pkfield=pkfield;//添加属性pkfieldid 作为带出到表单上的字段
config.titleviewtype=titleviewtype;
config.detailtable=detailtable;
config.saveLazy = true;
config.srcurl = "/formmode/browser/CommonMultiBrowserAjax.jsp?src=src";
config.desturl = "/formmode/browser/CommonMultiBrowserAjax.jsp?src=dest";
config.pagesize = 10;
config.formId = "frmmain";
config.selectids = selectids;
config.searchAreaId = "e8QuerySearchArea";//新版自定义多选框微调增加
var istree = jQuery("#istree");
if(istree.length>0&&istree.val()=="1"){//树形组合查询,返回数据前进行格式化
config.formatCallbackFn = function (config,destMap,destMapKeys){
return formateTreeData(config,destMap,destMapKeys);
}
} else {
config.formatCallbackFn = function(config,destMap,destMapKeys){
var ids="",names="";
var nameKey = destMap["__nameKey"];
for(var i=0;destMapKeys&&i<destMapKeys.length;i++){
var key = destMapKeys[i];
var dataitem = destMap[key];
var name = dataitem[nameKey];
var obj = null;
try{
obj = jQuery(name);
}catch(e){}
if(ids==""){
ids = key;
}else{
ids = ids+","+key;
}
if(names==""){
//names = (obj && obj.length>0)?obj.text().replace(/\,/g,""):name.replace(/\,/g,"");
names = (obj && obj.length>0)?obj.text():name;//qc370946
}else{
//names=names + ","+((obj && obj.length>0)?obj.text().replace(/\,/g,""):name).replace(/\,/g,"");
names=names + "~~WEAVERSplitFlag~~"+((obj && obj.length>0)?obj.text():name);//qc370946
}
}
return {id:ids,name:names};
}
}
try{
config.dialog = dialog;
}catch(e){}
jQuery("#colShow").html("");
rightsplugingForBrowser.createRightsPluing(config);
jQuery("#btnok").bind("click",function(){
rightsplugingForBrowser.system_btnok_onclick(config);
});
jQuery("#btnclear").bind("click",function(){
rightsplugingForBrowser.system_btnclear_onclick(config);
});
jQuery("#btncancel").bind("click",function(){
rightsplugingForBrowser.system_btncancel_onclick(config);
});
jQuery("#btnsearch").bind("click",function(){
rightsplugingForBrowser.system_btnsearch_onclick(config);
});
}
function formateTreeData (config,destMap,destMapKeys){
var treenodeid = jQuery("#treenodeid").val();
var nameKey = destMap["__nameKey"];
var ids = "";
var names = "";
for(var i=0;destMapKeys&&i<destMapKeys.length;i++){
var key = destMapKeys[i];
var dataitem = destMap[key];
var name = dataitem[nameKey];
var obj = null;
try{
obj = jQuery(name);
}catch(e){}
key = treenodeid+"_"+key;
if(ids==""){
ids = key;
}else{
ids = ids+","+key;
}
var text = (obj && obj.length>0)?obj.text().replace(/\,/g,""):name.replace(/\,/g,"");
if(dialog){
text = "<a target='_blank' href='/formmode/search/CustomSearchOpenTree.jsp?pid="+key+"' >"+text+"</a>";
}
if(names==""){
names = text;
}else{
names=names + ","+text;
}
}
var json = new Object();
json.id = ids;
json.name = names;
return json;
}
function btnOnSearch(){
jQuery("#btnsearch").trigger("click");
}
/*
rightsplugingForBrowser.system_btnok_onclick=function(config){
var dest = config.container.find("table.e8_box_target tbody tr");
var ids = config.container.find("#systemIds").val();
var names = "";
if(!!ids){
ids = "";
dest.each(function(){
var name = jQuery(this).children("td").eq(1).html();
var id = jQuery(this).children("td").eq(0).find("input[type='hidden']").val();
if(ids==""){
ids = id;
}else{
ids=ids + ","+id;
}
if(names==""){
names = name;
}else{
names=names + ","+name;
}
});
}
try{
if(config.dialog){
try{
config.dialog.callback({id:ids,name:names});
}catch(e){}
try{
config.dialog.close({id:ids,name:names});
}catch(e){}
}else{
if(config.parentWin){
config.parentWin.returnValue = {id:ids,name:names};
config.parentWin.close();
}else{
window.parent.returnValue = {id:ids,name:names};
window.parent.close();
}
}
}catch(e){
if(config.parentWin){
config.parentWin.returnValue = {id:ids,name:names};
config.parentWin.close();
}else{
window.parent.returnValue = {id:ids,name:names};
window.parent.close();
}
}
}
*/