seimin 2 years ago
parent
commit
9ee5ffca94

+ 102 - 12
assets/js/controllers/customform/customformCtrl.js

@@ -13846,6 +13846,8 @@ appFormly.config(function config(formlyConfigProvider) {
13846
                   $scope.searchField = JSON.parse(x[0]).account;
13846
                   $scope.searchField = JSON.parse(x[0]).account;
13847
                   $scope.requester = JSON.parse(x[0]);
13847
                   $scope.requester = JSON.parse(x[0]);
13848
                   console.log($scope.requester);
13848
                   console.log($scope.requester);
13849
+                  $scope.refreshArea('');
13850
+                  $scope.refresh('');
13849
                 };
13851
                 };
13850
                 $scope.getMydataone = function (x) {
13852
                 $scope.getMydataone = function (x) {
13851
                   $scope.searchField = x;
13853
                   $scope.searchField = x;
@@ -13886,15 +13888,25 @@ appFormly.config(function config(formlyConfigProvider) {
13886
                     });
13888
                     });
13887
                 }
13889
                 }
13888
                 api_user_data
13890
                 api_user_data
13889
-                  .fetchDataList("area", {
13891
+                  .fetchDataList("branch", {
13890
                     idx: 0,
13892
                     idx: 0,
13891
                     sum: 1000,
13893
                     sum: 1000,
13892
                   })
13894
                   })
13893
                   .then(function (response) {
13895
                   .then(function (response) {
13894
                     if (response.status == 200) {
13896
                     if (response.status == 200) {
13895
-                      $scope.areas = response.list;
13897
+                      $scope.branchs = response.list;
13896
                     }
13898
                     }
13897
                   });
13899
                   });
13900
+                // api_user_data
13901
+                //   .fetchDataList("area", {
13902
+                //     idx: 0,
13903
+                //     sum: 1000,
13904
+                //   })
13905
+                //   .then(function (response) {
13906
+                //     if (response.status == 200) {
13907
+                //       $scope.areas = response.list;
13908
+                //     }
13909
+                //   });
13898
                 api_wechatfile
13910
                 api_wechatfile
13899
                   .getDictionary(
13911
                   .getDictionary(
13900
                     {
13912
                     {
@@ -13911,9 +13923,26 @@ appFormly.config(function config(formlyConfigProvider) {
13911
                       $scope.networktypes = response;
13923
                       $scope.networktypes = response;
13912
                     }
13924
                     }
13913
                   });
13925
                   });
