地质所 沉降监测网建设项目
zmk
2024-05-15 9e3afc6d0fa514f986d3fea40fa23124e6fb5070
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
<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
    <th:block th:include="include :: header('修改模板')" />
</head>
<body class="white-bg">
    <div class="wrapper wrapper-content animated fadeInRight ibox-content">
        <form class="form-horizontal m" id="form-template-edit" th:object="${template}">
            <input name="templateId" th:field="*{templateId}" type="hidden">
            <div class="form-group">    
                <label class="col-sm-3 control-label">模板代码:</label>
                <div class="col-sm-8">
                    <input name="templateCode" th:field="*{templateCode}" required class="form-control" type="text">
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">模板分类:</label>
                <div class="col-sm-8">
                    <div class="radio-box" th:each="dict : ${@dict.getType('template_type')}">
                        <input type="radio" th:id="${'templateType_' + dict.dictCode}" name="templateType" th:value="${dict.dictValue}" th:field="*{templateType}">
                        <label th:for="${'templateType_' + dict.dictCode}" th:text="${dict.dictLabel}"></label>
                    </div>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">模板名称:</label>
                <div class="col-sm-8">
                    <input name="templateName" th:field="*{templateName}" required class="form-control" type="text">
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">模板内容:</label>
                <div class="col-sm-8">
                    <script id="editor" name="templateContent" type="text/plain" ></script>
                </div>
            </div>
            <textarea hidden="text" id="divdata">[[*{templateContent}]]</textarea>
        </form>
    </div>
    <th:block th:include="include :: footer" />
    <th:block th:include="include :: ueditor" />
 
    <script type="text/javascript">
        var ue = UE.getEditor('editor');
        function getContent() {
            return UE.getEditor('editor').getContent();
        }
        function getContentTxt() {
            return UE.getEditor('editor').getContentTxt();
        }
    </script>
 
    <script type="text/javascript">
        var prefix = ctx + "cms/template";
        $("#form-template-edit").validate({
            focusCleanup: true
        });
 
        function submitHandler() {
            if ($.validate.form()) {
 
                var c = getContentTxt();
                if (c == '' || c.length == 0) {
                    Fast.msg_error("请输入模板内容!");
                    return;
                }
 
                $.operate.save(prefix + "/edit", $('#form-template-edit').serialize());
            }
        }
 
        $(function(){
            $("#editor").css("height","380px");
 
            //给UEeditor赋值
            var data=$("#divdata").text();
            var ue = UE.getEditor('editor');
            var proinfo=$("#divdata").text();
            ue.ready(function() {//编辑器初始化完成再赋值
                ue.setContent(data);  //赋值给UEditor
            });
 
 
        })
 
    </script>
</body>
</html>