seimin 2 年之前
父節點
當前提交
dcc92ea514

+ 21 - 17
assets/js/controllers/system/phoneListCtrl.js

@@ -103,12 +103,14 @@ app.controller('phoneListCtrl', ["$rootScope", "$scope", "$http", "$state", "$ti
103 103
                 $scope.cancel = function () {
104 104
                     $modalInstance.dismiss('cancel');
105 105
                 };
106
-                $scope.areaName = data.unit;
107
-                $scope.unitAlias = data.unitAlias;
108
-                $scope.ok = function (areaName, unitAlias) {
106
+                $scope.check = {
107
+                    areaName: data.unit,
108
+                    unitAlias: data.unitAlias ? data.unitAlias.split(',') : []
109
+                }
110
+                $scope.ok = function (check) {
109 111
                     // if (areaName != data.unit) {
110
-                        if ($scope.areaName) {
111
-                            $modalInstance.close({areaName, unitAlias});
112
+                        if ($scope.check.areaName) {
113
+                            $modalInstance.close(check);
112 114
                         } else {
113 115
                             SweetAlert.swal({
114 116
                                 title: "修改失败!",
@@ -134,7 +136,7 @@ app.controller('phoneListCtrl', ["$rootScope", "$scope", "$http", "$state", "$ti
134 136
                         "id": data.id,
135 137
                         "deleteFlag": 0,
136 138
                         "unit": selectedItem.areaName,
137
-                        "unitAlias": selectedItem.unitAlias
139
+                        "unitAlias": String(selectedItem.unitAlias)
138 140
                     }
139 141
                 }
140 142
                 api_user_data.addData('phoneUnit', fildata).then(function (response) {
@@ -164,14 +166,16 @@ app.controller('phoneListCtrl', ["$rootScope", "$scope", "$http", "$state", "$ti
164 166
             templateUrl: 'assets/views/system/tpl/company.html',
165 167
             controller: function ($scope, scope, $modalInstance, api_user_data) {
166 168
                 $scope.title = "新增单位";
167
-                $scope.areaName = "";
168
-                $scope.unitAlias = "";
169
+                $scope.check = {
170
+                    areaName: "",
171
+                    unitAlias: []
172
+                }
169 173
                 $scope.cancel = function () {
170 174
                     $modalInstance.dismiss('cancel');
171 175
                 };
172
-                $scope.ok = function (areaName, unitAlias) {
173
-                    if ($scope.areaName) {
174
-                        $modalInstance.close({areaName, unitAlias});
176
+                $scope.ok = function (check) {
177
+                    if ($scope.check.areaName) {
178
+                        $modalInstance.close(check);
175 179
                     } else {
176 180
                         SweetAlert.swal({
177 181
                             title: "新增失败!",
@@ -192,7 +196,7 @@ app.controller('phoneListCtrl', ["$rootScope", "$scope", "$http", "$state", "$ti
192 196
                 var fildata = {
193 197
                     "phoneUnit": {
194 198
                         "unit": selectedItem.areaName,
195
-                        "unitAlias": selectedItem.unitAlias
199
+                        "unitAlias": String(selectedItem.unitAlias)
196 200
                     }
197 201
                 }
198 202
                 api_user_data.addData('phoneUnit', fildata).then(function (response) {
@@ -274,7 +278,7 @@ app.controller('phoneListCtrl', ["$rootScope", "$scope", "$http", "$state", "$ti
274 278
                 $scope.check = {
275 279
                     unit: data.unit,
276 280
                     dept: data.dept,
277
-                    deptAlias: data.deptAlias,
281
+                    deptAlias: data.deptAlias ? data.deptAlias.split(',') : [],
278 282
                     phone: data.phone,
279 283
                     address: data.address
280 284
                 }
@@ -309,7 +313,7 @@ app.controller('phoneListCtrl', ["$rootScope", "$scope", "$http", "$state", "$ti
309 313
                 var fildata = {
310 314
                     "phoneDirectory": {
311 315
                         "dept": check.dept,
312
-                        "deptAlias": check.deptAlias,
316
+                        "deptAlias": String(check.deptAlias),
313 317
                         "address": check.address,
314 318
                         "phone": check.phone,
315 319
                         "unit": {
@@ -347,9 +351,9 @@ app.controller('phoneListCtrl', ["$rootScope", "$scope", "$http", "$state", "$ti
347 351
             controller: function ($scope, scope, $modalInstance, api_user_data) {
348 352
                 $scope.title = "新增部门";
349 353
                 if (area !== undefined) {
350
-                    $scope.check = { unit: area }
354
+                    $scope.check = { unit: area, deptAlias: [] }
351 355
                 } else {
352
-                    $scope.check = {}
356
+                    $scope.check = { deptAlias: [] }
353 357
                 }
354 358
                 $scope.outarea = scope.outarea;
355 359
                 $scope.cancel = function () {
@@ -379,7 +383,7 @@ app.controller('phoneListCtrl', ["$rootScope", "$scope", "$http", "$state", "$ti
379 383
                 var fildata = {
380 384
                     "phoneDirectory": {
381 385
                         "dept": check.dept,
382
-                        "deptAlias": check.deptAlias,
386
+                        "deptAlias": String(check.deptAlias),
383 387
                         "phone": check.phone,
384 388
                         "address": check.address
385 389
                     }

+ 10 - 4
assets/views/system/tpl/company.html

@@ -13,14 +13,20 @@
13 13
         <div class="row form-group">
14 14
             <label class="col-md-3 col-md-offset-1 control-label">单位:</label>
15 15
             <div class="col-md-7">
16
-                <input class="form-control" ng-model="areaName" placeholder="请输入单位名称" />
16
+                <input class="form-control" ng-model="check.areaName" placeholder="请输入单位名称" />
17 17
             </div>
18 18
         </div>
19 19
         <div class="row form-group">
20 20
             <label class="col-md-3 col-md-offset-1 control-label">单位别名:</label>
21 21
             <div class="col-md-7">
22
-                <textarea rows="5" class="form-control" style="word-break:break-all;resize:none;" ng-model="unitAlias" placeholder="请输入单位别名" />
23
-                <div class="red">多个单位别名请使用【英文逗号】拼接!</div>
22
+                <ui-select multiple tagging tagging-label="false" ng-model="check.unitAlias" theme="bootstrap" style="text-align:left;min-height: 100px;">
23
+                    <ui-select-match placeholder="请输入单位别名">{{$item}}</ui-select-match>
24
+                    <ui-select-choices repeat="color in check.unitAlias | filter:$select.search">
25
+                        {{color}}
26
+                    </ui-select-choices>
27
+                </ui-select>
28
+                <!-- <textarea rows="5" class="form-control" style="word-break:break-all;resize:none;" ng-model="check.unitAlias" placeholder="请输入单位别名" /> -->
29
+                <div class="red">填写单位别名后按Tab键自动填入!</div>
24 30
             </div>
25 31
         </div>
26 32
         <!--<div class="row form-group">
@@ -30,7 +36,7 @@
30 36
             </div>
31 37
         </div>-->
32 38
         <div class="panel-footer text-center">
33
-            <a ng-click="ok(areaName, unitAlias)" data-dismiss="modal" class="btn btn-primary">保存</a>
39
+            <a ng-click="ok(check)" data-dismiss="modal" class="btn btn-primary">保存</a>
34 40
             <button class="btn btn-primary btn-o" ng-click="cancel()" translate="modal.button.CANCEL">取消</button>
35 41
         </div>
36 42
     </div>

+ 8 - 2
assets/views/system/tpl/department.html

@@ -37,8 +37,14 @@
37 37
         <div class="row form-group">
38 38
             <label class="col-md-3 col-md-offset-1 control-label">部门别名:</label>
39 39
             <div class="col-md-7">
40
-                <textarea rows="5" class="form-control" style="word-break:break-all;resize:none;" ng-model="check.deptAlias" placeholder="请输入部门别名" />
41
-                <div class="red">多个部门别名请使用【英文逗号】拼接!</div>
40
+                <ui-select multiple tagging tagging-label="false" ng-model="check.deptAlias" theme="bootstrap" style="text-align:left;min-height: 100px;">
41
+                    <ui-select-match placeholder="请输入部门别名">{{$item}}</ui-select-match>
42
+                    <ui-select-choices repeat="color in check.deptAlias | filter:$select.search">
43
+                        {{color}}
44
+                    </ui-select-choices>
45
+                </ui-select>
46
+                <!-- <textarea rows="5" class="form-control" style="word-break:break-all;resize:none;" ng-model="check.deptAlias" placeholder="请输入部门别名" /> -->
47
+                <div class="red">填写单位别名后按Tab键自动填入!</div>
42 48
             </div>
43 49
         </div>
44 50
         <div class="row form-group">