CustomerBrowser.jsp
8.89 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
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
<%@ include file="/systeminfo/init_wev8.jsp" %>
<%@ page import="weaver.general.Util" %>
<%@ page import="java.util.*" %>
<%@ page language="java" contentType="text/html; charset=UTF-8" %>
<%@ taglib uri="/WEB-INF/weaver.tld" prefix="wea"%>
<%@ taglib uri="/browserTag" prefix="brow"%>
<jsp:useBean id="DepartmentComInfo" class="weaver.hrm.company.DepartmentComInfo" scope="page" />
<jsp:useBean id="CustomerTypeComInfo" class="weaver.crm.Maint.CustomerTypeComInfo" scope="page" />
<jsp:useBean id="CustomerStatusComInfo" class="weaver.crm.Maint.CustomerStatusComInfo" scope="page" />
<jsp:useBean id="CustomerDescComInfo" class="weaver.crm.Maint.CustomerDescComInfo" scope="page" />
<jsp:useBean id="CustomerSizeComInfo" class="weaver.crm.Maint.CustomerSizeComInfo" scope="page" />
<jsp:useBean id="SectorInfoComInfo" class="weaver.crm.Maint.SectorInfoComInfo" scope="page" />
<jsp:useBean id="CountryComInfo" class="weaver.hrm.country.CountryComInfo" scope="page"/>
<jsp:useBean id="CityComInfo" class="weaver.hrm.city.CityComInfo" scope="page"/>
<jsp:useBean id="CrmShareBase" class="weaver.crm.CrmShareBase" scope="page" />
<jsp:useBean id="ResourceComInfo" class="weaver.hrm.resource.ResourceComInfo" scope="page"/>
<jsp:useBean id="xssUtil" class="weaver.filter.XssUtil" scope="page" />
<HTML><HEAD>
<LINK REL=stylesheet type=text/css HREF=/css/Weaver_wev8.css>
<SCRIPT language="javascript" src="/js/weaver_wev8.js"></script>
</HEAD>
<%
/**
* 本demo 是基于查询OA数据库的表数据 根据自己的业务逻辑,构造自己的查询条件 及返回的结果集
*/
//接收请求参数 用于sql条件过滤 根据实际的业务进行调整
String name = Util.null2String(request.getParameter("name"));
String crmcode = Util.null2String(request.getParameter("crmcode"));
String departmentid=Util.null2String(request.getParameter("departmentid"));
String personid=Util.null2String(request.getParameter("personid"));
//构造sql的where条件
String sqlwhere = "1=1";
Map hiddenMap = new HashMap();
%>
<BODY scroll="auto">
<%@ include file="/systeminfo/RightClickMenuConent_wev8.jsp" %>
<!--加载OA系统右键菜单 非必须使用 根据自己的实际业务进行调整-->
<%
RCMenu += "{"+SystemEnv.getHtmlLabelName(197,user.getLanguage())+",javascript:document.SearchForm.submit(),_top} " ;
RCMenuHeight += RCMenuHeightStep ;
RCMenu += "{"+SystemEnv.getHtmlLabelName(199,user.getLanguage())+",javascript:document.SearchForm.reset(),_top} " ;
RCMenuHeight += RCMenuHeightStep ;
RCMenu += "{"+SystemEnv.getHtmlLabelName(201,user.getLanguage())+",javascript:dialog.close(),_top} " ;
RCMenuHeight += RCMenuHeightStep ;
RCMenu += "{"+SystemEnv.getHtmlLabelName(311,user.getLanguage())+",javascript:btnclear_onclick(),_top} " ;
RCMenuHeight += RCMenuHeightStep ;
%>
<table id="topTitle" cellpadding="0" cellspacing="0">
<tr>
<td>
</td>
<td class="rightSearchSpan" style="text-align:right;">
<input type="button" onclick="document.SearchForm.submit()" class="e8_btn_top" value="<%=SystemEnv.getHtmlLabelName(197,user.getLanguage())%>"></input>
<span title="<%=SystemEnv.getHtmlLabelName(826,user.getLanguage()) %>" class="cornerMenu"></span>
</td>
</tr>
</table>
<!-- 右键菜单事件定义-->
<DIV align=right style="display:none">
<button type="button" class=btnSearch accessKey=S type=submit onclick="document.SearchForm.submit()"><U>S</U>-<%=SystemEnv.getHtmlLabelName(197,user.getLanguage())%></BUTTON>
<button type="button" class=btnReset accessKey=T type=reset onclick="document.SearchForm.reset()"><U>T</U>-<%=SystemEnv.getHtmlLabelName(199,user.getLanguage())%></BUTTON>
</DIV>
<div class="zDialog_div_content">
<FORM id=weaver NAME=SearchForm STYLE="margin-bottom:0" action="CustomerBrowser.jsp" method=post>
<input type="hidden" name="sqlwhere" value='<%=xssUtil.put(Util.null2String(request.getParameter("sqlwhere")))%>'>
<input type="hidden" name="pagenum" value=''>
<input type="hidden" name="selectSecond" value="1">
<!--构造输入条件框-->
<div style="max-height:155px;overflow:hidden;" id="e8QuerySearchArea">
<wea:layout type="4col" >
<wea:group context='<%=SystemEnv.getHtmlLabelName(20331,user.getLanguage())%>'>
<wea:item>客户名称</wea:item>
<wea:item><input class=InputStyle name=name value='<%=name%>' style="width: 120px;"></wea:item>
<wea:item>客户编码</wea:item>
<wea:item>
<input class=InputStyle name=crmcode value="<%=crmcode%>" style="width: 120px;">
</wea:item>
<wea:item>人力资源部门</wea:item>
<!-- 人力资源部门选择框 公共组件-->
<wea:item>
<brow:browser viewType="0" name="departmentid"
browserUrl="/systeminfo/BrowserMain.jsp?url=/hrm/company/DepartmentBrowser.jsp"
browserValue = '<%=departmentid%>'
browserSpanValue='<%=DepartmentComInfo.getDepartmentname(departmentid)%>'
isSingle="true" hasBrowser="true" hasInput="true" isMustInput='1'
completeUrl="/data.jsp?type=4" width="150px" ></brow:browser>
</wea:item>
<wea:item>人员</wea:item>
<!-- 人力资源人员选择框 公共组件-->
<wea:item>
<brow:browser viewType="0" name="personid"
browserUrl="/systeminfo/BrowserMain.jsp?url=/hrm/resource/ResourceBrowser.jsp"
browserValue = '<%=personid%>'
browserSpanValue='<%=ResourceComInfo.getResourcename(personid)%>'
isSingle="true" hasBrowser="true" hasInput="true" isMustInput='1'
completeUrl="/data.jsp" width="150px" ></brow:browser>
</wea:item>
</wea:group>
</wea:layout>
<%for(Object key : hiddenMap.keySet()){ %>
<input type="hidden" name="<%=key %>" value="<%=hiddenMap.get(key) %>">
<%} %>
</div>
<%
// ----------------接收请求参数 构造 sql过滤条件 start-----------------
if(!name.equals("")){
sqlwhere += " and t1.lastname like '%" + Util.fromScreen2(name,user.getLanguage()) +"%' ";
}
if(!crmcode.equals("")){
sqlwhere += " and t1.loginid like '%" + Util.fromScreen2(crmcode,user.getLanguage()) +"%' ";
}
if(!departmentid.equals("")){
sqlwhere += " and t1.departmentid = '" + Util.fromScreen2(departmentid,user.getLanguage()) +"' ";
}
if(!personid.equals("")){
sqlwhere += " and t1.id = '" + Util.fromScreen2(personid,user.getLanguage()) +"' ";
}
// ----------------接收请求参数 构造 sql过滤条件 end-----------------
//需要展示的字段
String backfields = "t1.id , t1.lastname , t1.loginid , t1.status ";
//查询的表名称
String fromSql =" hrmresource t1";
int pagesize = 10;
sqlwhere = Util.toHtmlForSplitPage(sqlwhere);
String orderby = "t1.id";
// 构造一个tableString 用于展示数据列表 这个是OA的前端组件,实际列表页面可以自行选择控件
String tableString =" <table instanceid='BrowseTable' tabletype='none' pagesize=\""+pagesize+"\">"+
"<sql backfields=\""+backfields+"\" sqlform=\""+Util.toHtmlForSplitPage(fromSql)+"\" sqlwhere=\""+sqlwhere+"\" sqlorderby=\""+orderby+"\" sqlprimarykey=\"t1.id\" sqlsortway=\"Desc\"/>"+
"<head>"+
"<col hide=\"true\" width=\"5%\" text=\"\" column=\"id\"/>"+
"<col width=\"45%\" text=\"姓名\" orderkey=\"lastname\" column=\"lastname\"/>"+
"<col width=\"20%\" text=\"登录名\" orderkey=\"loginid\" column=\"loginid\""+
" transmethod=\"\"/>"+
"<col width=\"30%\" text=\"人员状态\" orderkey=\"status\" column=\"status\""+
" transmethod=\"\"/>"+
"</head>"+
"</table>";
%>
<div id="e8resultArea">
<wea:SplitPageTag tableString='<%=tableString%>' mode="run" isShowTopInfo="false" />
</div>
</FORM>
</div>
<!-- 右键菜单 OA标准的菜单组件 -->
<%@ include file="/systeminfo/RightClickMenu_wev8.jsp" %>
</BODY></HTML>
<script type="text/javascript">
var parentWin = null;
var dialog = null;
try{
parentWin = parent.parent.getParentWindow(parent);
dialog = parent.parent.getDialog(parent);
}catch(e){}
jQuery(function(){
//选中事件监听
jQuery(".ListStyle").find("tbody tr").live('click',function(){
var id = jQuery.trim(jQuery(this).find("td:eq(1)").html()); //获取选中的id
var name = jQuery.trim(jQuery(this).find("td:eq(2)").html()); //获取选中的名称
var returnValue = [{id:id,name:name}]; //获取选中值 返回数据 如果是多选 例如 [{id:id,name:name},{id:id,name:name}]
var p = window.top;
// 固定无需调整 -----start 下面 是回调函数 将选中的数据返回到表单页面
var match = window.location.href.match(/urlOfIframeInDialogKey=.+$/);
if (match) {
var key = match[0].replace(/urlOfIframeInDialogKey=/, "");
if (
p &&
p !== window &&
p.ecCom &&
typeof p.ecCom.WeaBrowser.urlOfIframeInDialogCallBack[key] ===
"function"
) {
var browser = p.ecCom.WeaBrowser.urlOfIframeInDialogCallBack[
key
](returnValue);
console.log("browser: ", browser);
browser.closeModal();
}
}
// 固定无需调整 -----end
});
});
</script>