1 A页面跳转时候的地址: 2 parent.layer.open({ 3 type: 2, 4 title:'新建草稿', 5 shadeClose: true, 6 shade: 0.8, 7 scrollbar: false, 8 maxmin:true, 9 area: ['100%', '100%'], 10 content:'../../backstage/html/taskManagement/workFlowDefine/newFlowDefine.html?modelId=' + data.id, 11 }); 12 编辑页面:打开页面的时候,显示相关信息,并可以进行保存 13 getParam(); 14 function getParam() { 15 var url = location.search.substring(1);//location.search得到的是?后面的数据: ?modelId='+data.id,substring() 方法用于提取字符串中介于两个指定下标之间的字符;得到的是去掉?的部分 16 if (url != null && url != undefined && url != "") { //表示,如果有参数;且不等于空,则进行分割得到data.id; 17 modelId = url.split('&')[0].split('=')[1]; //data.id; 18 } 19 } 20 if (modelId != null && modelId != undefined && modelId != "") { 21 $.ajax({ 22 url: '/service/moddel/' + modelId + '/json',//如果前面不调用getParam(),则此处的modelId就是无定义的 23 type: 'get', 24 dataType: 'json', 25 data: {}, 26 success: function (response, statusText) { 27 if (response.code == '0') { 28 $('.copyName').val(response.name); 29 $('.flag').val(response.key); 32 categoryId = response.category; 33 $('.category select option').each(function () { 34 if ($(this).val() == response.category) { 35 $(this).attr("selected", true); 36 } 37 }); 38 form.render('select'); 39 if (response.description != null && response.description != undefined) { 40 $('.bigDescribe').text(response.description); 41 } 42 var dataNodes = response.nodes; 43 if (dataNodes != null && dataNodes != undefined) { 44 for (var i = 0; i < dataNodes.length; ++i) { 45 var dataNode = dataNodes[i]; 46 nodes[dataNode.resourceId] = dataNode; 47 console.log(nodes[dataNode.resourceId]); 48 console.log(dataNode); 49 // “人工” 50 if (dataNode.stencilId == "UserTask") { 51 var contentHuman = $('.contentHuman').html(); 52 $('.layui-timeline-item').css('display', 'block'); 53 contentHuman = "" + contentHuman + ""; 54 $('#layui-timeline').append(contentHuman); 55 var lists = $('.elementClass'); 56 for (var j = 0; j < lists.length; j++) { 57 var list = lists.eq(j).prevAll().length; 58 $('.elementClass').eq(j).find('span:eq(0)').text(list + 1); 59 } 60 layui.element.render('collapse'); 61 $('#' + dataNode.resourceId).find('.humanInput').val(dataNode.name); 62 63 64 // “操作” 65 } else if (dataNode.stencilId == "ServiceTask") { 66 var contentDo = $('.contentDo').html(); 67 $('.layui-timeline-item').css('display', 'block'); 68 contentDo = "" + contentDo + ""; 69 $('#layui-timeline').append(contentDo); 70 $('#' + dataNode.resourceId).find('.layui-colla-content').removeClass('layui-show'); 71 var lists = $('.elementClass'); 72 for (var j = 0; j < lists.length; j++) { 73 var list = lists.eq(j).prevAll().length; 74 $('.elementClass').eq(j).find('span:eq(0)').text(list + 1); 75 } 76 layui.element.render('collapse'); 77 $('#' + dataNode.resourceId).find('.toolId').val(dataNode.funcId) 78 $('#' + dataNode.resourceId).find('.toolId').text(dataNode.funcId) 79 $('#' + dataNode.resourceId).find('.doSelect').val(dataNode.funcId) 80 $('#' + dataNode.resourceId).find('.doSelect').text(dataNode.name + "-" + dataNode.toolVersion) 81 $('#' + dataNode.resourceId).find('.doname').val(dataNode.name + "-" + dataNode.toolVersion) 82 console.log($('.toolId').val()); 83 if (dataNode.scriptLanguage != '2') { 84 $('#' + dataNode.resourceId).find('.classOne').css('display', 'block'); 85 $('#' + dataNode.resourceId).find('.classTwo').css('display', 'none'); 86 $('#' + dataNode.resourceId).find('.layui-colla-content').addClass('layui-show'); 87 var svcFuncDfs = dataNode.svcFuncDfs; 88 if (svcFuncDfs != null && svcFuncDfs != undefined) { 89 $('#' + dataNode.resourceId).find('.tableHome').append('
" + content + "
";171 $('#layui-timeline').append(content);172 var lists = $('.elementClass');173 for (var j = 0; j < lists.length; j++) {174 var list = lists.eq(j).prevAll().length;175 $('.elementClass').eq(j).find('span:eq(0)').text(list + 1);176 }177 layui.element.render('collapse');178 $('#' + dataNode.resourceId).find('.flowId').val(dataNode.callactivitycalledelement);//隐藏域179 $('#' + dataNode.resourceId).find('.operateSelect').val(dataNode.callactivitycalledelement);180 $('#' + dataNode.resourceId).find('.operateSelect').text(dataNode.name);181 $('#' + dataNode.resourceId).find('.taskname').val(dataNode.name);182 }183 }184 }185 } else {186 layer.msg(response.msg);187 }188 },189 'error': function () {190 layer.msg("系统错误!");191 }192 });193 }