13914
-                $scope.requesterAreaid = "";
13926
+                $scope.onChangeBranch = function (item) {
13927
+                  delete $scope.requester.place;
13928
+                  console.log($scope.requester, 'changeArea');
13929
+                  api_user_data
13930
+                    .fetchDataList("area", {
13931
+                      area: {
13932
+                        branch: item.id,
13933
+                      },
13934
+                      idx: 0,
13935
+                      sum: 1000,
13936
+                    })
13937
+                    .then(function (response) {
13938
+                      if (response.status == 200) {
13939
+                        $scope.areas = response.list;
13940
+                      }
13941
+                    });
13942
+                };
13915
                 $scope.onChange = function (item) {
13943
                 $scope.onChange = function (item) {
13916
-                  $scope.requesterAreaid = item.id;
13944
+                  $scope.requester.place = {area: $scope.requester.place.area};
13945
+                  console.log($scope.requester, 'changeArea');
13917
                   api_user_data
13946
                   api_user_data
13918
                     .fetchDataList("place", {
13947
                     .fetchDataList("place", {
13919
                       place: {
13948
                       place: {
@@ -13935,6 +13964,7 @@ appFormly.config(function config(formlyConfigProvider) {
13935
                 $scope.requesterPlaceid = "";
13964
                 $scope.requesterPlaceid = "";
13936
                 $scope.onChangePlace = function (item) {
13965
                 $scope.onChangePlace = function (item) {
13937
                   $scope.requesterPlaceid = item.id;
13966
                   $scope.requesterPlaceid = item.id;
13967
+                  console.log($scope.requester, 'changePlace');
13938
                   api_user_data
13968
                   api_user_data
13939
                     .fetchDataList("room", {
13969
                     .fetchDataList("room", {
13940
                       room: {
13970
                       room: {
@@ -13951,27 +13981,44 @@ appFormly.config(function config(formlyConfigProvider) {
13951
                       }
13981
                       }
13952
                     });
13982
                     });
13953
                 };
13983
                 };
13954
-                $scope.refresh = function (searchVal) {
13984
+                $scope.refreshArea = function (searchVal) {
13985
+                  console.log($scope.requester, 'area');
13955
                   var faildata = {};
13986
                   var faildata = {};
13956
-                  if ($scope.requesterAreaid) {
13987
+                  if ($scope.requester.branch) {
13957
                     faildata = {
13988
                     faildata = {
13958
                       idx: 0,
13989
                       idx: 0,
13959
                       sum: 1000,
13990
                       sum: 1000,
13960
-                      place: {
13961
-                        areaId: $scope.requesterAreaid,
13962
-                        place: searchVal,
13991
+                      area: {
13992
+                        branch: $scope.requester.branch.id,
13993
+                        area: searchVal,
13963
                         selectType: "pinyin_qs",
13994
                         selectType: "pinyin_qs",
13964
                       },
13995
                       },
13965
                     };
13996
                     };
13966
                   } else {
13997
                   } else {
13998
+                    return;
13999
+                  }
14000
+                  api_user_data
14001
+                    .fetchDataList("area", faildata)
14002
+                    .then(function (response) {
14003
+                      $scope.areas = response.list;
14004
+                      delete $scope.requester.areaDTO;
14005
+                    });
14006
+                };
14007
+                $scope.refresh = function (searchVal) {
14008
+                  console.log($scope.requester, 'place');
14009
+                  var faildata = {};
14010
+                  if ($scope.requester.place && $scope.requester.place.area) {
13967
                     faildata = {
14011
                     faildata = {
13968
                       idx: 0,
14012
                       idx: 0,
13969
                       sum: 1000,
14013
                       sum: 1000,
13970
                       place: {
14014
                       place: {
14015
+                        areaId: $scope.requester.place.area.id,
13971
                         place: searchVal,
14016
                         place: searchVal,
13972
                         selectType: "pinyin_qs",
14017
                         selectType: "pinyin_qs",
13973
                       },
14018
                       },
13974
                     };
14019
                     };
14020
+                  } else {
14021
+                    return;
13975
                   }
14022
                   }
13976
                   api_user_data
14023
                   api_user_data
13977
                     .fetchDataList("place", faildata)
14024
                     .fetchDataList("place", faildata)
@@ -13981,7 +14028,7 @@ appFormly.config(function config(formlyConfigProvider) {
13981
                     });
14028
                     });
13982
                 };
14029
                 };
13983
                 // 初始化房间号
14030
                 // 初始化房间号
13984
-                $scope.refreshPlace = function () {
14031
+                $scope.refreshRoom = function () {
13985
                   var faildata = {};
14032
                   var faildata = {};
13986
                   if ($scope.requesterPlaceid) {
14033
                   if ($scope.requesterPlaceid) {
13987
                     faildata = {
14034
                     faildata = {
@@ -14197,13 +14244,56 @@ appFormly.config(function config(formlyConfigProvider) {
14197
                       if ($scope.$parent.$parent.$parent.model.saveAgain) {
14244
                       if ($scope.$parent.$parent.$parent.model.saveAgain) {
14198
                         if (selectedItem.place && selectedItem.place.id) {
14245
                         if (selectedItem.place && selectedItem.place.id) {
14199
                           options.model.place.id = selectedItem.place.id;
14246
                           options.model.place.id = selectedItem.place.id;
14200
-                          options.model.place.area.id =
14201
-                            selectedItem.place.area.id;
14247
+                          options.model.place.area.id = selectedItem.place.area.id;
14248
+                          if(selectedItem.branch && selectedItem.branch.id){
14249
+                            options.model.branch.id = selectedItem.branch.id;
14250
+                            console.log($scope.$parent.$parent.$parent.$parent.$parent.formData.fields[1].fields);
14251
+                            let fields = $scope.$parent.$parent.$parent.$parent.$parent.formData.fields[1].fields;
14252
+                            for (let i = 0; i < fields.length; i++) {
14253
+                              if(fields[i].templateOptions.onlyKey == 'area_start'){
14254
+                                // 如果是区域
14255
+                                options.templateOptions.UserService.fetchDataList('area', { idx: 0, sum: 1000, area:{branch:options.model.branch.id} }).then(function(response) {
14256
+                                    if (response.status == 200) {
14257
+                                      fields[i].templateOptions.options = response.list;
14258
+                                    }
14259
+                                })
14260
+                              }else if(fields[i].templateOptions.onlyKey == 'place_start'){
14261
+                                // 如果是地点
14262
+                                options.templateOptions.UserService.fetchDataList('place', { idx: 0, sum: 1000, place:{area:{id:options.model.area.id}} }).then(function(response) {
14263
+                                  if (response.status == 200) {
14264
+                                    fields[i].templateOptions.options = response.list;
14265
+                                  }
14266
+                              })
14267
+                              }
14268
+                            }
14269
+                          }
14202
                         }
14270
                         }
14203
                       } else {
14271
                       } else {
14204
                         if (selectedItem.place && selectedItem.place.id) {
14272
                         if (selectedItem.place && selectedItem.place.id) {
14205
                           options.model.place.id = selectedItem.place.id;
14273
                           options.model.place.id = selectedItem.place.id;
14206
                           options.model.area.id = selectedItem.place.area.id;
14274
                           options.model.area.id = selectedItem.place.area.id;
14275
+                          if(selectedItem.branch && selectedItem.branch.id){
14276
+                            options.model.branch.id = selectedItem.branch.id;
14277
+                            console.log($scope.$parent.$parent.$parent.$parent.$parent.formData.fields[1].fields);
14278
+                            let fields = $scope.$parent.$parent.$parent.$parent.$parent.formData.fields[1].fields;
14279
+                            for (let i = 0; i < fields.length; i++) {
14280
+                              if(fields[i].templateOptions.onlyKey == 'area_start'){
14281
+                                // 如果是区域
14282
+                                options.templateOptions.UserService.fetchDataList('area', { idx: 0, sum: 1000, area:{branch:options.model.branch.id} }).then(function(response) {
14283
+                                    if (response.status == 200) {
14284
+                                      fields[i].templateOptions.options = response.list;
14285
+                                    }
14286
+                                })
14287
+                              }else if(fields[i].templateOptions.onlyKey == 'place_start'){
14288
+                                // 如果是地点
14289
+                                options.templateOptions.UserService.fetchDataList('place', { idx: 0, sum: 1000, place:{area:{id:options.model.area.id}} }).then(function(response) {
14290
+                                  if (response.status == 200) {
14291
+                                    fields[i].templateOptions.options = response.list;
14292
+                                  }
14293
+                              })
14294
+                              }
14295
+                            }
14296
+                          }
14207
                         }
14297
                         }
14208
                       }
14298
                       }
14209
                       // if (selectedItem.areaDTO && selectedItem.place.area.id) {
14299
                       // if (selectedItem.areaDTO && selectedItem.place.area.id) {

+ 15 - 2
assets/views/customform/tpl/modal-add-callrequester.html

@@ -63,13 +63,26 @@
63
                 </div>
63
                 </div>
64
             </div>
64
             </div>
65
             <div class="margin-bottom-15 anline">
65
             <div class="margin-bottom-15 anline">
66
+                <div class="pull-left openaddlable control-label fontcolor-two fontsizes-14">校区:</div>
67
+                <div class="pull-right openaddinput">
68
+                    <ui-select ng-model="requester.branch" theme="bootstrap" ng-change="onChangeBranch(requester.branch)">
69
+                        <ui-select-match placeholder="校区">
70
+                            {{$select.selected.hosName}}
71
+                        </ui-select-match>
72
+                        <ui-select-choices repeat="item in branchs | filter: $select.search">
73
+                            <div ng-bind-html="item.hosName | highlight: $select.search"></div>
74
+                        </ui-select-choices>
75
+                    </ui-select>
76
+                </div>
77
+            </div>
78
+            <div class="margin-bottom-15 anline">
66
                 <div class="pull-left openaddlable control-label fontcolor-two fontsizes-14">区域:</div>
79
                 <div class="pull-left openaddlable control-label fontcolor-two fontsizes-14">区域:</div>
67
                 <div class="pull-right openaddinput">
80
                 <div class="pull-right openaddinput">
68
                     <ui-select ng-model="requester.place.area" theme="bootstrap" ng-change="onChange(requester.place.area)">
81
                     <ui-select ng-model="requester.place.area" theme="bootstrap" ng-change="onChange(requester.place.area)">
69
                         <ui-select-match placeholder="区域">
82
                         <ui-select-match placeholder="区域">
70
                             {{$select.selected.area}}
83
                             {{$select.selected.area}}
71
                         </ui-select-match>
84
                         </ui-select-match>
72
-                        <ui-select-choices repeat="item in areas | filter: $select.search">
85
+                        <ui-select-choices repeat="item in areas | filter: $select.search" refresh="refreshArea($select.search)">
73
                             <div ng-bind-html="item.area | highlight: $select.search"></div>
86
                             <div ng-bind-html="item.area | highlight: $select.search"></div>
74
                         </ui-select-choices>
87
                         </ui-select-choices>
75
                     </ui-select>
88
                     </ui-select>
@@ -97,7 +110,7 @@
97
                         <ui-select-match placeholder="房间号">
110
                         <ui-select-match placeholder="房间号">
98
                             {{$select.selected.room}}
111
                             {{$select.selected.room}}
99
                         </ui-select-match>
112
                         </ui-select-match>
100
-                        <ui-select-choices repeat="item in rooms" refresh="refreshPlace()">
113
+                        <ui-select-choices repeat="item in rooms" refresh="refreshRoom()">
101
                             <div ng-bind-html="item.room | highlight: $select.search"></div>
114
                             <div ng-bind-html="item.room | highlight: $select.search"></div>
102
                         </ui-select-choices>
115
                         </ui-select-choices>
103
                     </ui-select>
116
                     </ui-select>

+ 1 - 1
assets/views/customform/tpl/ui-requesterinformation.html

@@ -96,7 +96,7 @@
96
             class="btn btn-addbutton  addbutton col-md-offset-5 col-md-12">添加报修人</button>
96
             class="btn btn-addbutton  addbutton col-md-offset-5 col-md-12">添加报修人</button>
97
         <button style=" margin: 8px 0 0;line-height: 10px;" ng-click="quickCopy(options.model)"
97
         <button style=" margin: 8px 0 0;line-height: 10px;" ng-click="quickCopy(options.model)"
98
             class="btn btn-addbutton  addbutton col-md-offset-5 col-md-12">一键复制</button>
98
             class="btn btn-addbutton  addbutton col-md-offset-5 col-md-12">一键复制</button>
99
-        <div style="margin-top: 8px;float: left;"><input type="checkbox" ng-click="selectGradeBox()" ng-checked="saveReqPlace" id="saveAreaPlace" ng-disabled="!(model.place.id&&model.area.id)"><label for="saveAreaPlace" style="user-select: none;font-size: 15px;margin-left:8px;font-weight: bold;cursor: pointer;color: #333;">报修人区域地点保存</label></div>
99
+        <div style="margin-top: 8px;float: left;"><input type="checkbox" ng-click="selectGradeBox()" ng-checked="saveReqPlace" id="saveAreaPlace" ng-disabled="!(model.branch.id&&model.place.id&&model.area.id)"><label for="saveAreaPlace" style="user-select: none;font-size: 15px;margin-left:8px;font-weight: bold;cursor: pointer;color: #333;">报修人校区区域地点保存</label></div>
100
         <!-- <button class="btn btn-default default col-md-4 col-md-offset-1" ng-click="options.templateOptions['changeRequeter']('lg',options,to.modal,model)">修改</button> -->
100
         <!-- <button class="btn btn-default default col-md-4 col-md-offset-1" ng-click="options.templateOptions['changeRequeter']('lg',options,to.modal,model)">修改</button> -->
101
         <!-- </div> -->
101
         <!-- </div> -->
102
     </div>
102
     </div>