entrance.js 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118
  1. var flowID = [];
  2. var flowname = [];
  3. var periodID = [];
  4. var periodname = [];
  5. var userId = utils_get_param("userId");
  6. function page_document_load() {
  7. new_data_group("denglu",function(gp){
  8. if(gp.counter === 2){
  9. showEachSpot();
  10. showEachSpot1();
  11. }
  12. });
  13. firsttime_load_spots_data();
  14. secondtime_load_spots_data();
  15. }
  16. function firsttime_load_spots_data() {
  17. group_get_data("denglu","fcFlow/list", first_success)
  18. }
  19. function first_success(obj, sta) {
  20. let output = first_parse(this, obj);
  21. //在这里排序 spo\
  22. console.log(" output : ");
  23. console.log(output);
  24. let i, j, k;
  25. j = 0;
  26. k = 0;
  27. for (i = 0; i < output.list.length; i++) {
  28. if (userId === ""+output.list[i].flowMasterId) {
  29. flowID[j] = output.list[i].flowId;
  30. flowname[j] = output.list[i].flowName + "(负责人)";
  31. j++;
  32. } else {
  33. flowID[j] = output.list[i].flowId;
  34. flowname[j] = output.list[i].flowName + "(无权限)";
  35. j++;
  36. k++;
  37. }
  38. }
  39. if (k === output.list.length) {
  40. send_alert("请注意:您并不是任何生产线的负责人\n因此,您不得开始任何班次,只能进入已经存在的班次\n 提示:测试模式不受此限制!");
  41. }
  42. }
  43. function secondtime_load_spots_data() {
  44. group_get_data("denglu","fcWorkPeriod/list", second_success);
  45. }
  46. function second_success(obj, sta) {
  47. var history = first_parse(this, obj).list;
  48. var i, j;
  49. console.log(" history : ");
  50. console.log(history);
  51. for (i = 0; i < history.length; i++) {
  52. periodID[i] = history[i].periodId;
  53. periodname[i] = history[i].periodName;
  54. }
  55. showEachSpot1();
  56. }
  57. function showEachSpot1() {
  58. var htmlbody = "", one_person = "";
  59. var i = 0;
  60. var triGap = periodID.length;
  61. htmlbody = "";
  62. for (i = 0; i < triGap; i++) {
  63. htmlbody = getSpotHtml1(htmlbody, i);
  64. }
  65. $("#period_ID").html(htmlbody);
  66. //console.log(htmlbody);
  67. }
  68. function getSpotHtml1(htmlbody, i) {
  69. htmlbody += "";
  70. htmlbody += `<option value="${periodID[i]}">${periodname[i]}</option>`;
  71. htmlbody += "";
  72. return htmlbody;
  73. }
  74. function showEachSpot() {
  75. var htmlbody = "", one_person = "";
  76. var i = 0;
  77. var triGap = flowID.length;
  78. htmlbody = "";
  79. for (i = 0; i < triGap; i++) {
  80. htmlbody = getSpotHtml(htmlbody, i);
  81. }
  82. $("#pro_areaCode").html(htmlbody);
  83. //console.log(htmlbody);
  84. }
  85. function getSpotHtml(htmlbody, i) {
  86. htmlbody += "";
  87. htmlbody += `<option value="${flowID[i]}">${flowname[i]}</option>`;
  88. htmlbody += "";
  89. return htmlbody;
  90. }
  91. function moveToStart(btn) {
  92. $(btn).attr("disabled", "disabled");
  93. var proAreaCode = $("#pro_areaCode").val();
  94. var periodnum = $("#period_ID").val();
  95. get_data("/fcWorkSchedule/startSchedule?flowId=" + proAreaCode + "&periodId=" + periodnum, startToSchedule);
  96. }
  97. function startToSchedule(obj) {
  98. let output = first_parse(this, obj);
  99. if(output != undefined){
  100. var proAreaCode = $("#pro_areaCode").val();
  101. send_alert("即将跳转 拉长页面: scheduleId:"+output.scheduleId);
  102. location.href = 'lazhang.html?scheduleId=' + output.scheduleId + '&flowId=' + proAreaCode;
  103. }else{
  104. send_alert("开始失败!");
  105. }
  106. }