| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229 |
- var starter = angular.module('starter.controllers', [])
- starter.controller('loginCtrl',["$scope",'$state','$ionicLoading','$timeout','$ionicPopup',function($scope,$state,$ionicLoading,$timeout,$ionicPopup){
- $scope.vm = {
- mobile:'',
- password:''
- };
- $scope.login = function(){
- if($scope.vm.username == 'admin' && $scope.vm.password == 'admin'){
- $ionicLoading.show({
- template: '<div class="loader"><svg class="circular"><circle class="path" cx="50" cy="50" r="20" fill="none" stroke-width="2" stroke-miterlimit="10"/></svg></div>'
- });
- $timeout(function(){
- $ionicLoading.hide();
- $state.go('home')
- },1500);
-
- }else{
- // $scope.showAlert = function(){
- // var alertPopup = $ionicPopup.alert({
- // title:'账号密码不正确',
- // template:'唯一账号密码---admin'
- // })
- // }
- var alertPopup = $ionicPopup.alert({
- title: '账号密码不正确',
- template: '唯一账号密码:admin!!!'
- });
- $timeout(function() {
- ionicMaterialInk.displayEffect();
- }, 0);
- }
- }
-
-
- }])
- starter.controller('homeCtrl',["$scope",'$http','$timeout',function($scope,$http,$timeout){
- $scope.excals = [
- {'list':'测试一'},
- {'list':'测试二'},
- {'list':'测试三'}
- ];
- $scope.doRefresh = function(){
- $http.get('../lib/ionic/test.json')
- .success(function(newItems) {
- $scope.excals = newItems;
- })
- .finally(function() {
- $scope.$broadcast('scroll.refreshComplete');
- });
- }
- }])
- //展示首页控制器
- starter.controller('lineCtrl',["$scope",'$ionicHistory','$state',function($scope,$ionicHistory,$state){
- $scope.go = function(target){
- $ionicHistory.clearHistory();
- $state.go(target)
- }
- }])
- //TN曲线控制器
- starter.controller('tnCtrl',["$scope",'$ionicHistory','$state',function($scope,$ionicHistory,$state){
- $scope.go = function(target){
- $ionicHistory.clearHistory();
- $state.go(target)
- }
- $scope.legend = ["扭矩", "电压",'输入功率','电流','效率'];
- $scope.item = ['200rpm','400rpm','600rpm','800rpm','1000rpm','1200rpm','1400rpm','1600rpm','1800rpm','2000rpm','2200rpm','2400rpm'];
- $scope.num = [0,1,2,3,4];
- $scope.data = [
- [0.2,0.8,1.6,2.7,1.3,3.0,2.5,1.1,3.1,0.5,1.4,2.8,1.1], //扭矩
- [0, 1, 4, 7, 12, 15, 16, 15, 15, 10, 6, 5], //电压
- [2.0, 2.2, 3.3, 4.5, 6.3, 10.2, 20.3, 23.4, 23.0, 16.5, 12.0, 6.2], //输入功率
- [2.0, 2.2, 3.3, 4.5, 6.3, 10.2, 20.3, 23.4, 23.0, 16.5, 12.0, 6.2], //电流
- [2.6, 5.9, 9.0, 26.4, 28.7, 70.7, 175.6, 182.2, 48.7, 18.8, 6.0, 2.3]//效率
- ];
- }]);
-
-
- starter.directive('line', function() {
- return {
- scope: {
- id: "@",
- legend: "=",
- item: "=",
- num:"=",
- data: "="
- },
- restrict: 'E',
- template: '<div style="height:400px;"></div>',
- replace: true,
- link: function($scope, element, attrs, controller) {
- var colors = ['#a62ca6', '#8e0515', '#45baf3','#ff2420','#1a9a1a'];
- var option = {
- color:colors,
- // 提示框,鼠标悬浮交互时的信息提示
- tooltip: {
- show: true,
- trigger: 'axis'
- },
- grid:{
- left:'30%'
- },
- // 图例
- legend: {
- data: $scope.legend
- },
- // toolbox: {
- // feature: {
- // dataView: {show: true, readOnly: false},
- // restore: {show: true},
- // saveAsImage: {show: true}
- // }
- // },
- // 横轴坐标轴
- xAxis: [
- {
- type: 'category',
- axisTick: {
- alignWithLabel: true
- },
- data: $scope.item
- }
- ],
- // 纵轴坐标轴
- yAxis: [
- {
- type: 'value',
- name: '扭矩',
- min: 0,
- max: 3,
- position: 'left',
- offset:90,
- axisLine: {
- lineStyle: {
- color: colors[0]
- }
- },
- },
- {
- type: 'value',
- name: '电压',
- min: 0,
- max: 220,
- position: 'left',
- offset: 60,
- axisLine: {
- lineStyle: {
- color: colors[1]
- }
- },
- },
- {
- type: 'value',
- name: '输入功率',
- min: 0,
- max: 1500,
- position: 'left',
- offset:23,
- axisLine: {
- lineStyle: {
- color: colors[2]
- }
- },
- },
- {
- type: 'value',
- name: '电流',
- min: 0,
- max: 6,
- position: 'left',
- offset:5,
- axisLine: {
- lineStyle: {
- color: colors[3]
- }
- },
-
- },
- {
- type: 'value',
- name: '效率',
- min: 0,
- max: 80,
- position: 'left',
- offset:-20,
- axisLine: {
- lineStyle: {
- color: colors[4]
- }
- },
- }
- ],
- // 数据内容数组
- series: function(){
- var serie=[];
- for(var i=0;i<$scope.legend.length;i++){
- var item = {
- name : $scope.legend[i],
- type: 'line',
- yAxisIndex:$scope.num[i],
- data: $scope.data[i]
- };
- serie.push(item);
- }
- return serie;
- }()
-
- };
- var myChart = echarts.init(document.getElementById($scope.id),'macarons');
- myChart.setOption(option);
- }
- };
- })
- //五轴图控制器
- starter.controller('zhouCtrl',["$scope",'$ionicHistory','$state',function($scope,$ionicHistory,$state){
- $scope.go = function(target){
- $ionicHistory.clearHistory();
- $state.go(target)
- }
- }])
- //效率云图控制器
- starter.controller('stromCtrl',["$scope",'$ionicHistory','$state',function($scope,$ionicHistory,$state){
- $scope.go = function(target){
- $ionicHistory.clearHistory();
- $state.go(target)
- }
- }])
|