多单位版国产化地质资料管理系统
zs
2025-12-18 4f0d9bde31a80f6279e26466250da7716eec627f
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
<%@ 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>