增加测试快捷键(Ctrl+Q)
修复保存bug
This commit is contained in:
parent
6b4c39e756
commit
13ea2099c4
@ -25,8 +25,9 @@ public class SpiderFlowController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@RequestMapping("/save")
|
@RequestMapping("/save")
|
||||||
public void save(SpiderFlow spiderFlow){
|
public String save(SpiderFlow spiderFlow){
|
||||||
spiderFlowService.save(spiderFlow);
|
spiderFlowService.save(spiderFlow);
|
||||||
|
return spiderFlow.getId();
|
||||||
}
|
}
|
||||||
|
|
||||||
@RequestMapping("/get")
|
@RequestMapping("/get")
|
||||||
|
@ -17,8 +17,8 @@
|
|||||||
<div class="toolbar-container">
|
<div class="toolbar-container">
|
||||||
<ul>
|
<ul>
|
||||||
<li class="btn-return">返回</li>
|
<li class="btn-return">返回</li>
|
||||||
<li class="btn-save">保存</li>
|
<li class="btn-save" title="Ctrl+S">保存</li>
|
||||||
<li class="btn-test">测试</li>
|
<li class="btn-test" title="Ctrl+Q">测试</li>
|
||||||
<li class="btn-console-xml">打印XML</li>
|
<li class="btn-console-xml">打印XML</li>
|
||||||
<li class="btn-copy" title="Ctrl+C">复制</li>
|
<li class="btn-copy" title="Ctrl+C">复制</li>
|
||||||
<li class="btn-paste" title="Ctrl+V">粘贴</li>
|
<li class="btn-paste" title="Ctrl+V">粘贴</li>
|
||||||
|
@ -558,6 +558,12 @@ $(function(){
|
|||||||
keyHandler.bindControlKey(86,function(){ // Ctrl+V
|
keyHandler.bindControlKey(86,function(){ // Ctrl+V
|
||||||
editor.execute('paste')
|
editor.execute('paste')
|
||||||
});
|
});
|
||||||
|
keyHandler.bindControlKey(83,function(){ // Ctrl+S
|
||||||
|
Save();
|
||||||
|
});
|
||||||
|
keyHandler.bindControlKey(81,function(){ // Ctrl+S
|
||||||
|
$(".btn-test").click();
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function createWebSocket(options){
|
function createWebSocket(options){
|
||||||
@ -570,17 +576,18 @@ $(function(){
|
|||||||
}
|
}
|
||||||
return socket;
|
return socket;
|
||||||
}
|
}
|
||||||
|
var flowId;
|
||||||
function Save(){
|
function Save(){
|
||||||
$.ajax({
|
$.ajax({
|
||||||
url : 'spider/save',
|
url : 'spider/save',
|
||||||
type : 'post',
|
type : 'post',
|
||||||
data : {
|
data : {
|
||||||
id : getQueryString('id'),
|
id : getQueryString('id') || flowId,
|
||||||
xml : getXML(editor),
|
xml : getXML(editor),
|
||||||
name : editor.graph.getModel().getRoot().data.get('spiderName') || '未定义名称',
|
name : editor.graph.getModel().getRoot().data.get('spiderName') || '未定义名称',
|
||||||
},
|
},
|
||||||
success : function() {
|
success : function(id) {
|
||||||
|
flowId = id;
|
||||||
layui.layer.msg('保存成功', {
|
layui.layer.msg('保存成功', {
|
||||||
time : 800
|
time : 800
|
||||||
}, function() {
|
}, 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);
|
|
||||||
|
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user