浏览代码

区域地点

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