标签:copy select index isp toolbar struct ali inpu reac
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 = "<div id=‘" + dataNode.resourceId + "‘ class=‘elementClass‘>" + contentHuman + "</div>"; 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 = "<div id=‘" + dataNode.resourceId + "‘ class=‘elementClass‘>" + contentDo + "</div>"; 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(‘<table id="hostName_‘ + dataNode.resourceId + ‘" lay-filter="hostTable" class="hostName"></table>‘) 90 // 面板内容框“操作”选择主机后table表格内容渲染 91 var index = table.render({ 92 elem: ‘#hostName_‘ + dataNode.resourceId 93 , data: svcFuncDfs 94 , limit: 100 95 , cols: [[ 96 { 97 field: ‘serverName‘, 98 title: ‘目标主机‘, 99 width: 200, 100 align: ‘center‘ 101 }, { 102 field: ‘exeMachine‘, 103 title: ‘代理执行‘, 104 width: 182, 105 align: ‘center‘ 106 }, { 107 field: ‘exeUser‘, 108 title: ‘执行用户‘, 109 width: 180, 110 align: ‘center‘ 111 }, 112 { 113 title: ‘操作‘, 114 align: ‘center‘, 115 toolbar: ‘#flinkbar‘, 116 width: 117 117 }, 118 119 ]] 120 , id: ‘hostName_id‘ 121 , even: true 122 }); 123 } 124 } else { 125 $(‘#‘ + dataNode.resourceId).find(‘.classTwo‘).css(‘display‘, ‘block‘); 126 $(‘#‘ + dataNode.resourceId).find(‘.classOne‘).css(‘display‘, ‘none‘); 127 $(‘#‘ + dataNode.resourceId).find(‘.layui-colla-content‘).addClass(‘layui-show‘); 128 var svcFuncDfs = dataNode.svcFuncDfs; 129 if (svcFuncDfs != null && svcFuncDfs != undefined) { 130 $("#" + dataNode.resourceId).find("#jksSelect option[value=‘" + dataNode.jenServer + "‘]").prop("selected", true); 131 $("#" + dataNode.resourceId).find("#agentSelect option[value=‘" + svcFuncDfs[0].exeMachine + "‘]").prop("selected", true); 132 $("#" + dataNode.resourceId).find(‘.structName‘).val(dataNode.jobName); 133 } 134 } 135 136 //获取参数 137 $.ajax({ 138 type: "post", 139 url: ‘/cd/workPlatform/tool/parame/version.afca‘, 140 dataType: "json", 141 async: false, 142 data: { 143 toolId: dataNode.funcId 144 }, 145 success: function (response) { 146 $(‘#‘ + dataNode.resourceId).find(‘.params option‘).remove(); 147 $(‘#‘ + dataNode.resourceId).find(‘.params dl dd‘).remove(); 148 if (response.data != ‘‘ && response.data != null && response.data != undefined) { 149 response.data.forEach(function (n, i) { 150 if (n.paraVesionName != null) { 151 if (n.paraVesionName == dataNode.paraValue) { 152 $(‘#‘ + dataNode.resourceId).find(‘.params‘).append("<option value= ‘" + n.paraVesionName + "||" + n.exceNum + "‘ selected>" + n.paraVesionName + "</option>"); 153 } else { 154 $(‘#‘ + dataNode.resourceId).find(‘.params‘).append("<option value= ‘" + n.paraVesionName + "||" + n.exceNum + "‘>" + n.paraVesionName + "</option>"); 155 } 156 } 157 }) 158 } 159 form.render(‘select‘); 160 }, 161 error: function () { 162 } 163 }) 164 165 166 // “编排” 167 } else if (dataNode.stencilId == "CallActivity") { 168 var content = $(‘.content‘).html(); 169 $(‘.layui-timeline-item‘).css(‘display‘, ‘block‘); 170 content = "<div id=‘" + dataNode.resourceId + "‘ class=‘elementClass‘ draggable=‘true‘>" + content + "</div>"; 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 }
标签:copy select index isp toolbar struct ali inpu reac
原文地址:https://www.cnblogs.com/yangguoe/p/9120119.html