'use strict'; /** * controller for User Profile Example */ app.controller('adminSystemmanagerListCtrl', ["$rootScope","$scope", "$state", "$timeout", "$interval", "$modal", "$window", "SweetAlert", "i18nService", "uiGridConstants", "uiGridGroupingConstants", "Restangular", "api_sysinfo", function ($rootScope, $scope, $state, $timeout, $interval, $modal, $window, SweetAlert, i18nService, uiGridConstants, uiGridGroupingConstants, Restangular, api_sysinfo) { $scope.langs=i18nService.getAllLangs(); $scope.lang = 'zh-cn'; i18nService.setCurrentLang($scope.lang); var loginUser=$rootScope.user; var _ = $window._; var defaultFilterData = { "idx":0, "sum":1000 }; $scope.savesystem = function(data){ console.log("data1="+JSON.stringify(data)); var data2 = {}; data2["systemConfiguration"] = data; api_sysinfo.addData('systemConfiguration',data2).then(function(response){ console.log("data2="+data) if(response.data){ SweetAlert.swal({ title: "保存成功!", type: "success", confirmButtonColor: "#007AFF" } // ,function(){ // $scope.refreshData('expand-right', defaultFilterData); // } ); }else{ SweetAlert.swal({ title: "操作异常!", text: "系统异常,请稍后重试,或者联系管理员!", type: "error" }); } }) } $scope.ldloading = {}; $scope.refreshData = function(style,filterData){ $scope.ldloading[style.replace('-', '_')] = true; if(angular.isUndefined(filterData)){ filterData = defaultFilterData; } $scope.myData = []; api_sysinfo.fetchDataList('systemConfiguration',filterData).then(function(data){ var myData = Restangular.stripRestangular(data); // console.log("myData="+JSON.stringifymyData) // $scope.gridOptions.totalItems = myData.totalNum; $scope.myData = myData.list; console.log("$scope.myData="+JSON.stringify($scope.myData)) $scope.ldloading[style.replace('-', '_')] = false; },function(){ $scope.ldloading[style.replace('-', '_')] = false; }); }; $scope.refreshData('expand-right', defaultFilterData); }]);