浏览代码

首页上下班情况联动

seimin 3 年之前
父节点
当前提交
46532ceb24

+ 1 - 1
assets/js/config.router.js

@@ -505,7 +505,7 @@ app.config(['$authProvider', '$httpProvider', '$stateProvider', '$urlRouterProvi
505 505
                     label: 'incident list'
506 506
                 }
507 507
             }).state('app.working.history', {
508
-                url: '/history',
508
+                url: '/history/:tab/:state',
509 509
                 templateUrl: "assets/views/working/list.html",
510 510
                 resolve: loadSequence('jquery-sparkline', 'spin', 'ladda', 'angular-ladda', 'ui.grid', 'moment', 'angularPrint', 'angularFileUpload', 'ui.select', 'multi.select.tree', 'angularBootstrapNavTree', 'workingHistoryFormCtr'),
511 511
                 title: 'incident.LIST',

+ 33 - 12
assets/js/controllers/working/workingHistoryFormCtr.js

@@ -1,6 +1,7 @@
1 1
 'use strict';
2 2
 
3
-app.controller('workingHistoryFormCtr', ["$scope", "moment", "SweetAlert", "api_user_data", function ($scope, moment, SweetAlert, api_user_data) {
3
+app.controller('workingHistoryFormCtr', ["$scope", "moment", "SweetAlert", "$state", "api_user_data", function ($scope, moment, SweetAlert, $state, api_user_data) {
4
+  console.log($state.params)
4 5
   //上班记录状态
5 6
   $scope.statesOn = [
6 7
     { name: '全部', value: '0' },
@@ -15,10 +16,26 @@ app.controller('workingHistoryFormCtr', ["$scope", "moment", "SweetAlert", "api_
15 16
     { name: '未打卡', value: '4' }
16 17
   ];
17 18
   // 查询条件
18
-  $scope.searchkeys = {
19
-    state: $scope.statesOn[0],
20
-    date: moment().format('YYYY-MM-DD')
19
+  if ($state.params.state) {
20
+    var stateItem = $scope.statesOn.find(v => v.value == $state.params.state);
21
+    if (stateItem) {
22
+      $scope.searchkeys = {
23
+        state: stateItem,
24
+        date: moment().format('YYYY-MM-DD')
25
+      }
26
+    } else {
27
+      $scope.searchkeys = {
28
+        state: $scope.statesOn[0],
29
+        date: moment().format('YYYY-MM-DD')
30
+      }
31
+    }
32
+  } else {
33
+    $scope.searchkeys = {
34
+      state: $scope.statesOn[0],
35
+      date: moment().format('YYYY-MM-DD')
36
+    }
21 37
   }
38
+
22 39
   // 查询的重置条件
23 40
   $scope.resetSearchkeys = {
24 41
     state: $scope.statesOn[0],
@@ -97,7 +114,11 @@ app.controller('workingHistoryFormCtr', ["$scope", "moment", "SweetAlert", "api_
97 114
     }
98 115
   ];
99 116
   //默认选择上班记录
100
-  $scope.searchstate = 'on';
117
+  if ($state.params.tab) {
118
+    $scope.searchstate = $state.params.tab;
119
+  } else {
120
+    $scope.searchstate = 'on';
121
+  }
101 122
   $scope.states = $scope.statesOn;
102 123
   // 切换tab
103 124
   $scope.onChange = function (searchType) {
@@ -121,7 +142,7 @@ app.controller('workingHistoryFormCtr', ["$scope", "moment", "SweetAlert", "api_
121 142
     $scope.startOpened = !$scope.startOpened;
122 143
   };
123 144
   // 选择日期
124
-  $scope.changeDate = function(){
145
+  $scope.changeDate = function () {
125 146
     $scope.searchkeys.date = moment($scope.searchkeys.date).format('YYYY-MM-DD');
126 147
   }
127 148
   // 重置
@@ -130,7 +151,7 @@ app.controller('workingHistoryFormCtr', ["$scope", "moment", "SweetAlert", "api_
130 151
     $scope.refreshData();
131 152
   }
132 153
   //处理过滤数据
133
-  $scope.stateChange = function(data){
154
+  $scope.stateChange = function (data) {
134 155
     var arr = [];
135 156
     //过滤上班记录或下班记录
136 157
     if ($scope.searchstate === "on") {
@@ -145,7 +166,7 @@ app.controller('workingHistoryFormCtr', ["$scope", "moment", "SweetAlert", "api_
145 166
       //实到
146 167
       let arr1 = arr.filter(v => v.extra2 == "迟到");
147 168
       let arr2 = arr.filter(v => v.extra2 == "正常");
148
-      $scope.myData = [...arr1,...arr2];
169
+      $scope.myData = [...arr1, ...arr2];
149 170
     } else if ($scope.searchkeys.state.value === "2") {
150 171
       //迟到
151 172
       $scope.myData = arr.filter(v => v.extra2 == "迟到");
@@ -154,19 +175,19 @@ app.controller('workingHistoryFormCtr', ["$scope", "moment", "SweetAlert", "api_
154 175
       $scope.myData = arr.filter(v => v.extra2 == "早退");
155 176
     } else if ($scope.searchkeys.state.value === "4") {
156 177
       //未打卡
157
-      if($scope.searchstate === 'on'){
178
+      if ($scope.searchstate === 'on') {
158 179
         // 上班
159 180
         $scope.myData = angular.copy($scope.itemsSaveNoOn);
160
-      }else if($scope.searchstate === 'off'){
181
+      } else if ($scope.searchstate === 'off') {
161 182
         // 下班
162 183
         $scope.myData = angular.copy($scope.itemsSaveNoOff);
163 184
       }
164 185
     } else if ($scope.searchkeys.state.value === "0") {
165 186
       //全部
166
-      if($scope.searchstate === 'on'){
187
+      if ($scope.searchstate === 'on') {
167 188
         // 上班
168 189
         $scope.myData = angular.copy(arr.concat($scope.itemsSaveNoOn));
169
-      }else if($scope.searchstate === 'off'){
190
+      } else if ($scope.searchstate === 'off') {
170 191
         // 下班
171 192
         $scope.myData = angular.copy(arr.concat($scope.itemsSaveNoOff));
172 193
       }

+ 4 - 4
assets/views/dashboard/newdash.html

@@ -282,10 +282,10 @@
282 282
                         <div class="know-text-group_item fl">所有处理中:<strong class="know-text-group_strong" ng-click="goTo('app.incident.list',{tab:'all',state:'1544'})">{{managerIndexInfo.doingOrders}}</strong></div>
283 283
                     </div>
284 284
                     <div class="know-text-group_block fr">
285
-                        <div class="know-text-group_item fl">今日应到运维人员:<strong>{{managerIndexInfo.usersCount}}</strong></div>
286
-                        <div class="know-text-group_item fl">实到:<strong>{{managerIndexInfo.onlineCount}}</strong></div>
287
-                        <div class="know-text-group_item fl">迟到:<strong>{{managerIndexInfo.errorOnlineCount}}</strong></div>
288
-                        <div class="know-text-group_item fl">未打卡:<strong>{{managerIndexInfo.unOnlineCount}}</strong></div>
285
+                        <div class="know-text-group_item fl">今日应到运维人员:<strong class="know-text-group_strong" ng-click="goTo('app.working.history',{tab:'on',state:0})">{{managerIndexInfo.usersCount}}</strong></div>
286
+                        <div class="know-text-group_item fl">实到:<strong class="know-text-group_strong" ng-click="goTo('app.working.history',{tab:'on',state:1})">{{managerIndexInfo.onlineCount}}</strong></div>
287
+                        <div class="know-text-group_item fl">迟到:<strong class="know-text-group_strong" ng-click="goTo('app.working.history',{tab:'on',state:2})">{{managerIndexInfo.errorOnlineCount}}</strong></div>
288
+                        <div class="know-text-group_item fl">未打卡:<strong class="know-text-group_strong" ng-click="goTo('app.working.history',{tab:'on',state:4})">{{managerIndexInfo.unOnlineCount}}</strong></div>
289 289
                     </div>
290 290
                 </div>
291 291
                 <div class="know-text-group clearfix">