How to use handleMethod method in Puppeteer

Best JavaScript code snippet using puppeteer

workOrderClosedCycle.js

Source:workOrderClosedCycle.js Github

copy

Full Screen

1var dateValCache=[];2var indicatorValCache=[];3var cellValCache=[];4$(document).ready(function () {5 //所有用户查询工单6 $("#searchBtn").click(function () {7 if($("#dateSelect").val()=='-1'||$("#dateSelect").val()==null) {8 showInfoInAndOut("info", "请选择日期!");9 return;10 }11 getWorkOrder();12 });13 //导出工单14 $("#exportBtn").click(function () {15 if($("#dateSelect").val()=='-1'||$("#dateSelect").val()==null) {16 showInfoInAndOut("info", "请选择日期!");17 return;18 }19 exportWorkOrder();20 });21 //统计工单22 $("#evaluateData").click(function () {23 $("#collapseExample").collapse('hide');24 if($("#dateSelect").val()=='-1'||$("#dateSelect").val()==null) {25 showInfoInAndOut("info", "请选择日期!");26 return;27 }28 $("#loading").show();29 $("#workOrderClosedCycleForm").ajaxSubmit({30 url:'getEvaluateData',31 type:'post',32 dataType:'json',33 success:function (data) {34 $("#loading").css("display","none");35 showEvaluateData(data);36 },37 error:function () {38 $("#loading").css("display","none");39 showInfoInAndOut("info","获取统计信息失败!");40 }41 })42 });43 //普通用户处理工单44 $("#updateOrderBtn").click(function () {45 updateWorkOrder();46 });47 //普通用户申请挂起48 $("#applyForHangUp").click(function () {49 hangUp();50 });51 //普通用户申请撤销挂起52 $("#cancelHangUp").click(function () {53 cancelHangUp();54 });55 //管理员确认,处理工单状态56 $("#ensureOrder").click(function () {57 submitAdminSuggestion();58 });59 //管理员同意挂起60 $("#agreeHangUp").click(function () {61 var orderHangUp=$("#orderManId").val();62 var statusHangUp="已挂起";63 var handler=$("#orderManHandler").val().trim();64 var handleMethod=$("#handleManMethod").val().trim();65 var status=$("#orderManStatus").val();66 var admin=$("#orderManAdmin").val().trim();67 if(handler==='' || handleMethod==='' || admin===''){68 showInfoInAndOut("info","请等待处理人处理工单!");69 return;70 }71 if(status==='完结'){72 showInfoInAndOut("info","同意挂起时请勿修改工单状态!");73 return;74 }75 $("#updateManageWorkOrder").ajaxSubmit({76 url:'updateWorkOrderStatusByIdByAdmin',77 dataType:'text',78 data:{79 order:orderHangUp,80 status:statusHangUp,81 handler:handler82 },83 type:'post',84 success: function () {85 $("#showManageDetail").modal('hide');86 showInfoInAndOut("info","工单已挂起!");87 getWorkOrder();88 },89 error:function () {90 $("#showManageDetail").modal('hide');91 showInfoInAndOut("info","工单挂起失败!");92 }93 })94 });95 //拒绝挂起96 $("#refuseHangUp").click(function () {97 var orderHangUp=$("#orderManId").val();98 var statusHangUp="完结";99 var handler=$("#orderManHandler").val().trim();100 var handleMethod=$("#handleManMethod").val().trim();101 var admin=$("#orderManAdmin").val().trim();102 if(handler==='' || handleMethod==='' || admin===''){103 showInfoInAndOut("info","请等待处理人处理工单!");104 return;105 }106 $("#updateManageWorkOrder").ajaxSubmit({107 url:'updateWorkOrderStatusByIdByAdmin',108 dataType:'text',109 data:{110 order:orderHangUp,111 status:statusHangUp,112 handler:handler113 },114 type:'post',115 success: function () {116 $("#showManageDetail").modal('hide');117 showInfoInAndOut("info","工单挂起已拒绝,工单完结!");118 getWorkOrder();119 },120 error:function () {121 $("#showManageDetail").modal('hide');122 showInfoInAndOut("info","工单拒绝挂起失败!");123 }124 })125 });126 //管理员同意撤销挂起127 $("#agreeCancelHangUp").click(function () {128 var orderAgreeCancel=$("#orderManId").val();129 var statusAgreeCancel="完结";130 var handler=$("#orderManHandler").val().trim();131 var handleMethod=$("#handleManMethod").val().trim();132 var admin=$("#orderManAdmin").val().trim();133 if(handler==='' || handleMethod ==='' || admin===''){134 showInfoInAndOut("info","请等待处理人处理工单!");135 return;136 }137 $("#updateManageWorkOrder").ajaxSubmit({138 url:'updateWorkOrderStatusByIdByAdmin',139 dataType:'text',140 data:{141 order:orderAgreeCancel,142 status:statusAgreeCancel,143 handler:handler144 },145 type:'post',146 success: function () {147 $("#showManageDetail").modal('hide');148 showInfoInAndOut("info","同意撤销挂起成功,工单完结!");149 getWorkOrder();150 },151 error:function () {152 $("#showManageDetail").modal('hide');153 showInfoInAndOut("info","同意撤销挂起失败!");154 }155 })156 });157 //管理员退单158 $("#giveBack").click(function () {159 var orderGiveBack=$("#orderManId").val();160 var handleCount=$("#orderManHandleCount").val().trim();161 var statusGiveBack="已退回";162 var handler=$("#orderManHandler").val().trim();163 var handleMethod=$("#handleManMethod").val().trim();164 var admin=$("#orderManAdmin").val().trim();165 if(handler===''|| handleMethod==='' || admin===''){166 showInfoInAndOut("info","请等待处理人处理工单!");167 return;168 }169 var modifyStatus=$("#orderManStatus").val().trim();170 if(modifyStatus=='完结'){171 showInfoInAndOut("info","退单时请勿修改工单状态!");172 return;173 }174 $("#updateManageWorkOrder").ajaxSubmit({175 url:'giveBackOrder',176 dataType:'text',177 data:{178 order:orderGiveBack,179 status:statusGiveBack,180 handler:handler,181 handleCount:handleCount182 },183 type:'post',184 success: function () {185 $("#showManageDetail").modal('hide');186 showInfoInAndOut("info","退单成功!");187 getWorkOrder();188 },189 error:function () {190 $("#showManageDetail").modal('hide');191 showInfoInAndOut("info","退单失败!");192 }193 })194 });195 popUp();196});197function popUp() {198 var thisDom;199 //日期多选200 $("#dateBtn").click(function () {201 $('#myModalLabel1').empty();202 $('#search').empty();203 $("#search_to").empty();204 $('#match').val('');205 $("#myModalLabel").text("选择日期");206 thisDom = "dateSelect";207 if(dateValCache=='') {208 $.ajax({209 url: 'date',210 dataType: 'json',211 type: 'get',212 success: function (data) {213 $('#myModalLabel1').append("可选" + (data.length) + "个,双击可添加");214 if (data.length != 0) {215 for (var i = 0; i < data.length; i++) {216 var one = data[i];217 $('#search').append("<option>" + one + "</option>");218 }219 } else {220 }221 }222 });223 }else{224 $.each(dateValCache,function(index, value){225 $('#search').append("<option>" + value + "</option>");226 })227 $('#myModalLabel1').append("可选"+(dateValCache.length)+"个,双击可添加");228 }229 var dateVal = $("#dateSelect").val().split(",");230 for ( var i = 0; i <dateVal.length; i++) {231 if(dateVal[i]!=-1) {232 $('#search_to').append("<option>" + dateVal[i] + "</option>");233 }234 }235 $('#myModalLabel2').html("已选"+($('#search_to option').length)+"个,双击可删除");236 });237 //指标多选238 $("#indicatorBtn").click(function () {239 $('#myModalLabel1').empty();240 $('#search').empty();241 $("#search_to").empty();242 $('#match').val('');243 //$('#myModalLabel2').empty();244 $("#myModalLabel").text("选择工单类型");245 thisDom = "indicatorSelect";246 if(indicatorValCache=='') {247 $.ajax({248 url: 'indicator',249 dataType: 'json',250 type: 'get',251 success: function (data) {252 $('#myModalLabel1').append("可选" + (data.length) + "个,双击可添加");253 if (data.length != 0) {254 for (var i = 0; i < data.length; i++) {255 var one = data[i];256 $('#search').append("<option>" + one + "</option>");257 }258 } else {259 }260 }261 });262 }else{263 $.each(indicatorValCache,function(index, value){264 $('#search').append("<option>" + value + "</option>");265 })266 $('#myModalLabel1').append("可选"+(indicatorValCache.length)+"个,双击可添加");267 }268 var indicatorVal = $("#indicatorSelect").val().split(",");269 for ( var i = 0; i <indicatorVal.length; i++) {270 if(indicatorVal[i]!=-1) {271 $('#search_to').append("<option>" + indicatorVal[i] + "</option>");272 }273 }274 $('#myModalLabel2').html("已选"+($('#search_to option').length)+"个,双击可删除");275 });276 //小区多选277 $("#cellBtn").click(function(){278 $('#myModalLabel1').empty();279 $('#search').empty();280 $("#search_to").empty();281 $('#match').val('');282 //$('#myModalLabel2').empty();283 $("#myModalLabel").text("选择小区");284 thisDom = "cellSelect";285 if(cellValCache==''){286 $.ajax({287 url : 'cell',288 dataType : 'json',289 data : {date:$("#dateSelect").val()},290 type : 'get',291 success : function(data) {292 $('#myModalLabel1').append("可选"+(data.length)+"个,双击可添加");293 if(data.length != 0) {294 for ( var i = 0; i < data.length; i++) {295 var one = data[i];296 $('#search').append("<option>" + one + "</option>");297 cellValCache[i] = one;298 }299 } else {300 }301 }302 });303 }else{304 $.each(cellValCache,function(index, value){305 $('#search').append("<option>" + value + "</option>");306 })307 $('#myModalLabel1').append("可选"+(cellValCache.length)+"个,双击可添加");308 }309 var cellVal = $("#cellSelect").val().split(",");310 for ( var i = 0; i < cellVal.length; i++) {311 if(cellVal[i]!=-1 && cellVal[i].trim()!='') {312 $('#search_to').append("<option>" + cellVal[i] + "</option>");313 }314 }315 $('#myModalLabel2').html("已选"+($('#search_to option').length)+"个,双击可删除");316 });317 //工单状态多选318 $("#statusBtn").click(function () {319 $('#myModalLabel1').empty();320 $('#search').empty();321 $("#search_to").empty();322 $('#match').val('');323 //$('#myModalLabel2').empty();324 $("#myModalLabel").text("选择工单状态");325 thisDom = "statusSelect";326 $('#search').append('<option value="受理中">受理中</option>');327 $('#search').append('<option value="完结">完结</option>');328 $('#search').append('<option value="超时">超时</option>');329 $('#search').append('<option value="挂起">挂起</option>');330 $('#search').append(' <option value="已退回">已退回</option>');331 $('#myModalLabel1').append("可选" + ($('#search option').length) + "个,双击可添加");332 var maintainVal = $("#statusSelect").val().split(",");333 for (var i = 0; i < maintainVal.length; i++) {334 if (maintainVal[i] != -1) {335 $('#search_to').append("<option>" + maintainVal[i] + "</option>");336 }337 }338 $('#myModalLabel2').html("已选" + ($('#search_to option').length) + "个,双击可删除");339 });340 //确定按钮341 $('#ensure').click(function () {342 //$("#" + thisDom).children().remove();343 var html = "";344 $("#search_to option").each(function(index){345 if(index===0) {346 html += $(this).val();347 }else {348 html += "," + $(this).val();349 }350 });351 if(thisDom=="cellSelect" || thisDom == "bscSelect"){352 $("#"+thisDom).val(html);353 $('#myModal').modal('hide');354 return;355 }356 $("#" + thisDom + " option[style='display:none']").remove();357 //console.log("html="+html+","+html.length+","+"".length);358 if(html.length===0){359 if($("#" + thisDom).val()!==-1){360 $("#" + thisDom + " option:selected").remove();361 }362 $("#" + thisDom + " option[value='-1']").attr("selected", "selected");363 }else{364 var arr = html.split(",");365 var flag = false;366 //console.log(arr.length);367 if(arr.length===1){368 $("#search option").each(function(){369 if(html==$(this).val()){370 $("#" + thisDom + " option[value='" + $(this).val() + "']").attr("selected", "selected");371 flag = true;372 }373 //console.log($("#" + thisDom).val());374 })375 }else{376 $("#" + thisDom).prepend("<option selected='selected' style='display:none'>"+ html + "</option>");377 }378 if(flag){379 $("#" + thisDom).prepend("<option selected='selected' style='display:none'>"+ html + "</option>");380 }381 }382 $('#myModal').modal('hide');383 })384}385function getWorkOrder() {386 initFormPage("workOrderClosedCycleForm");387 submitCondition();388}389function exportWorkOrder() {390 $("#workOrderClosedCycleForm").submit();391}392//管理员确认反馈意见,修改工单状态393function submitAdminSuggestion() {394 var order=$("#orderManId").val();395 var handler=$("#orderManHandler").val().trim();396 var status=$("#orderManStatus").val().trim();397 var handleMethod=$("#handleManMethod").val().trim();398 var admin=$("#orderManAdmin").val().trim();399 if(handler=='' || handleMethod=='' || admin===''){400 showInfoInAndOut("info","请等待处理人处理工单!");401 return;402 }403 if(status=='' || status=='-1'){404 showInfoInAndOut("info","请修改工单状态!");405 return;406 }407 $("#updateManageWorkOrder").ajaxSubmit({408 url:'updateWorkOrderStatusByIdByAdmin',409 dataType:'text',410 data:{411 order:order,412 status:status,413 handler:handler414 },415 type:'post',416 success: function () {417 $("#showManageDetail").modal('hide');418 showInfoInAndOut("info","处理成功!");419 getWorkOrder();420 },421 error:function () {422 $("#showManageDetail").modal('hide');423 showInfoInAndOut("info","处理失败!");424 }425 })426}427//普通用户提交反馈428function updateWorkOrder() {429 var order = $("#orderId").val();430 var date=$("#orderDate").val();431 var handler= $("#orderHandler").val().trim();432 var handleMethod = $("#handleMethod").val().trim();433 var handleResult = $("#orderHandleRult").val().trim();434 var handleCount=$("#orderHandleCount").val().trim();435 var status=$("#orderStatus").val().trim();436 var admin=$("#orderAdmin").val().trim();437 if(handleMethod.trim()==="" ){438 showInfoInAndOut("info","请填写处理方法!");439 return;440 }441 if(handleResult.trim() ==="" || handleResult.trim()==="-1"){442 showInfoInAndOut("info","请选择处理结果!");443 return;444 }445 if(handleResult.trim()==="待处理"){446 showInfoInAndOut("info","请修改处理结果状态!");447 return;448 }449 if(admin.trim()==="" || admin.trim()==="-1"){450 showInfoInAndOut("info","请指定负责人!");451 return;452 }453 if(status.trim()==="已退回" || status.trim() ==="受理中"){454 status="待审核";455 }456 $("#updateWorkOrder").ajaxSubmit({457 url:'updateWorkOrderById',458 dataType: 'text',459 data: {460 order:order,461 date:date,462 handler:handler,463 handleMethod:handleMethod,464 handleResult:handleResult,465 handleCount:handleCount,466 status:status,467 admin:admin468 },469 type: 'post',470 success: function () {471 $("#showDetail").modal('hide');472 showInfoInAndOut("info","提交反馈成功!");473 getWorkOrder();474 },475 error: function () {476 $("#showDetail").modal('hide');477 showInfoInAndOut("info","提交反馈失败!");478 }479 })480}481//普通用户工单挂起申请482function hangUp() {483 var order = $("#orderId").val().trim();484 var date=$("#orderDate").val();485 var handler= $("#orderHandler").val().trim();486 var handleMethod = $("#handleMethod").val().trim();487 var handleResult=$("#orderHandleRult").val().trim();488 var admin=$("#orderAdmin").val().trim();489 var status = "申请挂起";490 if(handleMethod.trim()===""){491 showInfoInAndOut("info","请填写处理方法!");492 return;493 }494 if(handleResult.trim()==='-1'||handleResult.trim()===''){495 showInfoInAndOut("info","请选择处理结果!");496 return;497 }498 if(handleResult.trim()==="待处理"){499 showInfoInAndOut("info","请修改处理结果状态!");500 return;501 }502 if(admin.trim()==="" || admin.trim()==="-1"){503 showInfoInAndOut("info","请指定负责人!");504 return;505 }506 $("#workOrderClosedCycleForm").ajaxSubmit({507 url:'hangUp',508 dataType: 'text',509 data:{510 order:order,511 date:date,512 handler:handler,513 handleMethod:handleMethod,514 handleResult:handleResult,515 status:status,516 admin:admin517 },518 type: 'post',519 success:function () {520 $("#showDetail").modal('hide');521 showInfoInAndOut("info","申请挂起已发起!");522 getWorkOrder();523 },524 error:function () {525 $("#showDetail").modal('hide');526 showInfoInAndOut("info","申请挂起失败!");527 }528 })529}530//普通用户申请撤销挂起531function cancelHangUp() {532 var orderCancelHangUp=$("#orderId").val().trim();533 var date=$("#orderDate").val().trim();534 var handler= $("#orderHandler").val().trim();535 var handleMethod = $("#handleMethod").val().trim();536 var handleResult =$("#orderHandleRult").val().trim();537 var statusCancelHangUp="申请撤销挂起";538 var admin=$("#orderAdmin").val();539 if(handleMethod.trim()==="" ){540 showInfoInAndOut("info","请填写处理方法!");541 return;542 }543 if( handleResult.trim() ==="" || handleResult.trim() ==="-1"){544 showInfoInAndOut("info","请选择处理结果!");545 return;546 }547 if(handleResult.trim()==="待处理"){548 showInfoInAndOut("info","请修改处理结果!");549 return;550 }551 if(admin.trim()==="" || admin.trim()==="-1"){552 showInfoInAndOut("info","请指定负责人!");553 return;554 }555 $("#workOrderClosedCycleForm").ajaxSubmit({556 url:'hangUp',557 dataType:'text',558 data:{559 order:orderCancelHangUp,560 date:date,561 handler:handler,562 handleMethod:handleMethod,563 handleResult:handleResult,564 status:statusCancelHangUp,565 admin:admin566 },567 type:'post',568 success: function () {569 $("#showDetail").modal('hide');570 showInfoInAndOut("info","申请撤销挂起成功!");571 getWorkOrder();572 },573 error:function () {574 $("#showDetail").modal('hide');575 showInfoInAndOut("info","申请撤销挂起失败!");576 }577 })578}579function submitCondition() {580 $("#loading").show();581 $("#workOrderClosedCycleForm").ajaxSubmit({582 url: 'workOrderCycleByPage',583 dataType: 'text',584 type: 'post',585 success: function (raw) {586 showWorkOrder(raw);587 showAdminWorkOrder(raw)588 },589 error: function () {590 $("#loading").css("display", "none");591 $("#cycleTable").children().remove();592 $("#cycleAdminTable").children().remove();593 showInfoInAndOut("info", "不存在当前表!");594 }595 })596}597//管理员表格598function showAdminWorkOrder(raw) {599 $("#loading").css("display", "none");600 if(raw==""){601 showInfoInAndOut("info", "对应表不存在!");602 return;603 }604 var data = eval("(" + raw + ")");605 $("#cycleAdminTable").children().remove();606 if (data['data'].length !== 0) {607 var optHtml = "<thead><tr><th>工单</th><th>日期</th><th>BSC</th><th>CELL</th><th>中文名</th><th>县区</th><th>代维</th>"+608 "<th>覆盖场景</th><th>是否VIP小区</th><th>指标名</th><th>指标值</th><th>当天出现次数</th><th>处理人</th><th>处理方法" +609 "</th><th>处理结果</th><th>退单次数</th><th>工单状态</th><th>负责人</th><th>管理</th></tr></thead><tbody>";610 var x = 0;611 for(var i=0;i<data['data'].length;i++){612 x++;613 var one=data['data'][i];614 var handler=one['处理人'];615 var handleMethod=one['处理方法'];616 var bsHandler=one['review处理人'];617 var bsHandleMethod=one['review处理方法'];618 var handlerShow="";619 var handleMethodShow="";620 if(bsHandler.trim().length>0 ){621 handlerShow=bsHandler;622 }623 if(bsHandler.trim().length===0&&handler.trim().length>0){624 handlerShow=handler;625 }626 if(bsHandleMethod.trim().length>0){627 handleMethodShow=bsHandleMethod;628 }629 if(bsHandleMethod.trim().length===0&&handleMethod.trim().length>0){630 handleMethodShow=handleMethod;631 }632 var treatResult=one['处理结果'];633 if(treatResult.trim().length===0){634 treatResult="待处理";635 }636 var status=one['工单状态'];637 if(status.trim().length===0){638 status="受理中";639 }640 var treatCount=one['处理次数'];641 if(treatCount.trim().length===0){642 treatCount='0';643 }644 optHtml += "<tr><td style='white-space:pre-wrap;min-width: 200px'>"+one['工单']+"</td><td>" + one['日期'] + "</td><td>" + one['BSC'] +645 "</td><td>" + one['CELL'] + "</td><td style='white-space:pre-wrap;min-width: 120px'>" + one['中文名'] +646 "</td><td>" + one['县区'] + "</td><td>" + one['代维'] +647 "</td><td>" + one['覆盖场景'] + "</td><td>" + one['是否VIP小区'] +648 "</td><td>" + one['指标名'] + "</td><td>" + one['指标值'] +649 "</td><td>" + one['当天出现的次数'] + "</td><td>" + handlerShow+650 "</td><td style='white-space:pre-wrap;min-width:200px;'>"+handleMethodShow+"</td><td>"+treatResult+"</td><td>"+treatCount+651 "</td><td>"+status+"</td><td>"+one['管理员']+652 "</td><td><a style='cursor: pointer' class='btn btn-success' " +653 "id='manageHandle" + x + "' href='#showManageDetail' data-toggle='modal' onclick='showAdminWorkOrderDetail("+x+")'>管理</a></td>" +654 "</tr>";655 }656 optHtml += "</tbody>";657 $("#loading").css("display", "none");658 $("#cycleAdminTable").append(optHtml);659 setFormPageInfo("workOrderClosedCycleForm",data['page']);660 setPageView(data['page'],"cycleAdminDiv");661 }else{662 $("#loading").css("display", "none");663 // 设置分页面板664 setPageView(data['page'], "cycleAdminDiv");665 showInfoInAndOut("info", "没有找到对应的数据!");666 }667}668//普通用户表格669function showWorkOrder(raw) {670 $("#loading").css("display", "none");671 if(raw==""){672 showInfoInAndOut("info", "对应表不存在!");673 return;674 }675 var data = eval("(" + raw + ")");676 $("#cycleTable").children().remove();677 if (data['data'].length !== 0) {678 var optHtml = "<thead><tr><th>工单</th><th>日期</th><th>BSC</th><th>CELL</th><th>中文名</th><th>县区</th><th>代维</th>"+679 "<th>覆盖场景</th><th>是否VIP小区</th><th>指标名</th><th>指标值</th><th>当天出现次数</th><th>处理人</th><th>处理方法" +680 "</th><th>处理结果</th><th>退单次数</th><th>工单状态</th><th>负责人</th><th>操作</th></tr></thead><tbody>";681 var x = 0;682 for(var i=0;i<data['data'].length;i++){683 x++;684 var one=data['data'][i];685 var handler=one['处理人'];686 var handleMethod=one['处理方法'];687 var bsHandler=one['review处理人'];688 var bsHandleMethod=one['review处理方法'];689 var handlerShow="";690 var handleMethodShow="";691 if(bsHandler.trim().length>0 ){692 handlerShow=bsHandler;693 }694 if(bsHandler.trim().length===0&&handler.trim().length>0){695 handlerShow=handler;696 }697 if(bsHandleMethod.trim().length>0){698 handleMethodShow=bsHandleMethod;699 }700 if(bsHandleMethod.trim().length===0&&handleMethod.trim().length>0){701 handleMethodShow=handleMethod;702 }703 var treatResult=one['处理结果'];704 if(treatResult.trim().length===0){705 treatResult="待处理";706 }707 var status=one['工单状态'];708 if(status.trim().length===0){709 status="受理中";710 }711 var treatCount=one['处理次数'];712 if(treatCount.trim().length===0){713 treatCount='0';714 }715 optHtml += "<tr><td style='white-space:pre-wrap;min-width: 200px'>"+one['工单']+"</td><td>" + one['日期'] + "</td><td>" + one['BSC'] +716 "</td><td>" + one['CELL'] + "</td><td style='white-space:pre-wrap;min-width: 120px'>" + one['中文名'] +717 "</td><td>" + one['县区'] + "</td><td>" + one['代维'] +718 "</td><td>" + one['覆盖场景'] + "</td><td>" + one['是否VIP小区'] +719 "</td><td>" + one['指标名'] + "</td><td>" + one['指标值'] +720 "</td><td>" + one['当天出现的次数'] + "</td><td>" + handlerShow+721 "</td><td style='white-space:pre-wrap;min-width:200px;'>"+handleMethodShow+"</td><td>"+treatResult+"</td><td>"+treatCount+722 "</td><td>"+status+"</td><td>"+one['管理员']+723 "</td><td><a style='cursor: pointer' class='btn btn-success' " +724 "id='updateHandle" + x + "' href='#showDetail' data-toggle='modal' onclick='showWorkOrderDetail("+x+")'>处理</a></td>" +725 "</tr>";726 }727 optHtml += "</tbody>";728 $("#loading").css("display", "none");729 $("#cycleTable").append(optHtml);730 setFormPageInfo("workOrderClosedCycleForm",data['page']);731 setPageView(data['page'],"cycleDiv");732 }else{733 $("#loading").css("display", "none");734 // 设置分页面板735 setPageView(data['page'], "cycleDiv");736 if($("#cellSelect").val().trim()==''){737 showInfoInAndOut("info", "没有找到对应的数据!");738 }else{739 showInfoInAndOut("info", "该小区不在您的负责范围!");740 }741 }742}743//管理员管理工单模态框744function showAdminWorkOrderDetail(x) {745 var handleResultArr=[];746 var statusArr=[];747 $("#orderManHandleRult").empty();748 $("#orderManStatus").empty();749 $("#orderManHandler").empty();750 var rowContent = $("#manageHandle" + x).parent().siblings();751 var workOrderNum = rowContent[0].innerHTML;752 $("#orderManId").val(workOrderNum);753 var date = rowContent[1].innerHTML;754 $("#orderManDate").val(date);755 var bsc = rowContent[2].innerHTML;756 $("#orderManBsc").val(bsc);757 var cell = rowContent[3].innerHTML;758 $("#orderManCell").val(cell);759 var chinese = rowContent[4].innerHTML;760 $("#orderManChinese").val(chinese);761 var county = rowContent[5].innerHTML;762 var maintain = rowContent[6].innerHTML;763 $("#orderManMaintain").val(maintain);764 var coverScene = rowContent[7].innerHTML;765 var vip = rowContent[8].innerHTML;766 var indexName = rowContent[9].innerHTML;767 $("#orderManIndexName").val(indexName);768 var indexValue = rowContent[10].innerHTML;769 $("#orderManIndexValue").val(indexValue);770 var times = rowContent[11].innerHTML;771 var user = rowContent[12].innerHTML;772 $('#orderManHandler').val(user);773 /* $.ajax({774 url:'getNormalUser',775 dataType:'json',776 type:'get',777 success:function (data) {778 if (data.length != 0) {779 for (var i = 0; i < data.length; i++) {780 var one = data[i];781 if(one.trim()===user.trim()){782 $('#orderManHandler').append("<option selected>" + one + "</option>");783 }else{784 $('#orderManHandler').append("<option>" + one + "</option>");785 }786 }787 }788 }789 });790*/791 var handleMethod = rowContent[13].innerHTML;792 $("#handleManMethod").val(handleMethod);793 var handleResult=rowContent[14].innerHTML.trim()===''?'待处理':rowContent[14].innerHTML.trim();794 $("#orderManHandleRult").append("<option selected>"+handleResult+"</option>");795 var handleCount=rowContent[15].innerHTML.trim()===''?'0':rowContent[15].innerHTML.trim();796 $("#orderManHandleCount").val(handleCount);797 var status=rowContent[16].innerHTML.trim()==''?'受理中':rowContent[16].innerHTML.trim();798 $("#orderManStatusCurrent").val(status);799 var admin=rowContent[17].innerHTML;800 $("#orderManAdmin").val(admin);801 $("#orderManStatus").append("<option value='-1' selected></option>");802 $("#orderManStatus").append("<option>完结</option>");803 if(status.trim()=='申请挂起'){804 $("#agreeHangUp").attr("style","display:inline-block");805 $("#refuseHangUp").attr("style","display:inline-block");806 $("#orderManStatus").empty();807 }else{808 $("#agreeHangUp").attr("style","display:none");809 $("#refuseHangUp").attr("style","display:none");810 }811 if(status.trim()=='申请撤销挂起'){812 $("#agreeCancelHangUp").attr("style","display:inline-block;width: 105px");813 $("#orderManStatus").empty();814 }else{815 $("#agreeCancelHangUp").attr("style","display:none");816 }817 if(status.trim()!='已退回'&&status.trim()!='完结' && admin.trim() !=''818 && status.trim()!='申请挂起' && status.trim() !='申请撤销挂起' && status.trim() !='已挂起'819 && parseInt(handleCount)<=2820 ){821 $("#giveBack").attr("style",'display:inline-block;width: 105px');822 }else{823 $("#giveBack").attr("style","display:none");824 }825 if(status.trim()=='完结'|| status.trim() =='已挂起'||status.trim()=='申请挂起'826 ||status.trim()=='申请撤销挂起'){827 $("#ensureOrder").attr("style","display:none");828 $("#orderManStatus").empty();829 }else{830 $("#ensureOrder").attr("style","display:inline-block");831 }832}833//普通用户处理工单模态框834function showWorkOrderDetail(x) {835 var handleResultArr=[];836 var statusArr=[];837 $("#orderHandleRult").empty();838 $("#orderAdmin").empty();839 $("#orderStatus").empty();840 var rowContent = $("#updateHandle" + x).parent().siblings();841 var workOrderNum = rowContent[0].innerHTML;842 $("#orderId").val(workOrderNum);843 var date = rowContent[1].innerHTML;844 $("#orderDate").val(date);845 var bsc = rowContent[2].innerHTML;846 $("#orderBsc").val(bsc);847 var cell = rowContent[3].innerHTML;848 $("#orderCell").val(cell);849 var chinese = rowContent[4].innerHTML;850 $("#orderChinese").val(chinese);851 var county = rowContent[5].innerHTML;852 var maintain = rowContent[6].innerHTML;853 $("#orderMaintain").val(maintain);854 var coverScene = rowContent[7].innerHTML;855 var vip = rowContent[8].innerHTML;856 var indexName = rowContent[9].innerHTML;857 $("#orderIndexName").val(indexName);858 var indexValue = rowContent[10].innerHTML;859 $("#orderIndexValue").val(indexValue);860 var times = rowContent[11].innerHTML;861 var handler = rowContent[12].innerHTML;862 $("#orderHandler").val(handler);863 var handleMethod = rowContent[13].innerHTML;864 $("#handleMethod").val(handleMethod);865 var handleResult=rowContent[14].innerHTML;866 handleResultArr=["待处理","正在处理","已完成"];867 $("#orderHandleRult").append("<option value='-1' selected></option>");868 for(var j = 0;j<handleResultArr.length;j++){869 if(handleResultArr[j]===handleResult){870 $("#orderHandleRult").append("<option selected>"+handleResult+"</option>");871 }else{872 $("#orderHandleRult").append("<option>"+handleResultArr[j]+"</option>");873 }874 }875 var handleCount=rowContent[15].innerHTML.trim()==''?'0':rowContent[15].innerHTML.trim();876 $("#orderHandleCount").val(handleCount);877 var status=rowContent[16].innerHTML.trim()==''?'受理中':rowContent[16].innerHTML.trim();878 if(status.trim()=='待审核'||status.trim()=='受理中'|| status.trim()=='已退回'|| status.trim()=='超时'){879 $("#applyForHangUp").attr("style","display:inline-block");880 }else{881 $("#applyForHangUp").attr("style","display:none");882 }883 if(status.trim()=='已挂起'){884 $("#cancelHangUp").attr("style","display:inline-block;width: 105px");885 }else{886 $("#cancelHangUp").attr("style","display:none");887 }888 if((status.trim()=='完结' || status.trim()=='申请挂起'889 || status.trim()=='已挂起' || status.trim()=='申请撤销挂起')||parseInt(handleCount)>2 ){890 $("#updateOrderBtn").attr("style","display:none");891 }else{892 $("#updateOrderBtn").attr("style","inline-block");893 }894 $("#orderStatus").append("<option selected>"+status+"</option>");895 var admin=rowContent[17].innerHTML;896 //console.log(admin);897 $('#orderAdmin').append("<option selected value='-1'></option>");898 $.ajax({899 url:'getAdministrator',900 dataType:'json',901 type:'get',902 success:function (data) {903 if (data.length != 0) {904 for (var i = 0; i < data.length; i++) {905 var one = data[i];906 if(one.trim()===admin.trim()){907 $('#orderAdmin').append("<option selected>" + one + "</option>");908 }else{909 $('#orderAdmin').append("<option>" + one + "</option>");910 }911 }912 }913 }914 });915}916//统计信息917function showEvaluateData(one) {918 $("#allTable").children().remove();919 $("#finishedTable").children().remove();920 $("#overTimeTable").children().remove();921 for(var j=0;j<one['indicatorStatistic'].length;j++){922 var oneIndicator=one['indicatorStatistic'][j];923 $("#allTable").append("<td>"+oneIndicator+"(<span>"+one['a'+j]+"</span>)</td>");924 $("#finishedTable").append("<td>"+oneIndicator+"(<span>"+one['f'+j]+"</span>)</td>");925 $("#overTimeTable").append("<td>"+oneIndicator+"(<span>"+one['o'+j]+"</span>)</td>");926 }927 $("#collapseExample").collapse('toggle');...

Full Screen

Full Screen

eventnotificationscontroller.js

Source:eventnotificationscontroller.js Github

copy

Full Screen

1(function () {2 'use strict';3 angular4 .module('clConnectControllers')5 .controller('eventnotificationscontroller', eventnotificationscontroller);6 eventnotificationscontroller.$inject = ['resolveEventNotificationTypes', 'setupservice', 'validationservice'];7 function eventnotificationscontroller(resolveEventNotificationTypes, setupservice, validationservice) {8 var vm = this;9 vm.addEventNotification = addEventNotification;10 vm.clientDatabaseConnection = setupservice.configurationModel.campusLogicSection.clientDatabaseConnection;11 vm.connectionStringType = 'n'; // valid values 'c' = connection string, 'd' = dsn, 'n' = none12 vm.dsnName = '';13 vm.dsnPassword = '';14 vm.dsnUser = '';15 vm.usingDatabase = (vm.clientDatabaseConnection.connectionString !== '');16 vm.eventNotifications = setupservice.configurationModel.campusLogicSection.eventNotifications;17 vm.eventNotificationTypes = resolveEventNotificationTypes;18 vm.IsCommandEnabled = IsCommandEnabled;19 vm.IsFileStoreEnabled = IsFileStoreEnabled;20 vm.IsBatchProcessingEnabled = IsBatchProcessingEnabled;21 vm.IsApiIntegrationsEnabled = IsApiIntegrationsEnabled;22 vm.onConnectionStringTypeChange = onConnectionStringTypeChange;23 vm.removeEventNotification = removeEventNotification;24 vm.testConnectionString = testConnectionString;25 vm.onTextBoxChange = onTextBoxChange;26 vm.validationService = validationservice;27 vm.eventNotificationsValid = validationservice.pageValidations.eventNotificationsValid;28 vm.duplicateEvent = false;29 vm.invalidBatchName = false;30 vm.invalidApiEndpointName = false;31 vm.checkForDuplicateEvent = checkForDuplicateEvent;32 vm.checkForInvalidBatchName = checkForInvalidBatchName;33 vm.hasInvalidApiEndpointName = hasInvalidApiEndpointName;34 vm.handleMethodChange = handleMethodChange;35 onLoad();36 function checkForInvalidBatchName() {37 vm.invalidBatchName = validationservice.checkForInvalidBatchName();38 }39 function hasInvalidApiEndpointName() {40 vm.invalidApiEndpointName = validationservice.hasInvalidApiEndpointName();41 }42 function checkForDuplicateEvent() {43 vm.duplicateEvent = validationservice.checkForDuplicateEvent();44 }45 function onTextBoxChange() {46 vm.clientDatabaseConnection.connectionString = "DSN=" + vm.dsnName + ";UID=" + vm.dsnUser + ";PWD=" + vm.dsnPassword;47 }48 function addEventNotification() {49 vm.eventNotifications.push({50 eventNotificationId: 0,51 handleMethod: vm.eventNotificationTypes[0].eventNotificationTypeId,52 dbCommandFieldValue: ''53 });54 checkForDuplicateEvent();55 checkForInvalidBatchName();56 hasInvalidApiEndpointName();57 }58 function IsCommandEnabled(index) {59 var eventNotificationTypeId = vm.eventNotifications[index].handleMethod;60 if (!eventNotificationTypeId)61 return false;62 var eventNotificationType = $.grep(vm.eventNotificationTypes, function (e) { return e.eventNotificationTypeId == eventNotificationTypeId; })[0];63 return eventNotificationType.isCommandAttributeRequired;64 }65 function IsFileStoreEnabled(index) {66 var eventNotificationTypeId = vm.eventNotifications[index].handleMethod;67 if (!eventNotificationTypeId)68 return false;69 var eventNotificationType = $.grep(vm.eventNotificationTypes, function (e) { return e.eventNotificationTypeId == eventNotificationTypeId; })[0];70 return eventNotificationType.isFileStoreTypeRequired;71 }72 function IsBatchProcessingEnabled(index) {73 var eventNotificationTypeId = vm.eventNotifications[index].handleMethod;74 if (!eventNotificationTypeId)75 return false;76 var eventNotificationType = $.grep(vm.eventNotificationTypes, function (e) { return e.eventNotificationTypeId == eventNotificationTypeId; })[0];77 return eventNotificationType.isBatchProcessingRequired;78 }79 function IsApiIntegrationsEnabled(index) {80 var eventNotificationTypeId = vm.eventNotifications[index].handleMethod;81 if (!eventNotificationTypeId)82 return false;83 var eventNotificationType = $.grep(vm.eventNotificationTypes, function (e) { return e.eventNotificationTypeId == eventNotificationTypeId; })[0];84 return eventNotificationType.isApiIntegrationRequired;85 }86 function handleMethodChange(e) {87 if (e.handleMethod === 'DocumentRetrieval' || e.handleMethod === 'FileStore' || e.handleMethod === 'FileStoreAndDocumentRetrieval' || e.handleMethod === 'Print' || e.handleMethod === 'BatchProcessingAwardLetterPrint' || e.handleMethod === 'ApiIntegration' || e.handleMethod === 'PowerFAIDS' ) {88 e.dbCommandFieldValue = '';89 }90 if (e.handleMethod !== 'FileStore' && e.handleMethod !== 'FileStoreAndDocumentRetrieval') {91 e.fileStoreType = '';92 }93 if (e.handleMethod === 'FileStore' || e.handleMethod === 'FileStoreAndDocumentRetrieval') {94 e.fileStoreType = 'Shared';95 }96 if (e.handleMethod !== 'BatchProcessingAwardLetterPrint') {97 e.batchName = '';98 vm.invalidBatchName = false;99 }100 if (e.handleMethod !== 'ApiIntegration') {101 e.apiEndpointName = '';102 vm.invalidApiEndpointName = false;103 }104 }105 function onConnectionStringTypeChange() {106 switch (vm.connectionStringType) {107 case 'c':108 vm.usingDatabase = true;109 if (vm.clientDatabaseConnection.connectionString.indexOf("DSN") >= 0) {110 vm.clientDatabaseConnection.connectionString = '';111 }112 break;113 case 'n':114 vm.clientDatabaseConnection.connectionString = '';115 if (vm.eventNotifications.some(function (eventNotification)116 {117 return (eventNotification.handleMethod !== 'DocumentRetrieval'118 && eventNotification.handleMethod !== 'FileStore'119 && eventNotification.handleMethod !== 'FileStoreAndDocumentRetrieval'120 && eventNotification.handleMethod !== 'AwardLetterPrint'121 && eventNotification.handleMethod !== 'BatchProcessingAwardLetterPrint'122 && eventNotification.handleMethod !== 'ApiIntegration'123 && eventNotification.handleMethod !== 'PowerFAIDS'124 );125 }))126 {127 vm.usingDatabase = true;128 validationservice.pageValidations.connectionStringValid = false;129 }130 else131 {132 vm.usingDatabase = false;133 }134 break;135 case 'd':136 vm.usingDatabase = true;137 vm.clientDatabaseConnection.connectionString = "DSN=" + vm.dsnName + ";UID=" + vm.dsnUser + ";PWD=" + vm.dsnPassword;138 break;139 default:140 break;141 }142 }143 function onLoad() {144 checkForDuplicateEvent();145 checkForInvalidBatchName();146 hasInvalidApiEndpointName();147 if (vm.clientDatabaseConnection.connectionString.indexOf("DSN") >= 0) {148 vm.connectionStringType = 'd';149 var keyValuePairs = vm.clientDatabaseConnection.connectionString.split(';');150 for (var i = 0; i < keyValuePairs.length; i++) {151 var keyValuePair = keyValuePairs[i].split('=');152 switch (keyValuePair[0].toUpperCase()) {153 case 'DSN':154 vm.dsnName = keyValuePair[1];155 break;156 case 'PWD':157 vm.dsnPassword = keyValuePair[1];158 break;159 case 'UID':160 vm.dsnUser = keyValuePair[1];161 break;162 default:163 break;164 }165 }166 }167 else if (vm.clientDatabaseConnection.connectionString !== '') {168 vm.connectionStringType = 'c';169 }170 else if (vm.clientDatabaseConnection.connectionString === '') {171 vm.connectionStringType = 'n';172 }173 vm.onConnectionStringTypeChange();174 }175 function removeEventNotification(index) {176 vm.eventNotifications.splice(index, 1);177 checkForDuplicateEvent();178 checkForInvalidBatchName();179 hasInvalidApiEndpointName();180 }181 function testConnectionString(form) {182 if (vm.connectionStringType == 'd')183 vm.clientDatabaseConnection.connectionString = "DSN=" + vm.dsnName + ";UID=" + vm.dsnUser + ";PWD=" + vm.dsnPassword;184 validationservice.testEventNotifications(form);185 };186 };...

Full Screen

Full Screen

route.js

Source:route.js Github

copy

Full Screen

1/**2 * Date: 2013.04.153 * The request processor for the route mapping.4 */5function route(routemap, url, request, response) {6 var pathObject = null;7 var err = true;8 if (url == '/favicon.ico') {9 return404();10 return;11 }12 var handlemethod = null;13 if (request.method == "GET") {14 handlemethod = routemap.get;15 } else if (request.method == "PUT") {16 handlemethod = routemap.put;17 } else if (request.method == "POST") {18 handlemethod = routemap.post;19 } else if (request.method == "DELETE") {20 handlemethod = routemap.del;21 } else {22 return404();23 return;24 }25 for (var pathvalue in handlemethod) {26 pathObject = routepath(pathvalue, url);27 if (pathObject != null && typeof handlemethod[pathvalue] === 'function') {28 err = false;29 var getParam = parseUrl(url);30 getPostData(request, response, function (postData) {31 if (request.method == "GET") {32 handlemethod[pathvalue](request, response, pathObject, getParam);33 } else if (request.method == "POST") {34 handlemethod[pathvalue](request, response, pathObject, postData);35 }36 })37 break;38 }39 }40 if (err) {41 return404();42 }43 function return404() {44 response.writeHead(404, {"Content-Type":"text/plain; charset=UTF-8"});45 if (url == "/") {46 response.write("欢迎访问Restful Server.");47 } else if (url == "/favicon.ico") {48 response.write("");49 }50 else {51 response.write("404 Not found, API地址木有找到。。。");52 console.log("No request handler found for " + url);53 }54 response.end();55 }56}57var separator = /^[\s\/]+|[\s\/]+$/g;58function routepath(pathvalue, url) {59 var pathObject = {};60 var pathvalueArray = decodeURI(pathvalue).split('?', 1)[0].replace(separator, '').split('/');61 var urlArray = decodeURI(url).split('?', 1)[0].replace(separator, '').split('/');62 if (urlArray.length == pathvalueArray.length) {63 for (var i = 0; i < pathvalueArray.length; i++) {64 if (pathvalueArray[i] == "*") {65 continue;66 } else if (pathvalueArray[i].substring(0, 1) == ":") {67 pathObject[pathvalueArray[i].substring(1, pathvalueArray[i].length)] = urlArray[i];68 continue;69 } else if (urlArray[i] == pathvalueArray[i]) {70 continue;71 } else {72 return null;73 }74 }75 return pathObject;76 }77 return null;78}79/**80 * parseUrl to read the GET paramiter.81 */82function parseUrl(url) {83 var getParamStr = decodeURI(url).split('?', 2)[1];84 if (getParamStr != null) {85 var getParam = {};86 var getParamArray = getParamStr.replace(separator, '').split('&');87 for (var i = 0; i < getParamArray.length; i++) {88 if (getParamArray[i] != "") {89 getParamPeer = getParamArray[i].split('=', 2);90 getParam[getParamPeer[0]] = getParamPeer[1];91 }92 }93 return getParam;94 }95 return null;96}97var maxData = 2 * 1024 * 1024; //prevent mass post data98var querystring = require('querystring');99function getPostData(request, response, next) {100 if (request.method == "POST") {101 response.asynchronous = 1;102 var postData = '';103 request.on('data',function (chunk) {104 postData += chunk;105 if (postData.length > maxData) {106 pstData = '';107 this.pause;//stop further data108 response.writeHead(413);109 response.end('Request too large');110 }111 }).on('end', function () {112 if (!postData) {113 response.end();114 return;115 }//prevent empty post116 var postDataObject = querystring.parse(postData);117 next(postDataObject);118 });119 }120 else {121 next(null);122 }123}...

Full Screen

Full Screen

ModalComponent.js

Source:ModalComponent.js Github

copy

Full Screen

1import React, {Component, PropTypes, Children} from 'react';2import {connect} from 'react-redux';3import _ from 'underscore';45import * as Actions from '../actions';67class ModalComponent extends Component{8 constructor(){9 super();10 this.state = {11 id: _.uniqueId('modal_')12 };13 }1415 render(){16 let title = this.props.title != undefined ? this.props.title : 'WARNING!';17 let body = this.props.body != undefined ? this.props.body : 'Would you like to continue this operation?';18 let handleMethod = this.props.handleMethod != undefined ? this.props.handleMethod : function(){};19 handleMethod = _.partial(handleMethod, this.state.source);2021 return (22 <div className="modal fade" id={this.state.id} tabIndex="-1" role="basic" aria-hidden="true">23 <div className="modal-dialog">24 <div className="modal-content">25 <div className="modal-header">26 <button type="button" className="close" data-dismiss="modal" aria-hidden="true"></button>27 <h4 className="modal-title">{title}</h4>28 </div>29 <div className="modal-body"> {body} </div>30 <div className="modal-footer">31 <button type="button" className="btn dark btn-outline" data-dismiss="modal">Close</button>32 <button type="button" className="btn green action-cont" data-dismiss="modal" onClick={handleMethod}> Continue </button>33 </div>34 </div>35 </div>36 </div>37 );38 }3940 componentDidMount(){41 $(`#${this.state.id}`).on('show.bs.modal', function(e){42 this.setState({43 source: e44 });45 }.bind(this));46 }4748 componentDidUpdate(){49 let show = this.props.show != undefined ? this.props.show : false;50 if(show){51 $(`#${this.state.id}`).modal('show', this.props.relatedTarget);52 this.props.dispatch(Actions.ModalActions.showModalFinish());53 }54 }55}5657ModalComponent.propTypes = {58 show: PropTypes.bool,59 title: PropTypes.string,60 body: PropTypes.string,61 handleMethod: PropTypes.func,62 relatedTarget: PropTypes.object63};6465const ShowSelector = state => state.modal.show;66const TitleSelector = state => state.modal.title;67const BodySelector = state => state.modal.body;68const HandleMethodSelector = state => state.modal.handleMethod;69const RelatedTargetSelector = state => state.modal.relatedTarget;7071function select(state){72 return {73 show: ShowSelector(state),74 title: TitleSelector(state),75 body: BodySelector(state),76 handleMethod: HandleMethodSelector(state),77 relatedTarget: RelatedTargetSelector(state)78 };79}80 ...

Full Screen

Full Screen

bind.test.js

Source:bind.test.js Github

copy

Full Screen

...28 }29 onMethod() {30 this.called.push('onMethod');31 }32 handleMethod() {33 this.called.push('handleMethod');34 }35}36describe('decorators/bind()', () => {37 it('should automatically set the context', () => {38 const obj = new BindMethodStub();39 processInThread(obj.withoutBind);40 processInThread(obj.withBind);41 processInThread(() => {42 expect(obj.with).toBe(true);43 expect(obj.without).toBe(false);44 });45 });46 it('should not modify other objects', () => {...

Full Screen

Full Screen

HTTPObject.js

Source:HTTPObject.js Github

copy

Full Screen

1function getHTTPObject() {2//alert("getHTTPObject");3 var xhr_object = null;4 if(window.XMLHttpRequest) // Firefox5 xhr_object = new XMLHttpRequest();6 else if(window.ActiveXObject) { // Internet Explorer7 try {8 xhr_object = new ActiveXObject("Msxml2.XMLHTTP");9 } catch (E) {10 xhr_object = new ActiveXObject("Microsoft.XMLHTTP");11 }12 } else { // XMLHttpRequest non supportamp;eacute; par le navigateur13 //alert("You do not support XMLHTTPRequest objet");14 return;15 }16 return xhr_object;17}18function sendToUrlPost(oHttp, url, urlParam, handleMethod) {19//alert("sendToUrlPost url:" + url + " urlParam:" + urlParam + " handleMethod:" + handleMethod);20 oHttp.open("POST", url + "?" + urlParam, true);21 oHttp.onreadystatechange = eval(handleMethod);22 oHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");23 oHttp.send(urlParam);24}25function sendToUrlGet(oHttp, url, urlParam, handleMethod) {26//alert("sendToUrlPost url:" + url + " urlParam:" + urlParam + " handleMethod:" + handleMethod);27 //oHttp.open(method, url + "&" + urlParam, true);28 oHttp.open("GET", url + "?" + urlParam, true);29 oHttp.onreadystatechange = eval(handleMethod);30 oHttp.send(null);31}32function sendToUrl(oHttp, url, urlParam, handleMethod, method) {33//alert("sendToUrl url:" + url + " urlParam:" + urlParam + " handleMethod:" + handleMethod);34 //var method = "POST";//"GET";35 if(method == "GET") {36 //oHttp.open(method, url + "&" + urlParam, true);37 oHttp.open(method, url + "?" + urlParam, true);38 oHttp.onreadystatechange = eval(handleMethod);39 oHttp.send(null);40 }41 else { // POST42//alert("sendToUrl url:" + url + "?" + urlParam);43 oHttp.open(method, url + "?" + urlParam, true);44 oHttp.onreadystatechange = eval(handleMethod);45 oHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");46 oHttp.send(urlParam);47 }...

Full Screen

Full Screen

api.js

Source:api.js Github

copy

Full Screen

...23 },24 clearApiToken() {25 delete axios.defaults.headers.common.Authorization;26 },27 get(url) { return handleMethod('GET', url, null); },28 put(url, payload) { return handleMethod('PUT', url, payload); },29 post(url, payload) { return handleMethod('POST', url, payload); },30 patch(url, payload) { return handleMethod('PATCH', url, payload); },31 delete(url, payload) { return handleMethod('DELETE', url, null); },...

Full Screen

Full Screen

StellarHandler.js

Source:StellarHandler.js Github

copy

Full Screen

...4import lowerCase from 'lodash/lowerCase';5import StellarCore from './StellarCore';6export default class StellarHandler extends StellarCore {7 get(url, handler) {8 return this.handleMethod(url, 'GET', handler);9 }10 create(url, handler) {11 return this.handleMethod(url, 'CREATE', handler);12 }13 update(url, handler) {14 return this.handleMethod(url, 'UPDATE', handler);15 }16 remove(url, handler) {17 return this.handleMethod(url, 'REMOVE', handler);18 }19 handleMethod(url, method, handler) {20 return this.handleRequest(`${url}:${lowerCase(method)}`, handler);21 }22 handleRequest(url, handler) {23 this.allMiddlewares = this.handlerChain.concat({24 fn({ headers, body }) {25 return handler({ headers, body });26 },27 });28 return this.transport.addRequestHandler(url, this._executeMiddlewares(this.allMiddlewares));29 }...

Full Screen

Full Screen

Using AI Code Generation

copy

Full Screen

1const puppeteer = require('puppeteer');2const fs = require('fs');3const { promisify } = require('util');4const writeFile = promisify(fs.writeFile);5(async () => {6 const browser = await puppeteer.launch({ headless: false });7 const page = await browser.newPage();8 await page.waitForSelector('input[name="q"]');9 const methods = await page.evaluate(() => {10 const puppeteer = require('puppeteer');11 const browser = puppeteer.launch({ headless: false });12 const page = browser.newPage();13 return page.handleMethod('Page.methods');14 });15 await writeFile('methods.json', JSON.stringify(methods, null, 2));16 await browser.close();17})();

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run Puppeteer automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful