Kaynağa Gözat

绩效统计修改

seimin 2 yıl önce
ebeveyn
işleme
2389cfbbc9

+ 147 - 89
assets/js/controllers/report/chargingCtrl.js

@@ -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
     // var ROWS = "ROWS";
33
     // var ROWS = "ROWS";
4
     // var COLUMNS = "COLUMNS";
34
     // var COLUMNS = "COLUMNS";
5
     // $scope.treeshow = true;
35
     // $scope.treeshow = true;
@@ -16,32 +46,35 @@ app.controller('chartingCtrl', ["$scope", "$rootScope", "$state", "$timeout", "$
16
     $scope.reportName = "计费";
46
     $scope.reportName = "计费";
17
     $scope.allheight = 100;
47
     $scope.allheight = 100;
18
     $scope.isMaskground = false;
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
     // var starttime, endtime
67
     // var starttime, endtime
38
     // $scope.starttimes = moment().startOf('month').format('YYYYMMDD');
68
     // $scope.starttimes = moment().startOf('month').format('YYYYMMDD');
39
     // $scope.endtimes = moment().format('YYYYMMDD');
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
     $scope.parameters.paramDateFrom = $scope.starttimes;
76
     $scope.parameters.paramDateFrom = $scope.starttimes;
43
     $scope.parameters.paramDateTo = $scope.endtimes;
77
     $scope.parameters.paramDateTo = $scope.endtimes;
44
-    $scope.parameters.group = { "id": 1, "groupName": "网络维修组" };
45
     // $scope.charginrow = [{
78
     // $scope.charginrow = [{
46
     //     complexity: 774,
79
     //     complexity: 774,
47
     //     incidentCount: 18,
80
     //     incidentCount: 18,
@@ -51,81 +84,106 @@ app.controller('chartingCtrl', ["$scope", "$rootScope", "$state", "$timeout", "$
51
     //     incidentCount: 12,
84
     //     incidentCount: 12,
52
     //     name: "王磊"
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
         if (response) {
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
     function reshdata(group) {
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
+]);

+ 16 - 12
assets/views/report/charging.html

@@ -62,7 +62,7 @@
62
                             <input type="text" class="form-control" datepicker-popuptime="yyyy-MM-dd" ng-model="parameters.paramDateTo" hour-time=true min-date="parameters.paramDateFrom" is-open="endOpened" ng-init="endOpened = false" close-text="关闭" ng-click="endOpen($event)" />
62
                             <input type="text" class="form-control" datepicker-popuptime="yyyy-MM-dd" ng-model="parameters.paramDateTo" hour-time=true min-date="parameters.paramDateFrom" is-open="endOpened" ng-init="endOpened = false" close-text="关闭" ng-click="endOpen($event)" />
63
                         </div>
63
                         </div>
64
                         <div class="form-group margin-right-5">
64
                         <div class="form-group margin-right-5">
65
-                            <span class="panel-title text-dark pull-left">工作组:</span>
65
+                            <span class="panel-title text-dark pull-left">工作组</span>
66
                             <div class="pull-right" style="width:158px">
66
                             <div class="pull-right" style="width:158px">
67
                                 <ui-select ng-model="parameters.group" theme="bootstrap">
67
                                 <ui-select ng-model="parameters.group" theme="bootstrap">
68
                                     <ui-select-match placeholder="选择工作组">
68
                                     <ui-select-match placeholder="选择工作组">
@@ -76,19 +76,23 @@
76
                             </div>
76
                             </div>
77
                         </div>
77
                         </div>
78
                         <div class="form-group">
78
                         <div class="form-group">
79
-                            <button class="btn btn-searchbutton steelbutton" ng-click="mdxquerym(parameters.group)" type="button">搜索</button>
80
-                        </div>
81
-                        <div class="form-group">
82
-                            <a class="btn btn-exportbutton  exportbutton" ng-click="exportData()" ng-disabled="disabledParentGroup" type="button">导出</a>
79
+                            <span class="panel-title text-dark pull-left">计费:</span>
80
+                            <div class="pull-right" style="width:158px">
81
+                                <input class="form-control" style="border-radius: 4px 0px 0px 4px !important" type="number" min="0" max="1000000000" ng-minlength="1" ng-maxlength="1000" ng-model="allMoney">
82
+                            </div>
83
                         </div>
83
                         </div>
84
+                        
84
                         <div class="form-group pull-right">
85
                         <div class="form-group pull-right">
85
                             <div class="input-group">
86
                             <div class="input-group">
86
-                                <input class="form-control" style="border-radius: 4px 0px 0px 4px !important" type="number" min="0" max="1000000000" ng-minlength="1" ng-maxlength="1000" ng-model="allMoney">
87
-                                <span class="input-group-btn">
88
-                                                    <button class="btn btn-primary" ng-disabled="getmoney()"
89
-                                                            ng-click="shareMoney(allMoney)"
90
-                                                            type="button">计费<i class="moneground"></i></button>
91
-                                                </span>
87
+                                <div class="form-group margin-right-5">
88
+                                    <button class="btn btn-searchbutton steelbutton" ng-click="mdxquerym(parameters.group)" type="button">搜索</button>
89
+                                </div>
90
+                                <div class="form-group margin-right-5">
91
+                                    <a class="btn btn-exportbutton exportbutton" ng-click="exportData()" ng-disabled="disabledParentGroup" type="button">导出</a>
92
+                                </div>
93
+                                <div class="form-group margin-right-5">
94
+                                    <a class="btn btn-default defaultheight" ng-click="reset()" type="button">重置</a>
95
+                                </div>
92
                             </div>
96
                             </div>
93
                         </div>
97
                         </div>
94
                     </div>
98
                     </div>
@@ -121,7 +125,7 @@
121
                                             {{rowData.complexity}}
125
                                             {{rowData.complexity}}
122
                                         </td>
126
                                         </td>
123
                                         <td ng-class="fieldData.thclass">
127
                                         <td ng-class="fieldData.thclass">
124
-                                            {{rowData.money||0}}
128
+                                            {{rowData.score||0}}
125
                                         </td>
129
                                         </td>
126
                                     </tr>
130
                                     </tr>
127
                                 </tbody>
131
                                 </tbody>