Browse Source

派人派组BUG

seimin 11 months ago
parent
commit
afea967535
1 changed files with 42 additions and 7 deletions
  1. 42 7
      assets/js/controllers/mainCtrl.js

+ 42 - 7
assets/js/controllers/mainCtrl.js

@@ -4197,9 +4197,43 @@ function ($rootScope, $scope, $state, $translate, $localStorage, $cookieStore, $
4197
           };
4197
           };
4198
 
4198
 
4199
           // 处理人/处理组加责任科室搜索
4199
           // 处理人/处理组加责任科室搜索
4200
-          $scope.userAndGroupSearch = function(){
4201
-            $scope.jry_userSearch();
4202
-            $scope.jry_groupSearch();
4200
+          $scope.userAndGroupSearch = async function(){
4201
+            // $scope.jry_userSearch();
4202
+            // $scope.jry_groupSearch();
4203
+            var userData = {
4204
+              idx: 0,
4205
+              sum: 1000,
4206
+              user: {
4207
+                duty: $scope.selectedDuty || undefined,
4208
+                roledata: {rolecode: "first-line support"},
4209
+                selectDetails:'1',
4210
+                simple:true,
4211
+                name: key,
4212
+                selectType: "pinyin_qs",
4213
+                engineer: 1,
4214
+              },
4215
+            };
4216
+
4217
+            var groupData = {
4218
+              idx: 0,
4219
+              sum: 1000,
4220
+              group: {
4221
+                duty: $scope.selectedDuty || undefined,
4222
+                selectType: "nouser"
4223
+              },
4224
+            };
4225
+
4226
+            let userResult = await api_user_data.fetchDataList("user", userData);
4227
+            let groupResult = await api_user_data.fetchDataList("group", groupData);
4228
+
4229
+            $scope.jry_userData = userResult.list;
4230
+            if($scope.incidentModel.user){
4231
+              if(!$scope.incidentModel.user.name){
4232
+                $scope.incidentModel.user = userResult.list.find(v=>v.id == $scope.incidentModel.user.id);
4233
+              }
4234
+            }
4235
+
4236
+            $scope.jry_groupData = groupResult.list;
4203
             // if($scope.incidentModel.assign == 0){
4237
             // if($scope.incidentModel.assign == 0){
4204
             //   $scope.jry_userSearch();
4238
             //   $scope.jry_userSearch();
4205
             //   $scope.jry_groupSearch();
4239
             //   $scope.jry_groupSearch();
@@ -4226,6 +4260,7 @@ function ($rootScope, $scope, $state, $translate, $localStorage, $cookieStore, $
4226
                 if(result.status == 200){
4260
                 if(result.status == 200){
4227
                   var deptBinduserConfig = result.list?result.list[0]:null;//获取第一条配置
4261
                   var deptBinduserConfig = result.list?result.list[0]:null;//获取第一条配置
4228
                   if(deptBinduserConfig){
4262
                   if(deptBinduserConfig){
4263
+                    $scope.userAndGroupSearch();
4229
                     // 如果有科室绑定人员的配置
4264
                     // 如果有科室绑定人员的配置
4230
                     if(deptBinduserConfig.userOrGroupType == 1){
4265
                     if(deptBinduserConfig.userOrGroupType == 1){
4231
                       // 派单给人
4266
                       // 派单给人
@@ -4236,7 +4271,7 @@ function ($rootScope, $scope, $state, $translate, $localStorage, $cookieStore, $
4236
                       $scope.incidentModel.assign = 2;
4271
                       $scope.incidentModel.assign = 2;
4237
                       $scope.incidentModel.group = $scope.jry_groupData.find(v=>v.id == deptBinduserConfig.group);
4272
                       $scope.incidentModel.group = $scope.jry_groupData.find(v=>v.id == deptBinduserConfig.group);
4238
                     }
4273
                     }
4239
-                    $scope.userAndGroupSearch();
4274
+
4240
                   }else{
4275
                   }else{
4241
                     // 没有查询到科室绑定人员的配置,则根据院区,普通科室,责任科室查询
4276
                     // 没有查询到科室绑定人员的配置,则根据院区,普通科室,责任科室查询
4242
                     var postData = {
4277
                     var postData = {
@@ -4257,6 +4292,7 @@ function ($rootScope, $scope, $state, $translate, $localStorage, $cookieStore, $
4257
                         // 获取第一条配置
4292
                         // 获取第一条配置
4258
                         deptBinduserConfig = deptBinduserConfig[0] || null;
4293
                         deptBinduserConfig = deptBinduserConfig[0] || null;
4259
                         if(deptBinduserConfig){
4294
                         if(deptBinduserConfig){
4295
+                          $scope.userAndGroupSearch();
4260
                           // 如果有科室绑定人员的配置
4296
                           // 如果有科室绑定人员的配置
4261
                           if(deptBinduserConfig.userOrGroupType == 1){
4297
                           if(deptBinduserConfig.userOrGroupType == 1){
4262
                             // 派单给人
4298
                             // 派单给人
@@ -4267,7 +4303,6 @@ function ($rootScope, $scope, $state, $translate, $localStorage, $cookieStore, $
4267
                             $scope.incidentModel.assign = 2;
4303
                             $scope.incidentModel.assign = 2;
4268
                             $scope.incidentModel.group = $scope.jry_groupData.find(v=>v.id == deptBinduserConfig.group);
4304
                             $scope.incidentModel.group = $scope.jry_groupData.find(v=>v.id == deptBinduserConfig.group);
4269
                           }
4305
                           }
4270
-                          $scope.userAndGroupSearch();
4271
                         }else{
4306
                         }else{
4272
                           if($scope.categorySelect){
4307
                           if($scope.categorySelect){
4273
                             // 选择了故障现象
4308
                             // 选择了故障现象
@@ -4952,6 +4987,7 @@ function ($rootScope, $scope, $state, $translate, $localStorage, $cookieStore, $
4952
           function assignCommon(sj){
4987
           function assignCommon(sj){
4953
             console.log(sj);
4988
             console.log(sj);
4954
             if(!sj){return;}
4989
             if(!sj){return;}
4990
+            $scope.userAndGroupSearch();
4955
             if (sj.branchType == 0) {
4991
             if (sj.branchType == 0) {
4956
               if (sj.userOrGroupType === 1) {
4992
               if (sj.userOrGroupType === 1) {
4957
                 //派人
4993
                 //派人
@@ -4998,7 +5034,6 @@ function ($rootScope, $scope, $state, $translate, $localStorage, $cookieStore, $
4998
               }
5034
               }
4999
             }
5035
             }
5000
 
5036
 
5001
-            $scope.userAndGroupSearch();
5002
           }
5037
           }
5003
 
5038
 
5004
           // 取消故障描述弹窗
5039
           // 取消故障描述弹窗
@@ -5135,7 +5170,7 @@ function ($rootScope, $scope, $state, $translate, $localStorage, $cookieStore, $
5135
             newVal && $scope.jry_incident(newVal.id);
5170
             newVal && $scope.jry_incident(newVal.id);
5136
             console.log(newVal);
5171
             console.log(newVal);
5137
 
5172
 
5138
-            if($scope.modelData && newVal.id == oldVal.id){
5173
+            if($scope.modelData && (newVal.id === oldVal.id || newVal == oldVal)){
5139
 
5174
 
5140
             }else{
5175
             }else{
5141
               if(newVal){
5176
               if(newVal){