excelUploadFormulaList.jsp
16.7 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
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
<%@ page language="java" contentType="text/html; charset=UTF-8" %>
<%@ include file="/systeminfo/init_wev8.jsp" %>
<%@ taglib uri="/WEB-INF/weaver.tld" prefix="wea"%>
<%
String isDetail = Util.null2String(request.getParameter("isDetail"));
String formulaKeys = Util.null2String(request.getParameter("formulaKeys"));
String from = Util.null2String(request.getParameter("from"));
String formulas = Util.null2String(request.getParameter("formulas"));
formulas = formulas.replaceAll(">","&at;");
formulas = formulas.replaceAll("'","&dy;");
%>
<HTML><HEAD>
<script type="text/javascript">
var isDetail = "<%=isDetail%>";
var parentWin = null;
var dialog = null;
try {
parentWin = parent.getParentWindow(window);
dialog = parent.getDialog(window);
} catch (e) {
}
function closeme() {
var superdialog = window.top.getDialog(window);
superdialog.closeByHand();
}
//编辑老版公式
function editOldFormula(__key, detailIndex) {
var _formulaObj = parentWin.isDetail==="on" ? parentWin.parentWin_Main.formulaObj : parentWin.formulaObj;
var srcformulatxt = _formulaObj.getOneFormula(__key);
paramtxt = encodeURIComponent(srcformulatxt);
var isDetail;
var detailIdenty;
if (detailIndex) {
isDetail = "on";
detailIdenty = detailIndex;
}
var url = "/workflow/exceldesign/excelUploadFormula.jsp?isDetail="+isDetail+"&detailIdenty="+detailIdenty+"¶mtxt="+paramtxt+"&from=list";
var formula_dialog = new window.top.Dialog();
formula_dialog.currentWindow = window;
window.top.formula_dialog = formula_dialog;
formula_dialog.Title = '<%=SystemEnv.getHtmlLabelNames("93,18125",user.getLanguage()) %>';
formula_dialog.Width = 630;
formula_dialog.Height = 550;
formula_dialog.Drag = true;
formula_dialog.Modal = true;
formula_dialog.normalDialog = false;
formula_dialog.URL = url;
formula_dialog.show();
formula_dialog.callbackfunc4CloseBtn=function(){ //点击关闭按钮,应还原之前的状态
formula_dialog.callbackfunc4CloseBtn = null;
formula_dialog.innerWin.setFormula(false);
}
formula_dialog.callbackfun=function(paramobj, result){
formula_dialog.callbackfunc4CloseBtn = null;
sheet = parentWin.getCurrentSheet();
var dataObj = parentWin.getCurrentDataObj();
var formulaStr = jQuery.trim(result.formula);
var _formulaObj = parentWin.isDetail==="on" ? parentWin.parentWin_Main.formulaObj : parentWin.formulaObj;
var cellletter = __key.substring(__key.indexOf(".FORMULA") + 8);
var cellIndex = parentWin.formulaOperate.getCellIndexByLetterFace(sheet, cellletter);
var ar;
var ac;
if (cellIndex) {
var cellArray = cellIndex.split(",");
if (cellArray.length == 2) {
ar = cellArray[0];
ac = cellArray[1];
}
}
//公式清除
_formulaObj.delOneFormula(__key);
parentWin.formulaOperate.controlFormulaSignFace(sheet, ar, ac, "remove");
if(dataObj.ecs[ar+","+ac].formula)
delete dataObj.ecs[ar+","+ac].formula;
if(!formulaStr){
refresh();
return;
}
//公式保存
try{
sheet.isPaintSuspended(true);
_formulaObj.setOneFormula(__key, formulaStr);
parentWin.formulaOperate.controlFormulaSignFace(sheet, ar, ac, "add");
sheet.isPaintSuspended(false);
//理论上明细点击关闭应去掉明细设置的公式,暂未实现
//if(isDetail === "on")
// detailFormulaTempAry.push(__key);
parentWin.setCellProperties(ar+","+ac,"",{"formula":"y"});
}catch(e){
window.top.Dialog.alert(e.message);
}
refresh();
}
}
//编辑新版公式
function editNewFormula(__key) {
var _formulaObj = parentWin.isDetail==="on" ? parentWin.parentWin_Main.formulaObj : parentWin.formulaObj;
var srcformulatxt = _formulaObj.getOneFormula(__key);
var formid = dialog.formid;
var isbill = dialog.isbill;
var wfid = dialog.wfid;
paramtxt = encodeURIComponent(srcformulatxt);
var url = "/workflow/exceldesign/excelUploadFormulaNew.jsp?"+
"¶mtxt="+paramtxt+"&formid="+formid+"&isbill="+isbill+"&wfid="+wfid+"&from=list";
var formula_dialog = new window.top.Dialog();
formula_dialog.currentWindow = window;
window.top.formula_dialog = formula_dialog;
formula_dialog.Title = '<%=SystemEnv.getHtmlLabelNames("93,18125",user.getLanguage()) %>';
formula_dialog.Width = 800;
formula_dialog.Height = 700;
formula_dialog.Drag = true;
formula_dialog.Modal = true;
formula_dialog.normalDialog = false;
formula_dialog.URL = url;
formula_dialog.show();
formula_dialog.callbackfun=function(paramobj, result){
formula_dialog.callbackfunc4CloseBtn = null;
sheet = parentWin.getCurrentSheet();
var dataObj = parentWin.getCurrentDataObj();
var formulaStr = jQuery.trim(result.formula);
var _formulaObj = parentWin.isDetail==="on" ? parentWin.parentWin_Main.formulaObj : parentWin.formulaObj;
parentWin.formulaOperate.deleteFormulaAndSignFace(__key);
parentWin.formulaOperate.addFormulaAndSignFace(__key, formulaStr);
refresh();
}
}
//编辑公式
function editFormula(__key, detailIndex) {
if (__key.indexOf("#new#") > -1) {
editNewFormula(__key);
} else {
editOldFormula(__key, detailIndex);
}
}
function delFormula(id) {
if (id) {
var mes = confirm("<%=SystemEnv.getHtmlLabelName(82017,user.getLanguage()) %>");
if (mes == false) {
return;
}
parentWin.formulaOperate.deleteFormulaAndSignFace(id);
} else {
id = _xtable_CheckedCheckboxId();
if (!id) {
alert("<%=SystemEnv.getHtmlLabelName(384499,user.getLanguage()) %>");
return;
}
console.log("id:"+id);
var mes = confirm("<%=SystemEnv.getHtmlLabelName(82017,user.getLanguage()) %>");
if (mes == false) {
return;
}
if(id.match(/,$/)){
id = id.substring(0,id.length-1);
}
var keys = id.split(",");
for (var i = 0; i < keys.length; i++)
{
parentWin.formulaOperate.deleteFormulaAndSignFace(keys[i]);
}
}
refresh();
}
function addFormula() {
var dialog = parent.getDialog(window);
var formid = dialog.formid;
var isbill = dialog.isbill;
var wfid = dialog.wfid;
var url = "/workflow/exceldesign/excelUploadFormulaNew.jsp?"+
"&formid="+formid+"&isbill="+isbill+"&wfid="+wfid+"&from=list";
var formula_dialog = new window.top.Dialog();
formula_dialog.currentWindow = window;
window.top.formula_dialog = formula_dialog;
formula_dialog.Title = '<%=SystemEnv.getHtmlLabelNames("93,18125",user.getLanguage()) %>';
formula_dialog.Width = 800;
formula_dialog.Height = 700;
formula_dialog.Drag = true;
formula_dialog.Modal = true;
formula_dialog.normalDialog = false;
formula_dialog.URL = url;
formula_dialog.show();
formula_dialog.callbackfun=function(paramobj, result){
formula_dialog.callbackfunc4CloseBtn = null;
var formulaStr = jQuery.trim(result.formula);
var newKey = parentWin.formulaOperate.generateFormulaKeyFace();
parentWin.formulaOperate.addFormulaAndSignFace(newKey, formulaStr);
refresh();
}
}
function refresh() {
var from = "<%=from %>";
var formulaKeys;
if (from == "cell") {
formulaKeys = parentWin.formulaOperate.containsFormulaKeysFace();
}
if (!formulaKeys || formulaKeys.length == 0) {
$("#formulaKeys").val("");
} else {
$("#formulaKeys").val(formulaKeys.join("#_#"));
}
var _formulaObj = parentWin.isDetail==="on" ? parentWin.parentWin_Main.formulaObj : parentWin.formulaObj;
var formulas = _formulaObj.getFormulas();
if (formulas) {
$("#formulas").val(JSON.stringify(formulas));
} else {
$("#formulas").val("");
}
document.frmmain.submit();
}
</script>
<style type="text/css">
div p {text-align: left;margin-top:5px;margin-bottom: 5px;}
#_xTable .table{
max-height: 345px !important;
}
</style>
</HEAD>
<BODY style="overflow:hidden;">
<%@ include file="/systeminfo/RightClickMenuConent_wev8.jsp" %>
<%
RCMenuHeight += RCMenuHeightStep;
RCMenu += "{" + SystemEnv.getHtmlLabelName(611, user.getLanguage()) + ",javascript:addFormula(),_self}";
RCMenuHeight += RCMenuHeightStep;
RCMenuHeight += RCMenuHeightStep;
RCMenu += "{" + SystemEnv.getHtmlLabelName(91, user.getLanguage()) + ",javascript:delFormula(),_self}";
RCMenuHeight += RCMenuHeightStep;
RCMenuHeight += RCMenuHeightStep;
RCMenu += "{" + SystemEnv.getHtmlLabelName(309, user.getLanguage()) + ",javascript:closeme(),_self}";
RCMenuHeight += RCMenuHeightStep;
%>
<jsp:include page="/systeminfo/commonTabHead.jsp">
<jsp:param name="mouldID" value="workflow"/>
<jsp:param name="navName" value='<%=SystemEnv.getHtmlLabelNames("18125,320", user.getLanguage())%>'/>
</jsp:include>
<form name="frmmain" id="frmmain" method="post" action="/workflow/exceldesign/excelUploadFormulaList.jsp">
<input type="hidden" name="isDetail" id="isDetail" value="<%=isDetail%>">
<input type="hidden" name="formulaKeys" id="formulaKeys" value="<%=formulaKeys%>">
<input type="hidden" name="from" id="from" value="<%=from%>">
<input type="hidden" name="formulas" id="formulas" value='<%=formulas%>'>
<div class="zDialog_div_content" id="zDialog_div_content" style="height:450px;">
<table id="topTitle" cellpadding="0" cellspacing="0">
<tr>
<td></td>
<td class="rightSearchSpan" style="text-align:right; width:500px!important">
<span title="<%=SystemEnv.getHtmlLabelName(23036,user.getLanguage()) %>" class="cornerMenu"></span>
</td>
</tr>
</table>
<wea:layout type="2col">
<%
String attributes1 = "{'groupOperDisplay':'none','samePair':'subwfSetContentDivSame','groupDisplay':'','itemAreaDisplay':''}";
String attributes2 = "{'groupOperDisplay':'none','samePair':'subwfSetContentDivDiff','groupDisplay':'none','itemAreaDisplay':'none'}";
%>
<wea:group context='' attributes="<%=attributes1 %>">
<wea:item type="groupHead">
<input type=button class=addbtn style="margin-top:7px;" onclick="addFormula()" title="<%=SystemEnv.getHtmlLabelName(82,user.getLanguage())%>"></input>
<input type=button class=delbtn style="margin-top:7px;" onclick="delFormula()"title="<%=SystemEnv.getHtmlLabelName(23777,user.getLanguage())%>"></input>
</wea:item>
<wea:item attributes="{'isTableList':'true'}">
<wea:layout needImportDefaultJsAndCss="false" attributes="{'formTableId':'oTable'}">
<wea:group context="" attributes="{'groupDisplay':'none'}">
<wea:item attributes="{'isTableList':'true'}">
<!-- 分页列表 -->
<%
String encodeFormulas = URLEncoder.encode(formulas,"utf-8");
encodeFormulas = encodeFormulas.replaceAll("\\+","_add_");
String encodeKeys = URLEncoder.encode(formulaKeys,"utf-8");
String operateString= "";
operateString = "<operates width='20%'>";
operateString+=" <popedom isalwaysshow='true'></popedom> ";
operateString+=" <operate isalwaysshow='true' href='javascript:editFormula();' otherpara=\"column:key+column:detailIndex\" text='"+SystemEnv.getHtmlLabelName(93,user.getLanguage())+"' index='0'/>";
operateString+=" <operate isalwaysshow='true' href='javascript:delFormula()' text='"+SystemEnv.getHtmlLabelName(91,user.getLanguage())+"' index='1'/>";
operateString+="</operates>";
String tabletype="checkbox";
String tableString=""+
"<table pageId=\""+PageIdConst.WF_WORKFLOW_FORMULALIST+"\" datasource='weaver.workflow.exceldesign.ExcelFormulaList.getFormulaList' sourceparams='formulas:"+encodeFormulas+"+formulaKeys:"+encodeKeys+"' needPage='true' instanceid='formulaListTable' pagesize='"+PageIdConst.getPageSize(PageIdConst.WF_WORKFLOW_FORMULALIST,user.getUID())+"' tabletype='"+tabletype+"'>"+
" <checkboxpopedom id='formulaCheck' name='formulaCheck' showmethod=\"weaver.workflow.exceldesign.ExcelFormulaList.getCheckbox\" />"+
"<sql backfields='*' sqlform='tmptable' sqlorderby='key' sqlprimarykey='key' sqlsortway='asc' sqldistinct='true' />"+
operateString+
"<head>"+
"<col width='0%' hide=\"true\" transmethod='weaver.general.KnowledgeTransMethod.forHtml' text='' column='key'/>"+
"<col width='0%' hide=\"true\" transmethod='weaver.general.KnowledgeTransMethod.forHtml' text='' column='detailIndex'/>"+
"<col width='10%' transmethod='weaver.general.KnowledgeTransMethod.forHtml' text='"+SystemEnv.getHtmlLabelNames("18125,195",user.getLanguage())+"' column='formulaName'/>"+
"<col width='15%' text='"+SystemEnv.getHtmlLabelNames("383725,261",user.getLanguage())+"' column='assignPosition'/>"+
"<col width='25%' text='"+SystemEnv.getHtmlLabelNames("382975",user.getLanguage())+"' column='triggerAction'/>"+
"<col width='45%' text='"+SystemEnv.getHtmlLabelNames("18125,345",user.getLanguage())+"' column='formulaContent'/>"+
"</head>"+
"</table>";
%>
<wea:SplitPageTag tableString='<%=tableString %>' isShowTopInfo="false" mode="run"/>
<input type="hidden" name="pageId" id="pageId" value="<%= PageIdConst.WF_WORKFLOW_FORMULALIST %>"/>
</wea:item>
</wea:group>
</wea:layout>
</wea:item>
</wea:group>
</wea:layout>
</div>
</form>
<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" value="<%=SystemEnv.getHtmlLabelName(309, user.getLanguage())%>" id="zd_btn_clear" class="zd_btn_cancle" onclick="closeme()">
</wea:item>
</wea:group>
</wea:layout>
</div>
<%@ include file="/systeminfo/RightClickMenu_wev8.jsp" %>
</BODY>
</HTML>