<!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/layuiadmin/layui/css/layui.css" media="all">
    <link rel="stylesheet" href="assets/layuiadmin/style/admin.css" media="all">
    <link rel="stylesheet" href="assets/js/vendor/codemirror/codemirror.css" media="all">
    <link rel="stylesheet" href="assets/js/vendor/codemirror/theme/blackboard.css" media="all">
</head>
<body>
<div class="layui-anim layui-anim-fadein">
    <div class="layui-card">
        <div class="layui-card-body" style="padding: 15px;">
            <form class="layui-form layui-form-pane" lay-filter="dataForm">
                <textarea id="exceptionSummary" name="exceptionSummary" class="layui-textarea" placeholder="请输入异常详情" disabled style="display: none;"></textarea>
            </form>
        </div>
    </div>
</div>
<script src="assets/js/vendor/codemirror/codemirror.js"></script>
<script src="assets/layuiadmin/layui/layui.js"></script>
<script>
    layui.config({
        base: 'assets/layuiadmin/' //静态资源所在路径
    }).extend({
        index: 'lib/index' //主入口模块
    }).use(['index', 'form'], function(){
        var $ = layui.$;
        var form = layui.form;
        var clientExceptionId = top.restAjax.params(window.location.href).clientExceptionId;

        function closeBox() {
            parent.layer.close(parent.layer.getFrameIndex(window.name));
        }

        // 初始化内容
        function initData() {
            var loadLayerIndex;
            top.restAjax.get(top.restAjax.path('api/clientexception/getclientexceptionbyid/{clientExceptionId}', [clientExceptionId]), {}, null, function(code, data) {
                var dataFormData = {};
                for(var i in data) {
                    dataFormData[i] = data[i] +'';
                }
                form.val('dataForm', dataFormData);
                form.render(null, 'dataForm');

                var codeMirror = CodeMirror.fromTextArea(document.getElementById('exceptionSummary'), {
                    theme: 'blackboard',
                    mode : 'text/x-java',
                    matchBrackets: true,
                    indentUnit : 4,
                    smartIndent : true,
                    tabSize : 4,
                    readOnly : true,
                    showCursorWhenSelecting : true,
                    lineNumbers : true
                });
                codeMirror.setSize('auto', '100%');
            }, 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();

        $('.close').on('click', function() {
            closeBox();
        });

        // 校验
        form.verify({
        });
    });
</script>
</body>
</html>