smartchart/templates/echart/div_editor.html
JohnYan b8406c19d2 v3.9.9.16
- 新增模板编辑功能(重点)
- 增加嵌入报表TOKEN方式
- 优化编辑界面
- 优化连接池选择
- 各类问题提示优化
2021-10-17 18:09:19 +08:00

113 lines
4.8 KiB
HTML

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8"/>
<title>DIV设计</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">{{name|safe}}</span>
<span class="devhead"><span class="glyphicon glyphicon-adjust" style="color: rgb(255, 140, 60);"></span>
<select id="ace-theme">
</select></span><a class="glyphicon glyphicon-import" href="#" id="load_sample1"
style="color: rgb(255, 140, 60);">DV</a><a class="glyphicon glyphicon-import" href="#" id="load_sample2"
style="color: #6ec2cf;">AB</a><span id="printlog" style="color:red"></span>
<a class="submit-btn" id="submit">保存DIV</a>
<a class="glyphicon glyphicon-question-sign" title="帮助"
style="color: rgb(155, 205, 60);float:right" onclick="load_help('help_div')"></a>
<a class="glyphicon glyphicon-magnet" title="复制数据集"
style="color: rgb(255, 140, 60);float:right" onclick="copy_ds()"></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');
editor1.setValue(`{{div_str|safe}}`);
$('#submit').click(function () {
let e = editor1.getValue();
console.log(e);
$.ajax({
type: "POST",
url: "/echart/save_div/",
data: {divid: GetQueryString('divid'), 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) {
$("#preview").html(editor1.getValue());
$("#printlog").html('');
});
function copy_ds() {
$.ajax({type:"GET",url:"/echart/copy_ds?divid="+GetQueryString('divid'),
success: function(data){
$('#printlog').html(data['msg']);
if(data['status']==='success'){try {window.opener.location.reload();} catch (e) {console.log('no opener');}
}
}
})
}
$("#load_sample1").click(function () {
$.ajax({
type: "get", url: 'https://www.smartchart.cn/smartdata/api/?i=datavsample',
success: function (data) {
editor1.setValue(editor1.getValue() + '\n\n' + data);
}
})
});
$("#load_sample2").click(function () {
$.ajax({
type: "get", url: 'https://www.smartchart.cn/smartdata/api/?i=datavsample2',
success: function (data) {
editor1.setValue(editor1.getValue() + '\n\n' + data);
}
})
});
</script>
</body>
</html>