From 633c3420c73af3d6676a36862c41a552530131db Mon Sep 17 00:00:00 2001 From: yixian Date: Tue, 2 Jan 2018 14:01:58 +0800 Subject: [PATCH] year select --- src/main/ui/static/analysis/settle_report.js | 5 +++-- src/main/ui/static/analysis/templates/settle_report.html | 2 +- src/main/ui/static/config/bdprize/bdprize.js | 9 ++++++--- .../static/config/bdprize/templates/bd_prize_root.html | 9 ++++++++- 4 files changed, 18 insertions(+), 7 deletions(-) diff --git a/src/main/ui/static/analysis/settle_report.js b/src/main/ui/static/analysis/settle_report.js index c0d79fd61..b7f907541 100644 --- a/src/main/ui/static/analysis/settle_report.js +++ b/src/main/ui/static/analysis/settle_report.js @@ -15,6 +15,7 @@ define(['angular', 'decimal', 'uiRouter', './report/analysis-report'], function $scope.params = {year: new Date().getFullYear()}; $scope.availableYears = [new Date().getFullYear() - 1, new Date().getFullYear()]; $scope.initMonth = function (year) { + $scope.params.year = year; $scope.months = []; for (var i = 1; i < 13; i++) { var mon = '00' + i; @@ -22,9 +23,9 @@ define(['angular', 'decimal', 'uiRouter', './report/analysis-report'], function $scope.months.push(year + '-' + mon); } }; - $scope.initMonth($scope.params.year); + $scope.initMonth(new Date().getFullYear()); $scope.hasReport = function (mon) { - var start = '2017-02'; + var start = '2017-02';//todo modify in different country var end = $filter('date')(new Date(), 'yyyy-MM'); return start <= mon && end >= mon }; diff --git a/src/main/ui/static/analysis/templates/settle_report.html b/src/main/ui/static/analysis/templates/settle_report.html index 8d568c437..9089dbfa1 100644 --- a/src/main/ui/static/analysis/templates/settle_report.html +++ b/src/main/ui/static/analysis/templates/settle_report.html @@ -5,7 +5,7 @@
diff --git a/src/main/ui/static/config/bdprize/bdprize.js b/src/main/ui/static/config/bdprize/bdprize.js index 981306cd5..e241f344d 100644 --- a/src/main/ui/static/config/bdprize/bdprize.js +++ b/src/main/ui/static/config/bdprize/bdprize.js @@ -41,7 +41,9 @@ define(['angular', '../../analysis/bd/analysis-bd'], function (angular) { app.controller('bdPrizeRootCtrl', ['$scope', '$http', '$uibModal', 'commonDialog', function ($scope, $http, $uibModal, commonDialog) { $scope.params = {year: new Date().getFullYear()}; + $scope.availableYears = [new Date().getFullYear() - 1, new Date().getFullYear()]; $scope.initMonth = function (year) { + $scope.params.year = year; $scope.months = []; for (var i = 1; i < 13; i++) { var mon = '00' + i; @@ -68,7 +70,7 @@ define(['angular', '../../analysis/bd/analysis-bd'], function (angular) { $scope.reportMonths = resp.data.data; }) }; - $scope.getYearReports($scope.params.year); + $scope.getYearReports(new Date().getFullYear()); $scope.generateReport = function () { commonDialog.confirm({ title: 'Warning', @@ -193,6 +195,7 @@ define(['angular', '../../analysis/bd/analysis-bd'], function (angular) { // $scope.bdmon; // $scope.newSwitch; $scope.initMonth = function (year) { + $scope.params.year = year; $scope.months = []; for (var i = 1; i < 13; i++) { var mon = '00' + i; @@ -200,9 +203,9 @@ define(['angular', '../../analysis/bd/analysis-bd'], function (angular) { $scope.months.push(year + '-' + mon); } }; - $scope.initMonth($scope.params.year); + $scope.initMonth(new Date().getFullYear()); $scope.hasReport = function (mon) { - var start = '2017-01'; + var start = '2017-01';//todo change for different country var end = $filter('date')(new Date(), 'yyyy-MM'); return start <= mon && end >= mon }; diff --git a/src/main/ui/static/config/bdprize/templates/bd_prize_root.html b/src/main/ui/static/config/bdprize/templates/bd_prize_root.html index 34eb980ee..f14ff90ec 100644 --- a/src/main/ui/static/config/bdprize/templates/bd_prize_root.html +++ b/src/main/ui/static/config/bdprize/templates/bd_prize_root.html @@ -16,7 +16,14 @@
-
+
+
+ + +
+