123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427 |
- getUserId();
- function load_table_red_rank() {
- get_data("fcBiWorkerDaily/get?type=1&limit=3", on_red_rank_success);
- }
- function load_table_red_rank1() {
- get_data("fcBiWorkerDaily/get?type=2&limit=3", on_red_rank_success1);
- }
- function load_table_black_rank1() {
- get_data("fcBiWorkerDaily/get?type=3&limit=3", on_black_rank_success1);
- }
- function load_table_black_rank() {
- get_data("fcBiWorkerDaily/get?type=0&limit=3", on_black_rank_success);
- }
- var goodColor = [];
- var badColor = [];
- var goodColor1 = [];
- var badColor1 = [];
- var userIDs = [];
- var schedulepass = 0, schedulefail = 0, schedulestack = 0;
- var todayotherpass = 0, todayotherfail = 0, todayotherstack = 0;
- var lastTimeHistory = "";
- var histoires = [];
- var hispass = [];
- var hisfail = [];
- var hisstack = [];
- var hisrate = [];
- var goodpass = [];
- var goodid = [];
- var goodfailrate = [];
- var goodpass1 = [];
- var goodid1 = [];
- var goodfailrate1 = [];
- var badpass = [];
- var badid = [];
- var badfailrate = [];
- var badpass1 = [];
- var badid1 = [];
- var badfailrate1 = [];
- function history_success(obj, sta) {
- var histoire = first_parse(this, obj);
- var i, j, t;
- console.log(" histoire : ");
- console.log(histoire);
- if (this.url.indexOf("type=1") >= 0) {
- t = 1;
- } else if (this.url.indexOf("type=2") >= 0) {
- t = 2;
- } else if (this.url.indexOf("type=3") >= 0) {
- t = 3;
- } else {
- t = 0;
- return;
- }
- histoires[t] = histoire;
- if (t === 2 || t === 3) {
- hispass[t] = 0;
- hisfail[t] = 0;
- hisstack[t] = 0;
- hisrate[t] = 0;
- for (i = 0; i < histoire.length - 1; i++) { //除了今日
- hispass[t] = histoire[i].passNum + hispass[t];
- hisfail[t] = histoire[i].failNum + hisfail[t];
- hisstack[t] = histoire[i].avgDue + hisstack[t];
- }
- orighispass[t] = hispass[t];
- orighisfail[t] = hisfail[t];
- orighisstack[t] = hisstack[t];
- hispass[t] += hispass[0];
- hisfail[t] += hisfail[0];
- hisstack[t] += hisstack[0];
- hisrate[t] = get_factor(hispass[t], hisfail[t]);
- } else if (t === 1) {
- hispass[1] = histoire[0].passNum;
- hisfail[1] = histoire[0].failNum;
- hisstack[1] = histoire[0].avgDue;
- hisrate[t] = get_factor(hispass[1], hisfail[1]);
- }
- todayotherpass = histoire[histoire.length - 1].passNum;
- todayotherfail = histoire[histoire.length - 1].failNum;
- todayotherstack = histoire[histoire.length - 1].avgDue;
- update_all_history();
- }
- function update_all_history(){
- hispass[0] = todayotherpass + schedulepass;
- hisfail[0] = todayotherfail + schedulefail;
- hisstack[0] = todayotherstack + schedulestack;
- hisrate[0] = get_factor(hispass[0], hisfail[0]);
- for(i=2;i<=3;i++){
- hispass[i] = orighispass[i] + hispass[0];
- hisfail[i] = orighisfail[i] + hisfail[0];
- hisstack[i] = orighisstack[i] + hisstack[0];
- hisrate[i] = get_factor(hispass[i], hisfail[i]);
- }
- }
- var todayotherpass , todayotherfail, todayotherstack;
- var orighisfail= [], orighispass=[], orighisstack=[];
- function isUserOfThisFlow(uid) {
- var isExist = false;
- userIDs.forEach(function (vals) {
- if (vals == uid) {
- isExist = true;
- }
- });
- return isExist;
- }
- function on_red_rank_success(obj, sta) {
- var redchart = first_parse(this, obj);
- var i, j;
- i = j = 0;
- console.log(" redchart : ");
- console.log(redchart);
- for (i = 0; i < redchart.list.length; i++) {
- goodid[i] = getUserName(redchart.list[i].workerId);
- goodpass[i] = redchart.list[i].passNum;
- if(redchart.list[i].passNum + redchart.list[i].failNum > 0) {
- goodfailrate[i] = Math.floor(redchart.list[i].failNum * 10000 / (redchart.list[i].passNum + redchart.list[i].failNum)) / 100;
- }else{
- goodfailrate[i] = 0;
- }
- if(isUserOfThisFlow(redchart.list[i].workerId)){
- goodColor[i] = 'red';
- }else{
- goodColor[i] = '';
- }
- }
- }
- function on_red_rank_success1(obj, sta) {
- var redchart = first_parse(this, obj);
- var i, j;
- i = j = 0;
- console.log(" redchart : ");
- console.log(redchart);
- for (i = 0; i < redchart.list.length; i++) {
- goodid1[i] = getUserName(redchart.list[i].workerId);
- goodpass1[i] = redchart.list[i].passNum;
- if(redchart.list[i].passNum + redchart.list[i].failNum > 0) {
- goodfailrate1[i] = Math.floor(redchart.list[i].failNum * 10000 / (redchart.list[i].passNum + redchart.list[i].failNum)) / 100;
- }else{
- goodfailrate1[i] = 0;
- }
- if(isUserOfThisFlow(redchart.list[i].workerId)){
- goodColor1[i] = 'red';
- }else{
- goodColor1[i] = '';
- }
- }
- }
- function on_black_rank_success(obj, sta) {
- var blackchart = first_parse(this, obj);
- var i, j;
- i = j = 0;
- console.log(" black chart : ");
- console.log(blackchart);
- for (i = 0; i < blackchart.list.length; i++) {
- badid[i] = getUserName(blackchart.list[i].workerId);
- badpass[i] = blackchart.list[i].passNum;
- //badfailrate[i] = blackchart.list[i].failRate / 100;
- if(blackchart.list[i].passNum + blackchart.list[i].failNum > 0) {
- badfailrate[i] = Math.floor(blackchart.list[i].failNum * 10000 / (blackchart.list[i].passNum + blackchart.list[i].failNum)) / 100;
- }else{
- badfailrate[i] = 0;
- }
- if(isUserOfThisFlow(blackchart.list[i].workerId)){
- badColor[i] = 'green';
- }else{
- badColor[i] = '';
- }
- }
- }
- function on_black_rank_success1(obj, sta) {
- var blackchart = first_parse(this, obj);
- var i, j;
- i = j = 0;
- console.log(" black chart : ");
- console.log(blackchart);
- for (i = 0; i < blackchart.list.length; i++) {
- badid1[i] = getUserName(blackchart.list[i].workerId);
- badpass1[i] = blackchart.list[i].passNum;
- //badfailrate[i] = blackchart.list[i].failRate / 100;
- if(blackchart.list[i].passNum + blackchart.list[i].failNum > 0) {
- badfailrate1[i] = Math.floor(blackchart.list[i].failNum * 10000 / (blackchart.list[i].passNum + blackchart.list[i].failNum)) / 100;
- }else{
- badfailrate1[i] = 0;
- }
- if(isUserOfThisFlow(blackchart.list[i].workerId)){
- badColor1[i] = 'green';
- }else{
- badColor1[i] = '';
- }
- }
- }
- function getSpotHtml(htmlbody, i) {
- if(typeof hispass[i] === "undefined"){
- htmlbody += "<tr>";
- htmlbody += `<tr>
- <td> - </td>
- <td> - </td>
- <td> - </td>
- <td> - </td>
- <td> - </td>
- </tr>`;
- htmlbody += "</tr>";
- return htmlbody;
- }
- htmlbody += "<tr>";
- htmlbody += `<tr>
- <td>${timeday[i]}</td>
- <td>${hispass[i]}</td>
- <td>${hisfail[i]}</td>
- <td>${hisstack[i]}</td>
- <td>${hisrate[i] + '%'}</td>
- </tr>`;
- htmlbody += "</tr>";
- return htmlbody;
- }
- function getSpotHtml1(htmlbody, i) {
- if(typeof goodid[i] === "undefined"){
- htmlbody += "<tr>";
- htmlbody += `<tr>
- <td> - </td>
- <td> - </td>
- <td> - </td>
- <td> - </td>
- </tr>`;
- htmlbody += "</tr>";
- return htmlbody;
- }
- htmlbody += "<tr>";
- htmlbody += `<tr ">
- <td style="background-color: ${goodColor[i]}">${goodid[i]}</td>
- <td style="background-color: ${goodColor[i]}">${goodpass[i]}</td>
- <td style="background-color: ${goodColor1[i]}">${goodid1[i]}</td>
- <td style="background-color: ${goodColor1[i]}">${goodfailrate1[i] + '%'}</td>
- </tr>`;
- htmlbody += "</tr>";
- return htmlbody;
- }
- /*function getSpotHtml3(htmlbody, i) {
- if(typeof goodid1[i] === "undefined"){
- htmlbody += "<tr>";
- htmlbody += `<tr>
- <td> - </td>
- <td> - </td>
-
- </tr>`;
- htmlbody += "</tr>";
- return htmlbody;
- }
- htmlbody += "<tr>";
- htmlbody += `<tr style="background-color: ${goodColor1[i]}">
- <td>${goodid1[i]}</td>
- <td>${goodfailrate1[i] + '%'}</td>
- </tr>`;
- htmlbody += "</tr>";
- return htmlbody;
- }*/
- function getSpotHtml2(htmlbody, i) {
- if(typeof badid[i] === "undefined"){
- htmlbody += "<tr>";
- htmlbody += `<tr>
- <td> - </td>
- <td> - </td>
- <td> - </td>
- <td> - </td>
- </tr>`;
- htmlbody += "</tr>";
- return htmlbody;
- }
- htmlbody += "<tr>";
- if(typeof badColor[i] === "undefined"){
- htmlbody += `<tr>
- <td style="background-color: ${badColor[i]}">${badid[i]}</td>
- <td style="background-color: ${badColor[i]}">${badpass[i]}</td>
- <td style="background-color: ${badColor1[i]}">${badid1[i]}</td>
- <td style="background-color: ${badColor1[i]}">${badfailrate1[i] + '%'}</td>
- </tr>`;
- }else {
- htmlbody += `<tr >
- <td style="background-color: ${badColor[i]}">${badid[i]}</td>
- <td style="background-color: ${badColor[i]}">${badpass[i]}</td>
- <td style="background-color: ${badColor1[i]}">${badid1[i]}</td>
- <td style="background-color: ${badColor1[i]}">${badfailrate1[i] + '%'}</td>
- </tr>`;
- }
- htmlbody += "</tr>";
- return htmlbody;
- }
- /*function getSpotHtml4(htmlbody, i) {
- if(typeof badid1[i] === "undefined"){
- htmlbody += "<tr>";
- htmlbody += `<tr>
- <td> - </td>
- <td> - </td>
-
- </tr>`;
- htmlbody += "</tr>";
- return htmlbody;
- }
- htmlbody += "<tr>";
- if(typeof badColor1[i] === "undefined"){
- htmlbody += `<tr style="background-color: ${badColor1[i]}">
- <td>${badid1[i]}</td>
-
- <td>${badfailrate1[i] + '%'}</td>
- </tr>`;
- }else {
- htmlbody += `<tr style="background-color: ${badColor1[i]}">
- <td>${badid1[i]}</td>
- <td>${badfailrate1[i] + '%'}</td>
- </tr>`;
- }
- htmlbody += "</tr>";
- return htmlbody;
- }*/
- var lastTimeRank0 = "";
- var lastTimeRank1 = "";
- var lastTimeRank2 = "";
- var lastTimeRank3 = "";
- var lastTimeRank4 = "";
- function showEachSpot() {
- var htmlbody = "", one_person = "";
- var i = 0;
- var triGap = 4;
- htmlbody = "";
- for (i = 0; i < triGap; i++) {
- htmlbody = getSpotHtml(htmlbody, i);
- }
- if(lastTimeRank0 !== htmlbody) {
- $("#rank-one").html(htmlbody);
- lastTimeRank0 = htmlbody;
- }
- //console.log(htmlbody);
- }
- function showEachSpot1() {
- var htmlbody = "", one_person = "";
- var i = 0;
- var triGap = 3;
- htmlbody = "";
- for (i = 0; i < triGap; i++) {
- htmlbody = getSpotHtml1(htmlbody, i);
- }
- if(lastTimeRank1 !== htmlbody){
- $("#rank-two").html(htmlbody);
- lastTimeRank1 = htmlbody;
- }
- //console.log(htmlbody);
- }
- /*function showEachSpot3() {
- var htmlbody = "", one_person = "";
- var i = 0;
- var triGap = 3;
- htmlbody = "";
- for (i = 0; i < triGap; i++) {
- htmlbody = getSpotHtml3(htmlbody, i);
- }
- if(lastTimeRank3 !== htmlbody){
- $("#rank-four").html(htmlbody);
- lastTimeRank3 = htmlbody;
- }
- //console.log(htmlbody);
- }*/
- function showEachSpot2() {
- var htmlbody = "", one_person = "";
- var i = 0;
- var triGap = 3;
- htmlbody = "";
- for (i = 0; i < triGap; i++) {
- htmlbody = getSpotHtml2(htmlbody, i);
- }
- if(lastTimeRank2 !== htmlbody){
- $("#rank-three").html(htmlbody);
- lastTimeRank2 = htmlbody;
- }
- //console.log(htmlbody);
- }
- /*function showEachSpot4() {
- var htmlbody = "", one_person = "";
- var i = 0;
- var triGap = 3;
- htmlbody = "";
- for (i = 0; i < triGap; i++) {
- htmlbody = getSpotHtml4(htmlbody, i);
- }
- if(lastTimeRank4 !== htmlbody){
- $("#rank-five").html(htmlbody);
- lastTimeRank4 = htmlbody;
- }
- //console.log(htmlbody);
- }*/
|