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