mirror of
https://gitee.com/smartchart/smartchart
synced 2025-05-05 00:59:25 +08:00
- 增加模板有变更未保存提示
- 增加数据集未保存高亮提示 - 增加数据集选择执行部分脚本 - 修复智能数据集转化BUG - 优化保存模板重复提交的问题
This commit is contained in:
parent
05ca37c40a
commit
135c5d24bb
26
README.md
26
README.md
@ -77,6 +77,9 @@
|
||||
pip3 install smartchart -U (升级)
|
||||
```
|
||||
|
||||
[SmartChart入门文档入口](https://gitee.com/smartchart/smartchart/wikis/ "SmartChart入门")
|
||||
|
||||
|
||||
### 应用场景一: 快速启动, 独立平台使用(推荐!)
|
||||
```shell script
|
||||
本地命令行启动:
|
||||
@ -86,7 +89,7 @@
|
||||
```
|
||||
**管理员帐号密码: admin/admin, 请及时更改密码**
|
||||
|
||||
[SmartChart入门文档入口](https://gitee.com/smartchart/smartchart/wikis/pages "SmartChart入门")
|
||||
[SmartChart入门文档入口](https://gitee.com/smartchart/smartchart/wikis/ "SmartChart入门")
|
||||
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
@ -99,21 +102,7 @@
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
### 应用场景三: 外部系统对接方式
|
||||
```python
|
||||
# 如果需要,你可以采用单点登录的方式与smartchart进行对接嵌入
|
||||
'/echart/smart_login?id=xxx&stamp=xxx&token=xxx&url=/'
|
||||
'''
|
||||
参数说明:
|
||||
id: 用户名(在smartchart平台中管理)
|
||||
stamp: 时间戳(1970年1月1日到生成时间的毫秒数)
|
||||
token: 采用sha1加密, token=SHA1(链接秘钥+stamp+id)
|
||||
链接秘钥默认smartchart,
|
||||
请在环境变量设定SMART_KEY替换(重要)
|
||||
url: 登录成功后跳转链接
|
||||
'''
|
||||
|
||||
# 提示:为了数据安全,对外生产环境使用,务必设定你的环境变量SMART_KEY
|
||||
```
|
||||
使用方法参考文档
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
### 应用场景四: 在django项目中当作apps使用
|
||||
@ -189,6 +178,7 @@ 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
|
||||
v3.9.9.25 增加变更未保存提示,数据集选择执行,优化保存模板重复提交的问题
|
||||
```
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
@ -204,9 +194,11 @@ v3.9.9.24 模板开发界面增加编辑功能,自动建立数据集,新增数
|
||||
- 但如果要使用好smart chart, 建意了解下javascript, H5, Echarts这些前端知识, 可以让你的应用更加得心应手,创作更炫的效果
|
||||
- 如果你需要更进一步订制你的数据, 你需要了解下SQL的使用,本项目高级应用语言都是通用的技能, 象js, h5,sql 学习成本低
|
||||
|
||||
- [SmartChart入门文档入口](https://gitee.com/smartchart/smartchart/wikis/pages "SmartChart入门")
|
||||
- [SmartChart入门文档入口](https://gitee.com/smartchart/smartchart/wikis/ "SmartChart入门")
|
||||
|
||||
**参考视屏,建意观看,有些可能有些久,可进入后关注作者头条号, 查看最新视屏, 请对比最新文档**
|
||||
|
||||
**产品迭代较快, 请关注作者头条号, 查看最新视屏!!!**
|
||||
- [Smartchart数据库与数据集SQL](https://www.ixigua.com/6910413586208653837?id=6902584882958959116 "SQL")
|
||||
- [Smartchart页面快速布局](https://www.ixigua.com/6910413586208653837?id=6907784122065191438 "布局")
|
||||
- [Smartchart数据库与图形的对话](https://www.ixigua.com/6910413586208653837?id=6910373199603565063 "布局")
|
||||
|
@ -1,202 +0,0 @@
|
||||
define("ace/snippets/javascript",["require","exports","module"], function(require, exports, module) {
|
||||
"use strict";
|
||||
|
||||
exports.snippetText = "# Prototype\n\
|
||||
snippet proto\n\
|
||||
${1:class_name}.prototype.${2:method_name} = function(${3:first_argument}) {\n\
|
||||
${4:// body...}\n\
|
||||
};\n\
|
||||
# Function\n\
|
||||
snippet fun\n\
|
||||
function ${1?:function_name}(${2:argument}) {\n\
|
||||
${3:// body...}\n\
|
||||
}\n\
|
||||
# Anonymous Function\n\
|
||||
regex /((=)\\s*|(:)\\s*|(\\()|\\b)/f/(\\))?/\n\
|
||||
snippet f\n\
|
||||
function${M1?: ${1:functionName}}($2) {\n\
|
||||
${0:$TM_SELECTED_TEXT}\n\
|
||||
}${M2?;}${M3?,}${M4?)}\n\
|
||||
# Immediate function\n\
|
||||
trigger \\(?f\\(\n\
|
||||
endTrigger \\)?\n\
|
||||
snippet f(\n\
|
||||
(function(${1}) {\n\
|
||||
${0:${TM_SELECTED_TEXT:/* code */}}\n\
|
||||
}(${1}));\n\
|
||||
# if\n\
|
||||
snippet if\n\
|
||||
if (${1:true}) {\n\
|
||||
${0}\n\
|
||||
}\n\
|
||||
# if ... else\n\
|
||||
snippet ife\n\
|
||||
if (${1:true}) {\n\
|
||||
${2}\n\
|
||||
} else {\n\
|
||||
${0}\n\
|
||||
}\n\
|
||||
# tertiary conditional\n\
|
||||
snippet ter\n\
|
||||
${1:/* condition */} ? ${2:a} : ${3:b}\n\
|
||||
# switch\n\
|
||||
snippet switch\n\
|
||||
switch (${1:expression}) {\n\
|
||||
case '${3:case}':\n\
|
||||
${4:// code}\n\
|
||||
break;\n\
|
||||
${5}\n\
|
||||
default:\n\
|
||||
${2:// code}\n\
|
||||
}\n\
|
||||
# case\n\
|
||||
snippet case\n\
|
||||
case '${1:case}':\n\
|
||||
${2:// code}\n\
|
||||
break;\n\
|
||||
${3}\n\
|
||||
\n\
|
||||
# while (...) {...}\n\
|
||||
snippet wh\n\
|
||||
while (${1:/* condition */}) {\n\
|
||||
${0:/* code */}\n\
|
||||
}\n\
|
||||
# try\n\
|
||||
snippet try\n\
|
||||
try {\n\
|
||||
${0:/* code */}\n\
|
||||
} catch (e) {}\n\
|
||||
# do...while\n\
|
||||
snippet do\n\
|
||||
do {\n\
|
||||
${2:/* code */}\n\
|
||||
} while (${1:/* condition */});\n\
|
||||
# Object Method\n\
|
||||
snippet :f\n\
|
||||
regex /([,{[])|^\\s*/:f/\n\
|
||||
${1:method_name}: function(${2:attribute}) {\n\
|
||||
${0}\n\
|
||||
}${3:,}\n\
|
||||
# setTimeout function\n\
|
||||
snippet setTimeout\n\
|
||||
regex /\\b/st|timeout|setTimeo?u?t?/\n\
|
||||
setTimeout(function() {${3:$TM_SELECTED_TEXT}}, ${1:10});\n\
|
||||
# Get Elements\n\
|
||||
snippet gett\n\
|
||||
getElementsBy${1:TagName}('${2}')${3}\n\
|
||||
# Get Element\n\
|
||||
snippet get\n\
|
||||
getElementBy${1:Id}('${2}')${3}\n\
|
||||
# console.log (Firebug)\n\
|
||||
snippet cl\n\
|
||||
console.log(${1});\n\
|
||||
# return\n\
|
||||
snippet ret\n\
|
||||
return ${1:result}\n\
|
||||
# for (property in object ) { ... }\n\
|
||||
snippet fori\n\
|
||||
for (var ${1:prop} in ${2:Things}) {\n\
|
||||
${0:$2[$1]}\n\
|
||||
}\n\
|
||||
# hasOwnProperty\n\
|
||||
snippet has\n\
|
||||
hasOwnProperty(${1})\n\
|
||||
# docstring\n\
|
||||
snippet /**\n\
|
||||
/**\n\
|
||||
* ${1:description}\n\
|
||||
*\n\
|
||||
*/\n\
|
||||
snippet @par\n\
|
||||
regex /^\\s*\\*\\s*/@(para?m?)?/\n\
|
||||
@param {${1:type}} ${2:name} ${3:description}\n\
|
||||
snippet @ret\n\
|
||||
@return {${1:type}} ${2:description}\n\
|
||||
# JSON.parse\n\
|
||||
snippet jsonp\n\
|
||||
JSON.parse(${1:jstr});\n\
|
||||
# JSON.stringify\n\
|
||||
snippet jsons\n\
|
||||
JSON.stringify(${1:object});\n\
|
||||
# self-defining function\n\
|
||||
snippet sdf\n\
|
||||
var ${1:function_name} = function(${2:argument}) {\n\
|
||||
${3:// initial code ...}\n\
|
||||
\n\
|
||||
$1 = function($2) {\n\
|
||||
${4:// main code}\n\
|
||||
};\n\
|
||||
}\n\
|
||||
# singleton\n\
|
||||
snippet sing\n\
|
||||
function ${1:Singleton} (${2:argument}) {\n\
|
||||
// the cached instance\n\
|
||||
var instance;\n\
|
||||
\n\
|
||||
// rewrite the constructor\n\
|
||||
$1 = function $1($2) {\n\
|
||||
return instance;\n\
|
||||
};\n\
|
||||
\n\
|
||||
// carry over the prototype properties\n\
|
||||
$1.prototype = this;\n\
|
||||
\n\
|
||||
// the instance\n\
|
||||
instance = new $1();\n\
|
||||
\n\
|
||||
// reset the constructor pointer\n\
|
||||
instance.constructor = $1;\n\
|
||||
\n\
|
||||
${3:// code ...}\n\
|
||||
\n\
|
||||
return instance;\n\
|
||||
}\n\
|
||||
# class\n\
|
||||
snippet class\n\
|
||||
regex /^\\s*/clas{0,2}/\n\
|
||||
var ${1:class} = function(${20}) {\n\
|
||||
$40$0\n\
|
||||
};\n\
|
||||
\n\
|
||||
(function() {\n\
|
||||
${60:this.prop = \"\"}\n\
|
||||
}).call(${1:class}.prototype);\n\
|
||||
\n\
|
||||
exports.${1:class} = ${1:class};\n\
|
||||
# \n\
|
||||
snippet for-\n\
|
||||
for (var ${1:i} = ${2:Things}.length; ${1:i}--; ) {\n\
|
||||
${0:${2:Things}[${1:i}];}\n\
|
||||
}\n\
|
||||
# for (...) {...}\n\
|
||||
snippet for\n\
|
||||
for (var ${1:i} = 0; $1 < ${2:Things}.length; $1++) {\n\
|
||||
${3:$2[$1]}$0\n\
|
||||
}\n\
|
||||
# for (...) {...} (Improved Native For-Loop)\n\
|
||||
snippet forr\n\
|
||||
for (var ${1:i} = ${2:Things}.length - 1; $1 >= 0; $1--) {\n\
|
||||
${3:$2[$1]}$0\n\
|
||||
}\n\
|
||||
\n\
|
||||
\n\
|
||||
#modules\n\
|
||||
snippet def\n\
|
||||
define(function(require, exports, module) {\n\
|
||||
\"use strict\";\n\
|
||||
var ${1/.*\\///} = require(\"${1}\");\n\
|
||||
\n\
|
||||
$TM_SELECTED_TEXT\n\
|
||||
});\n\
|
||||
snippet req\n\
|
||||
guard ^\\s*\n\
|
||||
var ${1/.*\\///} = require(\"${1}\");\n\
|
||||
$0\n\
|
||||
snippet requ\n\
|
||||
guard ^\\s*\n\
|
||||
var ${1/.*\\/(.)/\\u$1/} = require(\"${1}\").${1/.*\\/(.)/\\u$1/};\n\
|
||||
$0\n\
|
||||
";
|
||||
exports.scope = "javascript";
|
||||
|
||||
});
|
@ -12,8 +12,8 @@ $("#ace-theme").change(function () {
|
||||
});
|
||||
|
||||
function GetQueryString(name) {
|
||||
var reg = new RegExp('(^|&)' + name + '=([^&]*)(&|$)', 'i');
|
||||
var r = window.location.search.substr(1).match(reg);
|
||||
let reg = new RegExp('(^|&)' + name + '=([^&]*)(&|$)', 'i');
|
||||
let r = window.location.search.substr(1).match(reg);
|
||||
if (r != null) {
|
||||
return unescape(r[2]);
|
||||
}
|
||||
@ -39,7 +39,7 @@ function load_help(name) {
|
||||
}
|
||||
|
||||
function theme_init(){
|
||||
theme_option = `<option value="clouds">clouds</option>
|
||||
let theme_option = `<option value="clouds">clouds</option>
|
||||
<option value="monokai">monokai</option>
|
||||
<option value="chrome">chrome</option>
|
||||
<option value="github">github</option>
|
||||
@ -91,7 +91,7 @@ function open_select(name) {
|
||||
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);
|
||||
if(url!==$('#iframepage').attr('src')){$('#iframepage').attr('src', url)}
|
||||
$('#modal_iframe').modal('show');
|
||||
}else if(data.status===501){r=confirm(data.msg + ', 是否新增数据集?'); if(r===true){create_div(dashid)}}
|
||||
}});
|
||||
|
@ -3,12 +3,13 @@ var divid = GetQueryString('divid') || '';
|
||||
var on = GetQueryString('on') || '1';
|
||||
var dsname ='';
|
||||
var seq = GetQueryString('seq') || '';
|
||||
let mflag = false;
|
||||
|
||||
if(divid) {dssq_init(16);set_onoff();}else{$('#dsseq').css('display', 'None');$('#onoff').css('display', 'None');}
|
||||
|
||||
if(divid) {dssq_init(16);}else{$('#dsseq').css('display', 'None');}
|
||||
$.ajax({type: "get",url: '/echart/get_sqlstr/?dsid='+ dsid,success: function (data)
|
||||
{editor1.setValue(data['msg']);dsname=data['name'];$('#title').text('#'+seq+":"+dsid+dsname);$('#conn').text(data['connname']);} });
|
||||
if(divid){set_onoff();}else{$('#onoff').css('display', 'None');}
|
||||
editor1 = init_editor('sql');
|
||||
$.ajax({type: "get",async:false, url: '/echart/get_sqlstr/?dsid='+ dsid,success: function (data)
|
||||
{editor1.setValue(data['msg']); dsname=data['name'];$('#title').text('#'+seq+":"+dsid+dsname);$('#conn').text(data['connname']);} });
|
||||
|
||||
|
||||
function set_onoff() {
|
||||
@ -48,6 +49,8 @@ $('#submit').click(function () {let e = editor1.getValue();console.log(e);
|
||||
success: function(data) {
|
||||
console.log(data);
|
||||
$('#printlog').html(data['msg']);
|
||||
$('#submit').css('background-color', 'green');
|
||||
mflag = false;
|
||||
dsid = data['dsid'];
|
||||
dsname = data['dsname'];
|
||||
$('#title').text('#'+seq+":"+dsid+dsname);
|
||||
@ -58,12 +61,11 @@ $('#submit').click(function () {let e = editor1.getValue();console.log(e);
|
||||
else{window.opener.location.reload();}}
|
||||
catch (e) {console.log('no opener');}
|
||||
} // window.opener=null;window.close();
|
||||
// else{window.location.href="/echart/?type=z.chart&dev=1&dataset="+dsid }
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
editor1.getSession().on('change', function(e) {$("#printlog").html('');});
|
||||
editor1.getSession().on('change', function(e) {$("#printlog").html(''); mflag=true});
|
||||
|
||||
|
||||
$("#dsseq").change(function () {
|
||||
@ -107,15 +109,17 @@ function dssq_init(qty){
|
||||
$('#dsseq').val(seq);
|
||||
}
|
||||
|
||||
$('#runsql').click(function () {let e = editor1.getValue();console.log(e);
|
||||
$('#runsql').click(function () {
|
||||
let sText=editor1.session.getTextRange(editor1.getSelectionRange());
|
||||
if(sText.length < 10){sText = editor1.getValue();}
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: "/echart/run_ds/",
|
||||
data: { dsid: dsid, sqlstr:e},
|
||||
data: { dsid: dsid, sqlstr:sText},
|
||||
success: function(data) {
|
||||
console.log(data);
|
||||
$('#printlog').html(data.msg);
|
||||
$('#preview').html(JSON.stringify(data.data), data.data);
|
||||
if(mflag){$('#submit').css('background-color', 'red')}
|
||||
}
|
||||
});
|
||||
});
|
@ -84,8 +84,8 @@
|
||||
提交更改
|
||||
</button>
|
||||
</div>
|
||||
</div><!-- /.modal-content -->
|
||||
</div><!-- /.modal-dialog -->
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- 修改连接 -->
|
||||
<div class="modal fade" id="modal_conn" tabindex="-1" role="dialog" aria-labelledby="myModalLabel_conn"
|
||||
@ -114,8 +114,8 @@
|
||||
提交更改
|
||||
</button>
|
||||
</div>
|
||||
</div><!-- /.modal-content -->
|
||||
</div><!-- /.modal-dialog -->
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script src="/static/js/jquery-2.2.3.min.js"></script>
|
||||
|
@ -67,10 +67,14 @@
|
||||
<script type="text/javascript">
|
||||
editor1=init_editor('html');
|
||||
get_template_editor();
|
||||
var autoshow = false;
|
||||
let autoshow = false;
|
||||
let mflag = false;
|
||||
let insubmit = false;
|
||||
$('#submit').click(function () {
|
||||
let e = editor1.getValue();
|
||||
console.log(e);
|
||||
if(insubmit){alert('已提交处理中,不要重复点击');return}
|
||||
insubmit = true;
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: "/echart/save_template/",
|
||||
@ -78,6 +82,8 @@
|
||||
success: function (data) {
|
||||
console.log(data);
|
||||
$('#printlog').html(data['msg']);
|
||||
mflag=false;
|
||||
insubmit = false;
|
||||
if (GetQueryString('r')) {
|
||||
try {
|
||||
window.opener.location.reload();
|
||||
@ -92,6 +98,7 @@
|
||||
editor1.getSession().on('change', function (e) {
|
||||
if(autoshow){$("#preview").html(editor1.getValue());}
|
||||
$("#printlog").html('');
|
||||
mflag=true;
|
||||
});
|
||||
|
||||
function auto_html() {
|
||||
@ -110,7 +117,7 @@ function get_template_editor() {
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
window.onbeforeunload= function(event) {if(mflag){return '你有修改'}}
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
Loading…
x
Reference in New Issue
Block a user