CptAssortmentBrowser.jsp
6.87 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
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
<%@ taglib uri="/WEB-INF/weaver.tld" prefix="wea"%>
<%@ page import="weaver.general.Util" %>
<%@ page import="java.util.*" %>
<%@ page language="java" contentType="text/html; charset=UTF-8" %> <%@ include file="/systeminfo/init_wev8.jsp" %>
<%
String id=Util.null2String(request.getParameter("paraid"));
String checktype="checksingle"; //checksingle or not
String onlyendnode="y"; //如果需要check是否仅仅只是没有孩子的节点,y
%>
<HTML>
<HEAD>
<LINK REL=stylesheet type=text/css HREF=/css/Weaver_wev8.css>
<link rel="stylesheet" href="/wui/common/jquery/plugin/zTree/css/zTreeStyle/zTreeStyle_wev8.css" type="text/css">
<script type="text/javascript" src="/wui/common/jquery/plugin/zTree/js/jquery.ztree.core.min_wev8.js"></script>
<script type="text/javascript" src="/wui/common/jquery/plugin/zTree/js/jquery.ztree.excheck.min_wev8.js"></script>
<script type="text/javascript">
var parentWin = parent.parent.getParentWindow(parent);
var dialog = parent.parent.getDialog(parent);
</script>
<script type="text/javascript">
//<!--
/**
* 获取url(alax方式获得子节点时使用)
*/
function getAsyncUrl(treeId, treeNode) {
//获取子节点时
if (treeNode != undefined && treeNode.isParent != undefined && treeNode.isParent != null) {
return "/cpt/maintenance/CptAssortmentTreeXML.jsp?" + treeNode.ajaxParam + "&" + new Date().getTime() + "=" + new Date().getTime();
} else {
//初始化时
return "/cpt/maintenance/CptAssortmentTreeXML.jsp?checktype=<%=checktype%>&onlyendnode=<%=onlyendnode%><%if(!id.equals("")){%>&id=<%=id%>&init=y<%}%>" + "&" + new Date().getTime() + "=" + new Date().getTime();
}
};
//zTree配置信息
var setting = {
async: {
enable: true, //启用异步加载
dataType: "text", //ajax数据类型
url: getAsyncUrl //ajax的url
},
check: {
enable: true, //启用checkbox或者radio
chkStyle: "radio", //check类型为radio
radioType: "all", //radio选择范围
chkboxType: { "Y" : "", "N" : "" }
},
view: {
expandSpeed: "" //效果
},
callback: {
onClick: zTreeOnClick, //节点点击事件
onAsyncSuccess: zTreeOnAsyncSuccess //ajax成功事件
}
};
var zNodes =[
];
$(document).ready(function(){
//初始化zTree
$.fn.zTree.init($("#ztreedeep"), setting, zNodes);
});
function zTreeOnClick(event, treeId, treeNode) {
var treeObj = $.fn.zTree.getZTreeObj(treeId);
if (treeNode.isParent) {
treeObj.expandNode(treeNode);
}
treeObj.checkNode(treeNode, true, false);
};
function zTreeOnAsyncSuccess(event, treeId, treeNode, msg) {
var treeObj = $.fn.zTree.getZTreeObj(treeId);
//treeObj.expandAll(true);
}
function onSaveJavaScript(){
var nameStr="";
var idStr = "";
var treeObj = $.fn.zTree.getZTreeObj("ztreedeep");
var nodes = treeObj.getCheckedNodes(true);
if (nodes == undefined || nodes == "" || nodes.length < 1) {
return "";
}
for (var i=0; i<nodes.length; i++) {
nameStr = nodes[i].nodeid;
idStr = nodes[i].name;
}
var arraytemp = nameStr.split("_");
var resultStr = "0";
if(arraytemp.length > 1) {
resultStr = arraytemp[1];;
}
var strtmp2 = "";
for(var i=0;i<arraytemp.length;i++){
if(i>2){
strtmp2 = strtmp2 + "_" + arraytemp[i];
}
}
resultStr = resultStr + "$" + idStr;
return resultStr;
}
function onSave() {
var trunStr = "", returnVBArray = null;
trunStr = onSaveJavaScript();
if(trunStr != "") {
returnVBArray = trunStr.split("$");
var returnjson = {id:returnVBArray[0], name:returnVBArray[1]};
if(dialog){
try{
dialog.callback(returnjson);
}catch(e){}
try{
dialog.close(returnjson);
}catch(e){}
}else{
window.parent.returnValue = returnjson;
window.parent.close();
}
} else {
if(dialog){
dialog.close();
}else{
window.parent.close();
}
}
}
function onClear() {
if(dialog){
var returnjson={id:"", name:""};
try{
dialog.callback(returnjson);
}catch(e){}
try{
dialog.close(returnjson);
}catch(e){}
}else{
window.parent.returnValue = {id:"", name:""};
window.parent.close();
}
}
function onClose() {
window.parent.close();
}
//-->
</SCRIPT>
</HEAD>
<body>
<jsp:include page="/systeminfo/commonTabHead.jsp">
<jsp:param name="mouldID" value="assest"/>
<jsp:param name="navName" value='<%=SystemEnv.getHtmlLabelNames("831",user.getLanguage()) %>'/>
</jsp:include>
<%@ include file="/systeminfo/RightClickMenuConent_wev8.jsp" %>
<%
RCMenu += "{"+SystemEnv.getHtmlLabelName(826,user.getLanguage())+",javascript:onSave(),_self} " ;
RCMenuHeight += RCMenuHeightStep ;
RCMenu += "{"+SystemEnv.getHtmlLabelName(311,user.getLanguage())+",javascript:onClear(),_self} " ;
RCMenuHeight += RCMenuHeightStep ;
RCMenu += "{"+SystemEnv.getHtmlLabelName(201,user.getLanguage())+",javascript:dialog.close(),_self} " ;
RCMenuHeight += RCMenuHeightStep ;
%>
<%@ include file="/systeminfo/RightClickMenu_wev8.jsp" %>
<table id="topTitle" cellpadding="0" cellspacing="0">
<tr>
<td>
</td>
<td class="rightSearchSpan" style="text-align:right;">
<span title="<%=SystemEnv.getHtmlLabelName(23036,user.getLanguage())%>" class="cornerMenu"></span>
</td>
</tr>
</table>
<div class="zDialog_div_content">
<DIV align=right>
</DIV>
<table height="100%" width="100%" cellspacing="0" cellpadding="0">
<form action="" name="form1" id ="form1" method="get" target="optFrame">
<input type="hidden" name="id" id ="id">
<input type="hidden" name="name" id ="name">
<tr>
<td height="100%">
<div id="deeptree" style="height:100%;width:100%;overflow:scroll;">
<ul id="ztreedeep" class="ztree"></ul>
</div>
<td>
</tr>
</form>
</table>
</div>
<div id="zDialog_div_bottom" class="zDialog_div_bottom">
<wea:layout needImportDefaultJsAndCss="false">
<wea:group context="" attributes="{\"groupDisplay\":\"none\"}">
<wea:item type="toolbar">
<input type="button" accessKey=O id=btnok value="<%="O-"+SystemEnv.getHtmlLabelName(826,user.getLanguage())%>" id="zd_btn_submit_0" class="zd_btn_submit" onclick="onSave();">
<input type="button" accessKey=2 id=btnclear value="<%="2-"+SystemEnv.getHtmlLabelName(311,user.getLanguage())%>" id="zd_btn_submit" class="zd_btn_submit" onclick="onClear();">
<input type="button" accessKey=T id=btncancel value="<%="T-"+SystemEnv.getHtmlLabelName(201,user.getLanguage())%>" id="zd_btn_cancle" class="zd_btn_cancle" onclick="dialog.close();">
</wea:item>
</wea:group>
</wea:layout>
<script type="text/javascript">
jQuery(document).ready(function(){
resizeDialog(document);
});
</script>
</div>
</BODY>
</HTML>