var flowID = []; var flowname = []; var periodID = []; var periodname = []; getUserId(); function page_document_load() { new_data_group("denglu",function(gp){ if(gp.counter === 2){ showEachSpot(); showEachSpot1(); } }); checkIfExists(); firsttime_load_spots_data(); secondtime_load_spots_data(); } function firsttime_load_spots_data() { group_get_data("denglu","fcFlow/list", first_success) } function first_success(obj, sta) { let output = first_parse(this, obj); //在这里排序 spo\ console.log(" output : "); console.log(output); let i, j, k; j = 0; k = 0; for (i = 0; i < output.list.length; i++) { if (userId+"" === ""+output.list[i].flowMasterId) { flowID[j] = output.list[i].flowId; flowname[j] = output.list[i].flowName + "(负责人)"; j++; } else { flowID[j] = 0; flowname[j] = output.list[i].flowName + "(无权限)"; j++; k++; } } if (k === output.list.length) { send_alert("请注意:您不是任一产线负责人
因此,您不得开始班次
如果有误,请修改产线的负责人信息 "); } } function secondtime_load_spots_data() { group_get_data("denglu","fcWorkPeriod/list", second_success); } function second_success(obj, sta) { var history = first_parse(this, obj).list; var i, j; console.log(" history : "); console.log(history); for (i = 0; i < history.length; i++) { periodID[i] = history[i].periodId; periodname[i] = history[i].periodName; } showEachSpot1(); } function showEachSpot1() { var htmlbody = "", one_person = ""; var i = 0; var triGap = periodID.length; htmlbody = ""; for (i = 0; i < triGap; i++) { htmlbody = getSpotHtml1(htmlbody, i); } $("#period_ID").html(htmlbody); //console.log(htmlbody); } function getSpotHtml1(htmlbody, i) { htmlbody += ""; htmlbody += ``; htmlbody += ""; return htmlbody; } function showEachSpot() { var htmlbody = "", one_person = ""; var i = 0; var triGap = flowID.length; htmlbody = ""; for (i = 0; i < triGap; i++) { htmlbody = getSpotHtml(htmlbody, i); } $("#pro_areaCode").html(htmlbody); //console.log(htmlbody); } function getSpotHtml(htmlbody, i) { htmlbody += ""; htmlbody += ``; htmlbody += ""; return htmlbody; } function moveToStart(btn) { $(btn).attr("disabled", "disabled"); var proAreaCode = $("#pro_areaCode").val(); if(""+proAreaCode === "0"){ send_alert("请确认您拥有本产线的权限"); $(btn).attr("disabled",""); return; } var periodnum = $("#period_ID").val(); get_data("/fcWorkSchedule/startSchedule?flowId=" + proAreaCode + "&periodId=" + periodnum + "&userId="+userId, startToSchedule); } function startToSchedule(obj) { let output = first_parse(this, obj); if(output != undefined){ var proAreaCode = $("#pro_areaCode").val(); send_alert("即将跳转 拉长页面: scheduleId:"+output.scheduleId); location.href = 'lazhang.html?scheduleId=' + output.scheduleId + '&flowId=' + proAreaCode; }else{ send_alert("开始失败!"); } } function checkIfExists(){ get_data("/fcWorkSchedule/remaining?status=100",on_receive_exist); } function getRemainHTML(obj) { var pdName = ""; for(i=0;i ${obj.flowName} ${obj.workDay} ${pdName}
` } function send_remain(a, b) { $("#mpRemain").html(a); $("#mpRemain").show(); return; } function on_receive_exist(objs, sta){ let obj = first_parse(this, objs); console.log(obj); let wholehtml = ""; if(obj != null && obj != undefined && obj.list != null){ if(obj.list.length === 0){ wholehtml = "当前没有正在进行的班次
请开始班次!"; send_remain(wholehtml); return; } let i = 0; wholehtml = "正在进行的班次:
"; for(i=0;i