浏览代码

在区域地点管理中增加所属院区字段

seimin 3 年之前
父节点
当前提交
9f364ef842

+ 29 - 10
assets/js/controllers/system/organizationdesign/placeCtrl.js

@@ -23,6 +23,7 @@ app.controller('placeCtrl', ["$rootScope", "$scope", "$http", "$state", "$timeou
23
     };
23
     };
24
     $scope.choice = false;
24
     $scope.choice = false;
25
     $scope.backcolor = [];
25
     $scope.backcolor = [];
26
+    $scope.outhospital = [];
26
     $scope.outarea = [];
27
     $scope.outarea = [];
27
     $scope.outplace = [];
28
     $scope.outplace = [];
28
     $scope.pla = {};
29
     $scope.pla = {};
@@ -30,6 +31,16 @@ app.controller('placeCtrl', ["$rootScope", "$scope", "$http", "$state", "$timeou
30
     $scope.areaname = "";
31
     $scope.areaname = "";
31
     $scope.area = {};
32
     $scope.area = {};
32
     $scope.areaplace = true;
33
     $scope.areaplace = true;
34
+    $scope.freshenHospital = function () {
35
+        api_user_data.fetchDataList('branch', fildata).then(function (response) {
36
+            if (response) {
37
+                if (response.status = 200) {
38
+                    $scope.outhospital = response.list;
39
+                }
40
+            }
41
+        })
42
+    }
43
+    $scope.freshenHospital();
33
     $scope.freshenarea = function () {
44
     $scope.freshenarea = function () {
34
         api_user_data.fetchDataList('area', fildata).then(function (response) {
45
         api_user_data.fetchDataList('area', fildata).then(function (response) {
35
             if (response) {
46
             if (response) {
@@ -103,11 +114,13 @@ app.controller('placeCtrl', ["$rootScope", "$scope", "$http", "$state", "$timeou
103
                 $scope.cancel = function () {
114
                 $scope.cancel = function () {
104
                     $modalInstance.dismiss('cancel');
115
                     $modalInstance.dismiss('cancel');
105
                 };
116
                 };
117
+                $scope.outhospital = scope.outhospital;
106
                 $scope.areaName = data.area;
118
                 $scope.areaName = data.area;
119
+                $scope.search = {hospital:{id:data.branch,hosName:data.branchName}};
107
                 $scope.ok = function (areaName) {
120
                 $scope.ok = function (areaName) {
108
-                    if (areaName != data.area) {
109
-                        if ($scope.areaName) {
110
-                            $modalInstance.close(areaName);
121
+                    // if (areaName != data.area) {
122
+                        if ($scope.areaName && $scope.search.hospital.id) {
123
+                            $modalInstance.close({areaName:areaName,hospital:$scope.search.hospital});
111
                         } else {
124
                         } else {
112
                             SweetAlert.swal({
125
                             SweetAlert.swal({
113
                                 title: "修改失败!",
126
                                 title: "修改失败!",
@@ -115,9 +128,9 @@ app.controller('placeCtrl', ["$rootScope", "$scope", "$http", "$state", "$timeou
115
                                 type: "error"
128
                                 type: "error"
116
                             })
129
                             })
117
                         }
130
                         }
118
-                    } else {
119
-                        $modalInstance.dismiss('cancel');
120
-                    }
131
+                    // } else {
132
+                    //     $modalInstance.dismiss('cancel');
133
+                    // }
121
                 }
134
                 }
122
             },
135
             },
123
             resolve: {
136
             resolve: {
@@ -132,7 +145,9 @@ app.controller('placeCtrl', ["$rootScope", "$scope", "$http", "$state", "$timeou
132
                     "area": {
145
                     "area": {
133
                         "id": data.id,
146
                         "id": data.id,
134
                         "deleteFlag": 0,
147
                         "deleteFlag": 0,
135
-                        "area": selectedItem
148
+                        "area": selectedItem.areaName,
149
+                        branch: selectedItem.hospital.id,
150
+                        branchName: selectedItem.hospital.hosName
136
                     }
151
                     }
137
                 }
152
                 }
138
                 api_user_data.updData('area', fildata).then(function (response) {
153
                 api_user_data.updData('area', fildata).then(function (response) {
@@ -163,12 +178,14 @@ app.controller('placeCtrl', ["$rootScope", "$scope", "$http", "$state", "$timeou
163
             controller: function ($scope, scope, $modalInstance, api_user_data) {
178
             controller: function ($scope, scope, $modalInstance, api_user_data) {
164
                 $scope.title = "新增区域";
179
                 $scope.title = "新增区域";
165
                 $scope.areaName = "";
180
                 $scope.areaName = "";
181
+                $scope.search = {hospital:{}};
182
+                $scope.outhospital = scope.outhospital;
166
                 $scope.cancel = function () {
183
                 $scope.cancel = function () {
167
                     $modalInstance.dismiss('cancel');
184
                     $modalInstance.dismiss('cancel');
168
                 };
185
                 };
169
                 $scope.ok = function (areaName) {
186
                 $scope.ok = function (areaName) {
170
-                    if ($scope.areaName) {
171
-                        $modalInstance.close(areaName);
187
+                    if ($scope.areaName&&$scope.search.hospital.id) {
188
+                        $modalInstance.close({areaName:areaName,hospital:$scope.search.hospital});
172
                     } else {
189
                     } else {
173
                         SweetAlert.swal({
190
                         SweetAlert.swal({
174
                             title: "新增失败!",
191
                             title: "新增失败!",
@@ -188,7 +205,9 @@ app.controller('placeCtrl', ["$rootScope", "$scope", "$http", "$state", "$timeou
188
             if (selectedItem) {
205
             if (selectedItem) {
189
                 var fildata = {
206
                 var fildata = {
190
                     "area": {
207
                     "area": {
191
-                        "area": selectedItem
208
+                        "area": selectedItem.areaName,
209
+                        branch: selectedItem.hospital.id,
210
+                        branchName: selectedItem.hospital.hosName
192
                     }
211
                     }
193
                 }
212
                 }
194
                 api_user_data.addData('area', fildata).then(function (response) {
213
                 api_user_data.addData('area', fildata).then(function (response) {

+ 1 - 1
assets/views/system/organization/place.html

@@ -307,7 +307,7 @@
307
                 <div class="mainDiv-body-2" style="cursor: pointer;" ng-repeat="area in outarea"
307
                 <div class="mainDiv-body-2" style="cursor: pointer;" ng-repeat="area in outarea"
308
                     ng-click="ckickrow(area)">
308
                     ng-click="ckickrow(area)">
309
                     <div class="" ng-hide="editShow">
309
                     <div class="" ng-hide="editShow">
310
-                        <span>{{ (area.area || '添加区域') | uppercase }}</span>
310
+                        <span>{{area.branchName}} - {{ area.area }}</span>
311
                         <div class="mainDiv-head-right">
311
                         <div class="mainDiv-head-right">
312
                             <span class="mainDivLeft-span-1 span-1 pointfont bluefont" ng-click="editArea(area)"
312
                             <span class="mainDivLeft-span-1 span-1 pointfont bluefont" ng-click="editArea(area)"
313
                                 ng-show="bianji">
313
                                 ng-show="bianji">

+ 15 - 1
assets/views/system/tpl/area.html

@@ -11,7 +11,21 @@
11
 <div class="modal-body">
11
 <div class="modal-body">
12
     <div class="well-lg"><br/>
12
     <div class="well-lg"><br/>
13
         <div class="row form-group">
13
         <div class="row form-group">
14
-            <label class="col-md-3 col-md-offset-1 control-label">区域:</label>
14
+            <label class="col-md-3 col-md-offset-1 control-label">所属院区*:</label>
15
+            <div class="col-md-7">
16
+                <ui-select style="width: 100%;" ng-model="search.hospital"
17
+                    theme="bootstrap">
18
+                    <ui-select-match placeholder="">
19
+                        {{$select.selected.hosName}}
20
+                    </ui-select-match>
21
+                    <ui-select-choices repeat="item in outhospital | filter: $select.search">
22
+                        <div ng-bind-html="item.hosName | highlight: $select.search"></div>
23
+                    </ui-select-choices>
24
+                </ui-select>
25
+            </div>
26
+        </div>
27
+        <div class="row form-group">
28
+            <label class="col-md-3 col-md-offset-1 control-label">区域*:</label>
15
             <div class="col-md-7">
29
             <div class="col-md-7">
16
                 <input class="form-control" ng-model="areaName" placeholder="请输入区域名称" />
30
                 <input class="form-control" ng-model="areaName" placeholder="请输入区域名称" />
17
             </div>
31
             </div>