123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194 |
- "use strict";
- app.controller("chartingCtrl", [
- "$scope",
- "$rootScope",
- "$state",
- "$timeout",
- "$interval",
- "$http",
- "$cookieStore",
- "moment",
- "SweetAlert",
- "Restangular",
- "api_report",
- "api_statistic",
- "api_bpm_data",
- "api_user_data",
- function (
- $scope,
- $rootScope,
- $state,
- $timeout,
- $interval,
- $http,
- $cookieStore,
- moment,
- SweetAlert,
- Restangular,
- api_report,
- api_statistic,
- api_bpm_data,
- api_user_data
- ) {
- // var ROWS = "ROWS";
- // var COLUMNS = "COLUMNS";
- // $scope.treeshow = true;
- // // $scope.headers = "请选择事件树形列表!";
- // api_report.getLicenseKey().then(function(response) {
- // $cookieStore.put('Auth-Token', response.token);
- // // $scope.try_async_load();
- // });
- // var apple_selected, tree, treedata_avm, treedata_geography;
- // var workspace = {};
- $scope.parameters = {};
- $scope.allMoney = 0;
- $scope.category = {};
- $scope.reportName = "计费";
- $scope.allheight = 100;
- $scope.isMaskground = false;
- $scope.open = function ($event) {
- $event.preventDefault();
- $event.stopPropagation();
- $scope.opened = !$scope.opened;
- };
- $scope.endOpen = function ($event) {
- $event.preventDefault();
- $event.stopPropagation();
- $scope.startOpened = false;
- $scope.endOpened = !$scope.endOpened;
- };
- $scope.startOpen = function ($event) {
- $event.preventDefault();
- $event.stopPropagation();
- $scope.endOpened = false;
- $scope.startOpened = !$scope.startOpened;
- };
- // var starttime, endtime
- // $scope.starttimes = moment().startOf('month').format('YYYYMMDD');
- // $scope.endtimes = moment().format('YYYYMMDD');
- $scope.starttimes = moment(
- new Date(moment().startOf("month")).setMonth(new Date().getMonth() - 1)
- ).format("YYYY-MM-DD HH:mm:ss");
- $scope.endtimes = moment(
- new Date(moment().startOf("month")).setMonth(new Date().getMonth()) - 1
- ).format("YYYY-MM-DD HH:mm:ss");
- $scope.parameters.paramDateFrom = $scope.starttimes;
- $scope.parameters.paramDateTo = $scope.endtimes;
- // $scope.charginrow = [{
- // complexity: 774,
- // incidentCount: 18,
- // name: "李晓峰"
- // }, {
- // complexity: 23,
- // incidentCount: 12,
- // name: "王磊"
- // }]
- api_user_data
- .fetchDataList("group", {
- idx: 0,
- sum: 1000,
- group: { selectType: "nouser" },
- })
- .then(function (response) {
- if (response) {
- if ((response.status = 200)) {
- $scope.groups = response.list;
- }
- }
- });
- reshdata();
- $scope.reset = function () {
- $scope.parameters = {};
- $scope.starttimes = moment(
- new Date(moment().startOf("month")).setMonth(new Date().getMonth() - 1)
- ).format("YYYY-MM-DD HH:mm:ss");
- $scope.endtimes = moment(
- new Date(moment().startOf("month")).setMonth(new Date().getMonth()) - 1
- ).format("YYYY-MM-DD HH:mm:ss");
- $scope.parameters.paramDateFrom = $scope.starttimes;
- $scope.parameters.paramDateTo = $scope.endtimes;
- $scope.allMoney = 0;
- $scope.mdxquerym($scope.parameters.group);
- };
- // var sumChargin = 0;
- // angular.forEach($scope.charginrow, function(item) {
- // sumChargin = sumChargin + item.complexity;
- // })
- // $scope.shareMoney = function(allMoney) {
- // $scope.allMoney = allMoney;
- // $scope.reportData = angular.copy($scope.manyData);
- // $scope.rRows = [];
- // $scope.rheaders = [];
- // checkmoney(allMoney)
- // }
- // $scope.shareMoney = function(key) {
- // $scope.mdxquerym($scope.parameters.group);
- // }
- $scope.mdxquerym = function (group) {
- $scope.starttimes = moment($scope.parameters.paramDateFrom).format(
- "YYYY-MM-DD HH:mm:ss"
- );
- $scope.endtimes = moment($scope.parameters.paramDateTo).format(
- "YYYY-MM-DD HH:mm:ss"
- );
- $scope.isMaskground = true;
- $scope.shows = false;
- if (group) {
- reshdata(group.id);
- } else {
- reshdata();
- }
- // if (angular.isDefined(workspace.query)) {
- // if ($scope.rptUUID) {
- // // workspace.query.parameters = ConvertDateParameter($scope.parameters);
- // $scope.starttimes = workspace.query.parameters.paramDateFrom;
- // $scope.endtimes = workspace.query.parameters.paramDateTo;
- // reshdata();
- // } else {
- // // $scope.rptUUID = undefined;
- // // workspace.query.parameters = ConvertDateParameter($scope.parameters);
- // if (angular.isDefined($scope.parameters.paramDateFrom) && angular.isDefined($scope.parameters.paramDateTo)) {
- // $scope.starttimes = workspace.query.parameters.paramDateFrom;
- // $scope.endtimes = workspace.query.parameters.paramDateTo;
- // reshdata();
- // }
- // }
- // }
- };
- function reshdata(group) {
- api_bpm_data
- .fetchDataByGroupId({
- groupID: group,
- startTime: $scope.starttimes,
- finishTime: $scope.endtimes,
- weight: $scope.allMoney,
- })
- .then(function (response) {
- if (response) {
- if ((response.status = 200)) {
- $scope.isMaskground = false;
- $scope.charginrow = response.data;
- // var totalComplexity = 0;
- // totalComplexity = $scope.charginrow.reduce((pre,cur)=>pre + cur.complexity,0)
- angular.forEach($scope.charginrow, function(item) {
- // sumChargin = sumChargin + item.complexity;
- // item.complexityPercentage = (item.complexity / totalComplexity * 100).toFixed(2) + '%';
- item.percent += '%';
- })
- if (response.list && response.list.length == 0) {
- $scope.shows = true;
- $scope.empty = "数据为空!";
- }
- // if ($scope.allMoney != 0) {
- // $scope.shareMoney($scope.allMoney)
- // }
- }
- }
- });
- }
- },
- ]);
|