|
@@ -1,5 +1,5 @@
|
1
|
1
|
'use strict';
|
2
|
|
-app.controller('service_formCtrl', ["$scope", "$rootScope", "$state", "$timeout", "$interval", "$http", "$cookieStore", "SweetAlert", "Restangular", "api_report", "api_statistic", "moment", 'api_user_data','api_event_form', function ($scope, $rootScope, $state, $timeout, $interval, $http, $cookieStore, SweetAlert, Restangular, api_report, api_statistic, moment, api_user_data, api_event_form) {
|
|
2
|
+app.controller('service_formCtrl', ["$scope", "$rootScope", "$state", "$timeout", "$interval", "$http", "$cookieStore", "SweetAlert", "Restangular", "api_report", "api_statistic", "moment", 'api_user_data', 'api_event_form', 'api_bpm', function ($scope, $rootScope, $state, $timeout, $interval, $http, $cookieStore, SweetAlert, Restangular, api_report, api_statistic, moment, api_user_data, api_event_form, api_bpm) {
|
3
|
3
|
//默认显示综合统计
|
4
|
4
|
$scope.tap = 'ZHTJ';
|
5
|
5
|
//默认显示上一周
|
|
@@ -26,7 +26,7 @@ app.controller('service_formCtrl', ["$scope", "$rootScope", "$state", "$timeout"
|
26
|
26
|
$scope.endtimesModel = moment().endOf('year').add(-1, 'y').format('YYYY-MM-DD');
|
27
|
27
|
}
|
28
|
28
|
// 今天
|
29
|
|
- $scope.today = function(){
|
|
29
|
+ $scope.today = function () {
|
30
|
30
|
$scope.searchstate = "today";
|
31
|
31
|
$scope.starttimesModel = moment().format('YYYY-MM-DD');
|
32
|
32
|
$scope.endtimesModel = moment().format('YYYY-MM-DD');
|
|
@@ -75,9 +75,9 @@ app.controller('service_formCtrl', ["$scope", "$rootScope", "$state", "$timeout"
|
75
|
75
|
$scope.endOpened = !$scope.endOpened;
|
76
|
76
|
};
|
77
|
77
|
//重置
|
78
|
|
- $scope.reload = function(isReload){
|
|
78
|
+ $scope.reload = function (isReload) {
|
79
|
79
|
//点击重置时传true,切换tab传false
|
80
|
|
- if(isReload){
|
|
80
|
+ if (isReload) {
|
81
|
81
|
$scope.day(7);
|
82
|
82
|
}
|
83
|
83
|
$scope.searchstate = 'none';
|
|
@@ -106,7 +106,7 @@ app.controller('service_formCtrl', ["$scope", "$rootScope", "$state", "$timeout"
|
106
|
106
|
$scope.reload(false);
|
107
|
107
|
};
|
108
|
108
|
//综合统计,无限滚动加载
|
109
|
|
- $scope.topEndComplete = function(){
|
|
109
|
+ $scope.topEndComplete = function () {
|
110
|
110
|
console.log('滚动');
|
111
|
111
|
};
|
112
|
112
|
// 请求人
|
|
@@ -133,10 +133,10 @@ app.controller('service_formCtrl', ["$scope", "$rootScope", "$state", "$timeout"
|
133
|
133
|
* @param {string} direction 箭头方向 top,bottom
|
134
|
134
|
*/
|
135
|
135
|
$scope.tableSort = function (name) {
|
136
|
|
- if($scope.name == name){
|
137
|
|
- $scope.type = $scope.type == 'desc'?'asc':'desc';
|
138
|
|
- $scope.direction = $scope.direction == 'top'?'bottom':'top';
|
139
|
|
- }else{
|
|
136
|
+ if ($scope.name == name) {
|
|
137
|
+ $scope.type = $scope.type == 'desc' ? 'asc' : 'desc';
|
|
138
|
+ $scope.direction = $scope.direction == 'top' ? 'bottom' : 'top';
|
|
139
|
+ } else {
|
140
|
140
|
$scope.type = 'desc';
|
141
|
141
|
$scope.direction = 'top';
|
142
|
142
|
}
|
|
@@ -187,7 +187,7 @@ app.controller('service_formCtrl', ["$scope", "$rootScope", "$state", "$timeout"
|
187
|
187
|
* @param {string} name 排序字段
|
188
|
188
|
* @param {string} type 排序方式 desc,asc
|
189
|
189
|
*/
|
190
|
|
- $scope.mdxquery = function (name, type) {
|
|
190
|
+ $scope.mdxquery = function (name, type) {
|
191
|
191
|
if (!name) {
|
192
|
192
|
// name = $scope.tap == 'ZHTJ' ? 'accdate' : 'sum';
|
193
|
193
|
name = 'total';
|
|
@@ -278,6 +278,72 @@ app.controller('service_formCtrl', ["$scope", "$rootScope", "$state", "$timeout"
|
278
|
278
|
break;
|
279
|
279
|
}
|
280
|
280
|
};
|
|
281
|
+ //导出
|
|
282
|
+ $scope.export = function () {
|
|
283
|
+ var postData = {
|
|
284
|
+ "startTime": moment($scope.starttimesModel).format('YYYY-MM-DD'),
|
|
285
|
+ "endTime": moment($scope.endtimesModel).format('YYYY-MM-DD'),
|
|
286
|
+ "sortData": $scope.name,
|
|
287
|
+ "sortType": $scope.type,
|
|
288
|
+ report: {}
|
|
289
|
+ }
|
|
290
|
+ switch ($scope.tap) {
|
|
291
|
+ case 'ZHTJ'://综合统计
|
|
292
|
+ postData.key = 'mdv2_service_repot_all';
|
|
293
|
+ postData.titles = ['人员', '建单数量', '直接处理数量', '处理工单数', '电话接听数', '微信/web报修处理数', '留言处理数', '柜台受理数'];
|
|
294
|
+ break;
|
|
295
|
+ case 'DHTJ'://电话统计
|
|
296
|
+ postData.key = 'mdv2_service_repot_phone';
|
|
297
|
+ postData.titles = ['人员', '接听数量', '建单数量', '直接解决', '派单数量'];
|
|
298
|
+ break;
|
|
299
|
+ case 'WEB'://微信/WEB统计
|
|
300
|
+ postData.key = 'mdv2_service_repot_wechat_web';
|
|
301
|
+ postData.titles = ['人员', '受理报修数', '不受理数', '转换数量', '直接解决数量', '派单数量'];
|
|
302
|
+ break;
|
|
303
|
+ case 'DHLYTJ'://电话留言统计
|
|
304
|
+ postData.key = 'mdv2_service_repot_msg';
|
|
305
|
+ postData.titles = ['人员', '受理总数', '不受理总数', '建单总数', '直接解决总数', '派单总数']
|
|
306
|
+ break;
|
|
307
|
+ }
|
|
308
|
+ var wt_url = api_bpm.downDataModel('report', 1).getRequestedUrl()
|
|
309
|
+ $http({
|
|
310
|
+ url: wt_url,
|
|
311
|
+ method: 'POST',
|
|
312
|
+ data: JSON.stringify(postData),
|
|
313
|
+ headers: {
|
|
314
|
+ 'Accept': '*/*'
|
|
315
|
+ },
|
|
316
|
+ responseType: 'arraybuffer'
|
|
317
|
+ }).success(function (data, status, headers, config) {
|
|
318
|
+ var fileName = '';
|
|
319
|
+ switch ($scope.tap) {
|
|
320
|
+ case 'ZHTJ'://综合统计
|
|
321
|
+ fileName = '综合统计';
|
|
322
|
+ break;
|
|
323
|
+ case 'DHTJ'://电话统计
|
|
324
|
+ fileName = '电话统计';
|
|
325
|
+ break;
|
|
326
|
+ case 'WEB'://微信/WEB统计
|
|
327
|
+ fileName = '微信/WEB统计';
|
|
328
|
+ break;
|
|
329
|
+ case 'DHLYTJ'://电话留言统计
|
|
330
|
+ fileName = '电话留言统计';
|
|
331
|
+ break;
|
|
332
|
+ }
|
|
333
|
+ // var fileName = headers("Content-Disposition").split(";")[1].split("filename=")[1];
|
|
334
|
+ var file = new Blob([data], {
|
|
335
|
+ type: 'application/vnd.ms-excel'
|
|
336
|
+ });
|
|
337
|
+ var fileURL = URL.createObjectURL(file);
|
|
338
|
+ var a = document.createElement('a');
|
|
339
|
+ a.href = fileURL;
|
|
340
|
+ a.target = '_blank';
|
|
341
|
+ a.download = fileName + '.xls';
|
|
342
|
+ document.body.appendChild(a);
|
|
343
|
+ a.click();
|
|
344
|
+ }).error(function (data, status, headers, config) {
|
|
345
|
+ });
|
|
346
|
+ };
|
281
|
347
|
//初始化
|
282
|
348
|
$scope.mdxquery('total', 'desc');
|
283
|
349
|
$scope.sortActive = 'totaltop';
|