界面右侧挪到底部

This commit is contained in:
mxd 2020-02-29 16:41:26 +08:00
parent 56883a38cb
commit acfb07ad65
9 changed files with 648 additions and 380 deletions

View File

@ -8,6 +8,9 @@ html,body{
overflow: hidden;
font-family: Microsoft YaHei;
}
.text-center{
text-align: center;
}
.main-container{
width : 100%;
height : 100%;
@ -17,12 +20,13 @@ html,body{
width : 46px;
left : 0px;
top : 30px;
bottom:0px;
bottom:300px;
max-height: 100%;
overflow: auto;
background: #F6F6F6;
z-index: 1;
border-radius: 2px;
overflow-x: hidden;
}
.main-container .sidebar-container::-webkit-scrollbar {
width: 3px;
@ -50,32 +54,53 @@ html,body{
background:#ccc;
}
.main-container .resize-container{
cursor: w-resize;
cursor: n-resize;
position: absolute;
right : 400px;
width : 10px;
height : 100%;
bottom : 290px;
width : 100%;
height : 20px;
background: transparent;
}
.editor-container,.xml-container{
position: absolute;
left : 38px;
right : 400px;
width : 100%;
top : 30px;
bottom : 0px;
bottom : 300px;
background-image: linear-gradient(90deg, rgba(153, 153, 153, 0.3) 1px, rgba(0, 0, 0, 0) 1px),linear-gradient(rgba(153, 153, 153, 0.3) 1px, rgba(0, 0, 0, 0) 1px);
background-size: 8px 8px;
overflow: auto;
}
.properties-container{
position: absolute;
right : 0px;
top:30px;
width : 100%;
bottom : 0px;
width : 400px;
height : 300px;
box-shadow: -2px 1px 3px #eee;
overflow: auto;
}
.properties-container .layui-table-cell{
height:32px;
line-height: 32px;
overflow: visible !important;
}
.properties-container .layui-table-box,.properties-container .layui-table-body {
overflow: visible;
}
.properties-container .layui-table-cell{
padding : 0 5px;
}
.properties-container .layui-table .layui-input-block{
margin-left:0px;
min-height: 32px;
height: 32px;
}
.properties-container .layui-table,.properties-container .layui-table-view{
margin-top:0px;
}
.properties-container .layui-table .layui-input,.properties-container .layui-table .layui-select,.properties-container .layui-table .layui-textarea{
height:32px;
}
.properties-container .editor-form-node .layui-form-relative{
position: relative;
}
@ -99,6 +124,10 @@ html,body{
top : 5px;
}
.properties-container .layui-tab{
margin : 0px;
}
.toolbar-container ul li{
float : left;
padding : 0 10px;

View File

@ -49,6 +49,67 @@
<div class="editor-container"></div>
<div class="resize-container"></div>
<div class="properties-container"></div>
</div>
</div>
<script type="text/html" id="parameter-name-tmpl">
<input type="text" name="parameter-name" placeholder="请输入参数名" autocomplete="off" class="layui-input array" value="{{=d['parameter-name']}}">
</script>
<script type="text/html" id="parameter-description-tmpl">
<input type="text" name="parameter-description" placeholder="请输入参数描述" autocomplete="off" class="layui-input array" value="{{=d['parameter-description']}}">
</script>
<script type="text/html" id="parameter-value-tmpl">
<div class="layui-input-block array" placeholder="请输入参数值" codemirror="parameter-value" data-value="{{=d['parameter-value']}}"></div>
</script>
<script type="text/html" id="parameter-type-tmpl">
<select name="parameter-form-type" class="array">
<option value="text" {{d['parameter-form-type'] == 'text' ? 'selected': '' }}">text</option>
<option value="file" {{d['parameter-form-type'] == 'file' ? 'selected': '' }}>file</option>
</select>
</script>
<script type="text/html" id="parameter-filename-tmpl">
<div class="layui-input-block array" placeholder="请输入文件名" codemirror="parameter-form-filename" data-value="{{=d['parameter-form-filename']}}"></div>
</script>
<script type="text/html" id="cookie-name-tmpl">
<input type="text" name="cookie-name" placeholder="请输入Cookie名" autocomplete="off" class="layui-input array" value="{{=d['cookie-name']}}">
</script>
<script type="text/html" id="cookie-description-tmpl">
<input type="text" name="cookie-description" placeholder="请输入Cookie描述" autocomplete="off" class="layui-input array" value="{{=d['cookie-description']}}">
</script>
<script type="text/html" id="cookie-value-tmpl">
<div class="layui-input-block array" placeholder="请输入Cookie值" codemirror="cookie-value" data-value="{{=d['cookie-value']}}"></div>
</script>
<script type="text/html" id="header-name-tmpl">
<input type="text" name="header-name" placeholder="请输入Header名" autocomplete="off" class="layui-input array" value="{{=d['header-name']}}">
</script>
<script type="text/html" id="header-description-tmpl">
<input type="text" name="header-description" placeholder="请输入Header描述" autocomplete="off" class="layui-input array" value="{{=d['header-description']}}">
</script>
<script type="text/html" id="header-value-tmpl">
<div class="layui-input-block array" placeholder="请输入Header值" codemirror="header-value" data-value="{{=d['header-value']}}"></div>
</script>
<script type="text/html" id="variable-name-tmpl">
<input type="text" name="variable-name" placeholder="请输入变量名" autocomplete="off" class="layui-input array" value="{{=d['variable-name']}}">
</script>
<script type="text/html" id="variable-description-tmpl">
<input type="text" name="variable-description" placeholder="请输入变量描述" autocomplete="off" class="layui-input array" value="{{=d['variable-description']}}">
</script>
<script type="text/html" id="variable-value-tmpl">
<div class="layui-input-block array" placeholder="请输入变量值" codemirror="variable-value" data-value="{{=d['variable-value']}}"></div>
</script>
<script type="text/html" id="output-name-tmpl">
<input type="text" name="output-name" placeholder="输出项" autocomplete="off" class="layui-input array" value="{{=d['output-name']}}">
</script>
<script type="text/html" id="output-value-tmpl">
<div class="layui-input-block array" codemirror="output-value" placeholder="输出值" data-value="{{=d['output-value']}}"></div>
</script>
<script type="text/html" id="common-operation">
<a class="layui-btn layui-btn-sm table-row-up">上移</a>
<a class="layui-btn layui-btn-sm table-row-down">下移</a>
<a class="layui-btn layui-btn-sm" lay-event="del">删除</a>
</script>
</body>
</html>

View File

@ -15,7 +15,10 @@
/* PADDING */
.CodeMirror-lines {
padding: 4px 0; /* Vertical padding around content */
padding: 8px 0; /* Vertical padding around content */
}
.layui-table .CodeMirror-lines {
padding: 0px 0; /* Vertical padding around content */
}
.CodeMirror pre.CodeMirror-line,
.CodeMirror pre.CodeMirror-line-like {

View File

@ -27,6 +27,22 @@ function renderCodeMirror(){
cms.push(cm);
});
}
function getCellData(cellId,keys){
var cell = editor.getModel().getCell(cellId);
var data = [];
var object = cell.data.object;
for(var k in keys){
var key = keys[k];
if(Array.isArray(object[key])){
var array = object[key];
for(var i =0,len = array.length;i<len;i++){
data[i] = data[i] || {};
data[i][key] = array[i];
}
}
}
return data;
}
function serializeForm(){
var cell = editor.getSelectedCell();
var shape = cell.data.get('shape');
@ -95,22 +111,20 @@ $(function(){
});
var resize = $('.resize-container')[0]
resize.onmousedown = function(e){
var startX = e.clientX;
resize.left = resize.offsetLeft;
var startY = e.clientY;
resize.top = resize.offsetTop;
var box = $("body")[0];
var maxT = box.clientHeight;
document.onmousemove = function(e){
var endX = e.clientX;
var moveLen = resize.left + (endX - startX);
var maxT = box.clientWidth - resize.offsetWidth;
if(moveLen<150) moveLen = 150;
var moveLen = e.clientY;
if(moveLen<250) moveLen = 250;
if(moveLen>maxT-150) moveLen = maxT-150;
if(box.clientWidth - moveLen < 400 || box.clientWidth - moveLen > 800){
/*if(box.clientHeight - moveLen < 400 || box.clientHeight - moveLen > 800){
return;
}
resize.style.left = moveLen + 'px';
$(".editor-container").css('right',($('body').width() - moveLen) + 'px')
$(".properties-container").width(box.clientWidth - moveLen - 5);
$(".xml-container").width($(".main-container").width() - $(".properties-container").width() - $(".sidebar-container").width() + 8);
}*/
resize.style.top = moveLen + 'px';
$(".editor-container,.sidebar-container,.xml-container").css('bottom',($('body').height() - moveLen) + 'px');
$(".properties-container").height(box.clientHeight - moveLen - 5);
}
document.onmouseup = function(evt){
document.onmousemove = null;
@ -132,7 +146,8 @@ $(function(){
data : cell.data,
value : cell.value,
flows : flows || [],
model : model
model : model,
cell : cell
},function(html){
$(".properties-container").html(html);
layui.form.render();
@ -168,6 +183,14 @@ $(function(){
layui.form.on('checkbox',function(e){
serializeForm();
});
layui.table.on('tool',function(obj){
layui.layer.confirm('您确定要删除吗?',{
title : '删除'
},function(index) {
obj.del();
layui.layer.close(index);
});
})
//节点名称输入框事件
$("body").on("mousewheel",".layui-tab .layui-tab-title",function(e,delta){
var $dom = $(this);
@ -206,30 +229,35 @@ $(function(){
}else{
serializeForm();
}
}).on("click",".editor-form-node .variable-add",function(){
var index = $(".draggable").length;
$(this).parent().parent().before('<div id="variable' + index + '" class="draggable" draggable="true" ondragstart="drag(event)" ondrop="drop(event)" ondragover="allowDrop(event)"><div class="layui-form-item layui-form-relative"><i class="layui-icon layui-icon-close variable-remove"></i><label class="layui-form-label">变量名</label><div class="layui-input-block"><input type="text" name="variable-name" placeholder="变量名称" autocomplete="off" class="layui-input array"></div></div><div class="layui-form-item"><label class="layui-form-label">变量值</label><div class="layui-input-block array" codemirror="variable-value" placeholder="请输入变量值"></div></div><hr></div>');
renderCodeMirror();
}).on("click",".editor-form-node .header-remove,.editor-form-node .cookie-remove,.editor-form-node .parameter-remove,.editor-form-node .variable-remove,.editor-form-node .output-remove",function(){ //移除多行
var $dom = $(this).parents(".draggable");
$dom.remove();
}).on("click",".table-row-add",function(){ //添加一行
serializeForm();
var tableId = $(this).attr('for');
var $table = $('#' + tableId);
var cellId = $table.data('cell');
var data = getCellData(cellId,$table.data('keys').split(","));
data.push({});
layui.table.reload(tableId,{
data : data
});
renderCodeMirror();
}).on("click",".table-row-up",function(){ //上移
var current = $(this).parent().parent().parent(); //获取当前<tr>
var prev = current.prev(); //获取当前<tr>前一个元素
if (current.index() > 0) {
current.insertBefore(prev); //插入到当前<tr>前一个元素前
serializeForm();
}
}).on("click",".table-row-down",function(){ //下移
var current = $(this).parent().parent().parent(); //获取当前<tr>
var next = current.next(); //获取当前<tr>后面一个元素
if (next) {
current.insertAfter(next); //插入到当前<tr>后面一个元素后面
serializeForm();
}
}).on("click",".editor-form-node .function-remove,.editor-form-node .cmd-remove",function () {
var $dom = $(this).parents(".draggable");
$dom.remove();
serializeForm();
}).on("click",".editor-form-node .header-add",function(){
var index = $(".draggable").length;
$(this).parent().parent().before('<div id="header' + index + '" class="draggable" draggable="true" ondragstart="drag(event)" ondrop="drop(event)" ondragover="allowDrop(event)"><div class="layui-form-item layui-form-relative"><i class="layui-icon layui-icon-close header-remove"></i><label class="layui-form-label">header名</label><div class="layui-input-block"><input type="text" name="header-name" placeholder="header key" autocomplete="off" class="layui-input array"></div></div><div class="layui-form-item"><label class="layui-form-label">header值</label><div class="layui-input-block array" codemirror="header-value" placeholder="请输入header value"></div></div><hr></div>');
renderCodeMirror();
}).on("click",".editor-form-node .parameter-add",function(){
var index = $(".draggable").length;
$(this).parent().parent().before('<div id="parameter' + index + '" class="draggable" draggable="true" ondragstart="drag(event)" ondrop="drop(event)" ondragover="allowDrop(event)"><div class="layui-form-item layui-form-relative"><i class="layui-icon layui-icon-close parameter-remove"></i><label class="layui-form-label">参数名</label><div class="layui-input-block"><input type="text" name="parameter-name" placeholder="请输入参数名" autocomplete="off" class="layui-input array"></div></div><div class="layui-form-item"><label class="layui-form-label">参数值</label><div class="layui-input-block array" codemirror="parameter-value" placeholder="请输入参数值"></div></div><hr></div>');
renderCodeMirror();
}).on("click",".editor-form-node .cookie-add",function(){
var index = $(".draggable").length;
$(this).parent().parent().before('<div id="cookie' + index + '" class="draggable" draggable="true" ondragstart="drag(event)" ondrop="drop(event)" ondragover="allowDrop(event)"><div class="layui-form-item layui-form-relative"><i class="layui-icon layui-icon-close cookie-remove"></i><label class="layui-form-label">Cookie名</label><div class="layui-input-block"><input type="text" name="cookie-name" placeholder="请输入Cookie名" autocomplete="off" class="layui-input array"></div></div><div class="layui-form-item"><label class="layui-form-label">Cookie值</label><div class="layui-input-block array" codemirror="cookie-value" placeholder="请输入Cookie值"></div></div><hr></div>');
renderCodeMirror();
}).on("click",".editor-form-node .cookie-batch",function(){
layui.layer.open({
type : 1,
@ -342,10 +370,6 @@ $(function(){
}
}
})
}).on("click",".editor-form-node .output-add",function(){
var index = $(".draggable").length;
$(this).parent().parent().before('<div id="output' + index + '"class="draggable" draggable="true" ondragstart="drag(event)" ondrop="drop(event)" ondragover="allowDrop(event)"><div class="layui-form-item layui-form-relative"><i class="layui-icon layui-icon-close output-remove"></i><label class="layui-form-label">输出项</label><div class="layui-input-block"><input type="text" name="output-name" placeholder="请输入输出项" autocomplete="off" class="layui-input array"></div></div><div class="layui-form-item"><label class="layui-form-label">输出值</label><div class="layui-input-block array" codemirror="output-value" placeholder="请输入输出值"></div></div></div>');
renderCodeMirror();
}).on("click",".editor-form-node .function-add",function(){
var index = $(".draggable").length;
$(this).parent().parent().before('<div id="function' + index + '" class="draggable" draggable="true" ondragstart="drag(event)" ondrop="drop(event)" ondragover="allowDrop(event)"><div class="layui-form-item layui-form-relative"><i class="layui-icon layui-icon-close function-remove"></i><label class="layui-form-label">执行函数</label><div class="layui-input-block array" codemirror="function" placeholder="执行函数"></div></div></div>');
@ -354,47 +378,7 @@ $(function(){
var index = $(".draggable").length;
$(this).parent().parent().before('<div id="' + index + '" class="draggable" draggable="true" ondragstart="drag(event)" ondrop="drop(event)" ondragover="allowDrop(event)"><div class="layui-form-item layui-form-relative"><i class="layui-icon layui-icon-close cmd-remove"></i><label class="layui-form-label">执行命令</label><div class="layui-input-block array" codemirror="cmd" placeholder="执行命令"></div></div></div>');
renderCodeMirror();
}).on("click",".parameter-form-add",function(){
var html = '';
html+='<div class="layui-form-item layui-form-relative">';
html+= '<i class="layui-icon layui-icon-close parameter-form-remove"></i>';
html+= '<label class="layui-form-label">参数名</label>';
html+= '<div class="layui-input-block">';
html+= '<input type="text" name="parameter-form-name" placeholder="请输入参数名" autocomplete="off" class="layui-input array">';
html+= '</div>';
html+='</div>';
html+='<div class="layui-form-item">';
html+= '<label class="layui-form-label">参数类型</label>';
html+= '<div class="layui-input-block">';
html+= '<select name="parameter-form-type" lay-filter="formType" class="array">';
html+= '<option value="text">text</option>';
html+= '<option value="file">file</option>';
html+= '</select>';
html+= '</div>';
html+='</div>';
html+='<div class="layui-form-item" style="display:none;">';
html+= '<label class="layui-form-label">文件名</label>';
html+= '<div class="layui-input-block array" codemirror="parameter-form-filename" placeholder="请输入文件名">';
html+= '</div>';
html+='</div>';
html+='<div class="layui-form-item">';
html+= '<label class="layui-form-label">参数值</label>';
html+= '<div class="layui-input-block array" codemirror="parameter-form-value" placeholder="请输入参数值">';
html+= '</div>';
html+='</div>';
html+='<hr>';
$(this).parent().parent().before(html);
renderCodeMirror();
layui.form.render();
}).on("click",".parameter-form-remove",function(){
var $dom = $(this).parent();
$dom.next().remove();
$dom.next().remove();
$dom.next().remove();
$dom.next().remove();
$dom.remove();
serializeForm();
});
})
layui.form.on('select(bodyType)',function(e){
var bodyType = $(e.elem).val();
$(".form-body-raw,.form-body-form-data").hide();
@ -407,16 +391,6 @@ $(function(){
renderCodeMirror();
serializeForm();
});
layui.form.on('select(formType)',function(e){
var $select = $(e.elem);
if($select.val() == 'file'){
$select.parents(".layui-form-item").next().show();
}else{
$select.parents(".layui-form-item").next().hide();
}
renderCodeMirror();
serializeForm();
})
layui.element.on('tab',function(){
for(var i=0;i<cms.length;i++){
cms[i].refresh();

View File

@ -5,35 +5,43 @@
<div class="layui-tab-content">
<div class="layui-tab-item layui-show">
<form class="layui-form editor-form-node" lay-filter="executesql-form">
<div class="layui-form-item">
<label class="layui-form-label">节点名称</label>
<div class="layui-input-block">
<input type="text" name="value" placeholder="请输入节点名称" value="{{=d.value}}" autocomplete="off" class="layui-input">
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">数据源</label>
<div class="layui-input-block">
<select name="datasourceId">
{{# layui.each(d.datasources,function(index,datasource){ }}
<option value="{{=datasource.id}}" {{datasource.id == d.data.object.datasourceId ? 'selected': ''}}>{{datasource.name}}</option>
{{# }) }}
</select>
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">语句类型</label>
<div class="layui-input-block">
<select name="statementType">
<option value="select" {{d.data.object.statementType == 'select' ? 'selected':''}}>select</option>
<option value="selectOne" {{d.data.object.statementType == 'selectOne' ? 'selected':''}}>selectOne</option>
<option value="selectInt" {{d.data.object.statementType == 'selectInt' ? 'selected':''}}>selectInt</option>
<option value="insert" {{d.data.object.statementType == 'insert' ? 'selected':''}}>insert</option>
<option value="delete" {{d.data.object.statementType == 'delete' ? 'selected':''}}>delete</option>
<option value="update" {{d.data.object.statementType == 'update' ? 'selected':''}}>update</option>
</select>
</div>
</div>
<div class="layui-row">
<div class="layui-col-md4">
<div class="layui-form-item">
<label class="layui-form-label">节点名称</label>
<div class="layui-input-block">
<input type="text" name="value" placeholder="请输入节点名称" value="{{=d.value}}" autocomplete="off" class="layui-input">
</div>
</div>
</div>
<div class="layui-col-md4">
<div class="layui-form-item">
<label class="layui-form-label">数据源</label>
<div class="layui-input-block">
<select name="datasourceId">
{{# layui.each(d.datasources,function(index,datasource){ }}
<option value="{{=datasource.id}}" {{datasource.id == d.data.object.datasourceId ? 'selected': ''}}>{{datasource.name}}</option>
{{# }) }}
</select>
</div>
</div>
</div>
<div class="layui-col-md4">
<div class="layui-form-item">
<label class="layui-form-label">语句类型</label>
<div class="layui-input-block">
<select name="statementType">
<option value="select" {{d.data.object.statementType == 'select' ? 'selected':''}}>select</option>
<option value="selectOne" {{d.data.object.statementType == 'selectOne' ? 'selected':''}}>selectOne</option>
<option value="selectInt" {{d.data.object.statementType == 'selectInt' ? 'selected':''}}>selectInt</option>
<option value="insert" {{d.data.object.statementType == 'insert' ? 'selected':''}}>insert</option>
<option value="delete" {{d.data.object.statementType == 'delete' ? 'selected':''}}>delete</option>
<option value="update" {{d.data.object.statementType == 'update' ? 'selected':''}}>update</option>
</select>
</div>
</div>
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">SQL语句</label>
<div class="layui-input-block" style="height:200px;" codemirror="sql" data-value="{{=d.data.object.sql}}"></div>

View File

@ -5,51 +5,71 @@
<div class="layui-tab-content">
<div class="layui-tab-item layui-show">
<form class="layui-form editor-form-node">
<div class="layui-form-item">
<label class="layui-form-label">节点名称</label>
<div class="layui-input-block">
<input type="text" name="value" placeholder="请输入节点名称" value="{{=d.value}}" autocomplete="off" class="layui-input">
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">循环变量</label>
<div class="layui-input-block">
<input type="text" name="loopVariableName" placeholder="请输入循环变量" autocomplete="off" class="layui-input input-default" value="{{=d.data.object.loopVariableName}}">
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">循环次数</label>
<div class="layui-input-block" codemirror="loopCount" placeholder="请输入循环次数" data-value="{{=d.data.object.loopCount}}"></div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">输出设置</label>
<div class="layui-input-block">
<input type="checkbox" title="输出全部参数" value="output-all" lay-skin="primary" {{d.data.object['output-all'] == '1' ? 'checked' : ''}}/>
</div>
</div>
{{# layui.each(d.data.object['output-name'],function(index,output){ }}
<div id="output{{=index}}" class="draggable" draggable="true" ondragstart="drag(event)" ondrop="drop(event)" ondragover="allowDrop(event)">
<hr>
<div class="layui-form-item layui-form-relative">
<i class="layui-icon layui-icon-close output-remove"></i>
<label class="layui-form-label">输出项</label>
<div class="layui-input-block">
<input type="text" name="output-name" placeholder="输出项" autocomplete="off" class="layui-input array" value="{{=d.data.object['output-name'][index]}}">
<div class="layui-row">
<div class="layui-col-md3">
<div class="layui-form-item">
<label class="layui-form-label">节点名称</label>
<div class="layui-input-block">
<input type="text" name="value" placeholder="请输入节点名称" value="{{=d.value}}" autocomplete="off" class="layui-input">
</div>
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">输出值</label>
<div class="layui-input-block array" codemirror="output-value" placeholder="输出值" data-value="{{=d.data.object['output-value'][index]}}"></div>
<div class="layui-col-md3">
<div class="layui-form-item">
<label class="layui-form-label">循环变量</label>
<div class="layui-input-block">
<input type="text" name="loopVariableName" placeholder="请输入循环变量" autocomplete="off" class="layui-input input-default" value="{{=d.data.object.loopVariableName}}">
</div>
</div>
</div>
<div class="layui-col-md3">
<div class="layui-form-item">
<label class="layui-form-label">循环次数</label>
<div class="layui-input-block" codemirror="loopCount" placeholder="请输入循环次数" data-value="{{=d.data.object.loopCount}}"></div>
</div>
</div>
<div class="layui-col-md3">
<div class="layui-form-item">
<label class="layui-form-label">输出设置</label>
<div class="layui-input-block">
<input type="checkbox" title="输出全部参数" value="output-all" lay-skin="primary" {{d.data.object['output-all'] == '1' ? 'checked' : ''}}/>
</div>
</div>
</div>
</div>
{{# }) }}
<table class="layui-table" id="spider-output" data-cell="{{=d.cell.id}}" data-keys="output-name,output-value"></table>
<hr>
<div class="layui-form-item">
<div class="layui-input-block">
<button class="layui-btn output-add" type="button">添加一个输出项</button>
<button class="layui-btn table-row-add" type="button" for="spider-output">添加一个输出项</button>
</div>
</div>
</form>
</div>
</div>
</div>
</div>
<script>
function renderSpiderOutput(data){
layui.table.render({
elem : '#spider-output',
cols : [[{
title : '输出项',
width : 150,
templet : '#output-name-tmpl'
},{
title : '输出值',
templet : '#output-value-tmpl'
},{
title : '操作',
width : 120,
align : 'center',
templet : '#common-operation'
}]],
data : data,
text : {
none : '暂未设置输出项'
}
})
}
renderSpiderOutput(getCellData({{d.cell.id}},$("#spider-output").data('keys').split(",")));
</script>

View File

@ -9,92 +9,108 @@
<div class="layui-tab-content editor-form-node">
<div class="layui-tab-item layui-show">
<form class="layui-form">
<div class="layui-form-item">
<label class="layui-form-label">节点名称</label>
<div class="layui-input-block">
<input type="text" name="value" placeholder="请输入节点名称" value="{{=d.value}}" autocomplete="off" class="layui-input">
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">循环变量</label>
<div class="layui-input-block">
<input type="text" name="loopVariableName" placeholder="请输入循环变量" autocomplete="off" class="layui-input input-default" value="{{=d.data.object.loopVariableName}}">
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">循环次数</label>
<div class="layui-input-block" codemirror="loopCount" placeholder="请输入循环次数" data-value="{{=d.data.object.loopCount}}"></div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">延迟时间</label>
<div class="layui-input-block">
<input type="text" name="sleep" placeholder="请输入延迟时间" autocomplete="off" class="layui-input input-default" value="{{=d.data.object.sleep}}">
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">超时时间</label>
<div class="layui-input-block">
<input type="text" name="timeout" placeholder="请输入超时时间" autocomplete="off" class="layui-input input-default" value="{{=d.data.object.timeout}}">
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">URL</label>
<div class="layui-input-block" codemirror="url" data-value="{{=d.data.object.url}}"></div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">页面编码</label>
<div class="layui-input-block">
<input type="text" name="response-charset" placeholder="请输入页面编码" autocomplete="off" class="layui-input input-default" value="{{=d.data.object['response-charset']}}">
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">代理</label>
<div class="layui-input-block" placeholder="host:port" codemirror="proxy" data-value="{{=d.data.object.proxy}}"></div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">请求方法</label>
<div class="layui-input-block">
<select name="method">
<option value="GET" {{d.data.object.method == 'GET' ? 'selected':''}}>GET</option>
<option value="POST" {{d.data.object.method == 'POST' ? 'selected':''}}>POST</option>
<option value="PUT" {{d.data.object.method == 'PUT' ? 'selected':''}}>PUT</option>
<option value="DELETE" {{d.data.object.method == 'DELETE' ? 'selected':''}}>DELETE</option>
<option value="PATCH" {{d.data.object.method == 'PATCH' ? 'selected':''}}>PATCH</option>
<option value="HEAD" {{d.data.object.method == 'HEAD' ? 'selected':''}}>HEAD</option>
<option value="OPTIONS" {{d.data.object.method == 'OPTIONS' ? 'selected':''}}>OPTIONS</option>
<option value="TRACE" {{d.data.object.method == 'TRACE' ? 'selected':''}}>TRACE</option>
</select>
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">请求设置</label>
<div class="layui-input-block">
<input type="checkbox" title="跟随重定向" value="follow-redirect" lay-skin="primary" {{d.data.object['follow-redirect'] == '0' ? '' : 'checked'}}/>
<input type="checkbox" title="TLS证书验证" value="tls-validate" lay-skin="primary" {{d.data.object['tls-validate'] == '0' ? '' : 'checked'}}/>
<input type="checkbox" title="自动管理Cookie" value="cookie-auto-set" lay-skin="primary" {{d.data.object['cookie-auto-set'] == '0' ? '' : 'checked'}}/>
</div>
</div>
<div class="layui-row">
<div class="layui-col-md4">
<div class="layui-form-item">
<label class="layui-form-label">节点名称</label>
<div class="layui-input-block">
<input type="text" name="value" placeholder="请输入节点名称" value="{{=d.value}}" autocomplete="off" class="layui-input">
</div>
</div>
</div>
<div class="layui-col-md4">
<div class="layui-form-item">
<label class="layui-form-label">循环变量</label>
<div class="layui-input-block">
<input type="text" name="loopVariableName" placeholder="请输入循环变量" autocomplete="off" class="layui-input input-default" value="{{=d.data.object.loopVariableName}}">
</div>
</div>
</div>
<div class="layui-col-md4">
<div class="layui-form-item">
<label class="layui-form-label">循环次数</label>
<div class="layui-input-block" codemirror="loopCount" placeholder="请输入循环次数" data-value="{{=d.data.object.loopCount}}"></div>
</div>
</div>
</div>
<div class="layui-row">
<div class="layui-col-md2">
<div class="layui-form-item">
<label class="layui-form-label">请求方法</label>
<div class="layui-input-block">
<select name="method">
<option value="GET" {{d.data.object.method == 'GET' ? 'selected':''}}>GET</option>
<option value="POST" {{d.data.object.method == 'POST' ? 'selected':''}}>POST</option>
<option value="PUT" {{d.data.object.method == 'PUT' ? 'selected':''}}>PUT</option>
<option value="DELETE" {{d.data.object.method == 'DELETE' ? 'selected':''}}>DELETE</option>
<option value="PATCH" {{d.data.object.method == 'PATCH' ? 'selected':''}}>PATCH</option>
<option value="HEAD" {{d.data.object.method == 'HEAD' ? 'selected':''}}>HEAD</option>
<option value="OPTIONS" {{d.data.object.method == 'OPTIONS' ? 'selected':''}}>OPTIONS</option>
<option value="TRACE" {{d.data.object.method == 'TRACE' ? 'selected':''}}>TRACE</option>
</select>
</div>
</div>
</div>
<div class="layui-col-md10">
<div class="layui-form-item">
<label class="layui-form-label">URL</label>
<div class="layui-input-block" codemirror="url" data-value="{{=d.data.object.url}}"></div>
</div>
</div>
</div>
<div class="layui-row">
<div class="layui-col-md4">
<div class="layui-form-item">
<label class="layui-form-label">延迟时间</label>
<div class="layui-input-block">
<input type="text" name="sleep" placeholder="请输入延迟时间" autocomplete="off" class="layui-input input-default" value="{{=d.data.object.sleep}}">
</div>
</div>
</div>
<div class="layui-col-md4">
<div class="layui-form-item">
<label class="layui-form-label">超时时间</label>
<div class="layui-input-block">
<input type="text" name="timeout" placeholder="请输入超时时间" autocomplete="off" class="layui-input input-default" value="{{=d.data.object.timeout}}">
</div>
</div>
</div>
<div class="layui-col-md4">
<div class="layui-form-item">
<label class="layui-form-label">页面编码</label>
<div class="layui-input-block">
<input type="text" name="response-charset" placeholder="请输入页面编码" autocomplete="off" class="layui-input input-default" value="{{=d.data.object['response-charset']}}">
</div>
</div>
</div>
</div>
<div class="layui-row">
<div class="layui-col-md4">
<div class="layui-form-item">
<label class="layui-form-label">代理</label>
<div class="layui-input-block" placeholder="host:port" codemirror="proxy" data-value="{{=d.data.object.proxy}}"></div>
</div>
</div>
<div class="layui-col-md8">
<div class="layui-form-item">
<label class="layui-form-label">请求设置</label>
<div class="layui-input-block">
<input type="checkbox" title="跟随重定向" value="follow-redirect" lay-skin="primary" {{d.data.object['follow-redirect'] == '0' ? '' : 'checked'}}/>
<input type="checkbox" title="TLS证书验证" value="tls-validate" lay-skin="primary" {{d.data.object['tls-validate'] == '0' ? '' : 'checked'}}/>
<input type="checkbox" title="自动管理Cookie" value="cookie-auto-set" lay-skin="primary" {{d.data.object['cookie-auto-set'] == '0' ? '' : 'checked'}}/>
</div>
</div>
</div>
</div>
</form>
</div>
<div class="layui-tab-item">
<form class="layui-form">
{{# layui.each(d.data.object['parameter-name'],function(index){ }}
<div class="layui-form-item layui-form-relative">
<i class="layui-icon layui-icon-close parameter-remove"></i>
<label class="layui-form-label">参数名</label>
<div class="layui-input-block">
<input type="text" name="parameter-name" placeholder="请输入参数名" autocomplete="off" class="layui-input array" value="{{=d.data.object['parameter-name'][index]}}">
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">参数值</label>
<div class="layui-input-block array" placeholder="请输入参数值" codemirror="parameter-value" data-value="{{=d.data.object['parameter-value'][index]}}"></div>
</div>
<hr>
{{# }) }}
<table class="layui-table" id="request-parameter" data-cell="{{=d.cell.id}}" data-keys="parameter-name,parameter-value,parameter-description"></table>
<div id="addParamterBtn" class="layui-form-item">
<div class="layui-input-block">
<button class="layui-btn parameter-add" type="button">添加一个参数</button>
<button class="layui-btn table-row-add" type="button" for="request-parameter">添加一个参数</button>
</div>
</div>
<div class="layui-form-item">
@ -106,25 +122,10 @@
</div>
<div class="layui-tab-item">
<form class="layui-form">
{{# layui.each(d.data.object['cookie-name'],function(index){ }}
<div id="cookie{{=index}}" class="draggable" draggable="true" ondragstart="drag(event)" ondrop="drop(event)" ondragover="allowDrop(event)">
<div class="layui-form-item layui-form-relative">
<i class="layui-icon layui-icon-close cookie-remove"></i>
<label class="layui-form-label">Cookie名</label>
<div class="layui-input-block">
<input type="text" name="cookie-name" placeholder="请输入Cookie名" autocomplete="off" class="layui-input array" value="{{=d.data.object['cookie-name'][index]}}">
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">Cookie值</label>
<div class="layui-input-block array" placeholder="请输入Cookie值" codemirror="cookie-value" data-value="{{=d.data.object['cookie-value'][index]}}"></div>
</div>
<hr>
</div>
{{# }) }}
<table class="layui-table" id="request-cookie" data-cell="{{=d.cell.id}}" data-keys="cookie-name,cookie-value,cookie-description"></table>
<div id="addCookieBtn" class="layui-form-item">
<div class="layui-input-block">
<button class="layui-btn cookie-add" type="button">添加一个Cookie</button>
<button class="layui-btn table-row-add" type="button" for="request-cookie">添加一个Cookie</button>
</div>
</div>
<div class="layui-form-item">
@ -136,25 +137,10 @@
</div>
<div class="layui-tab-item">
<form class="layui-form">
{{# layui.each(d.data.object['header-name'],function(index){ }}
<div id="header{{=index}}" class="draggable" draggable="true" ondragstart="drag(event)" ondrop="drop(event)" ondragover="allowDrop(event)">
<div class="layui-form-item layui-form-relative">
<i class="layui-icon layui-icon-close header-remove"></i>
<label class="layui-form-label">header名</label>
<div class="layui-input-block">
<input type="text" name="header-name" placeholder="请输入header名" autocomplete="off" class="layui-input array" value="{{=d.data.object['header-name'][index]}}">
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">header值</label>
<div class="layui-input-block array" placeholder="请输入header值" codemirror="header-value" data-value="{{=d.data.object['header-value'][index]}}"></div>
</div>
<hr>
</div>
{{# }) }}
<table class="layui-table" id="request-header" data-cell="{{=d.cell.id}}" data-keys="header-name,header-value,header-description"></table>
<div id="addHeaderBtn" class="layui-form-item">
<div class="layui-input-block">
<button class="layui-btn header-add" type="button">添加一个Header</button>
<button class="layui-btn table-row-add" type="button" for="request-header">添加一个Header</button>
</div>
</div>
<div class="layui-form-item">
@ -193,6 +179,7 @@
</div>
</div>
<div class="form-body-form-data" {{d.data.object['body-type'] != 'form-data' ? 'style="display:none;"':''}}>
<table class="layui-table" id="body-parameter" data-cell="{{=d.cell.id}}" data-keys="parameter-form-name,parameter-form-value,parameter-form-type,parameter-form-filename,parameter-form-description"></table>
{{# layui.each(d.data.object['parameter-form-name'],function(index){ }}
<div class="layui-form-item layui-form-relative">
<i class="layui-icon layui-icon-close parameter-form-remove"></i>
@ -204,15 +191,12 @@
<div class="layui-form-item">
<label class="layui-form-label">参数类型</label>
<div class="layui-input-block">
<select name="parameter-form-type" lay-filter="formType" class="array">
<option value="text" {{d.data.object['parameter-form-type'][index] == 'text' ? 'selected': '' }}">text</option>
<option value="file" {{d.data.object['parameter-form-type'][index] == 'file' ? 'selected': '' }}>file</option>
</select>
</div>
</div>
<div class="layui-form-item" {{d.data.object['parameter-form-type'][index] == 'file' ? '': 'style="display:none;"' }}>
<label class="layui-form-label">文件名</label>
<div class="layui-input-block array" placeholder="请输入文件名" codemirror="parameter-form-filename" data-value="{{=d.data.object['parameter-form-filename']['index']}}"></div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">参数值</label>
@ -222,7 +206,7 @@
{{# }) }}
<div class="layui-form-item">
<div class="layui-input-block">
<button class="layui-btn parameter-form-add" type="button">添加一个参数</button>
<button class="layui-btn table-row-add" type="button" for="body-parameter">添加一个参数</button>
</div>
</div>
</div>
@ -230,3 +214,125 @@
</div>
</div>
</div>
<script>
$(function(){
function renderRequestParameter(data){
layui.table.render({
elem : '#request-parameter',
cols : [[{
title : '参数名',
width : 150,
templet : '#parameter-name-tmpl'
},{
title : '参数值',
templet : '#parameter-value-tmpl'
},{
title : '参数描述',
width : 250,
templet : '#parameter-description-tmpl'
},{
title : '操作',
width : 120,
align : 'center',
templet : '#common-operation'
}]],
data : data,
text : {
none : '暂未设置参数'
}
})
}
function renderRequestCookie(data){
layui.table.render({
elem : '#request-cookie',
cols : [[{
title : 'Cookie名',
width : 150,
templet : '#cookie-name-tmpl'
},{
title : 'Cookie值',
templet : '#cookie-value-tmpl'
},{
title : '描述',
width : 250,
templet : '#cookie-description-tmpl'
},{
title : '操作',
width : 120,
align : 'center',
templet : '#common-operation'
}]],
data : data,
text : {
none : '暂未设置Cookie'
}
})
}
function renderRequestHeader(data){
layui.table.render({
elem : '#request-header',
cols : [[{
title : 'Header名',
width : 150,
templet : '#header-name-tmpl'
},{
title : 'header值',
minWidth : 400,
templet : '#header-value-tmpl'
},{
title : '描述',
width : 250,
templet : '#header-description-tmpl'
},{
title : '操作',
width : 120,
align : 'center',
templet : '#common-operation'
}]],
data : data,
text : {
none : '暂未设置Header'
}
})
}
function renderBodyParameter(data){
layui.table.render({
elem : '#body-parameter',
cols : [[{
title : '参数名',
width : 150,
templet : '#parameter-name-tmpl'
},{
title : '参数类型',
width : 85,
templet : '#parameter-type-tmpl'
},{
title : '文件名',
width : 195,
templet : '#parameter-filename-tmpl'
},{
title : '参数值',
templet : '#parameter-value-tmpl'
},{
title : '参数描述',
width : 250,
templet : '#parameter-description-tmpl'
},{
title : '操作',
width : 120,
align : 'center',
templet : '#common-operation'
}]],
data : data,
text : {
none : '暂未设置参数'
}
})
}
renderRequestParameter(getCellData({{d.cell.id}},$("#request-parameter").data('keys').split(",")));
renderRequestCookie(getCellData({{d.cell.id}},$("#request-cookie").data('keys').split(",")));
renderRequestHeader(getCellData({{d.cell.id}},$("#request-header").data('keys').split(",")));
renderBodyParameter(getCellData({{d.cell.id}},$("#body-parameter").data('keys').split(",")));
});
</script>

View File

@ -7,67 +7,37 @@
</ul>
<div class="layui-tab-content editor-form-node">
<div class="layui-tab-item layui-show">
<form class="layui-form">
<div class="layui-form-item">
<label class="layui-form-label">爬虫名称</label>
<div class="layui-input-block">
<input type="text" name="spiderName" placeholder="请输入爬虫名称" autocomplete="off" class="layui-input" value="{{d.data.object.spiderName || '未定义名称'}}">
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">最大线程数</label>
<div class="layui-input-block">
<input type="text" name="threadCount" placeholder="请输入线程数" autocomplete="off" class="layui-input" value="{{=d.data.object.threadCount}}">
</div>
</div>
<form class="layui-form layui-row">
<div class="layui-col-md4">
<label class="layui-form-label">爬虫名称</label>
<div class="layui-input-block">
<input type="text" name="spiderName" placeholder="请输入爬虫名称" autocomplete="off" class="layui-input" value="{{d.data.object.spiderName || '未定义名称'}}">
</div>
</div>
<div class="layui-col-md4">
<label class="layui-form-label">最大线程数</label>
<div class="layui-input-block">
<input type="number" min="1" name="threadCount" placeholder="请输入线程数" autocomplete="off" class="layui-input" value="{{=d.data.object.threadCount}}">
</div>
</div>
</form>
</div>
<div class="layui-tab-item">
<form class="layui-form">
{{# layui.each(d.data.object['parameter-name'],function(index){ }}
<div id="parameter{{=index}}" class="draggable" draggable="true" ondragstart="drag(event)" ondrop="drop(event)" ondragover="allowDrop(event)">
<div class="layui-form-item layui-form-relative">
<i class="layui-icon layui-icon-close header-remove"></i>
<label class="layui-form-label">参数名</label>
<div class="layui-input-block">
<input type="text" name="parameter-name" placeholder="请输入参数名" autocomplete="off" class="layui-input array" value="{{=d.data.object['parameter-name'][index]}}">
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">参数值</label>
<div class="layui-input-block array" placeholder="请输入参数值" codemirror="parameter-value" data-value="{{=d.data.object['parameter-value'][index]}}"></div>
</div>
<hr>
</div>
{{# }) }}
<table class="layui-table" id="global-parameter" data-cell="{{=d.cell.id}}" data-keys="parameter-name,parameter-value,parameter-description"></table>
<div class="layui-form-item">
<div class="layui-input-block">
<button class="layui-btn parameter-add" type="button">添加一个参数</button>
<button class="layui-btn table-row-add" type="button" for="global-parameter">添加一个参数</button>
</div>
</div>
</form>
</div>
<div class="layui-tab-item">
<form class="layui-form">
{{# layui.each(d.data.object['cookie-name'],function(index){ }}
<div id="cookie{{=index}}" class="draggable" draggable="true" ondragstart="drag(event)" ondrop="drop(event)" ondragover="allowDrop(event)">
<div class="layui-form-item layui-form-relative">
<i class="layui-icon layui-icon-close cookie-remove"></i>
<label class="layui-form-label">Cookie名</label>
<div class="layui-input-block">
<input type="text" name="cookie-name" placeholder="请输入Cookie名" autocomplete="off" class="layui-input array" value="{{=d.data.object['cookie-name'][index]}}">
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">Cookie值</label>
<div class="layui-input-block array" placeholder="请输入Cookie值" codemirror="cookie-value" data-value="{{=d.data.object['cookie-value'][index]}}"></div>
</div>
<hr>
</div>
{{# }) }}
<table class="layui-table" id="global-cookie" data-cell="{{=d.cell.id}}" data-keys="cookie-name,cookie-value,cookie-description"></table>
<div id="addCookieBtn" class="layui-form-item">
<div class="layui-input-block">
<button class="layui-btn cookie-add" type="button">添加一个Cookie</button>
<button class="layui-btn table-row-add" type="button" for="global-cookie">添加一个Cookie</button>
</div>
</div>
<div class="layui-form-item">
@ -79,25 +49,10 @@
</div>
<div class="layui-tab-item">
<form class="layui-form">
{{# layui.each(d.data.object['header-name'],function(index){ }}
<div id="header{{=index}}" class="draggable" draggable="true" ondragstart="drag(event)" ondrop="drop(event)" ondragover="allowDrop(event)">
<div class="layui-form-item layui-form-relative">
<i class="layui-icon layui-icon-close header-remove"></i>
<label class="layui-form-label">header名</label>
<div class="layui-input-block">
<input type="text" name="header-name" placeholder="请输入header名" autocomplete="off" class="layui-input array" value="{{=d.data.object['header-name'][index]}}">
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">header值</label>
<div class="layui-input-block array" placeholder="请输入header值" codemirror="header-value" data-value="{{=d.data.object['header-value'][index]}}"></div>
</div>
<hr>
</div>
{{# }) }}
<table class="layui-table" id="global-header" data-cell="{{=d.cell.id}}" data-keys="header-name,header-value,header-description"></table>
<div id="addHeaderBtn" class="layui-form-item">
<div class="layui-input-block">
<button class="layui-btn header-add" type="button">添加一个Header</button>
<button class="layui-btn table-row-add" type="button" for="global-header">添加一个Header</button>
</div>
</div>
<div class="layui-form-item">
@ -108,4 +63,91 @@
</form>
</div>
</div>
</div>
</div>
<script>
$(function(){
function renderGlobalParameter(data){
layui.table.render({
elem : '#global-parameter',
cols : [[{
title : '参数名',
width : 150,
templet : '#parameter-name-tmpl'
},{
title : '参数值',
templet : '#parameter-value-tmpl'
},{
title : '参数描述',
width : 250,
templet : '#parameter-description-tmpl'
},{
title : '操作',
width : 120,
align : 'center',
templet : '#common-operation'
}]],
data : data,
text : {
none : '暂未设置参数'
}
})
}
function renderGlobalCookie(data){
layui.table.render({
elem : '#global-cookie',
cols : [[{
title : 'Cookie名',
width : 150,
templet : '#cookie-name-tmpl'
},{
title : 'Cookie值',
templet : '#cookie-value-tmpl'
},{
title : '描述',
width : 250,
templet : '#cookie-description-tmpl'
},{
title : '操作',
width : 120,
align : 'center',
templet : '#common-operation'
}]],
data : data,
text : {
none : '暂未设置Cookie'
}
})
}
function renderGlobalHeader(data){
layui.table.render({
elem : '#global-header',
cols : [[{
title : 'Header名',
width : 150,
templet : '#header-name-tmpl'
},{
title : 'header值',
minWidth : 400,
templet : '#header-value-tmpl'
},{
title : '描述',
width : 250,
templet : '#header-description-tmpl'
},{
title : '操作',
width : 120,
align : 'center',
templet : '#common-operation'
}]],
data : data,
text : {
none : '暂未设置Header'
}
})
}
renderGlobalParameter(getCellData({{d.cell.id}},$("#global-parameter").data('keys').split(",")));
renderGlobalCookie(getCellData({{d.cell.id}},$("#global-cookie").data('keys').split(",")));
renderGlobalHeader(getCellData({{d.cell.id}},$("#global-header").data('keys').split(",")));
});
</script>

View File

@ -5,45 +5,70 @@
<div class="layui-tab-content">
<div class="layui-tab-item layui-show">
<form class="layui-form editor-form-node">
<div class="layui-form-item">
<label class="layui-form-label">节点名称</label>
<div class="layui-input-block">
<input type="text" name="value" placeholder="请输入节点名称" value="{{=d.value}}" autocomplete="off" class="layui-input">
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">循环变量</label>
<div class="layui-input-block">
<input type="text" name="loopVariableName" placeholder="请输入循环变量" autocomplete="off" class="layui-input input-default" value="{{=d.data.object.loopVariableName}}">
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">循环次数</label>
<div class="layui-input-block" codemirror="loopCount" placeholder="请输入循环次数" data-value="{{=d.data.object.loopCount}}"></div>
</div>
{{# layui.each(d.data.object['variable-name'],function(index,variable){ }}
<div id="variable{{=index}}" class="draggable" draggable="true" ondragstart="drag(event)" ondrop="drop(event)" ondragover="allowDrop(event)">
<hr>
<div class="layui-form-item layui-form-relative">
<i class="layui-icon layui-icon-close variable-remove"></i>
<label class="layui-form-label">变量名</label>
<div class="layui-input-block array">
<input type="text" name="variable-name" placeholder="变量名称" autocomplete="off" class="layui-input array" value="{{=d.data.object['variable-name'][index]}}">
<div class="layui-row">
<div class="layui-col-md4">
<div class="layui-form-item">
<label class="layui-form-label">节点名称</label>
<div class="layui-input-block">
<input type="text" name="value" placeholder="请输入节点名称" value="{{=d.value}}" autocomplete="off" class="layui-input">
</div>
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">变量值</label>
<div class="layui-input-block array" codemirror="variable-value" placeholder="变量值" data-value="{{=d.data.object['variable-value'][index]}}"></div>
<div class="layui-col-md4">
<div class="layui-form-item">
<label class="layui-form-label">循环变量</label>
<div class="layui-input-block">
<input type="text" name="loopVariableName" placeholder="请输入循环变量" autocomplete="off" class="layui-input input-default" value="{{=d.data.object.loopVariableName}}">
</div>
</div>
</div>
<div class="layui-col-md4">
<div class="layui-form-item">
<label class="layui-form-label">循环次数</label>
<div class="layui-input-block" codemirror="loopCount" placeholder="请输入循环次数" data-value="{{=d.data.object.loopCount}}"></div>
</div>
</div>
</div>
{{# }) }}
<hr>
<table class="layui-table" id="spider-variable" data-cell="{{=d.cell.id}}" data-keys="variable-name,variable-value,variable-description"></table>
<div class="layui-form-item">
<div class="layui-input-block">
<button class="layui-btn variable-add" type="button">添加一个变量</button>
<button class="layui-btn table-row-add" type="button" for="spider-variable">添加一个变量</button>
</div>
</div>
</form>
</div>
</div>
</div>
</div>
<script>
$(function(){
function renderSpiderVariable(data){
layui.table.render({
elem : '#spider-variable',
cols : [[{
title : '变量名',
width : 150,
templet : '#variable-name-tmpl'
},{
title : '变量值',
minWidth : 400,
templet : '#variable-value-tmpl'
},{
title : '描述',
width : 250,
templet : '#variable-description-tmpl'
},{
title : '操作',
width : 120,
align : 'center',
templet : '#common-operation'
}]],
data : data,
text : {
none : '暂未设置变量'
}
})
}
renderSpiderVariable(getCellData({{d.cell.id}},$("#spider-variable").data('keys').split(",")));
});
</script>