<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <base th:href="${#request.getContextPath() + '/'}">
    <meta charset="utf-8">
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
    <link rel="stylesheet" href="assets/fonts/font-awesome/css/font-awesome.css"/>
    <link rel="stylesheet" href="assets/js/vendor/viewer/viewer.min.css">
    <link rel="stylesheet" href="assets/layuiadmin/layui/css/layui.css" media="all">
    <link rel="stylesheet" href="assets/layuiadmin/style/admin.css" media="all">
    <link rel="stylesheet" type="text/css" href="assets/js/vendor/viewer/viewer.min.css">
    <link rel="stylesheet" href="static/form-design/modules/cron.css"/>
    <link rel="stylesheet" href="static/form-design/modules/labelGeneration.css"/>
    <link rel="stylesheet" href="static/form-design/modules/formDesigner.css"/>
</head>

<body class="layui-fluid layui-layout-body">
<div style="height: 100%; width: 100%;" id="formdesigner"></div>
<script type="text/javascript" src="assets/layuiadmin/layui/layui.js"></script>
<script type="text/javascript" src="static/form-design/modules/Sortable/Sortable.js"></script>
<!--htmlformat 为js-beautify代码-->
<script type="text/javascript" src="static/form-design/js/htmlformat.js"></script>
<script type="text/javascript" src="static/form-design/js/jsformat.js"></script>
<script src="assets/js/vendor/viewer/viewer.min.js"></script>
<script>
    layui.config({
        base: 'static/form-design/modules/',
        version: true
    }).use(['layer', 'formDesigner'], function () {
        var formDesigner = layui.formDesigner;
        var formId = top.restAjax.params(window.location.href).formId;

        function initData() {
            var loadLayerIndex;
            top.restAjax.get(top.restAjax.path('api/form/get/{formId}', [formId]), {}, null, function(code, data) {
                var render = formDesigner.render({
                    data: JSON.parse(data.formSourceData),
                    elem: '#formdesigner',
                    formCode: data.formCode,
                    version: data.formVersion,
                    formName: data.formName,
                    formSummary: data.formSummary,
                    mainTitleTpl: data.mainTitleTpl,
                    formType: data.formType
                });
            }, function(code, data) {
                top.dialog.msg(data.msg);
            }, function() {
                loadLayerIndex = top.dialog.msg(top.dataMessage.loading, {icon: 16, time: 0, shade: 0.3});
            }, function() {
                top.dialog.close(loadLayerIndex);
            });
        }
        initData();
    });
</script>
</body>
</html>