|
|
|
@ -3,7 +3,7 @@
|
|
|
|
|
*/
|
|
|
|
|
define(['angular', 'echarts', 'jquery', 'uiRouter','./monitoring/analysis-monitoring'], function (angular, echarts, $) {
|
|
|
|
|
'use strict';
|
|
|
|
|
var app = angular.module('clientRatesModule', ['ui.router']);
|
|
|
|
|
let app = angular.module('clientRatesModule', ['ui.router']);
|
|
|
|
|
app.config(['$stateProvider', function ($stateProvider) {
|
|
|
|
|
$stateProvider.state('analysis_monitoring.client_rates', {
|
|
|
|
|
controller: 'clientRateRootCtrl',
|
|
|
|
@ -28,13 +28,13 @@ define(['angular', 'echarts', 'jquery', 'uiRouter','./monitoring/analysis-monito
|
|
|
|
|
})
|
|
|
|
|
};
|
|
|
|
|
$scope.loadOrgChild = function () {
|
|
|
|
|
var params = angular.copy($scope.params);
|
|
|
|
|
let params = angular.copy($scope.params);
|
|
|
|
|
$http.get('/sys/orgs/orgChild',{params: params}).then(function (resp) {
|
|
|
|
|
$scope.orgs_child = resp.data;
|
|
|
|
|
})
|
|
|
|
|
};
|
|
|
|
|
$scope.loadBDUsers = function () {
|
|
|
|
|
var params = angular.copy($scope.params);
|
|
|
|
|
let params = angular.copy($scope.params);
|
|
|
|
|
params.begin = $filter('date')(params.begin, 'yyyyMMdd');
|
|
|
|
|
params.end = $filter('date')(params.end, 'yyyyMMdd');
|
|
|
|
|
if (!params.org_id) {
|
|
|
|
@ -51,7 +51,7 @@ define(['angular', 'echarts', 'jquery', 'uiRouter','./monitoring/analysis-monito
|
|
|
|
|
};
|
|
|
|
|
$scope.chooseLastDays = function (days) {
|
|
|
|
|
$scope.params.end = new Date();
|
|
|
|
|
var begin = new Date();
|
|
|
|
|
let begin = new Date();
|
|
|
|
|
begin.setDate(begin.getDate() - days);
|
|
|
|
|
$scope.params.begin = begin;
|
|
|
|
|
$scope.dateRangeChanged();
|
|
|
|
@ -111,7 +111,7 @@ define(['angular', 'echarts', 'jquery', 'uiRouter','./monitoring/analysis-monito
|
|
|
|
|
});
|
|
|
|
|
$scope.loadDaysAnalysis = function () {
|
|
|
|
|
$scope.loading = true;
|
|
|
|
|
var params = {};
|
|
|
|
|
let params = {};
|
|
|
|
|
params.begin = $filter('date')($scope.params.begin, 'yyyyMMdd');
|
|
|
|
|
params.end = $filter('date')($scope.params.end, 'yyyyMMdd');
|
|
|
|
|
if ($scope.extParams.noactive.enable) {
|
|
|
|
@ -148,7 +148,7 @@ define(['angular', 'echarts', 'jquery', 'uiRouter','./monitoring/analysis-monito
|
|
|
|
|
$scope.review = {review_date: new Date()};
|
|
|
|
|
$scope.submit = function () {
|
|
|
|
|
$scope.errmsg = null;
|
|
|
|
|
var review = angular.copy($scope.review);
|
|
|
|
|
let review = angular.copy($scope.review);
|
|
|
|
|
review.review_date = $filter('date')(review.review_date, 'yyyyMMdd');
|
|
|
|
|
$http.post('/analysis/client_rates/clients/' + client.client_moniker + '/review_events', review).then(function () {
|
|
|
|
|
$scope.$close();
|
|
|
|
@ -189,7 +189,7 @@ define(['angular', 'echarts', 'jquery', 'uiRouter','./monitoring/analysis-monito
|
|
|
|
|
if (!$scope.extParams.noactive.enable && !$scope.extParams.transaction.enable) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
var params = {};
|
|
|
|
|
let params = {};
|
|
|
|
|
params.begin = $filter('date')($scope.params.begin, 'yyyyMMdd');
|
|
|
|
|
params.end = $filter('date')($scope.params.end, 'yyyyMMdd');
|
|
|
|
|
if ($scope.extParams.noactive.enable) {
|
|
|
|
@ -220,10 +220,10 @@ define(['angular', 'echarts', 'jquery', 'uiRouter','./monitoring/analysis-monito
|
|
|
|
|
},
|
|
|
|
|
link: function ($scope, $element, $attr) {
|
|
|
|
|
$scope.ctrl = {};
|
|
|
|
|
var resize = function () {
|
|
|
|
|
let resize = function () {
|
|
|
|
|
setTimeout(function () {
|
|
|
|
|
$('.analysis-box').width($('.active-rate-view').innerWidth() - $('.client-names').outerWidth() - 1)
|
|
|
|
|
},500);
|
|
|
|
|
}, 500);
|
|
|
|
|
|
|
|
|
|
};
|
|
|
|
|
$($element).resize(resize);
|
|
|
|
@ -242,7 +242,7 @@ define(['angular', 'echarts', 'jquery', 'uiRouter','./monitoring/analysis-monito
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
$scope.clients = [];
|
|
|
|
|
var maxRate = 0;
|
|
|
|
|
let maxRate = 0;
|
|
|
|
|
angular.forEach(data.clients, function (client) {
|
|
|
|
|
angular.forEach(client.trade_analysis, function (trade) {
|
|
|
|
|
maxRate = Math.max(maxRate, Math.log(Number(trade.total_amount)));
|
|
|
|
@ -250,19 +250,19 @@ define(['angular', 'echarts', 'jquery', 'uiRouter','./monitoring/analysis-monito
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
angular.forEach(data.clients, function (client) {
|
|
|
|
|
var cli = {client_moniker: client.client_moniker, trade_analysis: {}};
|
|
|
|
|
let cli = {client_moniker: client.client_moniker, trade_analysis: {}};
|
|
|
|
|
angular.forEach(client.trade_analysis, function (trade) {
|
|
|
|
|
trade = angular.copy(trade);
|
|
|
|
|
cli.trade_analysis[$filter('date')(new Date(trade.create_date), 'yyyyMMdd')] = trade;
|
|
|
|
|
|
|
|
|
|
var rate = Math.log(Number(trade.total_amount));
|
|
|
|
|
var h = 45 - parseInt(45 * rate / maxRate);
|
|
|
|
|
let rate = Math.log(Number(trade.total_amount));
|
|
|
|
|
let h = 45 - parseInt(45 * rate / maxRate);
|
|
|
|
|
trade.style = {background: 'hsl(' + h + ',70%,60%)'};
|
|
|
|
|
trade.client = cli;
|
|
|
|
|
});
|
|
|
|
|
angular.forEach(client.events, function (evt) {
|
|
|
|
|
var date = new Date(evt.date);
|
|
|
|
|
var trade = cli.trade_analysis[$filter('date')(date, 'yyyyMMdd')];
|
|
|
|
|
let date = new Date(evt.date);
|
|
|
|
|
let trade = cli.trade_analysis[$filter('date')(date, 'yyyyMMdd')];
|
|
|
|
|
if (!trade) {
|
|
|
|
|
trade = {
|
|
|
|
|
create_date: $filter('date')(date, 'yyyy/MM/dd'),
|
|
|
|
@ -272,7 +272,7 @@ define(['angular', 'echarts', 'jquery', 'uiRouter','./monitoring/analysis-monito
|
|
|
|
|
cli.trade_analysis[$filter('date')(date, 'yyyyMMdd')] = trade;
|
|
|
|
|
}
|
|
|
|
|
trade.events = trade.events || [];
|
|
|
|
|
var evtItem = $filter('clientRateEventFilter')(evt);
|
|
|
|
|
let evtItem = $filter('clientRateEventFilter')(evt);
|
|
|
|
|
if (evtItem) {
|
|
|
|
|
trade.events.push(evtItem);
|
|
|
|
|
}
|
|
|
|
@ -293,13 +293,13 @@ define(['angular', 'echarts', 'jquery', 'uiRouter','./monitoring/analysis-monito
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
$element.on('mousemove', function (evt) {
|
|
|
|
|
var x = evt.pageX;
|
|
|
|
|
var y = evt.pageY;
|
|
|
|
|
let x = evt.pageX;
|
|
|
|
|
let y = evt.pageY;
|
|
|
|
|
x -= $element.offset().left;
|
|
|
|
|
y -= $element.offset().top;
|
|
|
|
|
var infobox = $('.trade-info-box');
|
|
|
|
|
var position = {left: x + 10, top: y + 10};
|
|
|
|
|
var size = {width: infobox.width(), height: infobox.height()};
|
|
|
|
|
let infobox = $('.trade-info-box');
|
|
|
|
|
let position = {left: x + 10, top: y + 10};
|
|
|
|
|
let size = {width: infobox.width(), height: infobox.height()};
|
|
|
|
|
if (position.left + size.width > $element.width() - 10) {
|
|
|
|
|
position.left -= (size.width + 25)
|
|
|
|
|
}
|
|
|
|
@ -314,7 +314,7 @@ define(['angular', 'echarts', 'jquery', 'uiRouter','./monitoring/analysis-monito
|
|
|
|
|
}
|
|
|
|
|
}]);
|
|
|
|
|
app.filter('clientRateEventFilter', ['$uibModal', function ($uibModal) {
|
|
|
|
|
var hash = {
|
|
|
|
|
let hash = {
|
|
|
|
|
'create': {display: 'text-green', label: '新增商户', symbol: 'text-success fa fa-plus'},
|
|
|
|
|
'review': {
|
|
|
|
|
display: '',
|
|
|
|
|