123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118 |
- var flowID = [];
- var flowname = [];
- var periodID = [];
- var periodname = [];
- var userId = utils_get_param("userId");
- function page_document_load() {
- new_data_group("denglu",function(gp){
- if(gp.counter === 2){
- showEachSpot();
- showEachSpot1();
- }
- });
- 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] = output.list[i].flowId;
- flowname[j] = output.list[i].flowName + "(无权限)";
- j++;
- k++;
- }
- }
- if (k === output.list.length) {
- send_alert("请注意:您并不是任何生产线的负责人\n因此,您不得开始任何班次,只能进入已经存在的班次\n 提示:测试模式不受此限制!");
- }
- }
- 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 += `<option value="${periodID[i]}">${periodname[i]}</option>`;
- 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 += `<option value="${flowID[i]}">${flowname[i]}</option>`;
- htmlbody += "";
- return htmlbody;
- }
- function moveToStart(btn) {
- $(btn).attr("disabled", "disabled");
- var proAreaCode = $("#pro_areaCode").val();
- var periodnum = $("#period_ID").val();
- get_data("/fcWorkSchedule/startSchedule?flowId=" + proAreaCode + "&periodId=" + periodnum, 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("开始失败!");
- }
- }
|