demo20230512/Browser_Local/js/Report/ReportController.js

41 lines
1.1 KiB
JavaScript
Raw Permalink Normal View History

2023-05-12 10:20:28 +08:00
var arr = window.location.href.split("/");
if (arr[3].indexOf('app') == 0)
baseUrl = '';
else
baseUrl = '/' + arr[3];
angular.module('CarbonFootprint')
.config(function ($routeProvider) {
$routeProvider.when('/Report/Index', {
templateUrl: baseUrl+'/Partials/Report-Index',
controller: 'ReportController'
});
})
.controller('ReportController',
['$scope', '$http', '$timeout',
function ($scope, $http, $timeout) {
$scope.searchText = "";
// set $scope.baseUrl
var baseUrl = $scope.baseUrl;
if (typeof (baseUrl) === 'undefined' || baseUrl == null) {
var arr = window.location.href.split("/");
if (arr[3].indexOf('app') == 0)
baseUrl = '';
else
baseUrl = '/' + arr[3];
$scope.baseUrl = baseUrl;
}
$scope.downNameRewrite = function (name) {
if (typeof name != 'undefined' && name != null) {
return "Download";
}
}
$http.get($scope.baseUrl+'/api/LCA/GetMyReports')
.success(function (data, status, headers, config) {
$scope.reportList = data;
});
}
]);