浏览代码

21.报修转事件的时候,暂存和直接处理,修改后的信息不对

seimin 11 月之前
父节点
当前提交
09c8452de4
共有 1 个文件被更改,包括 71 次插入45 次删除
  1. 71 45
      assets/js/controllers/mainCtrl.js

+ 71 - 45
assets/js/controllers/mainCtrl.js

@@ -3766,7 +3766,7 @@ function ($rootScope, $scope, $state, $translate, $localStorage, $cookieStore, $
3766
           //   var curentHospital = $rootScope.user.duty?{id:$rootScope.user.duty.branch,hosName:$rootScope.user.duty.branchName}:$rootScope.user.branch;
3766
           //   var curentHospital = $rootScope.user.duty?{id:$rootScope.user.duty.branch,hosName:$rootScope.user.duty.branchName}:$rootScope.user.branch;
3767
           // }
3767
           // }
3768
           if(modelData){
3768
           if(modelData){
3769
-            var curentHospital = {};
3769
+            var curentHospital = {id: modelData.branch, hosName: modelData.branchName};
3770
           }else{
3770
           }else{
3771
             var curentHospital = $rootScope.user.duty?{id:$rootScope.user.duty.branch,hosName:$rootScope.user.duty.branchName}:$rootScope.user.branch;
3771
             var curentHospital = $rootScope.user.duty?{id:$rootScope.user.duty.branch,hosName:$rootScope.user.duty.branchName}:$rootScope.user.branch;
3772
           }
3772
           }
@@ -3805,8 +3805,8 @@ function ($rootScope, $scope, $state, $translate, $localStorage, $cookieStore, $
3805
               contacts: modelData.incident.contacts, //联系人
3805
               contacts: modelData.incident.contacts, //联系人
3806
               contactsInformation: modelData.incident.contactsInformation, //联系电话
3806
               contactsInformation: modelData.incident.contactsInformation, //联系电话
3807
               branch: curentHospital, //院区
3807
               branch: curentHospital, //院区
3808
-              area: type === 'incomingCall' ? (modelData.incident.department ? modelData.incident.department.area : "") : modelData.incident.area, //区域
3809
-              place: type === 'incomingCall' ? (modelData.incident.department ? modelData.incident.department.place : "") : modelData.incident.place, //地点
3808
+              area: type === 'incomingCall' ? (modelData.incident.department ? (modelData.incident.department.place ? modelData.incident.department.place.area : "") : "") : (modelData.incident.place ? modelData.incident.place.area : ""), //区域
3809
+              place: type === 'incomingCall' ? (modelData.incident.department ? (modelData.incident.department.place || "") : "") : (modelData.incident.place || ""), //地点
3810
               address: type === 'incomingCall' ? (modelData.incident.department ? modelData.incident.department.address : "") : modelData.incident.houseNumber, //详细地址
3810
               address: type === 'incomingCall' ? (modelData.incident.department ? modelData.incident.department.address : "") : modelData.incident.houseNumber, //详细地址
3811
               priority: modelData.incident.priority, //优先级
3811
               priority: modelData.incident.priority, //优先级
3812
               description: modelData.incident.description, //故障描述
3812
               description: modelData.incident.description, //故障描述
@@ -4714,22 +4714,25 @@ function ($rootScope, $scope, $state, $translate, $localStorage, $cookieStore, $
4714
           $scope.jry_requesterSearch();
4714
           $scope.jry_requesterSearch();
4715
           $scope.$watch("incidentModel.requester", function (newVal,oldVal) {
4715
           $scope.$watch("incidentModel.requester", function (newVal,oldVal) {
4716
             if(newVal){
4716
             if(newVal){
4717
-              $scope.incidentModel.contacts = newVal.name;
4718
-              SweetAlert.swal({
4719
-                title: "提示",
4720
-                text: "是否覆盖联系电话?",
4721
-                type: "warning",
4722
-                showCancelButton: true,
4723
-                confirmButtonColor: "#DD6B55",
4724
-                confirmButtonText: "确认覆盖",
4725
-                cancelButtonText: "取消操作",
4726
-                closeOnConfirm: true,
4727
-                closeOnCancel: true
4728
-              }, function (isConfirm) {
4729
-                  if (isConfirm) {
4730
-                    $scope.incidentModel.contactsInformation = newVal.phone;
4731
-                  }
4732
-              });
4717
+              if($scope.modelData && newVal.id == oldVal.id){
4718
+              }else{
4719
+                $scope.incidentModel.contacts = newVal.name;
4720
+                SweetAlert.swal({
4721
+                  title: "提示",
4722
+                  text: "是否覆盖联系电话?",
4723
+                  type: "warning",
4724
+                  showCancelButton: true,
4725
+                  confirmButtonColor: "#DD6B55",
4726
+                  confirmButtonText: "确认覆盖",
4727
+                  cancelButtonText: "取消操作",
4728
+                  closeOnConfirm: true,
4729
+                  closeOnCancel: true
4730
+                }, function (isConfirm) {
4731
+                    if (isConfirm) {
4732
+                      $scope.incidentModel.contactsInformation = newVal.phone;
4733
+                    }
4734
+                });
4735
+              }
4733
             }
4736
             }
4734
           });
4737
           });
4735
           // 处理人模糊搜索
4738
           // 处理人模糊搜索
@@ -5044,21 +5047,22 @@ function ($rootScope, $scope, $state, $translate, $localStorage, $cookieStore, $
5044
             newVal && $scope.jry_incident(newVal.id);
5047
             newVal && $scope.jry_incident(newVal.id);
5045
             console.log(newVal);
5048
             console.log(newVal);
5046
 
5049
 
5047
-            if(newVal){
5048
-              api_bpm_data.fetchData('department', $scope.incidentModel.department.id).then(res=>{
5049
-                if(res.status == 200){
5050
-                  // $scope.incidentModel.department = res.data;
5051
-                  if(res.data && res.data.place){
5052
-                    $scope.incidentModel.place = res.data.place;
5053
-                    $scope.incidentModel.area = res.data.place.area;
5050
+            if($scope.modelData && newVal.id == oldVal.id){
5051
+
5052
+            }else{
5053
+              if(newVal){
5054
+                if($scope.incidentModel.department){
5055
+                  if($scope.incidentModel.department.place){
5056
+                    $scope.incidentModel.place = $scope.incidentModel.department.place;
5057
+                    $scope.incidentModel.area = $scope.incidentModel.department.place.area;
5054
                   }else{
5058
                   }else{
5055
                     $scope.incidentModel.place = '';
5059
                     $scope.incidentModel.place = '';
5056
                     $scope.incidentModel.area = '';
5060
                     $scope.incidentModel.area = '';
5057
                   }
5061
                   }
5058
-                  $scope.incidentModel.address = res.data.address || '';
5062
+                  $scope.incidentModel.address = $scope.incidentModel.department.address || '';
5059
 
5063
 
5060
                   // 如果回显的有联系电话,联系电话不用科室带出
5064
                   // 如果回显的有联系电话,联系电话不用科室带出
5061
-                  !(oldVal && !oldVal.dept) && ($scope.incidentModel.contactsInformation = (res.data&&res.data.phone)?res.data.phone.split(',')[0]:'');
5065
+                  !(oldVal && !oldVal.dept) && ($scope.incidentModel.contactsInformation = ($scope.incidentModel.department.phone)?$scope.incidentModel.department.phone.split(',')[0]:'');
5062
                 }else{
5066
                 }else{
5063
                   $scope.incidentModel.place = '';
5067
                   $scope.incidentModel.place = '';
5064
                   $scope.incidentModel.area = '';
5068
                   $scope.incidentModel.area = '';
@@ -5066,24 +5070,46 @@ function ($rootScope, $scope, $state, $translate, $localStorage, $cookieStore, $
5066
                   // 如果回显的有联系电话,联系电话不用科室带出
5070
                   // 如果回显的有联系电话,联系电话不用科室带出
5067
                   !(oldVal && !oldVal.dept) && ($scope.incidentModel.contactsInformation = (newVal&&newVal.phone)?newVal.phone:'');
5071
                   !(oldVal && !oldVal.dept) && ($scope.incidentModel.contactsInformation = (newVal&&newVal.phone)?newVal.phone:'');
5068
                 }
5072
                 }
5069
-              })
5070
-            }else{
5071
-              $scope.incidentModel.place = '';
5072
-              $scope.incidentModel.area = '';
5073
-              $scope.incidentModel.address = '';
5074
-              // 如果回显的有联系电话,联系电话不用科室带出
5075
-              !(oldVal && !oldVal.dept) && ($scope.incidentModel.contactsInformation = (newVal&&newVal.phone)?newVal.phone:'');
5073
+                // api_bpm_data.fetchData('department', $scope.incidentModel.department.id).then(res=>{
5074
+                //   if(res.status == 200){
5075
+                //     // $scope.incidentModel.department = res.data;
5076
+                //     if(res.data && res.data.place){
5077
+                //       $scope.incidentModel.place = res.data.place;
5078
+                //       $scope.incidentModel.area = res.data.place.area;
5079
+                //     }else{
5080
+                //       $scope.incidentModel.place = '';
5081
+                //       $scope.incidentModel.area = '';
5082
+                //     }
5083
+                //     $scope.incidentModel.address = res.data.address || '';
5084
+
5085
+                //     // 如果回显的有联系电话,联系电话不用科室带出
5086
+                //     !(oldVal && !oldVal.dept) && ($scope.incidentModel.contactsInformation = (res.data&&res.data.phone)?res.data.phone.split(',')[0]:'');
5087
+                //   }else{
5088
+                //     $scope.incidentModel.place = '';
5089
+                //     $scope.incidentModel.area = '';
5090
+                //     $scope.incidentModel.address = '';
5091
+                //     // 如果回显的有联系电话,联系电话不用科室带出
5092
+                //     !(oldVal && !oldVal.dept) && ($scope.incidentModel.contactsInformation = (newVal&&newVal.phone)?newVal.phone:'');
5093
+                //   }
5094
+                // })
5095
+              }else{
5096
+                $scope.incidentModel.place = '';
5097
+                $scope.incidentModel.area = '';
5098
+                $scope.incidentModel.address = '';
5099
+                // 如果回显的有联系电话,联系电话不用科室带出
5100
+                !(oldVal && !oldVal.dept) && ($scope.incidentModel.contactsInformation = (newVal&&newVal.phone)?newVal.phone:'');
5101
+              }
5102
+              // if(newVal && newVal.place){
5103
+              //   $scope.incidentModel.place = newVal.place;
5104
+              //   $scope.incidentModel.area = newVal.place.area;
5105
+              // }else{
5106
+              //   $scope.incidentModel.place = '';
5107
+              //   $scope.incidentModel.area = '';
5108
+              // }
5109
+
5110
+              // // 如果回显的有联系电话,联系电话不用科室带出
5111
+              // !(oldVal && !oldVal.dept) && ($scope.incidentModel.contactsInformation = (newVal&&newVal.phone)?newVal.phone:'');
5076
             }
5112
             }
5077
-            // if(newVal && newVal.place){
5078
-            //   $scope.incidentModel.place = newVal.place;
5079
-            //   $scope.incidentModel.area = newVal.place.area;
5080
-            // }else{
5081
-            //   $scope.incidentModel.place = '';
5082
-            //   $scope.incidentModel.area = '';
5083
-            // }
5084
-
5085
-            // // 如果回显的有联系电话,联系电话不用科室带出
5086
-            // !(oldVal && !oldVal.dept) && ($scope.incidentModel.contactsInformation = (newVal&&newVal.phone)?newVal.phone:'');
5087
           });
5113
           });
5088
           // 知识库
5114
           // 知识库
5089
           $scope.jry_solution = function (id,key='') {
5115
           $scope.jry_solution = function (id,key='') {