numremind.jsp
13.1 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
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
<%@page import="net.sf.json.JSONObject"%>
<%@page import="com.weaver.formmodel.mobile.utils.MobileCommonUtil"%>
<%@ page contentType="text/html; charset=UTF-8"%>
<%@ page import="weaver.servicefiles.DataSourceXML"%>
<%@ include file="/mobilemode/admin/init.jsp"%>
<%
response.setHeader("cache-control", "no-cache");
response.setHeader("pragma", "no-cache");
response.setHeader("expires", "Mon 1 Jan 1990 00:00:00 GMT");
String type = Util.null2String(request.getParameter("remindtype"));
if(type.equals("")){
type = "1";
}
String sql = Util.null2String(request.getParameter("remindsql"));
String datasource = Util.null2String(request.getParameter("reminddatasource"));
String javafilename = Util.null2String(request.getParameter("remindjavafilename"));
String text = Util.null2String(request.getParameter("remindtext"));
String form = Util.null2String(request.getParameter("form"));
DataSourceXML dataSourceXML = new DataSourceXML();
List pointArrayList = dataSourceXML.getPointArrayList();
String apiConfigStr = MobileCommonUtil.decompressByLZ(Util.null2String(request.getParameter("remindapiconfig")));
JSONObject outFormat = null;
JSONObject apiConfig = null;
if(!"".equals(apiConfigStr)){
try{
JSONObject apiConfigObj = JSONObject.fromObject(apiConfigStr);
apiConfig = (JSONObject)apiConfigObj.get("apiConfig");
outFormat = (JSONObject)apiConfigObj.get("outFormat");
}catch(Exception e){
e.printStackTrace();
}
}
apiConfig = (apiConfig == null ? JSONObject.fromObject("{api: {},params: {query: [],body: {}}}") : apiConfig);
outFormat = (outFormat == null ? JSONObject.fromObject("{}") : outFormat);
%>
<html>
<head>
<title></title>
<link type="text/css" rel="stylesheet" href="/mobilemode/admin/src/common/css/common.css">
<link type="text/css" rel="stylesheet" href="/mobilemode/admin/src/appdesigner/appDesigner.css">
<script type="text/javascript" src="/formmode/js/jquery/jquery-1.8.3.min_wev8.js"></script>
<style>
body{
background: none;
}
select.form-control{
appearance: menulist-button;
-webkit-appearance:menulist-button;
-moz-appearance:menulist-button;
}
.codeEditFlag{
padding-right: 10px;
height: 16px;
cursor: pointer;
margin-left: 2px;
margin-top: 2px;
position: relative;
}
.valueContent{
display: none;
}
.area-control {
height: 100px;
}
.col-m-8 {
position: relative;
}
.helper {
position: absolute;
right: 5px;
top: 5px;
width: 14px;
height: 14px;
background: #666;
border-radius: 3px;
color: #fff;
text-align: center;
font-size: 14px;
font-family: Arial;
line-height: 14px;
cursor: pointer;
}
.helper:hover {
background: #999;
}
#tabs {
overflow: hidden;
margin-bottom: 2px;
border-bottom: 1px solid #d9d9d9;
display: none;
}
#tabs li {
float: left;
margin-right: 10px;
padding: 0px 16px;
line-height: 34px;
font-size: 14px;
color: #999;
height: 34px;
box-sizing: border-box;
cursor: pointer;
}
#tabs li.selected {
border-bottom: 2px solid #017afd;
color: #017afd;
}
#form-group-text{
display: none;
}
.form_Navigation #tabs{
display: block;
}
.form_Navigation .form-group{
display: none;
}
.tip{
padding-left: 65px;
word-break: break-all;
}
</style>
<script type="text/javascript">
var form = "<%=form%>";
var apiConfig = <%=apiConfig%>;
var apiResultKey = '<%=Util.null2String(outFormat.get("DATAS"))%>';
$(function() {
var type = <%=type%>;
var $cbObj;
if(type != 3){
$cbObj = $("input[type='checkbox'][name='type'][value='<%=type%>']");
}else{
$cbObj = $("input[type='checkbox'][name='type'][value='1']");
}
if($cbObj.length > 0){
$cbObj.attr("checked", "checked");
$cbObj.triggerHandler("click");
}
setApiName(apiConfig);
var selectApi = apiConfig.api || {};
var selectApiId = selectApi.id;
if(selectApiId){
getFieldOptionHtmlWithApi(selectApiId, apiResultKey, true, "", "api-resultkey");
}
require(["switcher"], function(){
$(".p-property").switcher();
});
require(["modal"], function(modal) {
$(".helper").on("click", function(e) {
modal.tips("SQL <%=SystemEnv.getHtmlLabelName(127577,user.getLanguage())%></br><%=SystemEnv.getHtmlLabelName(24533,user.getLanguage())%>:{curruser},<%=SystemEnv.getHtmlLabelName(126029,user.getLanguage())%>:{currdept},<%=SystemEnv.getHtmlLabelName(31131,user.getLanguage())%>:{currdate},<%=SystemEnv.getHtmlLabelName(25130,user.getLanguage())%>:{currtime},<%=SystemEnv.getHtmlLabelName(141,user.getLanguage())%>:{currdeptsub},<%=SystemEnv.getHtmlLabelName(82281,user.getLanguage())%>:{currdatetime}", $(this), {
area: ['250px', ''],
placement: "left"
});
e.stopPropagation();
});
$("body").on("click", function(e) {
var $target = $(e.target);
var layero = $target.parents(".layui-layer-tips");
if(layero.length) return;
modal.closeAll('tips');
});
});
top.require(["utils"], function(_u){
$("#api-browser, #api-name").on("click", function(){
_u.openRcDialog("api-config", {
title: SystemEnv.getHtmlNoteName(5239).replace(/[::]/g, ""),//接口配置
params: {
id: apiConfig.api.id||"",
config: apiConfig,
height: 506
}
}, function(result) {
var selectApi = result.api || {};
var selectApiId = selectApi.id,
selectApiName = selectApi.name;
apiConfig = result;
setApiName(apiConfig);
getFieldOptionHtmlWithApi(selectApiId, "", true, "", "api-resultkey");
});
});
$(".codeEditFlag").on("click", function(){
top.openCodeEdit({
"readonly": 1,
"type" : 4,
"filename" : $("#javafilename").val()
}, function(result){
if(result){
var fName = result["fileName"];
$("#javafilename_span").html(fName);
$("#javafilename").val(fName);
$(".codeDelFlag").show();
}
}, {btn: 'ok'});
});
});
$(".codeDelFlag").click(function(e){
if(confirm("<%=SystemEnv.getHtmlLabelName(127574,user.getLanguage())%>")){ //确定删除吗?
$("#javafilename_span").html("");
$("#javafilename").val("");
$(".codeDelFlag").hide();
}
e.stopPropagation();
});
if(form == "Navigation"){
$("#tabs").on("click", "li", function(){
if(!$(this).hasClass("selected")){
$(this).siblings("li.selected").removeClass("selected");
$(this).addClass("selected");
var tHref = $(this).attr("href");
$(tHref).siblings(".form-group").hide();
$(tHref).show();
}
});
$("#tabs").children("li").eq((type == "3") ? 1 : 0).trigger("click");
}
});
function getFieldOptionHtmlWithApi(apiId, defval, allowEmpty, filterKey, domid){
var that = this, theId = that.id;
if(!apiId) return;
top.require(["utils","i18n/lang"], function(_u,lang){
_u.api("api", {
action: "info",
data: {
id: apiId
}
}, function (result) {
apiResult = result.data;
var resultDefine = apiResult.resultDefine || [], data = [];
if(filterKey){
resultDefine.forEach(function(ele) {
var pname = ele.name;
if(pname !== filterKey && pname.substring(filterKey.length).indexOf(".") === 0){
data.push({
name: pname.substring(filterKey.length+1),
remark: ele.remark
});
}
});
}else{
data = resultDefine;
}
var optionHtml = "";
allowEmpty && (optionHtml += "<option value=\"\">"+SystemEnv.getHtmlNoteName(5324)+"</option>");//无(完整显示接口返回内容)
for(var i = 0; i < data.length; i++){
var field_name = data[i]["name"];
var label_name = lang.parse(data[i]["remark"]);
optionHtml+= "<option value=\""+field_name+"\"";
if(defval && field_name.toLowerCase()==defval.toLowerCase()){
optionHtml+= " selected = \"selected\" ";
}
optionHtml+= ">"+label_name+"</option>";
}
$("#"+domid).html(optionHtml);
});
});
}
function setApiName(apiConfig){
var selectApi = apiConfig.api || {};
var selectApiId = selectApi.id,
selectApiName = selectApi.name;
$("#api-name").text(selectApiName);
}
function fiexdUndefinedVal(v, defV){
if(typeof(v) == "undefined" || v == null){
if(defV){
return defV;
}else{
return "";
}
}
return v;
}
function changeSCT(cbObj){
setTimeout(function(){ //checkbox用了插件,不延时checkbox的checked状态获取不准确
var objV = cbObj.value;
$(".valueContent").hide();
$("#valueDiv_"+objV).show();
},100);
}
function onOK(){
if(top && top.callTopDlgHookFn){
var remindtype;
if(form == "Navigation" && $("#tabs li.selected").index() == 1){
remindtype = "3";
}else{
remindtype = $("input[type='checkbox'][name='type']:checked").val();
}
var api = {
apiConfig: apiConfig,
outFormat: {DATAS: $("#api-resultkey").val()}
}
var result = {
"remindtype" : remindtype,
"remindsql" : $("#sql").val(),
"reminddatasource" : $("#dataSource").val(),
"remindjavafilename" : $("#javafilename").val(),
"remindtext" : $("#text").val(),
"remindapiconfig" : JSON.stringify(api)
};
top.callTopDlgHookFn(result);
}
onClose();
}
function onClose(){
if(top && top.closeTopDialog){
top.closeTopDialog();
}else{
window.close();
}
}
</script>
</head>
<body class="form_<%=form%>">
<div style="padding: 0px 18px;" class="p-property">
<ul id="tabs">
<li href="#form-group-num"><%=SystemEnv.getHtmlLabelName(607,user.getLanguage())%></li> <!-- 数字 -->
<li href="#form-group-text"><%=SystemEnv.getHtmlLabelName(608,user.getLanguage())%></li> <!-- 文本 -->
</ul>
<div id="form-group-num" class="form-group">
<div class="row">
<span class="col-2 span-control"><%=SystemEnv.getHtmlNoteName(4185,user.getLanguage())%></span>
<div class="col-m-8">
<div class="multi-switch">
<span>
<input type="checkbox" name="type" value="1" onclick="changeSCT(this);"/><span class="cbboxLabel">SQL</span>
</span>
<% if("2".equals(type)){ %>
<span>
<input type="checkbox" name="type" value="2" onclick="changeSCT(this);"/><span class="cbboxLabel">Java</span>
</span>
<% } %>
<span>
<input type="checkbox" name="type" value="4" onclick="changeSCT(this);"/><span class="cbboxLabel"><%=SystemEnv.getHtmlNoteName(5268, user.getLanguage())%></span><!-- 接口 -->
</span>
</div>
</div>
</div>
<div id="valueDiv_1" class="valueContent">
<div class="row">
<span class="col-2 span-control"></span> <!-- 数据源: -->
<div class="col-m-8">
<select id="dataSource" class="form-control">
<option value="">(local)</option>
<%
for (int i = 0 ; pointArrayList != null && i < pointArrayList.size() ; i++) {
String pointid = Util.null2String(pointArrayList.get(i));
%>
<option value="<%=pointid%>" <%if(!"".equals(datasource) && datasource.equals(pointid)){%>selected<%}%>><%=pointid%></option>
<% } %>
</select>
</div>
</div>
<div class="row">
<span class="col-2 span-control">SQL:</span>
<div class="col-m-8">
<textarea id="sql" name="sql" class="area-control" placeholder="<%=SystemEnv.getHtmlLabelName(383347,user.getLanguage())%>"><%=sql %></textarea>
<!-- 请在此处输入SQL语句查询一个具体的数值 -->
<div class="helper" for="sql">?</div>
</div>
</div>
</div>
<% if("2".equals(type)){ %>
<div id="valueDiv_2" class="valueContent">
<div class="row" style="margin-bottom:0px;">
<span class="col-2 span-control">Java:</span>
<div class="col-m-8">
<span class="codeEditFlag">
<span id="javafilename_span"><%=javafilename %></span>
</span>
<input type="hidden" id="javafilename" name="javafilename" value="<%=javafilename %>"/>
</div>
</div>
<div class="row tip">
<%=SystemEnv.getHtmlNoteName(6000, user.getLanguage()).replace("#filename#", javafilename.replace(".java", ".class")) %>
</div>
</div>
<% } %>
<div id="valueDiv_4" class="valueContent">
<div class="row">
<div class="col-2 span-control"><%=SystemEnv.getHtmlNoteName(5239, user.getLanguage())%></div><!-- 接口配置: -->
<div class="col-m-8">
<div class="col api-browser pd-4 edit-before" id="api-browser" style="width:20px;text-align:left;"></div>
<div class="col ml-5 pd-7 link" id="api-name"></div>
</div>
</div>
<div class="row">
<div class="col-2 span-control"><%=SystemEnv.getHtmlNoteName(5485, user.getLanguage())%></div><!-- 输出格式: -->
<div class="col-m-8">
<div class="inline" style="width:45%;">
<select class="form-control" id="api-resultkey"></select>
</div>
<div class="inline" style="width:50%;">
<div class="outformat_key_desc" style="margin-left:10px;"><%=SystemEnv.getHtmlNoteName(4302, user.getLanguage())%></div><!-- 数据JSON对应KEY -->
</div>
</div>
</div>
</div>
</div>
<div id="form-group-text" class="form-group">
<div class="row">
<textarea id="text" name="text" class="area-control" style="height: 174px;" placeholder="<%=SystemEnv.getHtmlLabelName(383348,user.getLanguage())%>"><%=text %></textarea>
<!-- 请在此处输入任意文本,可以使用系统变量(如:{curruser}) 和 数据集(如:{data.name}) -->
</div>
</div>
</div>
</body>
</html>