修复全局参数回显不出值的问题

This commit is contained in:
mxd 2020-04-05 21:59:27 +08:00
parent 0379b02e7b
commit 369ee82445
3 changed files with 88 additions and 92 deletions

View File

@ -50,7 +50,8 @@ function getCellData(cellId,keys){
} }
function serializeForm(){ function serializeForm(){
var $container = $(".properties-container"); var $container = $(".properties-container");
if($container.data('version') != version){ var _version = $container.data('version');
if(_version && _version != version){
return; return;
} }
var cellId = $container.attr('data-cellid'); var cellId = $container.attr('data-cellid');
@ -522,8 +523,6 @@ $(function(){
layui.form.on('select(targetCheck)', function (data) { layui.form.on('select(targetCheck)', function (data) {
var targetDiv = $(data.elem).attr('target-div'); var targetDiv = $(data.elem).attr('target-div');
var targetValue = $(data.elem).attr('target-value'); var targetValue = $(data.elem).attr('target-value');
// var selectValue=$(data.elem).value();
console.log(targetDiv, data.elem.value);
if (targetDiv != null) { if (targetDiv != null) {
if (data.elem.value == targetValue) { if (data.elem.value == targetValue) {
$("." + targetDiv).show(); $("." + targetDiv).show();
@ -535,7 +534,6 @@ $(function(){
layui.form.on('checkbox(targetCheck)', function (data) { layui.form.on('checkbox(targetCheck)', function (data) {
var targetDiv = $(data.elem).attr('target-div'); var targetDiv = $(data.elem).attr('target-div');
console.log(targetDiv);
if (targetDiv != null) { if (targetDiv != null) {
if (data.elem.checked) { if (data.elem.checked) {
$("." + targetDiv).show(); $("." + targetDiv).show();
@ -975,7 +973,6 @@ function runSpider(debug){
LogViewer.append(texts); LogViewer.append(texts);
LogViewer.scrollTo(-1); LogViewer.scrollTo(-1);
}else if(eventType == 'debug'){ }else if(eventType == 'debug'){
console.log(message);
$(".btn-resume").removeClass('disabled'); $(".btn-resume").removeClass('disabled');
var type = message.event; var type = message.event;
editor.selectCell(editor.graph.model.cells[message.nodeId]); editor.selectCell(editor.graph.model.cells[message.nodeId]);

View File

@ -239,6 +239,7 @@ SpiderEditor.prototype.setXML = function(xml){
var root = doc.documentElement; var root = doc.documentElement;
var dec = new mxCodec(root.ownerDocument); var dec = new mxCodec(root.ownerDocument);
dec.decode(root,this.getModel()); dec.decode(root,this.getModel());
this.selectedCellListener(this.getSelectedCell());
} }
SpiderEditor.prototype.importFromUrl = function(url){ SpiderEditor.prototype.importFromUrl = function(url){
var req = mxUtils.load(url); var req = mxUtils.load(url);

View File

@ -73,92 +73,90 @@
</div> </div>
</div> </div>
<script> <script>
$(function(){ function renderGlobalParameter(data){
function renderGlobalParameter(data){ layui.table.render({
layui.table.render({ elem : '#global-parameter',
elem : '#global-parameter', limit: 50,
limit: 50, cols : [[{
cols : [[{ title : '参数名',
title : '参数名', width : 150,
width : 150, templet : '#parameter-name-tmpl'
templet : '#parameter-name-tmpl' },{
},{ title : '参数值',
title : '参数值', templet : '#parameter-value-tmpl'
templet : '#parameter-value-tmpl' },{
},{ title : '参数描述',
title : '参数描述', width : 250,
width : 250, templet : '#parameter-description-tmpl'
templet : '#parameter-description-tmpl' },{
},{ title : '操作',
title : '操作', width : 120,
width : 120, align : 'center',
align : 'center', templet : '#common-operation'
templet : '#common-operation' }]],
}]], data : data,
data : data, text : {
text : { none : '暂未设置参数'
none : '暂未设置参数' }
} })
}) }
} function renderGlobalCookie(data){
function renderGlobalCookie(data){ layui.table.render({
layui.table.render({ elem : '#global-cookie',
elem : '#global-cookie', limit: 50,
limit: 50, cols : [[{
cols : [[{ title : 'Cookie名',
title : 'Cookie名', width : 150,
width : 150, templet : '#cookie-name-tmpl'
templet : '#cookie-name-tmpl' },{
},{ title : 'Cookie值',
title : 'Cookie值', templet : '#cookie-value-tmpl'
templet : '#cookie-value-tmpl' },{
},{ title : '描述',
title : '描述', width : 250,
width : 250, templet : '#cookie-description-tmpl'
templet : '#cookie-description-tmpl' },{
},{ title : '操作',
title : '操作', width : 120,
width : 120, align : 'center',
align : 'center', templet : '#common-operation'
templet : '#common-operation' }]],
}]], data : data,
data : data, text : {
text : { none : '暂未设置Cookie'
none : '暂未设置Cookie' }
} })
}) }
}
function renderGlobalHeader(data){ function renderGlobalHeader(data){
layui.table.render({ layui.table.render({
elem : '#global-header', elem : '#global-header',
limit: 50, limit: 50,
cols : [[{ cols : [[{
title : 'Header名', title : 'Header名',
width : 150, width : 150,
templet : '#header-name-tmpl' templet : '#header-name-tmpl'
},{ },{
title : 'header值', title : 'header值',
minWidth : 400, minWidth : 400,
templet : '#header-value-tmpl' templet : '#header-value-tmpl'
},{ },{
title : '描述', title : '描述',
width : 250, width : 250,
templet : '#header-description-tmpl' templet : '#header-description-tmpl'
},{ },{
title : '操作', title : '操作',
width : 120, width : 120,
align : 'center', align : 'center',
templet : '#common-operation' templet : '#common-operation'
}]], }]],
data : data, data : data,
text : { text : {
none : '暂未设置Header' none : '暂未设置Header'
} }
}) })
} }
renderGlobalParameter(getCellData({{d.cell.id}},$("#global-parameter").data('keys').split(","))); renderGlobalParameter(getCellData({{d.cell.id}},$("#global-parameter").data('keys').split(",")));
renderGlobalCookie(getCellData({{d.cell.id}},$("#global-cookie").data('keys').split(","))); renderGlobalCookie(getCellData({{d.cell.id}},$("#global-cookie").data('keys').split(",")));
renderGlobalHeader(getCellData({{d.cell.id}},$("#global-header").data('keys').split(","))); renderGlobalHeader(getCellData({{d.cell.id}},$("#global-header").data('keys').split(",")));
});
</script> </script>