소스 검색

服务台人员和一线运维登录选择

seimin 1 년 전
부모
커밋
6d6f3a937d
4개의 변경된 파일161개의 추가작업 그리고 11개의 파일을 삭제
  1. 9 6
      assets/js/controllers/customform/customformCtrl.js
  2. 64 5
      assets/js/controllers/loginCtrl.js
  3. 15 0
      assets/js/main.js
  4. 73 0
      assets/views/customform/tpl/loginPurpose.html

+ 9 - 6
assets/js/controllers/customform/customformCtrl.js

@@ -22099,6 +22099,7 @@ appFormly.controller("CustomformCtrl", [
22099 22099
             } else {
22100 22100
               console.log($scope.formData.url, "zzzz");
22101 22101
               var integralMechanism = sessionStorage.getItem('integralMechanism');
22102
+              let resetDuty = sessionStorage.getItem("resetDuty");
22102 22103
               let integralRoles = [];
22103 22104
               let currentUserRoles = [];
22104 22105
               let intersection = [];
@@ -22190,9 +22191,10 @@ appFormly.controller("CustomformCtrl", [
22190 22191
                   if(integralMechanism == 1){
22191 22192
                     integralRoles = sessionStorage.getItem("integralRole") ? sessionStorage.getItem("integralRole").split(',') : [];
22192 22193
                     currentUserRoles = $rootScope.user.role ? $rootScope.user.role.map(v=>String(v.id)) : [];
22193
-                    intersection = integralRoles.filter(function (val) { return currentUserRoles.indexOf(val) > -1 })
22194
+                    intersection = integralRoles.filter(function (val) { return currentUserRoles.indexOf(val) > -1 });
22194 22195
                   }
22195
-                  if(vm.model.start_code == "close"&&((integralMechanism == 1 && (intersection.length || integralRoles.length === 0)) || (integralMechanism == 2 && $rootScope.user.userType.value == 2))){
22196
+                  
22197
+                  if(resetDuty === "false" && vm.model.start_code == "close"&&((integralMechanism == 1 && (intersection.length || integralRoles.length === 0)) || (integralMechanism == 2 && $rootScope.user.userType.value == 2))){
22196 22198
                     $modal.open({
22197 22199
                       templateUrl: 'assets/views/incident/tpl/toIntegralMechanism.tpl.html',
22198 22200
                       controller: function ($scope, $modalInstance, api_bpm_domain, incidentData, currentUserId, Alert, api_user_data,api_wechatfile,scope,api_bpm_data) {
@@ -22303,9 +22305,9 @@ appFormly.controller("CustomformCtrl", [
22303 22305
                           }
22304 22306
                       }
22305 22307
                     });
22306
-                }else{
22307
-                  handlerStart();
22308
-                }
22308
+                  }else{
22309
+                    handlerStart();
22310
+                  }
22309 22311
                   // -------------------------------end------------------------------------
22310 22312
                   function handlerStart(){
22311 22313
                     api_bpm_domain
@@ -22346,12 +22348,13 @@ appFormly.controller("CustomformCtrl", [
22346 22348
                         let integralRoles = [];
22347 22349
                         let currentUserRoles = [];
22348 22350
                         let intersection = [];
22351
+                        let resetDuty = sessionStorage.getItem("resetDuty");
22349 22352
                         if(integralMechanism == 1){
22350 22353
                           integralRoles = sessionStorage.getItem("integralRole") ? sessionStorage.getItem("integralRole").split(',') : [];
22351 22354
                           currentUserRoles = $rootScope.user.role ? $rootScope.user.role.map(v=>String(v.id)) : [];
22352 22355
                           intersection = integralRoles.filter(function (val) { return currentUserRoles.indexOf(val) > -1 })
22353 22356
                         }
22354
-                        if(vm.model.start_code == "close"&&((integralMechanism == 1 && (intersection.length || integralRoles.length === 0)) || (integralMechanism == 2 && $rootScope.user.userType.value == 2))){
22357
+                        if(resetDuty === "false" && vm.model.start_code == "close"&&((integralMechanism == 1 && (intersection.length || integralRoles.length === 0)) || (integralMechanism == 2 && $rootScope.user.userType.value == 2))){
22355 22358
                           api_wechatfile.getDictionary({"key":"incident_integral_state","type":"list"}).then(function(res){
22356 22359
                             var auditState = res.find(v=>v.value == 0);
22357 22360
                             var postData = { 

+ 64 - 5
assets/js/controllers/loginCtrl.js

@@ -1,7 +1,9 @@
1
-app.controller('LoginCtrl', ['$rootScope', '$scope', '$state', '$translate', '$localStorage', '$cookieStore', '$auth', '$window', '$document', '$timeout', '$filter', '$http', 'cfpLoadingBar', 'Restangular', 'api_login', 'api_is_category', 'SweetAlert', 'api_msg',
2
-    function ($rootScope, $scope, $state, $translate, $localStorage, $cookieStore, $auth, $window, $document, $timeout, $filter, $http, cfpLoadingBar, Restangular, api_login, api_is_category, SweetAlert, api_msg) {
1
+app.controller('LoginCtrl', ['$rootScope', '$scope', '$state', '$translate', '$localStorage', '$cookieStore', '$auth', '$window', '$document', '$timeout', '$filter', '$http', 'cfpLoadingBar', 'Restangular', 'api_login', 'api_is_category', 'SweetAlert', 'api_msg', '$modal', 'api_auth',
2
+    function ($rootScope, $scope, $state, $translate, $localStorage, $cookieStore, $auth, $window, $document, $timeout, $filter, $http, cfpLoadingBar, Restangular, api_login, api_is_category, SweetAlert, api_msg, $modal, api_auth) {
3 3
         $rootScope.app.layout.isNavbarFixed = false;
4 4
         $rootScope.app.layout.isSidebarFixed = false;
5
+        sessionStorage.clear();
6
+        localStorage.clear();
5 7
         //判断项目归属 start
6 8
         //因项目众多,前端为了加以区分,所以用域名加以判断,后期有更好的方式可以自行修改
7 9
         // 中南财大
@@ -555,9 +557,66 @@ app.controller('LoginCtrl', ['$rootScope', '$scope', '$state', '$translate', '$l
555 557
                                         // if (!resp.error || resp.error != 500) {
556 558
                                         if (resp.data && resp.data.user && resp.data.user.id) {
557 559
                                             // console.log(resp.error);
558
-                                            $rootScope.getpending();
559
-                                            $state.go('app.dashboard');
560
-                                            $rootScope.app.isLoginFixed = false;
560
+                                            var firstLineFlag = resp.data.user.role.some(function(v){
561
+                                                return v.rolecode === 'first-line support';
562
+                                            });
563
+                                            var callCenterFlag = resp.data.user.role.some(function(v){
564
+                                                return v.rolecode === 'call center';
565
+                                            });
566
+                                            if(firstLineFlag && callCenterFlag){
567
+                                                // 同时拥有服务台和一线运维的角色
568
+                                                // 强制选择登录用途 start
569
+                                                var modalInstance = $modal.open({
570
+                                                    templateUrl: "assets/views/customform/tpl/loginPurpose.html",
571
+                                                    controller: function ($scope, $rootScope, scope, $modalInstance, api_auth) {
572
+                                                        $scope.title = "选择登录用途";
573
+                                                        $scope.loginPurpose = 0;
574
+                                                        $scope.ok = function (item) {
575
+                                                            if(item){
576
+                                                                $modalInstance.close(item);
577
+                                                            }else{
578
+                                                                SweetAlert.swal("操作失败", "请选择登录用途!", "error");
579
+                                                            }
580
+                                                        };
581
+                                                        $scope.cancel = function () {
582
+                                                            $modalInstance.dismiss("cancel");
583
+                                                        };
584
+                                                        },
585
+                                                        size: "sm",
586
+                                                        resolve: {
587
+                                                        scope: function () {
588
+                                                            return $scope;
589
+                                                        },
590
+                                                    },
591
+                                                });
592
+                                                modalInstance.result.then(function (selectedItem) {
593
+                                                    if (selectedItem) {
594
+                                                        $rootScope.isMask = true;
595
+                                                        var flag  = selectedItem == 1 ? true : (selectedItem == 2 ? false : undefined);
596
+                                                        api_auth.resetDuty({isDuty: flag})
597
+                                                        .then(function (response) {
598
+                                                            $rootScope.isMask = false;
599
+                                                            if (response.status == 200) {
600
+                                                                sessionStorage.setItem('resetDuty', flag);
601
+                                                                $rootScope.getpending();
602
+                                                                $state.go('app.dashboard');
603
+                                                                $rootScope.app.isLoginFixed = false;
604
+                                                            } else {
605
+                                                                SweetAlert.swal("操作失败", "操作失败!", "error");
606
+                                                            }
607
+                                                        }).catch(function(err){
608
+                                                            $rootScope.isMask = false;
609
+                                                        });
610
+                                                    }else{
611
+                                                        SweetAlert.swal("操作失败", "请选择登录用途!", "error");
612
+                                                    }
613
+                                                });
614
+                                                // 强制选择登录用途 end
615
+                                            }else{
616
+                                                $rootScope.getpending();
617
+                                                $state.go('app.dashboard');
618
+                                                $rootScope.app.isLoginFixed = false;
619
+                                            }
561 620
                                             // console.log(resp);
562 621
                                             // api_wechatfile.getDictionary({ "type": "list", "key": "hjzx_cornet" }).then(function(data) {
563 622
                                             //     $scope.runNumber = data;

+ 15 - 0
assets/js/main.js

@@ -468,6 +468,21 @@ app.factory('api_text', ['textRestangular', function (textRestangular) {
468 468
     }
469 469
 }])
470 470
 
471
+app.factory('AuthRestangular', function (Restangular) {
472
+    return Restangular.withConfig(function (RestangularConfigurer) {
473
+        RestangularConfigurer.setBaseUrl(serverIp);
474
+    });
475
+});
476
+
477
+app.factory('api_auth', ['AuthRestangular', function (UserRestangular) {
478
+    var auths = UserRestangular.all("auth");
479
+    return {
480
+        resetDuty: function (data) {
481
+            return auths.customPOST(data, 'resetDuty', {});
482
+        }
483
+    };
484
+}]);
485
+
471 486
 
472 487
 
473 488
 app.factory('UserRestangular', function (Restangular) {

+ 73 - 0
assets/views/customform/tpl/loginPurpose.html

@@ -0,0 +1,73 @@
1
+<style>
2
+    .bootstrap-touchspin .input-group-btn-vertical>.btn {
3
+        padding: 6px 10px;
4
+        /* padding-top: 5px !important; */
5
+    }
6
+    
7
+    .bootstrap-touchspin .input-group-btn-vertical i {
8
+        top: 0px;
9
+    }
10
+    
11
+    .bootstrap-touchspin .input-group-btn-vertical .bootstrap-touchspin-down {
12
+        margin-top: 0px;
13
+    }
14
+    
15
+    .input-group-addon:not(:first-child):not(:last-child),
16
+    .input-group-btn:not(:first-child):not(:last-child),
17
+    .input-group .form-control:not(:first-child):not(:last-child) {
18
+        border-radius: 2px;
19
+    }
20
+    
21
+    .btn.btnopen {
22
+        padding: 3px 8px;
23
+    }
24
+    .tab_bdItem_tab {
25
+        margin-bottom: 0;
26
+        overflow: hidden;
27
+    }
28
+
29
+    .tab_bdItem_tab li {
30
+        margin-left: 24px;
31
+        height: 34px;
32
+        line-height: 34px;
33
+    }
34
+
35
+    .tab_bdItem_tabItem.active {
36
+        color: #005395;
37
+    }
38
+
39
+    .tab_bdItem_tabItem {
40
+        font-size: 14px;
41
+        color: #ddd;
42
+        cursor: pointer;
43
+    }
44
+</style>
45
+<div class="modal-header">
46
+    <div class="modal-title fontcolor-two fontsizes-14">{{title}}<button type="button" class="close pull-right" ng-click="cancel()">×</button></div>
47
+</div>
48
+<div class="modal-body margin-top-15 margin-left-15 margin-bottom-15 margin-right-15 addrequster">
49
+    <form role="form" class="row  margin-bottom-5">
50
+        <div class="col-xs-12  margin-top-10 margin-bottom-10">因为您同时拥有服务台和一线运维的角色,请选择当前登录用途</div>
51
+        <div class="col-xs-12  margin-top-10 margin-bottom-10">
52
+            <div class="control-label fontcolor-two fontsizes-14 col-xs-12"></div>
53
+            <div class="col-xs-12">
54
+                <div class="input-group">
55
+                    <ul class="tab_bdItem_tab">
56
+                        <li class="fl" style="cursor: pointer;" ng-click="loginPurpose = 1">
57
+                            <i class="tab_bdItem_tabItem iconfont icon-icon_weizuo" ng-class="loginPurpose === 1?'active':''"></i>
58
+                            <span>服务台值班</span>
59
+                        </li>
60
+                        <li class="fl" style="cursor: pointer;" ng-click="loginPurpose = 2">
61
+                            <i class="tab_bdItem_tabItem iconfont icon-icon_weizuo" ng-class="loginPurpose === 2?'active':''"></i>
62
+                            <span>一线维修</span>
63
+                        </li>
64
+                    </ul>
65
+                </div>
66
+            </div>
67
+        </div>
68
+    </form>
69
+</div>
70
+<div class="modal-footer ">
71
+    <button class="btn btn-primary " ng-click="ok(loginPurpose) " data-dismiss="modal">确定</button>
72
+    <button class="btn btn-primary btn-o " ng-click="cancel() ">取消</button>
73
+</div>