seimin пре 2 година
родитељ
комит
dcc92ea514

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

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

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

@@ -13,14 +13,20 @@
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">
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
             </div>
17
             </div>
18
         </div>
18
         </div>
19
         <div class="row form-group">
19
         <div class="row form-group">
20
             <label class="col-md-3 col-md-offset-1 control-label">单位别名:</label>
20
             <label class="col-md-3 col-md-offset-1 control-label">单位别名:</label>
21
             <div class="col-md-7">
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
             </div>
30
             </div>
25
         </div>
31
         </div>
26
         <!--<div class="row form-group">
32
         <!--<div class="row form-group">
@@ -30,7 +36,7 @@
30
             </div>
36
             </div>
31
         </div>-->
37
         </div>-->
32
         <div class="panel-footer text-center">
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
             <button class="btn btn-primary btn-o" ng-click="cancel()" translate="modal.button.CANCEL">取消</button>
40
             <button class="btn btn-primary btn-o" ng-click="cancel()" translate="modal.button.CANCEL">取消</button>
35
         </div>
41
         </div>
36
     </div>
42
     </div>

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

@@ -37,8 +37,14 @@
37
         <div class="row form-group">
37
         <div class="row form-group">
38
             <label class="col-md-3 col-md-offset-1 control-label">部门别名:</label>
38
             <label class="col-md-3 col-md-offset-1 control-label">部门别名:</label>
39
             <div class="col-md-7">
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
             </div>
48
             </div>
43
         </div>
49
         </div>
44
         <div class="row form-group">
50
         <div class="row form-group">