LayoutOperation.jsp
7.29 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
<%@ page language="java" contentType="text/html; charset=UTF-8" %>
<%@ include file="/systeminfo/init_wev8.jsp" %>
<%
if(Util.getIntValue(request.getParameter("isecme"), 0) == 1){
if (!new com.api.ecme.excel.ExcelLayoutManager(request,user).checkRight()){
response.sendRedirect("/notice/noright.jsp");
return;
}
}else{
if (!HrmUserVarify.checkUserRight("ModeSetting:All", user)) {
response.sendRedirect("/notice/noright.jsp");
return;
}
}
%>
<%@ page import="weaver.file.FileUpload,java.io.File"%>
<%@ page import="com.api.ecme.excel.ExcelInitManager" %>
<jsp:useBean id="rs" class="weaver.conn.RecordSet" scope="page" />
<jsp:useBean id="modeLayoutUtil" class="weaver.formmode.setup.ModeLayoutUtil" scope="page" />
<jsp:useBean id="ecmeLayoutUtil" class="com.engine.ecme.biz.EcmeLayoutUtil" scope="page" />
<jsp:useBean id="modeSetUtil" class="weaver.formmode.setup.ModeSetUtil" scope="page" />
<jsp:useBean id="excelsetInitManager" class="weaver.formmode.exceldesign.ExcelsetInitManager" scope="page"/>
<jsp:useBean id="excelInitManager" class="com.api.ecme.excel.ExcelInitManager" scope="page"/>
<%
FileUpload fu = new FileUpload(request, false, "filesystem/htmllayoutimages");
int flag = 0;
int Id = Util.getIntValue(fu.getParameter("Id"), 0);
int formId = Util.getIntValue(fu.getParameter("formId"), 0);
int modeId = Util.getIntValue(fu.getParameter("modeId"), 0);
int type = Util.getIntValue(fu.getParameter("type"), -1);
String operation = Util.null2String(fu.getParameter("operation"));
String opentype = Util.null2String(fu.getParameter("opentype"));//是否e9打开
int isecme = Util.getIntValue(request.getParameter("isecme"),0);
int feaid = Util.getIntValue(request.getParameter("feaid"),0);
int appid = Util.getIntValue(request.getParameter("appid"),0);
int categoryid = Util.getIntValue(request.getParameter("categoryid"),-1);
modeLayoutUtil.setFu(fu);
if("saveHtmlMode".equalsIgnoreCase(operation)){//保存模板
Id = modeLayoutUtil.doSaveLayoutInfo();
if(Id > 0){
flag = 1;
}
String layoutid = "";
String layoutname = "";
String layouttype = "";
String version = "0";
String sql = "SELECT id,layoutname,type,version FROM modehtmllayout where id="+Id;
rs.execute(sql);
if(rs.next()){
layoutid = rs.getString("id");
layoutname = rs.getString("layoutname");
layouttype = rs.getString("type");
version = rs.getString("version");
}
if(opentype.equals("e9")){%>
<script language="javascript">
if(window.opener&&window.opener.openDialogCallBack){
let obj = {layoutid:"<%=layoutid%>",layoutname:"<%=layoutname%>",layouttype:"<%=layouttype%>",version:"<%=version%>"};
window.opener.openDialogCallBack(obj);
}
window.location.href = "/formmode/setup/LayoutEdit.jsp?ajax=1&opentype=<%=opentype%>&modeId=<%=modeId%>&formId=<%=formId%>&Id=<%=Id%>&type=<%=type%>&flag=<%=flag%>";
</script>
<%}else{
%>
<script language="javascript">
try{
window.opener.location.reload();
}catch(e){}
location.href = "/formmode/setup/LayoutEdit.jsp?ajax=1&opentype=<%=opentype%>&modeId=<%=modeId%>&formId=<%=formId%>&Id=<%=Id%>&type=<%=type%>&flag=<%=flag%>";
</script>
<%
}
}else if("EditModesHtml".equalsIgnoreCase(operation)){//页面布局-模板设置(保存)
modeSetUtil.setRequest(request);
modeSetUtil.setUser(user);
modeSetUtil.saveModesHtml();
response.sendRedirect("/formmode/setup/ModeHtmlSet.jsp?ajax=1&opentype="+opentype+"&modeId="+modeId+"&formId="+formId);
}else if("batchHtmlField".equalsIgnoreCase(operation)){//批量处理字段
if(isecme == 1){
ecmeLayoutUtil.setRequest(request);
ecmeLayoutUtil.setUser(user);
Id = ecmeLayoutUtil.batchHtmlField();
}else{
modeLayoutUtil.setRequest(request);
modeLayoutUtil.setUser(user);
Id = modeLayoutUtil.batchHtmlField();
}
int isExcel = Util.getIntValue(request.getParameter("isExcel"),0);
if(isExcel != 0 ){ //当如果是新版流程表单设计器时,这里不需要重定向了
//根据保存的信息, 需要拼2个json :自定义属性json 和控件所需的json
int excelStyle = Util.getIntValue(request.getParameter("excelStyle"),0);
String issys = Util.null2String(request.getParameter("excelIssys"));
//1表示批量设置字段属性只保存,2表示批量设置字段属性并初始化,3表示模板列表页面初始化字段属性
int saveAttrFlag=Util.getIntValue(request.getParameter("saveAttrFlag"),0);
String layoutid = "";
String layoutname = "";
String layouttype = "";
String version = "2";
String sql = "SELECT id,layoutname,type,version FROM modehtmllayout where id="+Id;
if(saveAttrFlag==1){
rs.execute(sql);
if(rs.next()){
layoutid = rs.getString("id");
layoutname = rs.getString("layoutname");
layouttype = rs.getString("type");
version = rs.getString("version");
}
if(opentype.equals("e9")){%>
<script language="javascript">
jQuery(document).ready(function(){
let obj = {layoutid:"<%=layoutid%>",layoutname:"<%=layoutname%>",layouttype:"<%=layouttype%>",version:"<%=version%>"};
parent.doCloseAndCallBack(obj);
});
</script>
<%
}else{
out.print("<script>jQuery(document).ready(function(){parent.closeCurDialog()});</script>");
}
}else{
if(isecme == 1){
int colsperrow = Util.getIntValue(request.getParameter("colsperrow"), 1);
excelInitManager.setIsSys(issys);
excelInitManager.setExcelStyle(excelStyle);
Id = excelInitManager.createJsonByMode(modeId,feaid,appid,colsperrow,type,categoryid,user,Id);
}else{
excelsetInitManager.setRequest(request);
excelsetInitManager.setUser(user);
excelsetInitManager.setIsSys(issys);
excelsetInitManager.setExcelStyle(excelStyle);
Id = excelsetInitManager.createSheetJson(Id,type,excelStyle);
}
sql = "SELECT id,layoutname,type,version FROM modehtmllayout where id="+Id;
rs.execute(sql);
if(rs.next()){
layoutid = rs.getString("id");
layoutname = rs.getString("layoutname");
layouttype = rs.getString("type");
version = rs.getString("version");
}
if(opentype.equals("e9")){%>
<script language="javascript">
jQuery(document).ready(function(){
<%--let obj = JSON.stringify({layoutid:"<%=layoutid%>",layoutname:"<%=layoutname%>",layouttype:"<%=layouttype%>",version:"<%=version%>"});--%>
parent.doCloseAndCallBack({layoutid:"<%=layoutid%>",layoutname:"<%=layoutname%>",layouttype:"<%=layouttype%>",version:"<%=version%>"});
});
</script>
<%
}else{
if(saveAttrFlag==2){
out.print("<script>jQuery(document).ready(function(){parent.closeCurDialog()});</script>");
}else if(saveAttrFlag==3){
out.print("<script>jQuery(document).ready(function(){parent.initExcel("+excelStyle+","+Id+")});</script>");
}
}
}
return;
}
out.println("<script>try{window.opener.location.href=\"/formmode/setup/LayoutEdit.jsp?ajax=1&opentype="+opentype+"&modeId="+modeId+"&formId="+formId+"&Id="+Id+"&type="+type+"\";}catch(e){}");
out.println("window.close();");
out.println("</script>");
}else if("preppm".equalsIgnoreCase(operation)){
modeLayoutUtil.setRequest(request);
modeLayoutUtil.setUser(user);
Id = modeLayoutUtil.createDefaultLayout();
%>
<script language="javascript">
try{
window.opener.location.reload();
}catch(e){}
location.href = "/formmode/setup/LayoutEdit.jsp?ajax=1&opentype="+opentype+"&modeId=<%=modeId%>&formId=<%=formId%>&Id=<%=Id%>&type=<%=type%>&flag=<%=flag%>";
</script>
<%
}
%>