v3.9.9.24

- 优化ACE兼容datav
- 模板开发界面增加编辑功能!!
- 修改图形自动建立数据集!!
- 新增数据集测试功能!!
- Echarts升级到5.2
This commit is contained in:
JohnYan 2021-10-29 18:44:03 +08:00
parent 3eb4590336
commit 85fcf45d24
10 changed files with 130 additions and 25 deletions

View File

@ -188,6 +188,7 @@ v3.9.9.10 DIV设定中可以写css,新增内置动态表格,优化布局支持
v3.9.9.12 优化后台数据处理性能,Jupyter使用体验
v3.9.9.16 新增模板编辑功能,增加嵌入报表TOKEN方式,优化编辑界面,优化连接池选择
v3.9.9.18 修复vue bug, 增加elementUI支持, 优化DataV开发体验
v3.9.9.24 模板开发界面增加编辑功能,自动建立数据集,新增数据集测试功能,Echarts升级到5.2
```
-------------------------------------------------------------------------------

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -3,7 +3,7 @@ var logstr='';
var helpText = '';
var vapp = {};
var autoshow = true;
function print(item){logstr+=item+";"}
function print(item){logstr+=JSON.stringify(item)+ "|"}
function GetQueryString(name) {
let reg = new RegExp('(^|&)' + name + '=([^&]*)(&|$)', 'i');
let r = window.location.search.substr(1).match(reg);
@ -23,10 +23,11 @@ function loadlcdataset(localcachestr){__dataset__=JSON.parse(sessionStorage.getI
function serverSave() { console.log('serversave');var e = gb.editor.getValue();console.log(e);
let dataid = GetQueryString('dataid') || '';
let divid = GetQueryString('divid') || '';
$.ajax({
type: "POST",
url: "/echart/savechart/",
data: { chartid: GetQueryString('chartid'),dataid: dataid,chart:e},
data: { chartid: GetQueryString('chartid'),divid: divid, dataid: dataid,chart:e},
success: function(data) {
console.log(data);
$('#printlog').html(data['msg']);

View File

@ -53,12 +53,58 @@ function theme_init(){
}
function insert_span() {
editor1.insert(`<el-row>
<el-col :span="24" >{{div_list.0|safe}}</el-col>
</el-row>`);
let reg = /basevue.html/i;
let e = editor1.getValue()
let r = e.match(reg);
reg = /div_list.(\d+)/g;
let desc = function(a, b){return b-a}
let seqList = [];
let maxSeq=0;
while(seq = reg.exec(e)){
seqList.push(parseInt(seq[1]))
}
if(seqList.length>0){console.log(seqList); seqList.sort(desc); maxSeq=seqList[0] + 1;
if(maxSeq!==seqList.length){alert('序号不连续,请检查'+ seqList);return} }
if(r){editor1.insert(`<el-row>
<el-col :span="24" >{{div_list.${maxSeq}|safe}}</el-col>
</el-row>`);} else {editor1.insert(`{{div_list.${maxSeq}|safe}}`)}
}
function insert_vue() {
editor1.insert(`var vapp = new Vue({el: '#vue_app', delimiters: ['{[', ']}'], data: {d0:'',d1:''},
});`)
}
function open_select(name) {
let sText=editor1.session.getTextRange(editor1.getSelectionRange());
let reg = /div_list.(\d+)/i;
let r = sText.match(reg);
let url = '';
if(r!=null) {
let dashid = GetQueryString('dashid');
let seq = r[1];
console.log(seq);
$.ajax({
type: "POST",
url: "/echart/get_dashinfo/",
data: {dashid:dashid, seq:seq},
success: function(data) {
console.log(data);
$('#printlog').html(data['msg']);
if(data.status===200) {
dashDict = data.dashDict;
if(name==='chart'){url= `/echart/editor_min/?chartid=${dashDict.chartid}&dataid=${dashDict.dsid}&divid=${dashDict.divid}`}
else if(name==='ds'){url= `/echart/ds_editor/?divid=${dashDict.divid}&dsid=${dashDict.dsid}&seq=${dashDict.seq}`}
else if(name==='div'){url= `/echart/div_editor/?divid=${dashDict.divid}`}
$('#iframepage').attr('src', url);
$('#modal_iframe').modal('show');
}else if(data.status===501){r=confirm(data.msg + ', 是否新增数据集?'); if(r===true){create_div(dashid)}}
}});
}else{$('#printlog').html('请选择正确的div_list');}}
function create_div(dashid) {
$.ajax({
type: "GET",
url: "/echart/create_div/?r=1&dashid=" + dashid,
success: function (data) {
if(data.status===200){alert('新增完成,请修改你的序号'); }
else{alert(data.msg)}
}
});
}

View File

@ -101,8 +101,21 @@ $('#conn').click(function () {
});
function dssq_init(qty){
for(let i=1;i<qty;i++) {
for(let i=0;i<qty;i++) {
$('#dsseq').append(`<option value="${i}">${i}</option>`);
}
$('#dsseq').val(seq);
}
$('#runsql').click(function () {let e = editor1.getValue();console.log(e);
$.ajax({
type: "POST",
url: "/echart/run_ds/",
data: { dsid: dsid, sqlstr:e},
success: function(data) {
console.log(data);
$('#printlog').html(data.msg);
$('#preview').html(JSON.stringify(data.data), data.data);
}
});
});

View File

@ -41,6 +41,9 @@
overflow-y: hidden;
background-color: rgb(44, 52, 55);
}
.editorSet .editor_min {
height: 300px;
}
.iframechart {
height: 400px;
}

View File

@ -6,7 +6,7 @@
{% block body %}{% endblock %}
</html><script type="text/javascript" src="/static/echart/dist/echarts.min.js"></script><script src="/static/echart/dist/china.js"></script><script src="/static/js/fun.js"></script><script src="/static/js/scroll.js"></script><script src="/static/echart/theme/{{theme}}"></script><script type="text/javascript" src="/static/bootstrap/js/bootstrap.min.js"></script>
{{footer|safe}}{% block javascript %}{% endblock %}
<script>function print(item){console.log(item)};$("#smartcharthead").on("click",function(){if($("#id_devhead").hasClass('devhead')){$("#id_devhead").removeClass('devhead');}else{$("#id_devhead").addClass('devhead')}});{% if dv %}var vapp = new Vue({el: '#vue_app', data: {d0:'',d1:'',d2:'',d3:'',d4:'',d5:'',d6:'',d7:'',d8:'',d9:'',d10:'',d11:'',d12:'',d13:'',d14:'',d15:'',d16:''}});{% endif %}var app = {};var charts = [];{{echart_main|safe}}window.onresize = function(){for(var i = 0; i < charts.length; i++){charts[i].resize();}};
<script>function print(item){console.log(item)};$("#smartcharthead").on("click",function(){if($("#id_devhead").hasClass('devhead')){$("#id_devhead").removeClass('devhead');}else{$("#id_devhead").addClass('devhead')}});{% if dv %}if("undefined" == typeof vapp){var vapp = new Vue({el: '#vue_app', data: {d0:'',d1:'',d2:'',d3:'',d4:'',d5:'',d6:'',d7:'',d8:'',d9:'',d10:'',d11:'',d12:'',d13:'',d14:'',d15:'',d16:''}})}{% endif %}var app = {};var charts = [];{{echart_main|safe}}window.onresize = function(){for(var i = 0; i < charts.length; i++){charts[i].resize();}};
$(function(){$("#fullScreen").on("click",function(){var isFull=!!(document.webkitIsFullScreen||document.mozFullScreen||document.msFullscreenElement||document.fullscreenElement);if(isFull===false){fullScreen()}else{exitFullscreen()}})});function fullScreen(){var element=document.documentElement;if(element.requestFullscreen){element.requestFullscreen()}else if(element.msRequestFullscreen){element.msRequestFullscreen()}else if(element.mozRequestFullScreen){element.mozRequestFullScreen()}else if(element.webkitRequestFullscreen){element.webkitRequestFullscreen()}}function exitFullscreen(){if(document.exitFullscreen){document.exitFullscreen()}else if(document.msExitFullscreen){document.msExitFullscreen()}else if(document.mozCancelFullScreen){document.mozCancelFullScreen()}else if(document.webkitExitFullscreen){document.webkitExitFullscreen()}}
$(".devspan span").on("click",function(){let devspana=$(".devspan a");if(devspana.hasClass('show')){devspana.removeClass('show')}else{devspana.addClass('show')}})</script>
<!--powered by smartchart.cn,Designed by JohnYan mailto:84345999@qq.com, https://gitee.com/smartchart/smartchart you need keep this-->

View File

@ -16,13 +16,13 @@
<body>
<div class="container_fluid">
<div class="row_fluid">
<div class="col-xs-12 col-md-12" style="padding:0.5% 0.5%;">
<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">
<div class="editor editor_min">
<a class="label" id="title" ></a>
<a class="glyphicon glyphicon-compressed" style="color: rgb(255, 140, 60);"
id="conn" href="#"></a>
@ -31,7 +31,7 @@
</select></span>
<span class="devhead"><span class="glyphicon glyphicon-map-marker" style="color: rgb(255, 140, 60);"></span>
<select id="dsseq"></select></span>
<span id="changedsseq"></span><a class="submit-btn" id="submit">保存数据集</a>
<span id="changedsseq"></span><a class="submit-btn" id="submit">保存数据集</a><a class="glyphicon glyphicon-play-circle" href="#" style="color: rgb(226, 207, 84);" id="runsql">执行</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_ds')"></a>
@ -40,11 +40,6 @@
<a class="glyphicon glyphicon-ok-sign" title="切换激活状态" id="onoff" href="#"
style="color: rgb(126, 255, 140);float:right"> </a>
<pre id="editor1" class="edit-area"></pre>
<span class="glyphicon glyphicon-tags"
style="color: rgb(255, 254, 170); font-size: 8px;">常规为三个字段(维度,维度,度量) 或 (维度,度量,度量...),参数可使用/* and xx = $PARAM */,不传参数据自动忽略
你也可以直接使用dataset=[[]] 或{}来赋值. 建意用SQL工具调试好后再贴入, 更多dataset使用方法,参考 <a
href="https://www.smartchart.cn/blog/article/2019/7/9/10.html"
target="_blank">数据集说明</a></span>
</div>
</div>
</div>
@ -52,7 +47,12 @@
</div>
</div>
</div>
<div class="col-xs-12 col-md-12" style="padding:0.5% 0.5%;height:100%;" id="preview"></div>
<div class="col-xs-12 col-md-5" style="padding:0.5% 0.5%;" id="preview">
<span class="glyphicon glyphicon-tags" style="font-size: 8px;"></span>常规为三个字段(维度,维度,度量) 或
(维度,度量,度量...),参数可使用/* and xx = $PARAM */,不传参数据自动忽略
你也可以直接使用dataset=[[]] 或{}来赋值. 预览执行默认限定条数200, 更多dataset使用方法,参考 <a
href="https://www.smartchart.cn/blog/article/2019/7/9/10.html" target="_blank">数据集说明</a>
</div>
</div>
</div>
<div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">

View File

@ -27,8 +27,11 @@
<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="#" onclick="insert_span()"
style="color: rgb(255, 140, 60);">图形</a><a class="glyphicon glyphicon-import" href="#" onclick="insert_vue()"
style="color: rgb(255, 140, 60);">VUE</a><a class="submit-btn" id="submit">保存Template</a><span id="printlog" style="color:red"></span>
style="color: rgb(255, 140, 60);">图形</a><a class="glyphicon glyphicon-pencil" href="#" onclick="open_select('ds')"
style="color: rgb(122, 210, 60);">数据集</a><a class="glyphicon glyphicon-pencil" href="#" onclick="open_select('chart')"
style="color: rgb(122, 210, 60);">图形</a><a class="glyphicon glyphicon-pencil" href="#" onclick="open_select('div')"
style="color: rgb(122, 210, 60);">布局</a><a class="glyphicon glyphicon-refresh" href="#" onclick="window.opener.location.reload()"
style="color: rgb(98, 98, 198);">刷新</a><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="#"
@ -50,6 +53,12 @@
<div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
</div>
<div class="modal fade" id="modal_iframe" tabindex="-1" role="dialog" aria-labelledby="myModalLabel_name"
aria-hidden="true">
<iframe id="iframepage" class="iframechart" frameborder="0" scrolling="auto" width="100%"></iframe>
</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>