fix BD-ng-click

master
luoyang 6 years ago
parent 3ff563307f
commit 93f2af4d52

@ -363,21 +363,21 @@
</a> </a>
</div> </div>
<div ng-if="'1000'|withRole" class="col-sm-2 col-xs-6"> <div ng-if="'1000'|withRole" class="col-sm-2 col-xs-6">
<a ng-click="editRateConfig()"> <a ng-click="editRateConfig()" style="cursor: pointer">
<div class="description-block"> <div class="description-block">
<img src="/static/images/main_menu/bd_performance_setting.png"/> <img src="/static/images/main_menu/bd_performance_setting.png"/>
<div class="description-text"> <div class="description-text">
<span class="description-text">BD绩效设置(bug)</span> <span class="description-text">BD绩效设置</span>
</div> </div>
</div> </div>
</a> </a>
</div> </div>
<div ng-if="'1000'|withRole" class="col-sm-2 col-xs-6"> <div ng-if="'1000'|withRole" class="col-sm-2 col-xs-6">
<a ng-click="editBDLevels()"> <a ng-click="editBDLevels()" style="cursor: pointer">
<div class="description-block"> <div class="description-block">
<img src="/static/images/main_menu/bd_level_setting.png"/> <img src="/static/images/main_menu/bd_level_setting.png"/>
<div class="description-text"> <div class="description-text">
<span class="description-text">BD级别设置(bug)</span> <span class="description-text">BD级别设置</span>
</div> </div>
</div> </div>
</a> </a>

@ -254,7 +254,7 @@ margin-bottom: 10%;"/>
</div> </div>
<div style="margin: 0 auto;display: flex;padding-top: 40px;padding-bottom:0.5%;width: 60%;flex-wrap:wrap"> <div style="margin: 0 auto;display: flex;padding-top: 40px;padding-bottom:0.5%;width: 60%;min-height:626px;flex-wrap:wrap">
<div class="box-items" ng-if="'10'|withRole"> <div class="box-items" ng-if="'10'|withRole">
<a ng-click="headerShow()" ui-sref="listMenu({role:'Compliance'})" ui-sref-opts="{reload:true}"> <a ng-click="headerShow()" ui-sref="listMenu({role:'Compliance'})" ui-sref-opts="{reload:true}">
<div class="boxs"> <div class="boxs">

@ -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) { 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() { function init() {
console.log("dadadadada + " + $stateParams.role); 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(); 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; return app;
}); });

Loading…
Cancel
Save