Sfoglia il codice sorgente

快速建单报修人和报修科室联动

seimin 11 mesi fa
parent
commit
2483f4f757
2 ha cambiato i file con 22 aggiunte e 7 eliminazioni
  1. 17 2
      assets/js/controllers/mainCtrl.js
  2. 5 5
      assets/views/newOrderSeimin.html

+ 17 - 2
assets/js/controllers/mainCtrl.js

@@ -4941,26 +4941,36 @@ function ($rootScope, $scope, $state, $translate, $localStorage, $cookieStore, $
4941 4941
           };
4942 4942
           // $scope.jry_deptSearch();
4943 4943
           // 报修人模糊搜索
4944
-          $scope.jry_requesterSearch = function (key = "") {
4944
+          $scope.jry_requesterSearch = function (key = "",branchId) {
4945
+            console.log(branchId)
4946
+            if(!branchId){
4947
+              $scope.jry_requesterData = [];
4948
+              return;
4949
+            }
4945 4950
             var postData = {
4946 4951
               idx: 0,
4947 4952
               sum: 10,
4948 4953
               user: {
4954
+                branch: { id: branchId },
4949 4955
                 name: key,
4950 4956
                 selectType: "pinyin_all",
4951 4957
                 engineer: undefined,
4958
+                dept: $scope.incidentModel ? ($scope.incidentModel.department || undefined) : undefined,
4952 4959
               },
4953 4960
             };
4954 4961
             api_user_data.fetchDataList("user", postData).then(function (data) {
4955 4962
               $scope.jry_requesterData = data.list;
4956 4963
             });
4957 4964
           };
4958
-          $scope.jry_requesterSearch();
4965
+          // $scope.jry_requesterSearch();
4959 4966
           $scope.$watch("incidentModel.requester", function (newVal,oldVal) {
4960 4967
             if(newVal){
4961 4968
               if($scope.modelData && newVal == oldVal){
4962 4969
               }else{
4963 4970
                 $scope.incidentModel.contacts = newVal.name;
4971
+                if(!oldVal){
4972
+                  $scope.incidentModel.department = newVal.dept;
4973
+                }
4964 4974
                 SweetAlert.swal({
4965 4975
                   title: "提示",
4966 4976
                   text: "是否覆盖联系电话?",
@@ -5089,6 +5099,7 @@ function ($rootScope, $scope, $state, $translate, $localStorage, $cookieStore, $
5089 5099
             $scope.showUserOrGroup();
5090 5100
             newVal && $scope.jry_areaSearch('',newVal.id);
5091 5101
             newVal && $scope.jry_deptSearch('',newVal.id);
5102
+            newVal && $scope.jry_requesterSearch('',newVal.id);
5092 5103
           });
5093 5104
           $scope.$watch("incidentModel.area", function (newVal,oldVal) {
5094 5105
             newVal && $scope.jry_placeSearch('',newVal.id);
@@ -5298,6 +5309,10 @@ function ($rootScope, $scope, $state, $translate, $localStorage, $cookieStore, $
5298 5309
             if($scope.modelData && newVal == oldVal){
5299 5310
 
5300 5311
             }else{
5312
+              if(newVal && oldVal && newVal.id != oldVal.id){
5313
+                $scope.incidentModel.requester = '';
5314
+              }
5315
+              $scope.jry_requesterSearch('', $scope.incidentModel.branch.id)
5301 5316
               if(newVal){
5302 5317
                 if($scope.incidentModel.department){
5303 5318
                   if($scope.incidentModel.department.place){

+ 5 - 5
assets/views/newOrderSeimin.html

@@ -91,22 +91,22 @@
91 91
           >
92 92
           <ui-select
93 93
             class="c_item_value"
94
-            style="min-width: 190px"
94
+            style="min-width: 616px"
95 95
             ng-model="incidentModel.requester"
96 96
             theme="bootstrap"
97 97
             reset-search-input="false"
98 98
           >
99 99
             <ui-select-match allow-clear placeholder="请选择报修人">
100 100
               <span
101
-                ng-bind="$select.selected.name + '('+$select.selected.account+')'"
101
+                ng-bind="$select.selected.name + '('+$select.selected.account+')' + '('+($select.selected.dept ? $select.selected.dept.dept : '')+')'"
102 102
               ></span>
103 103
             </ui-select-match>
104 104
             <ui-select-choices
105 105
               repeat="item in jry_requesterData"
106
-              refresh="jry_requesterSearch($select.search)"
106
+              refresh="jry_requesterSearch($select.search,incidentModel.branch.id)"
107 107
             >
108 108
               <div
109
-                ng-bind-html="(item.name + '('+item.account+')') | highlight: $select.search"
109
+                ng-bind-html="(item.name + '('+item.account+')' + '('+(item.dept ? item.dept.dept : '')+')') | highlight: $select.search"
110 110
               ></div>
111 111
             </ui-select-choices>
112 112
           </ui-select>
@@ -936,7 +936,7 @@
936 936
     float: left;
937 937
   }
938 938
   .centerList .c_item.bxr .ui-select-allow-clear {
939
-    width: 140px;
939
+    min-width: 140px;
940 940
     overflow: hidden;
941 941
     text-overflow: ellipsis;
942 942
     white-space: nowrap;