2
13693261870
2022-09-16 653761a31dfeb50dd3d007e892d69c90bf0cdafc
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
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
<!--
功能描述:后台管理 - 资源管理 - 资源发布 - 业务图层 - 图表设置
-->
<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.w3.org/1999/xhtml" layout:decorator="MasterPage/Layout.Empty"
      xmlns:layout="http://www.w3.org/1999/xhtml">
<head>
    <meta charset="UTF-8"/>
    <title th:text="'图表设置 - ' + ${systemName}"></title>
    <link rel="stylesheet" th:href="@{${pubzyWebRoot} + 'BootStrap4/assets/css/style.css'}"/>
    <link rel="stylesheet" th:href="@{${pubzyWebRoot} + 'BootStrap4/expand/css/bootstrap-extract.css'}"/>
    <link rel="stylesheet" th:href="@{${pubzyWebRoot} + 'BootStrap4/assets/plugins/bootstrap-datepicker/old_datepaker/datepicker.css'}"/>
    <link rel="stylesheet" th:href="@{${pubzyWebRoot} + 'BootStrap4/expand/plugins/portlet/css/portlet.css'}"/>
    <script th:src="@{${pubzyWebRoot} + 'BootStrap4/expand/plugins/portlet/portlet.js'}"></script>
    <!-- 表单样式  -->
    <script th:src="@{${pubzyWebRoot} + 'BootStrap4/assets/js/jquery.min.js'}"></script>
    <script th:src="@{${pubzyWebRoot} + 'BootStrap4/expand/plugins/layer/layer.js'}"></script>
    <script th:src="@{${pubzyWebRoot} + 'BootStrap4/assets/js/tether.min.js'}"></script>
    <script th:src="@{${pubzyWebRoot} + 'BootStrap4/assets/js/bootstrap.min.js'}"></script>
    <script th:src="@{${pubzyWebRoot} + 'echarts/echarts.min-3.0.js'}" type="text/javascript"></script>
    <script th:src="@{${pubzyWebRoot} + 'media/js/jquery.form-3.51.0.js'}"></script>
    <script th:src="@{${jspwebroot}+'utf8-jsp/ueditor.config.js'}"></script>
    <script th:src="@{${jspwebroot}+'utf8-jsp/ueditor.all.js'}"></script>
    <script th:src="@{${jspwebroot}+'utf8-jsp/lang/zh-cn/zh-cn.js'}"></script>
    <script th:src="@{${pubzyWebRoot} + 'media/js/winPro.js'}"></script>
    <style>
        .form-control {
            padding: 0.3rem 0.7rem;
            height: 34px;
            display: inline-block;
        }
 
        .control-label {
            padding-top: 0 !important;
            width: 94px;
            float: left;
            line-height: 30px;
            padding-right: 1.2em;
            text-align: right;
        }
 
        .control-group {
            margin-bottom: 1em;
        }
 
        .controls {
            margin-left: 94px;
        }
 
        .row {
            margin-left: 0;
            margin-right: 0;
        }
 
        .col-sm-3,
        .col-sm-6,
        .col-sm-12 {
            padding-left: 0;
            padding-right: 0;
        }
 
        #right_Div {
            width: 64%;
            margin-left: 35%;
        }
 
        #left_Div {
            width: 100%;
            /*float: left;*/
            /*border-left: 1px solid #E3E3E3;*/
            position: relative;
        }
 
        #bottom_button {
            position: fixed;
            bottom: 60px;
            margin-left: 10px;
        }
 
        .addSave {
            float: right;
            margin-right: 25px;
        }
 
        #tables_t tr {
            width: 100%;
            height: 40px;
        }
 
        #tables_t tr td, #table_t tr th {
            width: 33.3%;
            /*padding: 10px 50px;*/
        }
 
        #listTable {
            width: 98%;
            margin: 15px auto;
            border: 1px solid #E3E3E3;
        }
 
        #listTable tr {
            border-bottom: 1px solid #E3E3E3;
        }
 
        .list_name {
            text-align: center;
            vertical-align: middle;
            border-right: 1px solid #E3E3E3;
        }
 
        .configList {
            margin: 0;
            padding: 0;
        }
 
        .configList li {
            list-style: none;
            padding: 10px 10px;
            border-bottom: 1px solid #E3E3E3;
        }
 
        .deledit {
            padding: 2px 3px;
            /*float: right;*/
            margin-left: 10px;
            cursor: pointer;
            color: #039cfd;
            font-size: 18px;
        }
 
        #tables_t {
            margin: 0 1.5rem;
            border: 1px solid #E3E3E3;
        }
 
        #tables_t thead th,
        #tables_t tbody td{
            padding-left: 10px;
            border-right: 1px solid #E3E3E3;
        }
 
        #tables_t tr {
            border-bottom: 1px solid #E3E3E3;
        }
 
        #var_Div, #table_Div, #charts_Div {
            padding: 20px 0 55px 50px;
            position: relative;
            min-height: 508px;
        }
 
        #bottom_Div {
            clear: both;
            padding: 10px 0 30px 0;
        }
 
        .YaoSuJiShu {
            display: none;
        }
 
        .td_table {
            width: 100%;
        }
 
        #listTable .td_table tr {
            border: none;
            line-height: 35px;
        }
 
        #listTable .td_table tr:not(:last-child) {
            border-bottom: 1px solid #E3E3E3;
        }
 
        .saveBtn {
            width: 100%;
            position: absolute;
            height: 50px;
            background-color: white;
            bottom: 0;
            right: 0;
        }
 
        .saveBtn button {
            margin-left: 25px;
        }
    </style>
 
    <script th:inline="javascript">
        $(function () {
            var height = document.documentElement.clientHeight;
            $("#main_Div").css("min-height", height - 165);
        });
 
        //新增(常量、表格、图表)
        function showConfig(type) {
            var url = "/res/common/addserviceconfig?resourceid=" + $("#resMainInfoId").val() + "&type=" + type+"&settype=0";
            // window.location.replace(url);
            var area = ['800px', '550px'];
            if (type == "vars") {
                area = ['800px', '370px'];
            }else if(type =="charts"){
                area = ['820px', '610px'];
            }
            layer.open({
                type: 2,
                title: '添加配置',
                id: 'tianjia',
                shadeClose: true,
                shade: 0.7,
                maxmin: false, //开启最大化最小化按钮
                area: area,
                content: url
            });
        }
 
        //修改(常量、表格、图表)
        function showEditJson(name) {
            var url = "/res/common/addserviceconfig?resourceid=" + $("#resMainInfoId").val() + "&name=" + name +"&settype=0";
            // window.location.replace(url);
                layer.open({
                    type: 2,
                    title: '修改配置',
                    id: 'tianjia',
                    shadeClose: true,
                    shade: 0.7,
                    maxmin: false, //开启最大化最小化按钮
                    area: ['800px', '550px'],
                    content: url
                });
        }
 
        function checkKey() {
            var resourceid = $("#resMainInfoId").val();
            //编辑器内容
            var content = UE.getEditor('contents').getContent();
            $.ajax({
                url: '/res/common/matchKeyNotInHTML',
                type: 'post',
                dataType: 'text',
                data: {
                    resourceid: resourceid,
                    serviceHTML: htmlEncodeByRegExp(content)
                },
                success: function (data) {
                    if (data != "") {
                        if(confirm(data +"没添加到图形页面,将不会显示在页面上,是否继续保存当前配置?")) {
                            saveHtml();
                        }
                    }
                    else {
                        saveHtml();
                    }
                },
                error: function (e) {
                    saveHtml();
                }
            })
        }
 
        function saveHtml() {
            var resourceid = $("#resMainInfoId").val();
            //编辑器内容
            var content = UE.getEditor('contents').getContent();
            $.ajax({
                url: '/res/common/saveHtmlConfig',
                type: 'post',
                dataType: 'text',
                data: {
                    resourceid: resourceid,
                    serviceHTML: htmlEncodeByRegExp(content)
                },
                success: function (data) {
                    if (data == "success") {
                        alert("保存成功!");
                        window.location.replace("/res/common/serviceconfig?resourceid=" + $("#resMainInfoId").val());
                    }
                    else {
                        alert("保存失败!");
                    }
                },
                error: function (e) {
                    alert(e.message);
                }
            })
        }
 
        function delJson(name) {
            var resourceid = $("#resMainInfoId").val();
            $.ajax({
                url: '/res/common/delserviceconfig',
                type: 'post',
                dataType: 'text',
                data: {name: name, resourceid: resourceid},
                success: function (data) {
                    if (data == "success") {
                        alert("删除成功!");
                        window.location.replace("/res/common/serviceconfig?resourceid=" + $("#resMainInfoId").val());
                    }
                    else {
                        alert("删除失败!");
                    }
                },
                error: function (e) {
                    alert(e.message);
                }
            })
        }
 
    </script>
 
    <script th:inline="javascript">
        $(function () {
            var content = [[${serviceHTML}]];
            if (content == null) content = "";
            initEditor(content != "" ? htmlDecodeByRegExp(content) : "");
        })
 
        //实例化编辑器
        function initEditor(content) {
            UE.Editor.prototype._bkGetActionUrl = UE.Editor.prototype.getActionUrl;
            UE.Editor.prototype.getActionUrl = function (action) {
                if (action == 'uploadimage' || action == 'uploadfile') {
                    return "/res/common/uploadueditorfile";
                } else {
                    return this._bkGetActionUrl.call(this, action);
                }
            }
            //建议使用工厂方法getEditor创建和引用编辑器实例,如果在某个闭包下引用该编辑器,直接调用UE.getEditor('editor')就能拿到相关的实例
            var ue = UE.getEditor('contents', {
                toolbars: [
                    [
                        'source',
                        'undo', //撤销
                        'redo', //重做
                        '|',
                        'bold', //加粗
                        'italic', //斜体
                        'strikethrough', //删除线
                        'underline', //下划线
                        '|',
                        'forecolor', //字体颜色
                        'backcolor', //背景色
                        '|',
                        'insertorderedlist', //有序列表
                        'insertunorderedlist', //无序列表
                        '|',
                        'fontfamily', //字体
                        'fontsize', //字号
                        '|',
                        'justifyleft', //居左对齐
                        'justifyright', //居右对齐
                        'justifycenter', //居中对齐
                        'justifyjustify', //两端对齐
                        '|',
                        'link', //超链接
                        'unlink', //取消链接
                        '|',
                        'simpleupload' //单图上传
                    ]
                ],
                initialContent: content, //初始化显示内容
                initialFrameHeight: 300, //初始化高度
                enableAutoSave: false //是否启用自动保存
            });
        }
 
        //解码
        function htmlDecodeByRegExp(str) {
            var s = "";
            if (str.length == 0) return "";
            s = str.replace(/&amp;/g, "&");
            s = s.replace(/&lt;/g, "<");
            s = s.replace(/&gt;/g, ">");
            // s = s.replace(/&nbsp;/g, " ");
            s = s.replace(/&#39;/g, "\'");
            s = s.replace(/&quot;/g, "\"");
            return s;
        }
 
        //转码
        function htmlEncodeByRegExp(str) {
            var s = "";
            if (str.length == 0) return "";
            s = str.replace(/&/g, "&amp;");
            s = s.replace(/</g, "&lt;");
            s = s.replace(/>/g, "&gt;");
            // s = s.replace(/ /g, "&nbsp;");
            s = s.replace(/\'/g, "&#39;");
            s = s.replace(/\"/g, "&quot;");
            return s;
        }
 
 
        function OpenSheZhi() {
            var resMainInfoId = $("#resMainInfoId").val();
            var url = "/res/common/TuXingConfig?resourceid="+resMainInfoId;
            // winPro.openFullwin(url, "图表测试", "yes");
            openFullWindow(url, "图表测试");
 
        }
        function OpenEcharts() {
            var url = "/res/common/chartTemplat";
            layer.open({
                type: 2,
                title: '图表',
                id: 'zhoubian',
                shadeClose: true,
                shade: 0.7,
                maxmin: false, //开启最大化最小化按钮
                area: ['950px', '630px'],
                content: url
            });
        }
 
    </script>
</head>
<body>
<div id="rapp" layout:fragment="content" style="background-color: #fff;">
    <div id="curtain"
         style="position:fixed!important;z-index:100;width:100%;height:100%;opacity:0.7;bottom:70px;visibility:collapse;color:white;text-align:center;display:table;">
        <div id="uploading"
             style="height:100px;width:200px;background-color:black;color:white;margin:auto;text-align:center;font-size:larger;display:table-cell;vertical-align:middle">
            上传中
        </div>
    </div>
    <div id="div_content" style="width: 100%;">
        <div class="tabbable tabbable-custom" id="divTabsView">
            <div class="tab-content" id="divContent">
                <div class="tab-pane active" id="tabContent" style="overflow-y: auto;">
                    <div class="row-fluid">
                        <div class="span12">
                            <!--BEGIN TABS-->
                            <div class="tabbable tabbable-custom">
                                <ul class="nav nav-tabs" role="tablist">
                                    <li class="nav-item">
                                        <a class="nav-link active" href="#tab_MainInfo" data-toggle="tab">
                                            <div class="top_tabs_li">图表设置</div>
                                        </a>
                                    </li>
                                </ul>
                                <div class="tab-content" style="border-left: 1px solid #ddd;border-right:1px solid #ddd;border-bottom:1px solid #ddd;">
                                    <input type="hidden" id="resMainInfoId" th:value="${resourceid}"/>
                                    <input type="hidden" id="jsonname" th:value="${jsonname}"/>
                                    <div class="portlet box ltblue">
                                        <div class="portlet-title">
                                            图表设置信息
                                            <div class="caption">
                                                <i class="fa fa-reorder"></i>
                                            </div>
                                            <div class="tools">
                                                <a class="collapse" onclick="portlet_body_ShowOrHide(this);"></a>
                                            </div>
                                        </div>
                                        <div class="portlet-body" id="main_Div">
                                            <div>
                                                <div id="left_Div">
                                                    <div id="top_list">
                                                        <table id="listTable">
                                                            <thead>
                                                            <tr style="height: 35px;background-color: #ccc;">
                                                                <th class="list_name" style="width: 15%;">类型</th>
                                                                <th style="width: 85%;">
                                                                    <table style="width: 100%;">
                                                                        <thead>
                                                                        <tr style="border: none;height: 35px;">
                                                                            <th style="width: 25%;padding-left: 10px;border-right: 1px solid #e3e3e3;">
                                                                                标识
                                                                            </th>
                                                                            <th style="width: 55%;padding-left: 10px;border-right: 1px solid #e3e3e3;">
                                                                                说明
                                                                            </th>
                                                                            <th style="width: 20%;text-align: center;">
                                                                                操作
                                                                            </th>
                                                                        </tr>
                                                                        </thead>
                                                                    </table>
                                                                </th>
                                                            </tr>
                                                            </thead>
                                                            <tbody>
                                                            <tr>
                                                                <td class="list_name">常量<i class="fa fa-plus deledit" title="添加常量" onclick="showConfig('vars');"></i></td>
                                                                <td>
                                                                    <table class="td_table">
                                                                        <tbody>
                                                                        <tr th:each="item:${varsList}">
                                                                            <td style="width: 25%;padding-left: 10px;border-right: 1px solid #e3e3e3;">
                                                                                <span th:text="${item.key}"></span></td>
                                                                            <td style="width: 55%;padding-left: 10px;border-right: 1px solid #e3e3e3;">
                                                                                <span th:text="${item.explain}"></span>
                                                                            </td>
                                                                            <td style="width: 20%;text-align: center">
                                                                                <i class="fa fa-pencil-square-o deledit"
                                                                                   th:onclick="'javascript:showEditJson(\'' + ${item.key} + '\')'"
                                                                                   title="编辑"></i>
                                                                                <i class="fa fa-trash-o deledit"
                                                                                   th:onclick="'javascript:delJson(\'' + ${item.key} + '\')'"
                                                                                   title="删除"></i>
                                                                            </td>
                                                                        </tr>
                                                                        </tbody>
                                                                    </table>
                                                                </td>
                                                            </tr>
                                                            <tr>
                                                                <td class="list_name">表格<i class="fa fa-plus deledit" title="添加表格" onclick="showConfig('tables');"></i></td>
                                                                <td>
                                                                    <table class="td_table">
                                                                        <tbody>
                                                                        <tr th:each="item:${tablesList}">
                                                                            <td style="width: 25%;padding-left: 10px;border-right: 1px solid #e3e3e3;">
                                                                                <span th:text="${item.key}"></span></td>
                                                                            <td style="width: 55%;padding-left: 10px;border-right: 1px solid #e3e3e3;">
                                                                                <span th:text="${item.explain}"></span>
                                                                            </td>
                                                                            <td style="width: 20%;text-align: center">
                                                                                <i class="fa fa-pencil-square-o deledit"
                                                                                   th:onclick="'javascript:showEditJson(\'' + ${item.key} + '\')'"
                                                                                   title="编辑"></i>
                                                                                <i class="fa fa-trash-o deledit"
                                                                                   th:onclick="'javascript:delJson(\'' + ${item.key} + '\')'"
                                                                                   title="删除"></i>
                                                                            </td>
                                                                        </tr>
                                                                        </tbody>
                                                                    </table>
                                                                </td>
                                                            </tr>
                                                            <tr>
                                                                <td class="list_name">图表<i class="fa fa-plus deledit" title="添加图表" onclick="showConfig('charts');"></i></td>
                                                                <td>
                                                                    <table class="td_table">
                                                                        <tbody>
                                                                        <tr th:each="item:${chartsList}">
                                                                            <td style="width: 25%;padding-left: 10px;border-right: 1px solid #e3e3e3;">
                                                                                <span th:text="${item.key}"></span></td>
                                                                            <td style="width: 55%;padding-left: 10px;border-right: 1px solid #e3e3e3;">
                                                                                <span th:text="${item.explain}"></span>
                                                                            </td>
                                                                            <td style="width: 20%;text-align: center">
                                                                                <i class="fa fa-pencil-square-o deledit"
                                                                                   th:onclick="'javascript:showEditJson(\'' + ${item.key} + '\')'"
                                                                                   title="编辑"></i>
                                                                                <i class="fa fa-trash-o deledit"
                                                                                   th:onclick="'javascript:delJson(\'' + ${item.key} + '\')'"
                                                                                   title="删除"></i>
                                                                            </td>
                                                                        </tr>
                                                                        </tbody>
                                                                    </table>
                                                                </td>
                                                            </tr>
                                                            </tbody>
                                                        </table>
                                                    </div>
                                                </div>
                                            </div>
                                            <div id="bottom_Div">
                                                <div class="row">
                                                    <div class="col-sm-12">
                                                        <div class="control-group">
                                                            <div style="width: 98%;margin: auto;">
                                                                <!-- 加载编辑器的容器 -->
                                                                <script id="contents" name="contents" type="text/plain" class="col-sm-12" style="z-index: 0;"></script>
                                                                <p style="color:red;text-align: center;margin-top: 15px;">
                                                                    注:可填写字段如下:
                                                                    <span th:each="item:${varsList}"
                                                                          th:text="'{'+${item.key}+'} |'"></span>
                                                                    <span th:each="item:${tablesList}"
                                                                          th:text="'{'+${item.key}+'} |'"></span>
                                                                    <span th:each="item:${chartsList}"
                                                                          th:text="'{'+${item.key}+'} |'"></span>
                                                                </p>
                                                            </div>
                                                        </div>
                                                    </div>
                                                </div>
                                            </div>
                                        </div>
                                        <div class="form-actions navbar-fixed-bottom" style="z-index: 0;">
                                            <div style="float: left;">
                                                <button class="btn btn-primary" type="button" onclick="checkKey();">
                                                    <i class="fa fa-check"> </i> 保存
                                                </button>
                                                <input type="button" class="btn btn-primary" value="模板管理" onclick="OpenEcharts()" style="margin-left: 1px;"/>
                                                <button class="btn btn-primary" type="button" onclick="OpenSheZhi()">
                                                    <i class="fa fa-check-square"> </i> 预览
                                                </button>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
</body>
</html>