增加测试快捷键(Ctrl+Q)

修复保存bug
This commit is contained in:
吕金泽 2019-07-23 13:15:08 +08:00
parent 6b4c39e756
commit 13ea2099c4
3 changed files with 14 additions and 14 deletions

View File

@ -25,8 +25,9 @@ public class SpiderFlowController {
}
@RequestMapping("/save")
public void save(SpiderFlow spiderFlow){
public String save(SpiderFlow spiderFlow){
spiderFlowService.save(spiderFlow);
return spiderFlow.getId();
}
@RequestMapping("/get")

View File

@ -17,8 +17,8 @@
<div class="toolbar-container">
<ul>
<li class="btn-return">返回</li>
<li class="btn-save">保存</li>
<li class="btn-test">测试</li>
<li class="btn-save" title="Ctrl+S">保存</li>
<li class="btn-test" title="Ctrl+Q">测试</li>
<li class="btn-console-xml">打印XML</li>
<li class="btn-copy" title="Ctrl+C">复制</li>
<li class="btn-paste" title="Ctrl+V">粘贴</li>

View File

@ -558,6 +558,12 @@ $(function(){
keyHandler.bindControlKey(86,function(){ // Ctrl+V
editor.execute('paste')
});
keyHandler.bindControlKey(83,function(){ // Ctrl+S
Save();
});
keyHandler.bindControlKey(81,function(){ // Ctrl+S
$(".btn-test").click();
});
}
function createWebSocket(options){
@ -570,17 +576,18 @@ $(function(){
}
return socket;
}
var flowId;
function Save(){
$.ajax({
url : 'spider/save',
type : 'post',
data : {
id : getQueryString('id'),
id : getQueryString('id') || flowId,
xml : getXML(editor),
name : editor.graph.getModel().getRoot().data.get('spiderName') || '未定义名称',
},
success : function() {
success : function(id) {
flowId = id;
layui.layer.msg('保存成功', {
time : 800
}, function() {
@ -590,12 +597,4 @@ $(function(){
})
}
window.addEventListener("keydown", function(e) {
// 可以判断是不是mac如果是mac,ctrl变为花键 按 ctrl+s是保存流程图
if (e.keyCode == 83 && (navigator.platform.match("Mac") ? e.metaKey : e.ctrlKey)) {
e.preventDefault();
Save();
}
}, false);
});