mirror of
https://gitee.com/smartchart/smartchart
synced 2025-05-05 00:59:25 +08:00
105 lines
4.5 KiB
HTML
105 lines
4.5 KiB
HTML
{% load static %}
|
|
<!DOCTYPE html>
|
|
<html>
|
|
<head>
|
|
<meta charset="utf-8"/>
|
|
<title>Template设计</title>
|
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
|
|
<meta http-equiv="X-UA-Compatible" content="chrome=1,IE=edge"/>
|
|
<meta name="viewport"
|
|
content="width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, user-scalable=0"/>
|
|
<link rel="icon" type="image.png" href="/static/images/favicon.ico">
|
|
<link rel="stylesheet" href="/static/bootstrap/css/bootstrap.min.css">
|
|
<link rel="stylesheet" href="/static/editor/editor.css">
|
|
</head>
|
|
|
|
<body>
|
|
<div class="container_fluid">
|
|
<div class="row_fluid">
|
|
<div class="col-xs-12 col-md-7" style="padding:0.5% 0.5%;">
|
|
<div class="NightTheme">
|
|
<div id="main_container">
|
|
<div id="core" class="core core_margin1">
|
|
<div class="editorSet clearfix">
|
|
<div>
|
|
<div class="editor">
|
|
<span class="label" id="idtitle"></span>
|
|
<span class="devhead"><span class="glyphicon glyphicon-adjust" style="color: rgb(255, 140, 60);"></span>
|
|
<select id="ace-theme">
|
|
</select></span><a class="submit-btn" id="submit">保存Template</a><span id="printlog" style="color:red"></span>
|
|
<a class="glyphicon glyphicon-question-sign" title="帮助" href="#"
|
|
style="color: rgb(155, 205, 60);float:right" onclick="load_help('help_template')"></a>
|
|
<a class="glyphicon glyphicon-certificate" title="开启实时调试" id="id_autohtml" href="#"
|
|
style="color: gray;float:right" onclick="auto_html()"></a>
|
|
<a class="glyphicon glyphicon-th" title="可视化布局" href="https://www.smartchart.cn/echart/layout/?id={{name}}"
|
|
style="color: green;float:right" target="_blank"></a>
|
|
<pre id="editor1" class="edit-area"></pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class="col-xs-12 col-md-5" style="padding:0.1% 0.1%;" id="preview">点击上方太阳标识可开启实时调试</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
|
|
</div>
|
|
|
|
<script src="/static/js/jquery-2.2.3.min.js"></script>
|
|
<script type="text/javascript" src="/static/ace/ace.js"></script>
|
|
<script type="text/javascript" src="/static/ace/ext-language_tools.js"></script>
|
|
<script type="text/javascript" src="/static/bootstrap/js/bootstrap.min.js"></script>
|
|
<script type="text/javascript" src="/static/editor/common.js"></script>
|
|
<script type="text/javascript">
|
|
editor1=init_editor('html');
|
|
get_template_editor();
|
|
var autoshow = false;
|
|
$('#submit').click(function () {
|
|
let e = editor1.getValue();
|
|
console.log(e);
|
|
$.ajax({
|
|
type: "POST",
|
|
url: "/echart/save_template/",
|
|
data: {dashid: GetQueryString('dashid'), div: e},
|
|
success: function (data) {
|
|
console.log(data);
|
|
$('#printlog').html(data['msg']);
|
|
if (GetQueryString('r')) {
|
|
try {
|
|
window.opener.location.reload();
|
|
// window.opener=null;window.close();
|
|
} catch (e) {
|
|
console.log('no opener');
|
|
}
|
|
}
|
|
}
|
|
});
|
|
});
|
|
editor1.getSession().on('change', function (e) {
|
|
if(autoshow){$("#preview").html(editor1.getValue());}
|
|
$("#printlog").html('');
|
|
});
|
|
|
|
function auto_html() {
|
|
autoshow = !autoshow;
|
|
if(autoshow){$('#id_autohtml').css('color', 'red')}else{$('#id_autohtml').css('color', 'gray')}
|
|
}
|
|
|
|
function get_template_editor() {
|
|
$.ajax({
|
|
type: "GET",
|
|
url: "/echart/get_template_editor/?dashid=" + GetQueryString('dashid'),
|
|
async:false,
|
|
success: function (data) {
|
|
editor1.setValue(data['div_str'])
|
|
$('#idtitle').html(data['name']);
|
|
}
|
|
});
|
|
}
|
|
|
|
</script>
|
|
</body>
|
|
</html> |