seimin пре 3 година
родитељ
комит
7624a497ef
1 измењених фајлова са 8 додато и 2 уклоњено
  1. 8 2
      assets/js/controllers/system/organizationdesign/placeCtrl.js

+ 8 - 2
assets/js/controllers/system/organizationdesign/placeCtrl.js

@@ -1,4 +1,4 @@
1
-app.controller('placeCtrl', ["$rootScope", "$scope", "$http", "$state", "$timeout", "$interval", "SweetAlert", "$modal", "FileUploader", "i18nService", "uiGridConstants", "uiGridGroupingConstants", "Restangular", "api_user_data","api_cmdb2", function ($rootScope, $scope, $http, $state, $timeout, $interval, SweetAlert, $modal, FileUploader, i18nService, uiGridConstants, uiGridGroupingConstants, Restangular, api_user_data,api_cmdb2) {
1
+app.controller('placeCtrl', ["$rootScope", "$scope", "$http", "$state", "$timeout", "$interval", "SweetAlert", "$modal", "FileUploader", "i18nService", "uiGridConstants", "uiGridGroupingConstants", "Restangular", "api_user_data", "api_cmdb2", function ($rootScope, $scope, $http, $state, $timeout, $interval, SweetAlert, $modal, FileUploader, i18nService, uiGridConstants, uiGridGroupingConstants, Restangular, api_user_data, api_cmdb2) {
2 2
     $scope.langs = i18nService.getAllLangs();
3 3
     $scope.lang = 'zh-cn';
4 4
     $scope.cancles = true;
@@ -34,12 +34,16 @@ app.controller('placeCtrl', ["$rootScope", "$scope", "$http", "$state", "$timeou
34 34
         api_user_data.fetchDataList('area', fildata).then(function (response) {
35 35
             if (response) {
36 36
                 if (response.status = 200) {
37
+                    if (!$scope.outarea.length&&response.list.length) {
38
+                        $scope.ckickrow(response.list[0]);
39
+                    }
37 40
                     $scope.outarea = response.list;
38 41
                 }
39 42
             }
40 43
         })
41 44
     }
42 45
     $scope.freshenarea();
46
+    
43 47
     $scope.freshenplace = function (id) {
44 48
         if (id) {
45 49
             var fildata = {
@@ -60,6 +64,7 @@ app.controller('placeCtrl', ["$rootScope", "$scope", "$http", "$state", "$timeou
60 64
             })
61 65
         }
62 66
     }
67
+    
63 68
     $scope.ckickrow = function (data) {
64 69
         $scope.choice = false;
65 70
         $scope.areaid = data.id;
@@ -616,7 +621,8 @@ app.controller('placeCtrl', ["$rootScope", "$scope", "$http", "$state", "$timeou
616 621
                     confirmButtonColor: "#007AFF",
617 622
                     type: "success"
618 623
                 }, function (flag) {
619
-                    $scope.reset();
624
+                    $scope.freshenarea();
625
+                    $scope.freshenplace();
620 626
                 });
621 627
             } else {
622 628
                 SweetAlert.swal({