|
@@ -1,5 +1,5 @@
|
|
|
var starter = angular.module('starter.controllers', [])
|
|
var starter = angular.module('starter.controllers', [])
|
|
|
-
|
|
|
|
|
|
|
+//登录页面控制器
|
|
|
starter.controller('loginCtrl',["$scope",'$state','$ionicLoading','$timeout','$ionicPopup',function($scope,$state,$ionicLoading,$timeout,$ionicPopup){
|
|
starter.controller('loginCtrl',["$scope",'$state','$ionicLoading','$timeout','$ionicPopup',function($scope,$state,$ionicLoading,$timeout,$ionicPopup){
|
|
|
$scope.vm = {
|
|
$scope.vm = {
|
|
|
mobile:'',
|
|
mobile:'',
|
|
@@ -16,12 +16,6 @@ starter.controller('loginCtrl',["$scope",'$state','$ionicLoading','$timeout','$i
|
|
|
},1500);
|
|
},1500);
|
|
|
|
|
|
|
|
}else{
|
|
}else{
|
|
|
-// $scope.showAlert = function(){
|
|
|
|
|
-// var alertPopup = $ionicPopup.alert({
|
|
|
|
|
-// title:'账号密码不正确',
|
|
|
|
|
-// template:'唯一账号密码---admin'
|
|
|
|
|
-// })
|
|
|
|
|
-// }
|
|
|
|
|
var alertPopup = $ionicPopup.alert({
|
|
var alertPopup = $ionicPopup.alert({
|
|
|
title: '账号密码不正确',
|
|
title: '账号密码不正确',
|
|
|
template: '唯一账号密码:admin!!!'
|
|
template: '唯一账号密码:admin!!!'
|
|
@@ -31,18 +25,17 @@ starter.controller('loginCtrl',["$scope",'$state','$ionicLoading','$timeout','$i
|
|
|
ionicMaterialInk.displayEffect();
|
|
ionicMaterialInk.displayEffect();
|
|
|
}, 0);
|
|
}, 0);
|
|
|
}
|
|
}
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
|
|
+ }
|
|
|
}])
|
|
}])
|
|
|
-
|
|
|
|
|
-starter.controller('homeCtrl',["$scope",'$http','$timeout','$ionicLoading',function($scope,$http,$timeout,$ionicLoading){
|
|
|
|
|
|
|
+//主页面控制器
|
|
|
|
|
+starter.controller('homeCtrl',["$scope",'$http','$timeout','$ionicLoading','$state',function($scope,$http,$timeout,$ionicLoading,$state){
|
|
|
$http({
|
|
$http({
|
|
|
method:'get',
|
|
method:'get',
|
|
|
url:'http://172.31.40.29/list',
|
|
url:'http://172.31.40.29/list',
|
|
|
}).success(function(newItem){
|
|
}).success(function(newItem){
|
|
|
$scope.excals = newItem
|
|
$scope.excals = newItem
|
|
|
})
|
|
})
|
|
|
|
|
+
|
|
|
$scope.doRefresh = function(){
|
|
$scope.doRefresh = function(){
|
|
|
$ionicLoading.show({
|
|
$ionicLoading.show({
|
|
|
tcontent: 'Loading',
|
|
tcontent: 'Loading',
|
|
@@ -51,72 +44,70 @@ starter.controller('homeCtrl',["$scope",'$http','$timeout','$ionicLoading',funct
|
|
|
maxWidth: 200,
|
|
maxWidth: 200,
|
|
|
showDelay: 0
|
|
showDelay: 0
|
|
|
});
|
|
});
|
|
|
- $timeout(function(){
|
|
|
|
|
- $ionicLoading.hide();
|
|
|
|
|
$http({
|
|
$http({
|
|
|
method:'get',
|
|
method:'get',
|
|
|
url:'http://172.31.40.29/list',
|
|
url:'http://172.31.40.29/list',
|
|
|
}).success(function(newItem){
|
|
}).success(function(newItem){
|
|
|
- $scope.excals = newItem
|
|
|
|
|
|
|
+ $timeout(function(){
|
|
|
|
|
+ $ionicLoading.hide();
|
|
|
|
|
+ $scope.excals = newItem
|
|
|
|
|
+ });
|
|
|
})
|
|
})
|
|
|
.finally(function() {
|
|
.finally(function() {
|
|
|
- $scope.$broadcast('scroll.refreshComplete');
|
|
|
|
|
|
|
+ $scope.$broadcast('scroll.refreshComplete');
|
|
|
});
|
|
});
|
|
|
- },1000);
|
|
|
|
|
|
|
|
|
|
}
|
|
}
|
|
|
-}])
|
|
|
|
|
-
|
|
|
|
|
-//starter.factory('getData',['$http','$q',function($http,$q){
|
|
|
|
|
-// return function(){
|
|
|
|
|
-// var defer = $q.defer();
|
|
|
|
|
-// $http.get('../lib/ionic/test2.json')
|
|
|
|
|
-// .success(function(data,status,headers,congfig){
|
|
|
|
|
-// defer.resolve(data)
|
|
|
|
|
-// }).error(function(data,status,headers,congfig){
|
|
|
|
|
-// defer.reject(data);
|
|
|
|
|
-// });
|
|
|
|
|
-// return defer.promise
|
|
|
|
|
-// }
|
|
|
|
|
-//}])
|
|
|
|
|
|
|
+
|
|
|
|
|
|
|
|
-//展示首页控制器
|
|
|
|
|
-starter.controller('lineCtrl',["$scope",'$ionicHistory','$state',function($scope,$ionicHistory,$state){
|
|
|
|
|
- $scope.go = function(target){
|
|
|
|
|
- $ionicHistory.clearHistory();
|
|
|
|
|
- $state.go(target)
|
|
|
|
|
|
|
+ $scope.getName = function(item){
|
|
|
|
|
+ name = this.$$watchers[0].last;
|
|
|
|
|
+ $state.go('show',{item:name})
|
|
|
}
|
|
}
|
|
|
}])
|
|
}])
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
-//TN曲线控制器
|
|
|
|
|
-starter.controller('tnCtrl',["$scope",'$ionicHistory','$state','$http',function($scope,$ionicHistory,$state,$http){
|
|
|
|
|
- $scope.go = function(target){
|
|
|
|
|
- $ionicHistory.clearHistory();
|
|
|
|
|
- $state.go(target)
|
|
|
|
|
- }
|
|
|
|
|
- $scope.legend = ["扭矩", "电压",'输入功率','电流','效率'];
|
|
|
|
|
-
|
|
|
|
|
-// $http.get('../lib/ionic/test2.json')
|
|
|
|
|
-// .success(function(newItems){
|
|
|
|
|
-// $scope.item = newItems.items;
|
|
|
|
|
-// console.log($scope.item)
|
|
|
|
|
-// })
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
-
|
|
|
|
|
- $scope.item = ['200rpm','400rpm','600rpm','800rpm','1000rpm','1200rpm','1400rpm','1600rpm','1800rpm','2000rpm','2200rpm'];
|
|
|
|
|
- console.log($scope.item)
|
|
|
|
|
- $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.controller('showCtrl',["$scope",'$ionicHistory','$state','$http',function($scope,$ionicHistory,$state,$http){
|
|
|
|
|
+ $scope.tabs = [{"title":"主页","url":"line.html"},
|
|
|
|
|
+ {"title":"TN曲线","url":"tn.html"},
|
|
|
|
|
+ {"title":"五轴图","url":"zhou.html"},
|
|
|
|
|
+ {"title":"效率云图","url":"strom.html"}];
|
|
|
|
|
+ $scope.name = name;
|
|
|
|
|
+
|
|
|
|
|
+ $scope.go = function(result){
|
|
|
|
|
+ $state.go(result)
|
|
|
|
|
+ };
|
|
|
|
|
+ $scope.isActiveTab = function(tabUrl){
|
|
|
|
|
+ return tabUrl == $scope.currentTab;
|
|
|
|
|
+ };
|
|
|
|
|
+ $scope.onClickTab = function(tab){
|
|
|
|
|
+ $scope.currentTab = tab.url;
|
|
|
|
|
+ if(tab.title==="TN曲线"){
|
|
|
|
|
+ $http({
|
|
|
|
|
+ method:'get',
|
|
|
|
|
+ url:'http://172.31.40.29/data/'+name
|
|
|
|
|
+ }).success(function(req){
|
|
|
|
|
+ $scope.item= req.speed;
|
|
|
|
|
+ $scope.data = [req.torque,req.v,req.p,req.a,req.efficiency]
|
|
|
|
|
+ })
|
|
|
|
|
+ }
|
|
|
|
|
+ };
|
|
|
|
|
+ //TN曲线图
|
|
|
|
|
+ $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 = [
|
|
|
|
|
+ [1,1,1,1,1,1,1,1,1,1,1,1], //扭矩
|
|
|
|
|
+ [196,196,196,196,196,196,196,196,196,196,196,196,], //电压
|
|
|
|
|
+ [500,500,500,500,500,500,500,500,500,500,500,500,], //输入功率
|
|
|
|
|
+ [4,4,4,4,4,4,4,4,4,4,4,4], //电流
|
|
|
|
|
+ [68,68,68,68,68,68,68,68,68,68,68,68,]//效率
|
|
|
|
|
+ ];
|
|
|
|
|
+
|
|
|
|
|
+ }])
|
|
|
|
|
|
|
|
starter.directive('line', function() {
|
|
starter.directive('line', function() {
|
|
|
return {
|
|
return {
|
|
@@ -141,13 +132,13 @@ starter.directive('line', function() {
|
|
|
},
|
|
},
|
|
|
grid:{
|
|
grid:{
|
|
|
|
|
|
|
|
- left:'28%'
|
|
|
|
|
|
|
+ left:'23%'
|
|
|
},
|
|
},
|
|
|
//图例
|
|
//图例
|
|
|
legend: {
|
|
legend: {
|
|
|
data: $scope.legend ,
|
|
data: $scope.legend ,
|
|
|
textStyle:{
|
|
textStyle:{
|
|
|
- fontSize:20
|
|
|
|
|
|
|
+ fontSize:22
|
|
|
}
|
|
}
|
|
|
},
|
|
},
|
|
|
// toolbox: {
|
|
// toolbox: {
|
|
@@ -161,12 +152,10 @@ starter.directive('line', function() {
|
|
|
xAxis: [
|
|
xAxis: [
|
|
|
{
|
|
{
|
|
|
type: 'category',
|
|
type: 'category',
|
|
|
- axisTick: {
|
|
|
|
|
- alignWithLabel: true
|
|
|
|
|
- },
|
|
|
|
|
|
|
+// boundaryGap:false,
|
|
|
axisLabel:{
|
|
axisLabel:{
|
|
|
textStyle:{
|
|
textStyle:{
|
|
|
- fontSize:18
|
|
|
|
|
|
|
+ fontSize:20
|
|
|
}
|
|
}
|
|
|
},
|
|
},
|
|
|
data: $scope.item
|
|
data: $scope.item
|
|
@@ -191,7 +180,7 @@ starter.directive('line', function() {
|
|
|
axisLabel:{
|
|
axisLabel:{
|
|
|
margin:20,
|
|
margin:20,
|
|
|
textStyle:{
|
|
textStyle:{
|
|
|
- fontSize:17
|
|
|
|
|
|
|
+ fontSize:18
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
},
|
|
},
|
|
@@ -211,7 +200,7 @@ starter.directive('line', function() {
|
|
|
axisLabel:{
|
|
axisLabel:{
|
|
|
margin:15,
|
|
margin:15,
|
|
|
textStyle:{
|
|
textStyle:{
|
|
|
- fontSize:17
|
|
|
|
|
|
|
+ fontSize:18
|
|
|
}
|
|
}
|
|
|
},
|
|
},
|
|
|
},
|
|
},
|
|
@@ -230,7 +219,7 @@ starter.directive('line', function() {
|
|
|
},
|
|
},
|
|
|
axisLabel:{
|
|
axisLabel:{
|
|
|
textStyle:{
|
|
textStyle:{
|
|
|
- fontSize:17
|
|
|
|
|
|
|
+ fontSize:18
|
|
|
}
|
|
}
|
|
|
},
|
|
},
|
|
|
},
|
|
},
|
|
@@ -250,7 +239,7 @@ starter.directive('line', function() {
|
|
|
axisLabel:{
|
|
axisLabel:{
|
|
|
margin:20,
|
|
margin:20,
|
|
|
textStyle:{
|
|
textStyle:{
|
|
|
- fontSize:17
|
|
|
|
|
|
|
+ fontSize:18
|
|
|
}
|
|
}
|
|
|
},
|
|
},
|
|
|
},
|
|
},
|
|
@@ -270,7 +259,7 @@ starter.directive('line', function() {
|
|
|
axisLabel:{
|
|
axisLabel:{
|
|
|
margin:15,
|
|
margin:15,
|
|
|
textStyle:{
|
|
textStyle:{
|
|
|
- fontSize:17
|
|
|
|
|
|
|
+ fontSize:18
|
|
|
}
|
|
}
|
|
|
},
|
|
},
|
|
|
}
|
|
}
|
|
@@ -296,17 +285,6 @@ starter.directive('line', function() {
|
|
|
}
|
|
}
|
|
|
};
|
|
};
|
|
|
})
|
|
})
|
|
|
-//五轴图控制器
|
|
|
|
|
-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)
|
|
|
|
|
- }
|
|
|
|
|
-}])
|
|
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+
|