|
@@ -1,5 +1,35 @@
|
1
|
|
-'use strict';
|
2
|
|
-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) {
|
|
1
|
+"use strict";
|
|
2
|
+app.controller("chartingCtrl", [
|
|
3
|
+ "$scope",
|
|
4
|
+ "$rootScope",
|
|
5
|
+ "$state",
|
|
6
|
+ "$timeout",
|
|
7
|
+ "$interval",
|
|
8
|
+ "$http",
|
|
9
|
+ "$cookieStore",
|
|
10
|
+ "moment",
|
|
11
|
+ "SweetAlert",
|
|
12
|
+ "Restangular",
|
|
13
|
+ "api_report",
|
|
14
|
+ "api_statistic",
|
|
15
|
+ "api_bpm_data",
|
|
16
|
+ "api_user_data",
|
|
17
|
+ function (
|
|
18
|
+ $scope,
|
|
19
|
+ $rootScope,
|
|
20
|
+ $state,
|
|
21
|
+ $timeout,
|
|
22
|
+ $interval,
|
|
23
|
+ $http,
|
|
24
|
+ $cookieStore,
|
|
25
|
+ moment,
|
|
26
|
+ SweetAlert,
|
|
27
|
+ Restangular,
|
|
28
|
+ api_report,
|
|
29
|
+ api_statistic,
|
|
30
|
+ api_bpm_data,
|
|
31
|
+ api_user_data
|
|
32
|
+ ) {
|
3
|
33
|
// var ROWS = "ROWS";
|
4
|
34
|
// var COLUMNS = "COLUMNS";
|
5
|
35
|
// $scope.treeshow = true;
|
|
@@ -16,32 +46,35 @@ app.controller('chartingCtrl', ["$scope", "$rootScope", "$state", "$timeout", "$
|
16
|
46
|
$scope.reportName = "计费";
|
17
|
47
|
$scope.allheight = 100;
|
18
|
48
|
$scope.isMaskground = false;
|
19
|
|
- $scope.open = function($event) {
|
20
|
|
- $event.preventDefault();
|
21
|
|
- $event.stopPropagation();
|
|
49
|
+ $scope.open = function ($event) {
|
|
50
|
+ $event.preventDefault();
|
|
51
|
+ $event.stopPropagation();
|
22
|
52
|
|
23
|
|
- $scope.opened = !$scope.opened;
|
|
53
|
+ $scope.opened = !$scope.opened;
|
24
|
54
|
};
|
25
|
|
- $scope.endOpen = function($event) {
|
26
|
|
- $event.preventDefault();
|
27
|
|
- $event.stopPropagation();
|
28
|
|
- $scope.startOpened = false;
|
29
|
|
- $scope.endOpened = !$scope.endOpened;
|
|
55
|
+ $scope.endOpen = function ($event) {
|
|
56
|
+ $event.preventDefault();
|
|
57
|
+ $event.stopPropagation();
|
|
58
|
+ $scope.startOpened = false;
|
|
59
|
+ $scope.endOpened = !$scope.endOpened;
|
30
|
60
|
};
|
31
|
|
- $scope.startOpen = function($event) {
|
32
|
|
- $event.preventDefault();
|
33
|
|
- $event.stopPropagation();
|
34
|
|
- $scope.endOpened = false;
|
35
|
|
- $scope.startOpened = !$scope.startOpened;
|
|
61
|
+ $scope.startOpen = function ($event) {
|
|
62
|
+ $event.preventDefault();
|
|
63
|
+ $event.stopPropagation();
|
|
64
|
+ $scope.endOpened = false;
|
|
65
|
+ $scope.startOpened = !$scope.startOpened;
|
36
|
66
|
};
|
37
|
67
|
// var starttime, endtime
|
38
|
68
|
// $scope.starttimes = moment().startOf('month').format('YYYYMMDD');
|
39
|
69
|
// $scope.endtimes = moment().format('YYYYMMDD');
|
40
|
|
- $scope.starttimes = moment((new Date(moment().startOf('month'))).setMonth((new Date()).getMonth() - 1)).format('YYYY-MM-DD HH:mm:ss');
|
41
|
|
- $scope.endtimes = moment((new Date(moment().startOf('month'))).setMonth((new Date()).getMonth()) - 1).format('YYYY-MM-DD HH:mm:ss')
|
|
70
|
+ $scope.starttimes = moment(
|
|
71
|
+ new Date(moment().startOf("month")).setMonth(new Date().getMonth() - 1)
|
|
72
|
+ ).format("YYYY-MM-DD HH:mm:ss");
|
|
73
|
+ $scope.endtimes = moment(
|
|
74
|
+ new Date(moment().startOf("month")).setMonth(new Date().getMonth()) - 1
|
|
75
|
+ ).format("YYYY-MM-DD HH:mm:ss");
|
42
|
76
|
$scope.parameters.paramDateFrom = $scope.starttimes;
|
43
|
77
|
$scope.parameters.paramDateTo = $scope.endtimes;
|
44
|
|
- $scope.parameters.group = { "id": 1, "groupName": "网络维修组" };
|
45
|
78
|
// $scope.charginrow = [{
|
46
|
79
|
// complexity: 774,
|
47
|
80
|
// incidentCount: 18,
|
|
@@ -51,81 +84,106 @@ app.controller('chartingCtrl', ["$scope", "$rootScope", "$state", "$timeout", "$
|
51
|
84
|
// incidentCount: 12,
|
52
|
85
|
// name: "王磊"
|
53
|
86
|
// }]
|
54
|
|
- api_user_data.fetchDataList('group', { "idx": 0, "sum": 1000 }).then(function(response) {
|
|
87
|
+ api_user_data
|
|
88
|
+ .fetchDataList("group", {
|
|
89
|
+ idx: 0,
|
|
90
|
+ sum: 1000,
|
|
91
|
+ group: { selectType: "nouser" },
|
|
92
|
+ })
|
|
93
|
+ .then(function (response) {
|
55
|
94
|
if (response) {
|
56
|
|
- if (response.status = 200) {
|
57
|
|
- $scope.groups = response.list;
|
58
|
|
- }
|
59
|
|
- }
|
60
|
|
- });
|
61
|
|
- reshdata(1);
|
62
|
|
- var sumChargin = 0;
|
63
|
|
- angular.forEach($scope.charginrow, function(item) {
|
64
|
|
- sumChargin = sumChargin + item.complexity;
|
65
|
|
- })
|
66
|
|
- // $scope.shareMoney = function(allMoney) {
|
67
|
|
- // $scope.allMoney = allMoney;
|
68
|
|
- // $scope.reportData = angular.copy($scope.manyData);
|
69
|
|
- // $scope.rRows = [];
|
70
|
|
- // $scope.rheaders = [];
|
71
|
|
- // checkmoney(allMoney)
|
72
|
|
- // }
|
73
|
|
-
|
74
|
|
- $scope.shareMoney = function(key) {
|
75
|
|
- $scope.allMoney = key;
|
76
|
|
- angular.forEach($scope.charginrow, function(item) {
|
77
|
|
- item.money = (key * item.complexity / sumChargin).toFixed(2);
|
78
|
|
- })
|
79
|
|
- }
|
80
|
|
- $scope.mdxquerym = function(group) {
|
81
|
|
- $scope.starttimes = moment($scope.parameters.paramDateFrom).format('YYYY-MM-DD HH:mm:ss');
|
82
|
|
- $scope.endtimes = moment($scope.parameters.paramDateTo).format('YYYY-MM-DD HH:mm:ss');
|
83
|
|
- $scope.isMaskground = true;
|
84
|
|
- $scope.shows = false;
|
85
|
|
- if (group) {
|
86
|
|
- reshdata(group.id);
|
87
|
|
- } else {
|
88
|
|
- reshdata();
|
|
95
|
+ if ((response.status = 200)) {
|
|
96
|
+ $scope.groups = response.list;
|
|
97
|
+ }
|
89
|
98
|
}
|
90
|
|
- // if (angular.isDefined(workspace.query)) {
|
91
|
|
- // if ($scope.rptUUID) {
|
92
|
|
- // // workspace.query.parameters = ConvertDateParameter($scope.parameters);
|
93
|
|
- // $scope.starttimes = workspace.query.parameters.paramDateFrom;
|
94
|
|
- // $scope.endtimes = workspace.query.parameters.paramDateTo;
|
95
|
|
- // reshdata();
|
96
|
|
- // } else {
|
97
|
|
- // // $scope.rptUUID = undefined;
|
98
|
|
- // // workspace.query.parameters = ConvertDateParameter($scope.parameters);
|
99
|
|
- // if (angular.isDefined($scope.parameters.paramDateFrom) && angular.isDefined($scope.parameters.paramDateTo)) {
|
100
|
|
- // $scope.starttimes = workspace.query.parameters.paramDateFrom;
|
101
|
|
- // $scope.endtimes = workspace.query.parameters.paramDateTo;
|
102
|
|
- // reshdata();
|
103
|
|
- // }
|
104
|
|
- // }
|
105
|
|
- // }
|
|
99
|
+ });
|
|
100
|
+ reshdata();
|
|
101
|
+ $scope.reset = function () {
|
|
102
|
+ $scope.parameters = {};
|
|
103
|
+ $scope.starttimes = moment(
|
|
104
|
+ new Date(moment().startOf("month")).setMonth(new Date().getMonth() - 1)
|
|
105
|
+ ).format("YYYY-MM-DD HH:mm:ss");
|
|
106
|
+ $scope.endtimes = moment(
|
|
107
|
+ new Date(moment().startOf("month")).setMonth(new Date().getMonth()) - 1
|
|
108
|
+ ).format("YYYY-MM-DD HH:mm:ss");
|
|
109
|
+ $scope.parameters.paramDateFrom = $scope.starttimes;
|
|
110
|
+ $scope.parameters.paramDateTo = $scope.endtimes;
|
|
111
|
+ $scope.allMoney = 0;
|
|
112
|
+ $scope.mdxquerym($scope.parameters.group);
|
|
113
|
+ };
|
|
114
|
+ // var sumChargin = 0;
|
|
115
|
+ // angular.forEach($scope.charginrow, function(item) {
|
|
116
|
+ // sumChargin = sumChargin + item.complexity;
|
|
117
|
+ // })
|
|
118
|
+ // $scope.shareMoney = function(allMoney) {
|
|
119
|
+ // $scope.allMoney = allMoney;
|
|
120
|
+ // $scope.reportData = angular.copy($scope.manyData);
|
|
121
|
+ // $scope.rRows = [];
|
|
122
|
+ // $scope.rheaders = [];
|
|
123
|
+ // checkmoney(allMoney)
|
|
124
|
+ // }
|
106
|
125
|
|
107
|
|
- }
|
|
126
|
+ // $scope.shareMoney = function(key) {
|
|
127
|
+ // $scope.mdxquerym($scope.parameters.group);
|
|
128
|
+ // }
|
|
129
|
+ $scope.mdxquerym = function (group) {
|
|
130
|
+ $scope.starttimes = moment($scope.parameters.paramDateFrom).format(
|
|
131
|
+ "YYYY-MM-DD HH:mm:ss"
|
|
132
|
+ );
|
|
133
|
+ $scope.endtimes = moment($scope.parameters.paramDateTo).format(
|
|
134
|
+ "YYYY-MM-DD HH:mm:ss"
|
|
135
|
+ );
|
|
136
|
+ $scope.isMaskground = true;
|
|
137
|
+ $scope.shows = false;
|
|
138
|
+ if (group) {
|
|
139
|
+ reshdata(group.id);
|
|
140
|
+ } else {
|
|
141
|
+ reshdata();
|
|
142
|
+ }
|
|
143
|
+ // if (angular.isDefined(workspace.query)) {
|
|
144
|
+ // if ($scope.rptUUID) {
|
|
145
|
+ // // workspace.query.parameters = ConvertDateParameter($scope.parameters);
|
|
146
|
+ // $scope.starttimes = workspace.query.parameters.paramDateFrom;
|
|
147
|
+ // $scope.endtimes = workspace.query.parameters.paramDateTo;
|
|
148
|
+ // reshdata();
|
|
149
|
+ // } else {
|
|
150
|
+ // // $scope.rptUUID = undefined;
|
|
151
|
+ // // workspace.query.parameters = ConvertDateParameter($scope.parameters);
|
|
152
|
+ // if (angular.isDefined($scope.parameters.paramDateFrom) && angular.isDefined($scope.parameters.paramDateTo)) {
|
|
153
|
+ // $scope.starttimes = workspace.query.parameters.paramDateFrom;
|
|
154
|
+ // $scope.endtimes = workspace.query.parameters.paramDateTo;
|
|
155
|
+ // reshdata();
|
|
156
|
+ // }
|
|
157
|
+ // }
|
|
158
|
+ // }
|
|
159
|
+ };
|
108
|
160
|
|
109
|
161
|
function reshdata(group) {
|
110
|
|
- api_bpm_data.fetchDataByGroupId({ "groupID": group, "startTime": $scope.starttimes, "finishTime": $scope.endtimes }).then(function(response) {
|
111
|
|
- if (response) {
|
112
|
|
- if (response.status = 200) {
|
113
|
|
- $scope.isMaskground = false;
|
114
|
|
- $scope.charginrow = response.data;
|
115
|
|
- angular.forEach($scope.charginrow, function(item) {
|
116
|
|
- sumChargin = sumChargin + item.complexity;
|
117
|
|
- })
|
118
|
|
- if (response.list && response.list.length == 0) {
|
119
|
|
- $scope.shows = true;
|
120
|
|
- $scope.empty = "数据为空!"
|
121
|
|
- }
|
122
|
|
- if ($scope.allMoney != 0) {
|
123
|
|
- $scope.shareMoney($scope.allMoney)
|
124
|
|
- }
|
125
|
|
- }
|
|
162
|
+ api_bpm_data
|
|
163
|
+ .fetchDataByGroupId({
|
|
164
|
+ groupID: group,
|
|
165
|
+ startTime: $scope.starttimes,
|
|
166
|
+ finishTime: $scope.endtimes,
|
|
167
|
+ weight: $scope.allMoney,
|
|
168
|
+ })
|
|
169
|
+ .then(function (response) {
|
|
170
|
+ if (response) {
|
|
171
|
+ if ((response.status = 200)) {
|
|
172
|
+ $scope.isMaskground = false;
|
|
173
|
+ $scope.charginrow = response.data;
|
|
174
|
+ // angular.forEach($scope.charginrow, function(item) {
|
|
175
|
+ // sumChargin = sumChargin + item.complexity;
|
|
176
|
+ // })
|
|
177
|
+ if (response.list && response.list.length == 0) {
|
|
178
|
+ $scope.shows = true;
|
|
179
|
+ $scope.empty = "数据为空!";
|
|
180
|
+ }
|
|
181
|
+ // if ($scope.allMoney != 0) {
|
|
182
|
+ // $scope.shareMoney($scope.allMoney)
|
|
183
|
+ // }
|
126
|
184
|
}
|
|
185
|
+ }
|
127
|
186
|
});
|
128
|
187
|
}
|
129
|
|
-
|
130
|
|
-
|
131
|
|
-}]);
|
|
188
|
+ },
|
|
189
|
+]);
|