From 93f2af4d523df832b0332b9d1fc62df912f49710 Mon Sep 17 00:00:00 2001 From: luoyang Date: Wed, 10 Oct 2018 19:02:52 +0800 Subject: [PATCH] fix BD-ng-click --- src/main/ui/main_menu.html | 8 +-- src/main/ui/manage.html | 2 +- src/main/ui/static/menu/managerMenu.js | 94 ++++++++++++++++++++++++++ 3 files changed, 99 insertions(+), 5 deletions(-) diff --git a/src/main/ui/main_menu.html b/src/main/ui/main_menu.html index faf03c5b1..de46097e2 100644 --- a/src/main/ui/main_menu.html +++ b/src/main/ui/main_menu.html @@ -363,21 +363,21 @@
- +
- BD绩效设置(bug) + BD绩效设置
- +
- BD级别设置(bug) + BD级别设置
diff --git a/src/main/ui/manage.html b/src/main/ui/manage.html index 97ba2811f..3b7de9695 100644 --- a/src/main/ui/manage.html +++ b/src/main/ui/manage.html @@ -254,7 +254,7 @@ margin-bottom: 10%;"/>
-
+
diff --git a/src/main/ui/static/menu/managerMenu.js b/src/main/ui/static/menu/managerMenu.js index 51d0c8f5d..8312b18cb 100644 --- a/src/main/ui/static/menu/managerMenu.js +++ b/src/main/ui/static/menu/managerMenu.js @@ -9,12 +9,106 @@ define(['angular', 'uiRouter', 'uiBootstrap'], function (angular) { }); }]); app.controller('listMenuCtrl', ['$scope', '$http', '$filter','$uibModal', 'commonDialog','$stateParams', function ($scope, $http,$filter, $uibModal, commonDialog,$stateParams) { + $scope.display = function () { + var json = {}; + $(".list-group").each(function () { + var child = ($(".list-group").find('a')).length; + var label = ($(".list-group").find("label:first-child")).val(); + if (child >0) { + json[label] = true; + }else { + json[label] = false; + } + }); + return json; + }; function init() { console.log("dadadadada + " + $stateParams.role); + /*console.log("json + " + $scope.display());*/ } + $scope.editRateConfig = function () { + $uibModal.open({ + templateUrl: '/static/config/bdprize/templates/rate_config_dialog.html', + controller: 'bdRateConfigCtrl', + resolve: { + rates: function () { + return angular.copy($scope.bd_rate_configs); + } + } + }).result.then(function () { + $scope.loadRateConfigs(); + }) + }; + $scope.editBDLevels = function () { + $uibModal.open({ + templateUrl: '/static/config/bdprize/templates/bd_level_config_dialog.html', + controller: 'bdLevelConfigCtrl' + }) + }; init(); }]); + app.controller('bdRateConfigCtrl', ['$scope', '$http', 'rates', function ($scope, $http, rates) { + $scope.bdLevels = [{value: 1, label: 'Junior'}, {value: 2, label: 'Intermediate'}, {value: 3, label: 'Senior'}]; + $scope.months = [{value: 1, label: '1-3 Months'}, {value: 2, label: '4-6 Months'}, { + value: 3, + label: '>=7 Months' + }]; + $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; + $scope.submitRates = function () { + var validation = null; + $scope.errmsg = null; + angular.forEach($scope.rates, function (rate) { + if (isNaN(rate.prize_rate)) { + validation = {months: rate.time_range, bd_level: rate.bd_level}; + $scope.errmsg = 'Rate Value is NaN'; + } + if (rate.prize_rate > 1) { + validation = {months: rate.time_range, bd_level: rate.bd_level}; + $scope.errmsg = 'Rate value shall no more than 1%'; + } + if (rate.prize_rate < 0) { + validation = {months: rate.time_range, bd_level: rate.bd_level}; + $scope.errmsg = 'Rate value shall be a positive value'; + } + }); + if (!validation) { + $http.put('/sys/bd_prize/config/rates', $scope.rates).then(function () { + $scope.$close(); + }, function (resp) { + $scope.errmsg = resp.data.message; + }) + } + } + }]); + app.controller('bdLevelConfigCtrl', ['$scope', '$http', function ($scope, $http) { + + $scope.getBDGroups = function () { + $http.get('/sys/manager_accounts/roles/bd_leader').then(function (resp) { + $scope.bdgroups = resp.data; + $scope.getBDLevels(); + }) + }; + $scope.getBDGroups(); + $scope.getBDLevels = function () { + $http.get('/sys/bd_prize/config/bd_levels').then(function (resp) { + $scope.bds = resp.data; + }) + }; + + $scope.bdLevels = [{value: 1, label: 'Junior'}, {value: 2, label: 'Intermediate'}, {value: 3, label: 'Senior'}]; + $scope.updateBDLevel = function (bdInfo) { + $http.put('/sys/bd_prize/config/bd_levels/' + bdInfo.manager_id, bdInfo).then(function () { + $scope.getBDGroups(); + }, function (resp) { + $scope.errmsg = resp.data.message; + }) + }; + }]); return app; });