|
|
|
@ -39,11 +39,12 @@ define(['angular', '../../analysis/bd/analysis-bd'], function (angular) {
|
|
|
|
|
})
|
|
|
|
|
}]);
|
|
|
|
|
|
|
|
|
|
app.controller('bdPrizeRootCtrl', ['$scope', '$http', '$uibModal', 'commonDialog', function ($scope, $http, $uibModal, commonDialog) {
|
|
|
|
|
app.controller('bdPrizeRootCtrl', ['$scope', '$http', '$uibModal', 'commonDialog','$filter', function ($scope, $http, $uibModal, commonDialog,$filter) {
|
|
|
|
|
$scope.params = {year: new Date().getFullYear()};
|
|
|
|
|
$scope.generate = {};
|
|
|
|
|
$scope.availableYears = [new Date().getFullYear() - 1, new Date().getFullYear()];
|
|
|
|
|
$scope.kpiRanges = [{value: 1, label: '0-0.5'}, {value: 2, label: '0.5-0.8'}, {value: 3, label: '0.8-1'},
|
|
|
|
|
{value: 4, label: '1-1.2'}, {value: 5, label: '>=1.2'}];
|
|
|
|
|
$scope.kpiRanges = [{value: 1, label: '0-50%'}, {value: 2, label: '50%~80%'}, {value: 3, label: '80%~100%'},
|
|
|
|
|
{value: 4, label: '100%-120%'}, {value: 5, label: '>=120%'}];
|
|
|
|
|
$scope.initMonth = function (year) {
|
|
|
|
|
$scope.params.year = year;
|
|
|
|
|
$scope.months = [];
|
|
|
|
@ -74,11 +75,20 @@ define(['angular', '../../analysis/bd/analysis-bd'], function (angular) {
|
|
|
|
|
};
|
|
|
|
|
$scope.getYearReports(new Date().getFullYear());
|
|
|
|
|
$scope.generateReport = function () {
|
|
|
|
|
$scope.generate.status = {};
|
|
|
|
|
if (!$scope.generate.month) {
|
|
|
|
|
commonDialog.alert({
|
|
|
|
|
type: 'error', title: 'Error', content: 'Select a month first!'
|
|
|
|
|
});
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
commonDialog.confirm({
|
|
|
|
|
title: 'Warning',
|
|
|
|
|
content: 'This operation will clear the result of last month generated before. Are you sure?'
|
|
|
|
|
}).then(function () {
|
|
|
|
|
$http.post('/sys/bd_prize/generate_record', null, {timeout: 60000}).then(function () {
|
|
|
|
|
var params = {month: $filter('date')($scope.generate.month, 'yyyy-MM')};
|
|
|
|
|
$http.post('/sys/bd_prize/generate_record/'+params.month, null, {timeout: 60000}).then(function () {
|
|
|
|
|
$scope.generate.status = null;
|
|
|
|
|
commonDialog.alert({title: 'Success', content: 'Generate Finished', type: 'success'});
|
|
|
|
|
$scope.getYearReports($scope.params.year);
|
|
|
|
|
}, function (resp) {
|
|
|
|
@ -108,8 +118,7 @@ define(['angular', '../../analysis/bd/analysis-bd'], function (angular) {
|
|
|
|
|
rates: function () {
|
|
|
|
|
return angular.copy($scope.bd_rate_configs);
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
size:'lg'
|
|
|
|
|
}
|
|
|
|
|
}).result.then(function () {
|
|
|
|
|
$scope.loadRateConfigs();
|
|
|
|
|
})
|
|
|
|
@ -139,8 +148,8 @@ define(['angular', '../../analysis/bd/analysis-bd'], function (angular) {
|
|
|
|
|
value: 3,
|
|
|
|
|
label: '>=7 Months'
|
|
|
|
|
}];
|
|
|
|
|
$scope.kpiRanges = [{value: 1, label: '0-0.5'}, {value: 2, label: '0.5-0.8'}, {value: 3, label: '0.8-1'},
|
|
|
|
|
{value: 4, label: '1-1.2'}, {value: 5, label: '>=1.2'}];
|
|
|
|
|
$scope.kpiRanges = [{value: 1, label: '0-50%'}, {value: 2, label: '50%~80%'}, {value: 3, label: '80%~100%'},
|
|
|
|
|
{value: 4, label: '100%-120%'}, {value: 5, label: '>=120%'}];
|
|
|
|
|
$scope.clientRate = [{value: 0.6, label: '0.6-0.79'}, {value: 0.8, label: '0.8-2.0'}];
|
|
|
|
|
$scope.filter = {bd_level: 1,rate_from:0.6};
|
|
|
|
|
$scope.rates = rates;
|
|
|
|
|