<%@ page language="java" import="java.util.*" pageEncoding="UTF-8" trimDirectiveWhitespaces="true"%>
|
<%@ taglib uri="http://shiro.apache.org/tags" prefix="shiro"%>
|
<%
|
String path = request.getContextPath();
|
String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort()
|
+ path + "/";
|
%>
|
|
<!DOCTYPE HTML>
|
<html>
|
<head>
|
<base href="<%=basePath%>">
|
<meta name="viewport" charset="width=device-width, initial-scale=1.0">
|
<meta http-equiv="X-UA-Compatible" content="ie=edge">
|
<title>阅读版式配置信息</title>
|
<link href="static/plugins/font-awesome/css/font-awesome.css" rel="stylesheet" type="text/css">
|
<link href="static/plugins/jquery-easyui/themes/bootstrap/easyui.css" rel="stylesheet" type="text/css">
|
<link rel="stylesheet" href="static/styles/initialize.css" type="text/css">
|
<link rel="stylesheet" href="static/styles/common.css" type="text/css">
|
<link rel="stylesheet" href="static/plugins/layer/skin/default/layer.css" type="text/css">
|
|
<script type="text/javascript" src="static/plugins/jquery/jquery.min.js"></script>
|
<script type="text/javascript" src="static/plugins/jquery-easyui/jquery.easyui.min.js"></script>
|
<script type="text/javascript" src="static/plugins/jquery-easyui/locale/easyui-lang-zh_CN.js"></script>
|
<script type="text/javascript" src="static/scripts/easyuiExtend.js"></script>
|
<script type="text/javascript" src="static/scripts/jquery-extend.js"></script>
|
<script type="text/javascript" src="static/plugins/layer/layer.js"></script>
|
<script type="text/javascript" src="static/plugins/slimScroll/jquery.slimscroll.min.js"></script>
|
<script type="text/javascript" src="static/plugins/jquery-easyui-datagrid-dnd/datagrid-dnd.js"></script>
|
<script src="static/plugins/ace/src-noconflict/ace.js" type="text/javascript"></script>
|
|
<!-- 弹窗加载组件 -->
|
<script type="text/javascript" src="static/plugins/layer/layer.js"></script>
|
<script type="text/javascript" src="static/plugins/spinjs/spin.js"></script>
|
<script type="text/javascript" src="static/plugins/spinjs/jquery.spin.js"></script>
|
<script type="text/javascript" src="static/plugins/jquery.blockUI.js"></script>
|
<!-- wcp组件 -->
|
<script type="text/javascript" src="static/wcp/scripts/wcp.js"></script>
|
<script type="text/javascript" src="static/wcp/scripts/libs/wcp.layer.js"></script>
|
<script type="text/javascript" src="static/wcp/scripts/libs/wcp.blockUI.js"></script>
|
<script type="text/javascript" src="static/wcp/scripts/libs/wcp.spin.js"></script>
|
<script type="text/javascript" src="static/wcp/scripts/libs/wcp.jquery.js"></script>
|
|
<!--[if lt IE 9]>
|
<script type="text/javascript" src="static/plugins/json2.js"></script>
|
<![endif]-->
|
<script type="text/javascript" src="static/wcp/scripts/libs/wcp.infoPicker.js"></script>
|
<style>
|
.combobox-group {
|
clear: both;
|
}
|
|
.combobox-gitem {
|
float: left;
|
padding-right: 10px;
|
}
|
|
.pt-form table {
|
margin: 20px auto 0 auto;
|
}
|
</style>
|
|
</head>
|
<body>
|
<div class="margin-lr">
|
<div class="pt-main-top clear">
|
<div class="pt-nav">
|
<span class="pt-title-icon">
|
<i class="fa fa-briefcase"></i>
|
</span>
|
<div class="pt-title">
|
<div>
|
<h4>阅读版式配置信息</h4>
|
</div>
|
</div>
|
</div>
|
</div>
|
<div class="pt-form">
|
<form id="formReading" method="post">
|
<div class="ptbody">
|
<input type="hidden" id="templateId" name="templateId" value="${reading.templateId } " />
|
<table style="width: 100%;">
|
<tr style="display: none">
|
<td class="tbtitle">所属模块:</td>
|
<td>
|
|
<input id="txt_ModuleName" name="moduleName" value="${reading.moduleName}" class="easyui-textbox" type="text" data-options="editable:false,buttonText:'选择模块',prompt:'',onClickButton:function(){selectModule();}" style="width:100%;" />
|
<input type="hidden" name="moduleId" value="${reading.moduleId }" id="txt_ModuleId" class="easyui-textbox">
|
</td>
|
</tr>
|
<tr>
|
<td class="tbtitle">
|
<em class="pt-color-danger">*</em>模板名称:
|
</td>
|
<td>
|
<input id="templateName" name="templateName" class="easyui-textbox" data-options="required:true" style="width:100%" value="${reading.templateName }" />
|
</td>
|
</tr>
|
<tr>
|
<td class="tbtitle">
|
<em class="pt-color-danger">*</em>数据源:
|
</td>
|
<td>
|
<input id="dataSource" name="dataSource" class="easyui-textbox" style="width:100%" value="${reading.dataSource }" data-options="required:true,buttonText:'选择表',prompt:'',onClickButton:function(){selectTable();}" />
|
<span class="pt-text-color"> 注:请输入完整的Sql语句,最后的主键条件用$keyId标注。</span>
|
</td>
|
</tr>
|
<tr>
|
<td class="tbtitle">模板内容:</td>
|
<td>
|
<div id="templateContentScriptDefaultHtml" style="display:none"></div>
|
|
<textarea name="templateContent" rows="2" cols="20" id="hid_templateContent" style="display: none;">
|
${reading.templateContent}
|
</textarea>
|
<pre id="templateContent" style="height:295px; width:100%;">
|
|
</pre>
|
<span class="pt-text-color"> 该模板内容使用Velocity语法,可使用的条件有:</span>
|
<span class="pt-text-color"> $dataMap:主数据源数据</span>
|
<span class="pt-text-color"> $attachMap:附件数据</span>
|
<span class="pt-text-color"> $basePath:Url基地址</span>
|
<span class="pt-text-color"> $dateTool:日期工具类</span>
|
<span class="pt-text-color"> $numberTool:数字工具类</span>
|
</td>
|
</tr>
|
</table>
|
</div>
|
</form>
|
<div class="pt-form-btn">
|
<div class="form-group">
|
<shiro:hasPermission name="SYS_CONFIG.MODULE.OPERATION.CONFIG.FORMATREADING.SAVE">
|
<button id="btnSave" class="pt-btn pt-btn-primary">保存</button>
|
</shiro:hasPermission>
|
<button id="btnClose" class="pt-btn pt-btn-default">关闭</button>
|
</div>
|
</div>
|
</div>
|
</div>
|
</body>
|
<script type="text/javascript" src="static/scripts/ResizeScroll.js"></script>
|
<script>
|
//窗口参数,用于弹窗传递
|
var params = {
|
callBack : null,
|
callBackParams : null
|
};
|
|
var editor_templateContentScript = null;
|
|
var moduleName = "${moduleName}";
|
var moduleId = "${moduleId}";
|
|
$(function() {
|
|
new ResizeScroll({
|
"id" : ".ptbody",
|
fun : function() {
|
var wh = $(window).height();
|
return (wh - 69 - 62);
|
|
}
|
});
|
|
if (moduleId != null && moduleId != "") {
|
$("#txt_ModuleId").textbox("setValue", moduleId);
|
}
|
|
if (moduleName != null && moduleName != "") {
|
$("#txt_ModuleName").textbox("setValue", moduleName);
|
}
|
|
//设置html表达式框
|
var templateContent = $("#hid_templateContent").val();
|
editor_templateContentScript = ace.edit("templateContent"); //其他样式框
|
editor_templateContentScript.setTheme("ace/theme/monokai");
|
editor_templateContentScript.session.setMode("ace/mode/html");
|
editor_templateContentScript.setFontSize(16);
|
editor_templateContentScript.session.setValue(templateContent);
|
var templateContentScriptDefaultHtml = $('#templateContentScriptDefaultHtml').html();
|
if (editor_templateContentScript.getValue().replace(/(^\s*)|(\s*$)/g, "") == "") {
|
editor_templateContentScript.session.setValue(templateContentScriptDefaultHtml);
|
}
|
|
|
$("#btnSave").click(function() {
|
//验证表单信息
|
var isValid = $('#formReading').form('validate');
|
if (!isValid) {
|
wcp.notify.warn('表单验证有误,请检查表单输入项!');
|
return false;
|
}
|
|
var objFormOperation = $("#formReading").serializeObject();
|
var templateContent = {
|
'templateContent' : editor_templateContentScript.getValue().replace(/(^\s*)|(\s*$)/g, "")
|
};
|
|
var obj = $.extend({}, objFormOperation, templateContent);
|
wcp.ui.setBusy("body", wcp.ajax({
|
url : "config/reading/saveReading",
|
data : JSON.stringify(obj),
|
}).done(function(result) {
|
//判断是否需要执行回调函数
|
if (params.callBack) {
|
if (params.callBackParams) {
|
params.callBack(params.callBackParams);
|
} else {
|
params.callBack();
|
}
|
}
|
|
//关闭窗口
|
closeWindow();
|
|
top.wcp.notify.success("保存成功!");
|
}));
|
});
|
|
|
$("#btnClose").click(function() {
|
closeWindow();
|
});
|
|
|
});
|
|
//选择数据源表名
|
function selectTable() {
|
moduleId = $("#txt_ModuleId").textbox("getValue");
|
wcp.picker.selectTable({
|
title : "请选择表名",
|
multiSelect : false,
|
moduleId : moduleId,
|
layerOpener : window
|
}, function(rows) {
|
var tableNames = "";
|
var primaryKey = "";
|
for (var i = 0; i < rows.length; i++) {
|
tableNames += rows[i].tableName + ",";
|
if (primaryKey == "") {
|
primaryKey = rows[i].primaryKey;
|
}
|
}
|
if (tableNames != "") {
|
tableNames = tableNames.substring(0, tableNames.length - 1);
|
var sql = "select * from " + tableNames + " where " + primaryKey + " = $keyId";
|
$("#dataSource").textbox("setValue", sql);
|
}
|
});
|
}
|
|
//选择模块
|
function selectModule() {
|
wcp.picker.selectModule({
|
title : "请选择模块",
|
multiSelect : false,
|
idElement : "txt_ModuleId",
|
nameElement : "txt_ModuleName",
|
layerOpener : window
|
});
|
}
|
|
|
function closeWindow() {
|
var index = top.layer.getFrameIndex(window.name); //获取窗口索引
|
top.layer.close(index);
|
}
|
</script>
|
</html>
|