控制器给出白屏死机 - >离子cordova运行android

时间:2017-11-20 12:02:28

标签: cordova android-emulator ionic-v1

在我的项目中,一切都在离子android模拟器上运行得很好,一旦这个控制器被诱导,模拟器甚至在登录屏幕之前就会显示白屏。然而,在离子发送命令时,控制器中没有逻辑中断,功能也可以正常工作。

有人可以帮忙吗?

    .controller(‘DashboardCtrl’, function($scope, $rootScope, $state, service, $ionicPopup, $ionicModal, $ionicLoading) {

//fusion chart graph properties
    $scope.dataSource = {
      "chart": {
        // "caption": "EBU WISE ASSOCIATE BREAKUP",
        "showvalues": "0",
        "plotgradientcolor": "",
        "formatnumberscale": "0",
        "showplotborder": "0",
        "palettecolors": "#2BC18A,#007b7d,#1485B4,#787878,#2C560A,#DD9D82",
        "canvaspadding": "1",
        "bgcolor": "FFFFFF",
        "showalternatehgridcolor": "1",
        "divLineDashed": "1",
        "divlinecolor": "FFF",
        "showcanvasborder": "0",
        "legendborderalpha": "0",
        "legendshadow": "0",
        "interactivelegend": "1",
        "showsum": "1",
        "canvasborderalpha": "0",
        "showborder": "0",
        "showvalues": "0",
        "rotateValues": "1",
        "labelDisplay": "auto"
      },
      "categories": [{
        "category": []
      }],
      "dataset": []
    }

//function to plot graph
     $scope.plotgraph = function() {
       var setBU = service.FetchData().getJsonObj();
       console.log(setBU);
       if ($rootScope.EmpRole == "CEO" || $rootScope.EmpRole == "BU") {
        if ($rootScope.EmpRole == "BU" && setBU != null || $rootScope.EmpRole == "CEO" && setBU != null) {
          // $rootScope.show()
          service.DashboardSingleGraph(setBU, $rootScope.EmpRole, service.authenticationToken().getToken()).then(function(response) {
            // $rootScope.hide()
            console.log(response.data);
            var graphdata = response.data.barChartData;
            dataByBU = [];
            var i;
            var j;
            var k;
            for (i in graphdata) {
              if (dataByBU[graphdata[i][2]] === undefined || dataByBU[graphdata[i][2]] === null) {
                dataByBU[graphdata[i][2]] = [];
              }
              dataByBU[graphdata[i][2]][graphdata[i][0]] = graphdata[i][1];
            }

            $scope.dataSource.categories[0].category = [];
            var categoryWiseData = [];
            var categories = ["Non-Rated", "Non-SME", "Potential-SME", "SME"];
            categoryWiseData["Non-Rated"] = [];
            categoryWiseData["Non-SME"] = [];
            categoryWiseData["Potential-SME"] = [];
            categoryWiseData.SME = [];

            function zeroOnNull(object) {
              if (object === undefined || object === null) {
                return "0";
              }
              return object;
            }
            console.log(dataByBU);
            for (i in dataByBU) {
              $scope.dataSource.categories[0].category.push({
                "label": i
              });

              categoryWiseData["Non-Rated"].push(zeroOnNull(dataByBU[i]["Non-Rated"]));
              categoryWiseData["Non-SME"].push(zeroOnNull(dataByBU[i]["Non-SME"]));
              categoryWiseData["Potential-SME"].push(zeroOnNull(dataByBU[i]["Potential-SME"]));
              categoryWiseData["SME"].push(zeroOnNull(dataByBU[i]["SME"]));

            }
            console.log(categoryWiseData);
            $scope.dataSource.dataset = [];
            for (j in categoryWiseData) {
              var dataAsValueObject = [];
              for (k in categoryWiseData[j]) {
                dataAsValueObject.push({
                  "value": categoryWiseData[j][k]
                }, );
              }

              $scope.dataSource.dataset.push({
                "seriesname": j,
                "renderas": "Area",
                "data": dataAsValueObject
              }, );
            }

          })
        } else if($rootScope.EmpRole == "BU" && setBU == null || $rootScope.EmpRole == "CEO" && setBU == null){
          // $rootScope.show()
          console.log($rootScope.EmpRole);
          service.DashboardGraph($rootScope.EmpRole, service.authenticationToken().getToken()).then(function(response) {
            // $rootScope.hide()
            console.log(response.data);
            var graphdata = response.data.barChartData;
            dataByBU = [];
            var i;
            var j;
            var k;
            for (i in graphdata) {
              if (dataByBU[graphdata[i][2]] === undefined || dataByBU[graphdata[i][2]] === null) {
                dataByBU[graphdata[i][2]] = [];
              }
              dataByBU[graphdata[i][2]][graphdata[i][0]] = graphdata[i][1];
            }

            $scope.dataSource.categories[0].category = [];
            var categoryWiseData = [];
            var categories = ["Non-Rated", "Non-SME", "Potential-SME", "SME"];
            categoryWiseData["Non-Rated"] = [];
            categoryWiseData["Non-SME"] = [];
            categoryWiseData["Potential-SME"] = [];
            categoryWiseData.SME = [];

            function zeroOnNull(object) {
              if (object === undefined || object === null) {
                return "0";
              }
              return object;
            }
            console.log(dataByBU);
            for (i in dataByBU) {
              $scope.dataSource.categories[0].category.push({
                "label": i
              });

              categoryWiseData["Non-Rated"].push(zeroOnNull(dataByBU[i]["Non-Rated"]));
              categoryWiseData["Non-SME"].push(zeroOnNull(dataByBU[i]["Non-SME"]));
              categoryWiseData["Potential-SME"].push(zeroOnNull(dataByBU[i]["Potential-SME"]));
              categoryWiseData["SME"].push(zeroOnNull(dataByBU[i]["SME"]));

            }
            console.log(categoryWiseData);
            $scope.dataSource.dataset = [];
            for (j in categoryWiseData) {
              var dataAsValueObject = [];
              for (k in categoryWiseData[j]) {
                dataAsValueObject.push({
                  "value": categoryWiseData[j][k]
                }, );
              }

              $scope.dataSource.dataset.push({
                "seriesname": j,
                "renderas": "Area",
                "data": dataAsValueObject
              }, );
            }

          })
        }
      } else {
        if ($rootScope.EmpRole == "DH" && setBU != null) {
           // $rootScope.show()
          service.DashboarddGraphDH($rootScope.EmpNumber, $rootScope.EmpRole, service.authenticationToken().getToken()).then(function(response) {
            // $rootScope.hide()
            console.log(response.data);
            var graphdata = response.data.barChartData;
            dataByBU = [];
            var i;
            var j;
            var k;
            for (i in graphdata) {
              if (dataByBU[graphdata[i][2]] === undefined || dataByBU[graphdata[i][2]] === null) {
                dataByBU[graphdata[i][2]] = [];
              }
              dataByBU[graphdata[i][2]][graphdata[i][0]] = graphdata[i][1];
            }

            $scope.dataSource.categories[0].category = [];
            var categoryWiseData = [];
            var categories = ["Non-Rated", "Non-SME", "Potential-SME", "SME"];
            categoryWiseData["Non-Rated"] = [];
            categoryWiseData["Non-SME"] = [];
            categoryWiseData["Potential-SME"] = [];
            categoryWiseData.SME = [];

            function zeroOnNull(object) {
              if (object === undefined || object === null) {
                return "0";
              }
              return object;
            }
            console.log(dataByBU);
            for (i in dataByBU) {
              $scope.dataSource.categories[0].category.push({
                "label": i
              });

              categoryWiseData["Non-Rated"].push(zeroOnNull(dataByBU[i]["Non-Rated"]));
              categoryWiseData["Non-SME"].push(zeroOnNull(dataByBU[i]["Non-SME"]));
              categoryWiseData["Potential-SME"].push(zeroOnNull(dataByBU[i]["Potential-SME"]));
              categoryWiseData["SME"].push(zeroOnNull(dataByBU[i]["SME"]));

            }
            console.log(categoryWiseData);
            $scope.dataSource.dataset = [];
            for (j in categoryWiseData) {
              var dataAsValueObject = [];
              for (k in categoryWiseData[j]) {
                dataAsValueObject.push({
                  "value": categoryWiseData[j][k]
                }, );
              }

              $scope.dataSource.dataset.push({
                "seriesname": j,
                "renderas": "Area",
                "data": dataAsValueObject
              }, );
            }

          })

        } else if ($rootScope.EmpRole == "DH" && setBU == null ) {
          // $rootScope.show()
          service.DashboardSingleGraph($rootScope.accountName, $rootScope.EmpRole, service.authenticationToken().getToken()).then(function(response) {
            // $rootScope.hide()
            console.log(response.data);
            var graphdata = response.data.barChartData;
            dataByBU = [];
            var i;
            var j;
            var k;
            for (i in graphdata) {
              if (dataByBU[graphdata[i][2]] === undefined || dataByBU[graphdata[i][2]] === null) {
                dataByBU[graphdata[i][2]] = [];
              }
              dataByBU[graphdata[i][2]][graphdata[i][0]] = graphdata[i][1];
            }

            $scope.dataSource.categories[0].category = [];
            var categoryWiseData = [];
            var categories = ["Non-Rated", "Non-SME", "Potential-SME", "SME"];
            categoryWiseData["Non-Rated"] = [];
            categoryWiseData["Non-SME"] = [];
            categoryWiseData["Potential-SME"] = [];
            categoryWiseData.SME = [];

            function zeroOnNull(object) {
              if (object === undefined || object === null) {
                return "0";
              }
              return object;
            }
            console.log(dataByBU);
            for (i in dataByBU) {
              $scope.dataSource.categories[0].category.push({
                "label": i
              });

              categoryWiseData["Non-Rated"].push(zeroOnNull(dataByBU[i]["Non-Rated"]));
              categoryWiseData["Non-SME"].push(zeroOnNull(dataByBU[i]["Non-SME"]));
              categoryWiseData["Potential-SME"].push(zeroOnNull(dataByBU[i]["Potential-SME"]));
              categoryWiseData["SME"].push(zeroOnNull(dataByBU[i]["SME"]));

            }
            console.log(categoryWiseData);
            $scope.dataSource.dataset = [];
            for (j in categoryWiseData) {
              var dataAsValueObject = [];
              for (k in categoryWiseData[j]) {
                dataAsValueObject.push({
                  "value": categoryWiseData[j][k]
                }, );
              }

              $scope.dataSource.dataset.push({
                "seriesname": j,
                "renderas": "Area",
                "data": dataAsValueObject
              }, );
            }

          })
        }
        else {
          console.log("for other roles");
        }
      }
     }

    var bu = null
//data to be inserted in the dashboard tiles
    $scope.bufn = function(bu) {
      console.log(bu);
      service.FetchData().setJsonObj(bu);

      if ($rootScope.EmpRole == 'DH') {
        $scope.plotgraph(bu)
        if ($rootScope.EmpRole == 'DH' && service.FetchData().getJsonObj() == null) {
          $rootScope.show()
          service.DashboardDataDH($rootScope.accountName, service.authenticationToken().getToken()).then(function(response) {
            $rootScope.hide()
            console.log(response.data);
            $scope.data = response.data
            var count = 0;
            var count2 = 0;
            var count3 = 0;
            var count4 = 0;
            var count5 = 0;
            var count6 = 0;
            var count7 = 0;
            var count8 = 0;
            var count9 = 0;
            var count10 = 0;
            var count11 = 0;
            var count12 = 0;
            var count13 = 0;
            var count14 = 0;
            var count15 = 0;

            for (i in $scope.data.associates) {
              count += $scope.data.associates[i].count
            }
            for (i in $scope.data.billableAssociates) {
              count2 += $scope.data.billableAssociates[i].count
            }
            for (i in $scope.data.NonbillableAssociates) {
              count3 += $scope.data.NonbillableAssociates[i].count
            }
            for (i in $scope.data.InTransitAssociates) {
              count4 += $scope.data.InTransitAssociates[i].count
            }
            for (i in $scope.data.EBRAssociates) {
              count5 += $scope.data.EBRAssociates[i].count
            }
            for (i in $scope.data.PoolAssociates) {
              count6 += $scope.data.PoolAssociates[i].count
            }
            for (i in $scope.data.Rated) {
              count7 += $scope.data.Rated[i].rated
            }
            for (i in $scope.data.NicheSkills) {
              count8 += $scope.data.NicheSkills[i].niche_skills
            }
            for (i in $scope.data.sme) {
              count9 += $scope.data.sme[i].SME
            }
            for (i in $scope.data.releasePiplepline) {
              count10 += $scope.data.releasePiplepline[i].Release_count
            }
            for (i in $scope.data.OpenPositions) {
              count11 += $scope.data.OpenPositions[i].open_positions
            }
            for (i in $scope.data.BillingLoss) {
              count12 += $scope.data.BillingLoss[i].billing_loss
            }
            for (i in $scope.data.onshoreLocationWiseCount) {
              count13 += $scope.data.onshoreLocationWiseCount[i].count
            }
            for (i in $scope.data.offshoreLocationWiseCount) {
              count14 += $scope.data.offshoreLocationWiseCount[i].count
            }
            for (i in $scope.data.visa) {
              count15 += $scope.data.visa[i].COUNT
            }

            $scope.associates = count;
            $scope.billableAssociates = count2;
            $scope.NonbillableAssociates = count3;
            $scope.InTransitAssociates = count4;
            $scope.EBRAssociates = count5;
            $scope.PoolAssociates = count6;
            $scope.Rated = count7;
            $scope.NicheSkills = count8;
            $scope.sme = count9;
            $scope.releasePiplepline = count10;
            $scope.OpenPositions = count11;
            $scope.BillingLoss = count12;
            $scope.onshoreCount = count13;
            $scope.offshoreCount = count14;
            $scope.visa = count15;
          })
          $scope.plotgraph()
        } else {
          $rootScope.show()
          service.DashboardDataDHToggle($rootScope.EmpNumber, service.authenticationToken().getToken()).then(function(response) {
            $rootScope.hide()
            console.log(response.data);
            $scope.data = response.data
            var count = 0;
            var count2 = 0;
            var count3 = 0;
            var count4 = 0;
            var count5 = 0;
            var count6 = 0;
            var count7 = 0;
            var count8 = 0;
            var count9 = 0;
            var count10 = 0;
            var count11 = 0;
            var count12 = 0;
            var count13 = 0;
            var count14 = 0;
            var count15 = 0;

            for (i in $scope.data.associates) {
              count += $scope.data.associates[i].count
            }
            for (i in $scope.data.billableAssociates) {
              count2 += $scope.data.billableAssociates[i].count
            }
            for (i in $scope.data.NonbillableAssociates) {
              count3 += $scope.data.NonbillableAssociates[i].count
            }
            for (i in $scope.data.InTransitAssociates) {
              count4 += $scope.data.InTransitAssociates[i].count
            }
            for (i in $scope.data.EBRAssociates) {
              count5 += $scope.data.EBRAssociates[i].count
            }
            for (i in $scope.data.PoolAssociates) {
              count6 += $scope.data.PoolAssociates[i].count
            }
            for (i in $scope.data.Rated) {
              count7 += $scope.data.Rated[i].rated
            }
            for (i in $scope.data.NicheSkills) {
              count8 += $scope.data.NicheSkills[i].niche_skills
            }
            for (i in $scope.data.sme) {
              count9 += $scope.data.sme[i].SME
            }
            for (i in $scope.data.releasePiplepline) {
              count10 += $scope.data.releasePiplepline[i].Release_count
            }
            for (i in $scope.data.OpenPositions) {
              count11 += $scope.data.OpenPositions[i].open_positions
            }
            for (i in $scope.data.BillingLoss) {
              count12 += $scope.data.BillingLoss[i].billing_loss
            }
            for (i in $scope.data.onshoreLocationWiseCount) {
              count13 += $scope.data.onshoreLocationWiseCount[i].count
            }
            for (i in $scope.data.offshoreLocationWiseCount) {
              count14 += $scope.data.offshoreLocationWiseCount[i].count
            }
            for (i in $scope.data.visa) {
              count15 += $scope.data.visa[i].COUNT
            }

            $scope.associates = count;
            $scope.billableAssociates = count2;
            $scope.NonbillableAssociates = count3;
            $scope.InTransitAssociates = count4;
            $scope.EBRAssociates = count5;
            $scope.PoolAssociates = count6;
            $scope.Rated = count7;
            $scope.NicheSkills = count8;
            $scope.sme = count9;
            $scope.releasePiplepline = count10;
            $scope.OpenPositions = count11;
            $scope.BillingLoss = count12;
            $scope.onshoreCount = count13;
            $scope.offshoreCount = count14;
            $scope.visa = count15;
          })
          $scope.plotgraph()
        }
        // service.DashboardDataDHToggle($rootScope.EmpNumber, service.authenticationToken().getToken()).then(function(response) {
        //   console.log(response.data);
        //   $scope.data = response.data;
        // })
      } else {
        $scope.plotgraph(bu)
        $rootScope.show()
        service.BUData(bu, service.authenticationToken().getToken()).then(function(response) {
          $rootScope.hide()
          console.log(response.data);
          $scope.data = response.data;
        })
      }
    }

    $scope.plotgraph()

    $scope.allORGData = function() {

      if ($rootScope.EmpRole == 'DH') {
        $rootScope.show()
        service.DashboardDataDH($rootScope.accountName, service.authenticationToken().getToken()).then(function(response) {
          $rootScope.hide()
          console.log(response.data);
          $scope.data = response.data
          var count = 0;
          var count2 = 0;
          var count3 = 0;
          var count4 = 0;
          var count5 = 0;
          var count6 = 0;
          var count7 = 0;
          var count8 = 0;
          var count9 = 0;
          var count10 = 0;
          var count11 = 0;
          var count12 = 0;
          var count13 = 0;
          var count14 = 0;
          var count15 = 0;

          for (i in $scope.data.associates) {
            count += $scope.data.associates[i].count
          }
          for (i in $scope.data.billableAssociates) {
            count2 += $scope.data.billableAssociates[i].count
          }
          for (i in $scope.data.NonbillableAssociates) {
            count3 += $scope.data.NonbillableAssociates[i].count
          }
          for (i in $scope.data.InTransitAssociates) {
            count4 += $scope.data.InTransitAssociates[i].count
          }
          for (i in $scope.data.EBRAssociates) {
            count5 += $scope.data.EBRAssociates[i].count
          }
          for (i in $scope.data.PoolAssociates) {
            count6 += $scope.data.PoolAssociates[i].count
          }
          for (i in $scope.data.Rated) {
            count7 += $scope.data.Rated[i].rated
          }
          for (i in $scope.data.NicheSkills) {
            count8 += $scope.data.NicheSkills[i].niche_skills
          }
          for (i in $scope.data.sme) {
            count9 += $scope.data.sme[i].SME
          }
          for (i in $scope.data.releasePiplepline) {
            count10 += $scope.data.releasePiplepline[i].Release_count
          }
          for (i in $scope.data.OpenPositions) {
            count11 += $scope.data.OpenPositions[i].open_positions
          }
          for (i in $scope.data.BillingLoss) {
            count12 += $scope.data.BillingLoss[i].billing_loss
          }
          for (i in $scope.data.onshoreNew) {
            count13 += $scope.data.onshoreNew[i].count
          }
          for (i in $scope.data.offshoreNew) {
            count14 += $scope.data.offshoreNew[i].count
          }
          for (i in $scope.data.visa) {
            count15 += $scope.data.visa[i].COUNT
          }

          $scope.associates = count;
          $scope.billableAssociates = count2;
          $scope.NonbillableAssociates = count3;
          $scope.InTransitAssociates = count4;
          $scope.EBRAssociates = count5;
          $scope.PoolAssociates = count6;
          $scope.Rated = count7;
          $scope.NicheSkills = count8;
          $scope.sme = count9;
          $scope.releasePiplepline = count10;
          $scope.OpenPositions = count11;
          $scope.BillingLoss = count12;
          $scope.onshoreCount = count13;
          $scope.offshoreCount = count14;
          $scope.visa = count15;
        })
        $scope.plotgraph()
      } else {
        $rootScope.show();
        service.Dashboarddata(service.authenticationToken().getToken()).then(function(response) {
          $rootScope.hide();
          console.log(response.data);
          $scope.BU = response.data.account;
          $scope.data = response.data
        }).then(function() {
          $scope.plotgraph()
        })

      }
      service.FetchData().setJsonObj(null);
    }
    $scope.allORGData()

    $scope.totalassociates = function() {
      console.log(service.FetchData().getJsonObj());
      $state.go('app.TotalAssosiates', {
        bu: service.FetchData().getJsonObj()
      });
    }

    $scope.deliverybillable = function() {
      $state.go('app.DeliveryBillable', {
        bu: service.FetchData().getJsonObj()
      });
    }

    $scope.nonbillable = function() {
      $state.go('app.NonBillable', {
        bu: service.FetchData().getJsonObj()
      });
    }

    $scope.intransit = function() {
      $state.go('app.InTransit', {
        bu: service.FetchData().getJsonObj()
      });
    }

    $scope.ebr = function() {
      $state.go('app.EBR', {
        bu: service.FetchData().getJsonObj()
      });
    }

    $scope.inpool = function() {
      $state.go('app.InPool', {
        bu: service.FetchData().getJsonObj()
      });
    }

    $scope.OnShore = function() {
      $state.go('app.OnShoreCount', {
        bu: service.FetchData().getJsonObj()
      });
    }

    $scope.OffShore = function() {
      $state.go('app.OffShoreCount', {
        bu: service.FetchData().getJsonObj()
      });
    }

    $scope.Visa = function() {
      $state.go('app.Visa', {
        bu: service.FetchData().getJsonObj()
      });
    }

    $scope.Rated = function() {
      $state.go('app.Rated', {
        bu: service.FetchData().getJsonObj()
      });
    }

    $scope.NicheSkills = function() {
      $state.go('app.NicheSkills', {
        bu: service.FetchData().getJsonObj()
      });
    }

    $scope.SME = function() {
      $state.go('app.SME', {
        bu: service.FetchData().getJsonObj()
      });
    }

    $scope.Pipeline = function() {
      $state.go('app.Pipeline', {
        bu: service.FetchData().getJsonObj()
      });
    }

    $scope.OpenPositions = function() {
      $state.go('app.OpenPositions', {
        bu: service.FetchData().getJsonObj()
      });
    }

    $scope.BillingLoss = function() {
      $state.go('app.BillingLoss', {
        bu: service.FetchData().getJsonObj()
      });
    }
    })

0 个答案:

没有答案