Commit 9b3eb9485778c924edd14e124d55f9329ce57b4f
1 parent
9b2f289a
update
Showing
12 changed files
with
194 additions
and
83 deletions
src/main/java/com/bsth/entity/Personnel.java
| @@ -39,7 +39,7 @@ public class Personnel { | @@ -39,7 +39,7 @@ public class Personnel { | ||
| 39 | /** 分公司编码 */ | 39 | /** 分公司编码 */ |
| 40 | private String brancheCompanyCode; | 40 | private String brancheCompanyCode; |
| 41 | /** 工号 */ | 41 | /** 工号 */ |
| 42 | - @Column(nullable = false, unique = true) | 42 | + @Column(nullable = false) |
| 43 | private String jobCode; | 43 | private String jobCode; |
| 44 | /** 姓名 */ | 44 | /** 姓名 */ |
| 45 | @Column(nullable = false) | 45 | @Column(nullable = false) |
| @@ -49,7 +49,7 @@ public class Personnel { | @@ -49,7 +49,7 @@ public class Personnel { | ||
| 49 | private String papersCode; | 49 | private String papersCode; |
| 50 | /** 一卡通工作卡号 */ | 50 | /** 一卡通工作卡号 */ |
| 51 | private String icCardCode; | 51 | private String icCardCode; |
| 52 | - /** 性别(TODO:暂时使用男/女,不使用字典) */ | 52 | + /** 性别(字典类型sexType) */ |
| 53 | private String personnelType; | 53 | private String personnelType; |
| 54 | /** 所属岗位/工种(TODO:暂时不使用字典) */ | 54 | /** 所属岗位/工种(TODO:暂时不使用字典) */ |
| 55 | private String posts; | 55 | private String posts; |
src/main/resources/static/pages/scheduleApp/module/basicInfo/busInfoManage/detail.html
| @@ -85,7 +85,7 @@ | @@ -85,7 +85,7 @@ | ||
| 85 | <label class="col-md-2 control-label">设备供应厂商*:</label> | 85 | <label class="col-md-2 control-label">设备供应厂商*:</label> |
| 86 | <div class="col-md-3"> | 86 | <div class="col-md-3"> |
| 87 | <input type="text" class="form-control" | 87 | <input type="text" class="form-control" |
| 88 | - name="supplierName" ng-model="ctrl.busInfoForDetail.supplierName" readonly/> | 88 | + name="supplierName" ng-value="ctrl.busInfoForDetail.supplierName | dict:'snames':'未知'" readonly/> |
| 89 | </div> | 89 | </div> |
| 90 | </div> | 90 | </div> |
| 91 | 91 | ||
| @@ -218,28 +218,28 @@ | @@ -218,28 +218,28 @@ | ||
| 218 | <div class="form-group"> | 218 | <div class="form-group"> |
| 219 | <label class="col-md-2 control-label">是否空调车:</label> | 219 | <label class="col-md-2 control-label">是否空调车:</label> |
| 220 | <div class="col-md-3"> | 220 | <div class="col-md-3"> |
| 221 | - <truefalse-Dic model="ctrl.busInfoForDetail.hvacCar" disabled="true" dicgroup="truefalseType" name="hvacCar"></truefalse-Dic> | 221 | + <sa-Radiogroup model="ctrl.busInfoForDetail.hvacCar" disabled="true" dicgroup="truefalseType" name="hvacCar"></sa-Radiogroup> |
| 222 | </div> | 222 | </div> |
| 223 | </div> | 223 | </div> |
| 224 | 224 | ||
| 225 | <div class="form-group"> | 225 | <div class="form-group"> |
| 226 | <label class="col-md-2 control-label">有无人售票:</label> | 226 | <label class="col-md-2 control-label">有无人售票:</label> |
| 227 | <div class="col-md-3"> | 227 | <div class="col-md-3"> |
| 228 | - <truefalse-Dic model="ctrl.busInfoForDetail.ticketType" disabled="true" dicgroup="truefalseType" name="ticketType"></truefalse-Dic> | 228 | + <sa-Radiogroup model="ctrl.busInfoForDetail.ticketType" disabled="true" dicgroup="truefalseType" name="ticketType"></sa-Radiogroup> |
| 229 | </div> | 229 | </div> |
| 230 | </div> | 230 | </div> |
| 231 | 231 | ||
| 232 | <div class="form-group"> | 232 | <div class="form-group"> |
| 233 | <label class="col-md-2 control-label">是否有LED服务屏:</label> | 233 | <label class="col-md-2 control-label">是否有LED服务屏:</label> |
| 234 | <div class="col-md-3"> | 234 | <div class="col-md-3"> |
| 235 | - <truefalse-Dic model="ctrl.busInfoForDetail.ledScreen" disabled="true" dicgroup="truefalseType" name="ledScreen"></truefalse-Dic> | 235 | + <sa-Radiogroup model="ctrl.busInfoForDetail.ledScreen" disabled="true" dicgroup="truefalseType" name="ledScreen"></sa-Radiogroup> |
| 236 | </div> | 236 | </div> |
| 237 | </div> | 237 | </div> |
| 238 | 238 | ||
| 239 | <div class="form-group"> | 239 | <div class="form-group"> |
| 240 | <label class="col-md-2 control-label">是否有TV视屏:</label> | 240 | <label class="col-md-2 control-label">是否有TV视屏:</label> |
| 241 | <div class="col-md-3"> | 241 | <div class="col-md-3"> |
| 242 | - <truefalse-Dic model="ctrl.busInfoForDetail.tvVideoType" disabled="true" dicgroup="truefalseType" name="tvVideoType"></truefalse-Dic> | 242 | + <sa-Radiogroup model="ctrl.busInfoForDetail.tvVideoType" disabled="true" dicgroup="truefalseType" name="tvVideoType"></sa-Radiogroup> |
| 243 | </div> | 243 | </div> |
| 244 | </div> | 244 | </div> |
| 245 | 245 | ||
| @@ -279,7 +279,7 @@ | @@ -279,7 +279,7 @@ | ||
| 279 | <div class="form-group"> | 279 | <div class="form-group"> |
| 280 | <label class="col-md-2 control-label">是否电车:</label> | 280 | <label class="col-md-2 control-label">是否电车:</label> |
| 281 | <div class="col-md-3"> | 281 | <div class="col-md-3"> |
| 282 | - <truefalse-Dic model="ctrl.busInfoForDetail.sfdc" disabled="true" dicgroup="truefalseType" name="sfdc"></truefalse-Dic> | 282 | + <sa-Radiogroup model="ctrl.busInfoForDetail.sfdc" disabled="true" dicgroup="truefalseType" name="sfdc"></sa-Radiogroup> |
| 283 | </div> | 283 | </div> |
| 284 | </div> | 284 | </div> |
| 285 | 285 |
src/main/resources/static/pages/scheduleApp/module/basicInfo/busInfoManage/edit.html
| @@ -128,21 +128,30 @@ | @@ -128,21 +128,30 @@ | ||
| 128 | <div class="form-group has-success has-feedback"> | 128 | <div class="form-group has-success has-feedback"> |
| 129 | <label class="col-md-2 control-label">设备供应厂商*:</label> | 129 | <label class="col-md-2 control-label">设备供应厂商*:</label> |
| 130 | <div class="col-md-3"> | 130 | <div class="col-md-3"> |
| 131 | - <div class="input-group"> | ||
| 132 | - <ui-select ng-model="ctrl.busInfoForSave.supplierName_selected" | ||
| 133 | - on-select="ctrl.supplierName_selected_change($item, $model)" | ||
| 134 | - theme="bootstrap" name="supplierName" required> | ||
| 135 | - <ui-select-match placeholder="请选择设备厂商...">{{$select.selected.name}}</ui-select-match> | ||
| 136 | - <ui-select-choices repeat="item in ctrl.supplierNames"> | ||
| 137 | - <span ng-bind="item.name"></span> | ||
| 138 | - </ui-select-choices> | ||
| 139 | - </ui-select> | ||
| 140 | - <span class="input-group-btn"> | ||
| 141 | - <button type="button" ng-click="ctrl.supplierName_selected_remove()" class="btn btn-default"> | ||
| 142 | - <span class="glyphicon glyphicon-trash"></span> | ||
| 143 | - </button> | ||
| 144 | - </span> | ||
| 145 | - </div> | 131 | + <!--<div class="input-group">--> |
| 132 | + <!--<ui-select ng-model="ctrl.busInfoForSave.supplierName_selected"--> | ||
| 133 | + <!--on-select="ctrl.supplierName_selected_change($item, $model)"--> | ||
| 134 | + <!--theme="bootstrap" name="supplierName" required>--> | ||
| 135 | + <!--<ui-select-match placeholder="请选择设备厂商...">{{$select.selected.name}}</ui-select-match>--> | ||
| 136 | + <!--<ui-select-choices repeat="item in ctrl.supplierNames">--> | ||
| 137 | + <!--<span ng-bind="item.name"></span>--> | ||
| 138 | + <!--</ui-select-choices>--> | ||
| 139 | + <!--</ui-select>--> | ||
| 140 | + | ||
| 141 | + <sa-Select model="ctrl.busInfoForSave" | ||
| 142 | + dicgroup="snames" | ||
| 143 | + placeholder="请选择设备厂商..." | ||
| 144 | + name="supplierName" | ||
| 145 | + codename="supplierName" | ||
| 146 | + ></sa-Select> | ||
| 147 | + | ||
| 148 | + | ||
| 149 | + <!--<span class="input-group-btn">--> | ||
| 150 | + <!--<button type="button" ng-click="ctrl.supplierName_selected_remove()" class="btn btn-default">--> | ||
| 151 | + <!--<span class="glyphicon glyphicon-trash"></span>--> | ||
| 152 | + <!--</button>--> | ||
| 153 | + <!--</span>--> | ||
| 154 | + <!--</div>--> | ||
| 146 | </div> | 155 | </div> |
| 147 | <!-- 隐藏快,显示验证信息 --> | 156 | <!-- 隐藏快,显示验证信息 --> |
| 148 | <div class="alert alert-danger well-sm" ng-show="myForm.supplierName.$error.required"> | 157 | <div class="alert alert-danger well-sm" ng-show="myForm.supplierName.$error.required"> |
| @@ -324,28 +333,28 @@ | @@ -324,28 +333,28 @@ | ||
| 324 | <div class="form-group"> | 333 | <div class="form-group"> |
| 325 | <label class="col-md-2 control-label">是否空调车:</label> | 334 | <label class="col-md-2 control-label">是否空调车:</label> |
| 326 | <div class="col-md-3"> | 335 | <div class="col-md-3"> |
| 327 | - <truefalse-Dic model="ctrl.busInfoForSave.hvacCar" dicgroup="truefalseType" name="hvacCar"></truefalse-Dic> | 336 | + <sa-Radiogroup model="ctrl.busInfoForSave.hvacCar" dicgroup="truefalseType" name="hvacCar"></sa-Radiogroup> |
| 328 | </div> | 337 | </div> |
| 329 | </div> | 338 | </div> |
| 330 | 339 | ||
| 331 | <div class="form-group"> | 340 | <div class="form-group"> |
| 332 | <label class="col-md-2 control-label">有无人售票:</label> | 341 | <label class="col-md-2 control-label">有无人售票:</label> |
| 333 | <div class="col-md-3"> | 342 | <div class="col-md-3"> |
| 334 | - <truefalse-Dic model="ctrl.busInfoForSave.ticketType" dicgroup="truefalseType" name="ticketType"></truefalse-Dic> | 343 | + <sa-Radiogroup model="ctrl.busInfoForSave.ticketType" dicgroup="truefalseType" name="ticketType"></sa-Radiogroup> |
| 335 | </div> | 344 | </div> |
| 336 | </div> | 345 | </div> |
| 337 | 346 | ||
| 338 | <div class="form-group"> | 347 | <div class="form-group"> |
| 339 | <label class="col-md-2 control-label">是否有LED服务屏:</label> | 348 | <label class="col-md-2 control-label">是否有LED服务屏:</label> |
| 340 | <div class="col-md-3"> | 349 | <div class="col-md-3"> |
| 341 | - <truefalse-Dic model="ctrl.busInfoForSave.ledScreen" dicgroup="truefalseType" name="ledScreen"></truefalse-Dic> | 350 | + <sa-Radiogroup model="ctrl.busInfoForSave.ledScreen" dicgroup="truefalseType" name="ledScreen"></sa-Radiogroup> |
| 342 | </div> | 351 | </div> |
| 343 | </div> | 352 | </div> |
| 344 | 353 | ||
| 345 | <div class="form-group"> | 354 | <div class="form-group"> |
| 346 | <label class="col-md-2 control-label">是否有TV视屏:</label> | 355 | <label class="col-md-2 control-label">是否有TV视屏:</label> |
| 347 | <div class="col-md-3"> | 356 | <div class="col-md-3"> |
| 348 | - <truefalse-Dic model="ctrl.busInfoForSave.tvVideoType" dicgroup="truefalseType" name="tvVideoType"></truefalse-Dic> | 357 | + <sa-Radiogroup model="ctrl.busInfoForSave.tvVideoType" dicgroup="truefalseType" name="tvVideoType"></sa-Radiogroup> |
| 349 | </div> | 358 | </div> |
| 350 | </div> | 359 | </div> |
| 351 | 360 | ||
| @@ -376,7 +385,7 @@ | @@ -376,7 +385,7 @@ | ||
| 376 | <div class="form-group"> | 385 | <div class="form-group"> |
| 377 | <label class="col-md-2 control-label">是否电车:</label> | 386 | <label class="col-md-2 control-label">是否电车:</label> |
| 378 | <div class="col-md-3"> | 387 | <div class="col-md-3"> |
| 379 | - <truefalse-Dic model="ctrl.busInfoForSave.sfdc" dicgroup="truefalseType" name="sfdc"></truefalse-Dic> | 388 | + <sa-Radiogroup model="ctrl.busInfoForSave.sfdc" dicgroup="truefalseType" name="sfdc"></sa-Radiogroup> |
| 380 | </div> | 389 | </div> |
| 381 | </div> | 390 | </div> |
| 382 | 391 |
src/main/resources/static/pages/scheduleApp/module/basicInfo/busInfoManage/form.html
| @@ -324,28 +324,28 @@ | @@ -324,28 +324,28 @@ | ||
| 324 | <div class="form-group"> | 324 | <div class="form-group"> |
| 325 | <label class="col-md-2 control-label">是否空调车:</label> | 325 | <label class="col-md-2 control-label">是否空调车:</label> |
| 326 | <div class="col-md-3"> | 326 | <div class="col-md-3"> |
| 327 | - <truefalse-Dic model="ctrl.busInfoForSave.hvacCar" disabled="true" dicgroup="truefalseType" name="hvacCar"></truefalse-Dic> | 327 | + <sa-Radiogroup model="ctrl.busInfoForSave.hvacCar" disabled="true" dicgroup="truefalseType" name="hvacCar"></sa-Radiogroup> |
| 328 | </div> | 328 | </div> |
| 329 | </div> | 329 | </div> |
| 330 | 330 | ||
| 331 | <div class="form-group"> | 331 | <div class="form-group"> |
| 332 | <label class="col-md-2 control-label">有无人售票:</label> | 332 | <label class="col-md-2 control-label">有无人售票:</label> |
| 333 | <div class="col-md-3"> | 333 | <div class="col-md-3"> |
| 334 | - <truefalse-Dic model="ctrl.busInfoForSave.ticketType" disabled="true" dicgroup="truefalseType" name="ticketType"></truefalse-Dic> | 334 | + <sa-Radiogroup model="ctrl.busInfoForSave.ticketType" disabled="true" dicgroup="truefalseType" name="ticketType"></sa-Radiogroup> |
| 335 | </div> | 335 | </div> |
| 336 | </div> | 336 | </div> |
| 337 | 337 | ||
| 338 | <div class="form-group"> | 338 | <div class="form-group"> |
| 339 | <label class="col-md-2 control-label">是否有LED服务屏:</label> | 339 | <label class="col-md-2 control-label">是否有LED服务屏:</label> |
| 340 | <div class="col-md-3"> | 340 | <div class="col-md-3"> |
| 341 | - <truefalse-Dic model="ctrl.busInfoForSave.ledScreen" disabled="true" dicgroup="truefalseType" name="ledScreen"></truefalse-Dic> | 341 | + <sa-Radiogroup model="ctrl.busInfoForSave.ledScreen" disabled="true" dicgroup="truefalseType" name="ledScreen"></sa-Radiogroup> |
| 342 | </div> | 342 | </div> |
| 343 | </div> | 343 | </div> |
| 344 | 344 | ||
| 345 | <div class="form-group"> | 345 | <div class="form-group"> |
| 346 | <label class="col-md-2 control-label">是否有TV视屏:</label> | 346 | <label class="col-md-2 control-label">是否有TV视屏:</label> |
| 347 | <div class="col-md-3"> | 347 | <div class="col-md-3"> |
| 348 | - <truefalse-Dic model="ctrl.busInfoForSave.tvVideoType" disabled="true" dicgroup="truefalseType" name="tvVideoType"></truefalse-Dic> | 348 | + <sa-Radiogroup model="ctrl.busInfoForSave.tvVideoType" disabled="true" dicgroup="truefalseType" name="tvVideoType"></sa-Radiogroup> |
| 349 | </div> | 349 | </div> |
| 350 | </div> | 350 | </div> |
| 351 | 351 | ||
| @@ -376,7 +376,7 @@ | @@ -376,7 +376,7 @@ | ||
| 376 | <div class="form-group"> | 376 | <div class="form-group"> |
| 377 | <label class="col-md-2 control-label">是否电车:</label> | 377 | <label class="col-md-2 control-label">是否电车:</label> |
| 378 | <div class="col-md-3"> | 378 | <div class="col-md-3"> |
| 379 | - <truefalse-Dic model="ctrl.busInfoForSave.sfdc" disabled="true" dicgroup="truefalseType" name="sfdc"></truefalse-Dic> | 379 | + <sa-Radiogroup model="ctrl.busInfoForSave.sfdc" disabled="true" dicgroup="truefalseType" name="sfdc"></sa-Radiogroup> |
| 380 | </div> | 380 | </div> |
| 381 | </div> | 381 | </div> |
| 382 | 382 |
src/main/resources/static/pages/scheduleApp/module/basicInfo/employeeInfoManage/detail.html
| @@ -79,12 +79,7 @@ | @@ -79,12 +79,7 @@ | ||
| 79 | <div class="form-group"> | 79 | <div class="form-group"> |
| 80 | <label class="col-md-2 control-label">性别:</label> | 80 | <label class="col-md-2 control-label">性别:</label> |
| 81 | <div class="col-md-4"> | 81 | <div class="col-md-4"> |
| 82 | - <label class="radio-inline"> | ||
| 83 | - <input type="radio" name="ledScreen" ng-value="'男性'" ng-model="ctrl.employeeInfoForDetail.personnelType" disabled/>男性 | ||
| 84 | - </label> | ||
| 85 | - <label class="radio-inline"> | ||
| 86 | - <input type="radio" name="ledScreen" ng-value="'女性'" ng-model="ctrl.employeeInfoForDetail.personnelType" disabled/>女性 | ||
| 87 | - </label> | 82 | + <sa-Radiogroup model="ctrl.employeeInfoForDetail.personnelType" disabled="true" dicgroup="sexType" name="personnelType"></sa-Radiogroup> |
| 88 | </div> | 83 | </div> |
| 89 | </div> | 84 | </div> |
| 90 | <div class="form-group"> | 85 | <div class="form-group"> |
src/main/resources/static/pages/scheduleApp/module/basicInfo/employeeInfoManage/edit.html
| @@ -117,14 +117,7 @@ | @@ -117,14 +117,7 @@ | ||
| 117 | <div class="form-group"> | 117 | <div class="form-group"> |
| 118 | <label class="col-md-2 control-label">性别:</label> | 118 | <label class="col-md-2 control-label">性别:</label> |
| 119 | <div class="col-md-4"> | 119 | <div class="col-md-4"> |
| 120 | - <label class="radio-inline"> | ||
| 121 | - <input type="radio" name="personnelType" | ||
| 122 | - ng-value="'男性'" ng-model="ctrl.employeeInfoForSave.personnelType"/>男性 | ||
| 123 | - </label> | ||
| 124 | - <label class="radio-inline"> | ||
| 125 | - <input type="radio" name="personnelType" | ||
| 126 | - ng-value="'女性'" ng-model="ctrl.employeeInfoForSave.personnelType"/>女性 | ||
| 127 | - </label> | 120 | + <sa-Radiogroup model="ctrl.employeeInfoForSave.personnelType" dicgroup="sexType" name="personnelType"></sa-Radiogroup> |
| 128 | </div> | 121 | </div> |
| 129 | </div> | 122 | </div> |
| 130 | 123 |
src/main/resources/static/pages/scheduleApp/module/basicInfo/employeeInfoManage/form.html
| @@ -117,14 +117,7 @@ | @@ -117,14 +117,7 @@ | ||
| 117 | <div class="form-group"> | 117 | <div class="form-group"> |
| 118 | <label class="col-md-2 control-label">性别:</label> | 118 | <label class="col-md-2 control-label">性别:</label> |
| 119 | <div class="col-md-4"> | 119 | <div class="col-md-4"> |
| 120 | - <label class="radio-inline"> | ||
| 121 | - <input type="radio" name="personnelType" | ||
| 122 | - ng-value="'男性'" ng-model="ctrl.employeeInfoForSave.personnelType"/>男性 | ||
| 123 | - </label> | ||
| 124 | - <label class="radio-inline"> | ||
| 125 | - <input type="radio" name="personnelType" | ||
| 126 | - ng-value="'女性'" ng-model="ctrl.employeeInfoForSave.personnelType"/>女性 | ||
| 127 | - </label> | 120 | + <sa-Radiogroup model="ctrl.employeeInfoForSave.personnelType" dicgroup="sexType" name="personnelType"></sa-Radiogroup> |
| 128 | </div> | 121 | </div> |
| 129 | </div> | 122 | </div> |
| 130 | 123 |
src/main/resources/static/pages/scheduleApp/module/basicInfo/employeeInfoManage/list.html
| @@ -106,7 +106,7 @@ | @@ -106,7 +106,7 @@ | ||
| 106 | <span ng-bind="info.jobCode"></span> | 106 | <span ng-bind="info.jobCode"></span> |
| 107 | </td> | 107 | </td> |
| 108 | <td> | 108 | <td> |
| 109 | - <span ng-bind="info.personnelType"></span> | 109 | + <span ng-bind="info.personnelType | dict:'sexType':'未知'"></span> |
| 110 | </td> | 110 | </td> |
| 111 | <td> | 111 | <td> |
| 112 | <span ng-bind="info.company"></span> | 112 | <span ng-bind="info.company"></span> |
src/main/resources/static/pages/scheduleApp/module/main.js
| @@ -928,44 +928,138 @@ angular.module('ScheduleApp').filter("dict", [function() { | @@ -928,44 +928,138 @@ angular.module('ScheduleApp').filter("dict", [function() { | ||
| 928 | }; | 928 | }; |
| 929 | }]); | 929 | }]); |
| 930 | 930 | ||
| 931 | -angular.module('ScheduleApp').directive("truefalseDic", [function() { | 931 | +angular.module('ScheduleApp').directive("saSelect", ['$timeout', function($timeout) { |
| 932 | + return { | ||
| 933 | + restrict: 'E', | ||
| 934 | + templateUrl: '/pages/scheduleApp/module/other/MyDictionarySelectTemplate.html', | ||
| 935 | + scope: { | ||
| 936 | + model: "=" | ||
| 937 | + }, | ||
| 938 | + controllerAs: "$saSelectCtrl", | ||
| 939 | + bindToController: true, | ||
| 940 | + controller: function($scope) { | ||
| 941 | + var self = this; | ||
| 942 | + self.datas = []; // 关联的字典数据,内部格式 {code:{值},name:{名字}} | ||
| 943 | + }, | ||
| 944 | + | ||
| 945 | + /** | ||
| 946 | + * 重要属性如下: | ||
| 947 | + * model 是绑定外部值。 | ||
| 948 | + * dicgroup 字典组的类型 | ||
| 949 | + * name input name属性值 | ||
| 950 | + */ | ||
| 951 | + link: function(scope, element, attr, ctrl) { | ||
| 952 | + // 1、获取属性 | ||
| 953 | + var dicgroup_attr = attr['dicgroup']; // 字典组的类型 | ||
| 954 | + var name_attr = attr['name']; // input name属性值 | ||
| 955 | + var dicname_attr = attr['dicname']; // model关联的字典名字段 | ||
| 956 | + var codename_attr = attr['codename']; // model关联的字典值字段 | ||
| 957 | + var placeholder_attr = attr['placeholder']; // select placeholder提示 | ||
| 958 | + | ||
| 959 | + // 系统的字典对象,使用dictionaryUtils类获取 | ||
| 960 | + var origin_dicgroup; | ||
| 961 | + var dic_key; // 字典key | ||
| 962 | + | ||
| 963 | + if (dicgroup_attr) { // 赋值指定的字典数据 | ||
| 964 | + origin_dicgroup = dictionaryUtils.getByGroup(dicgroup_attr); | ||
| 965 | + for (dic_key in origin_dicgroup) { | ||
| 966 | + var data = {}; // 重新组合的字典元素对象 | ||
| 967 | + if (dic_key == "true") | ||
| 968 | + data.code = true; | ||
| 969 | + else | ||
| 970 | + data.code = dic_key; | ||
| 971 | + data.name = origin_dicgroup[dic_key]; | ||
| 972 | + scope["$saSelectCtrl"].datas.push(data); | ||
| 973 | + } | ||
| 974 | + } | ||
| 975 | + | ||
| 976 | + if (name_attr) { | ||
| 977 | + scope["$saSelectCtrl"].nv = name_attr; | ||
| 978 | + } | ||
| 979 | + if (placeholder_attr) { | ||
| 980 | + scope["$saSelectCtrl"].ph = placeholder_attr; | ||
| 981 | + } | ||
| 982 | + | ||
| 983 | + scope["$saSelectCtrl"].select = function($item) { | ||
| 984 | + if (codename_attr) { | ||
| 985 | + scope["$saSelectCtrl"].model[codename_attr] = $item.code; | ||
| 986 | + } | ||
| 987 | + if (dicname_attr) { | ||
| 988 | + scope["$saSelectCtrl"].model[dicname_attr] = $item.name; | ||
| 989 | + } | ||
| 990 | + }; | ||
| 991 | + | ||
| 992 | + scope["$saSelectCtrl"].remove = function() { | ||
| 993 | + if (codename_attr) { | ||
| 994 | + scope["$saSelectCtrl"].model[codename_attr] = null; | ||
| 995 | + } | ||
| 996 | + if (dicname_attr) { | ||
| 997 | + scope["$saSelectCtrl"].model[dicname_attr] = null; | ||
| 998 | + } | ||
| 999 | + scope["$saSelectCtrl"].cmodel = null; | ||
| 1000 | + }; | ||
| 1001 | + | ||
| 1002 | + $timeout(function() { | ||
| 1003 | + // 创建内部使用的绑定对象 | ||
| 1004 | + var model_code = scope["$saSelectCtrl"].model[codename_attr]; | ||
| 1005 | + scope["$saSelectCtrl"].cmodel = model_code; | ||
| 1006 | + }, 0); | ||
| 1007 | + } | ||
| 1008 | + }; | ||
| 1009 | +}]); | ||
| 1010 | + | ||
| 1011 | +angular.module('ScheduleApp').directive("saRadiogroup", [function() { | ||
| 932 | /** | 1012 | /** |
| 933 | - * true,false组合的单元按钮组的指令。 | 1013 | + * 使用字典数据的单选按钮组的指令。 |
| 934 | * 指令名称:truefalse-Dic | 1014 | * 指令名称:truefalse-Dic |
| 935 | */ | 1015 | */ |
| 936 | return { | 1016 | return { |
| 937 | restrict: 'E', | 1017 | restrict: 'E', |
| 938 | - templateUrl: '/pages/scheduleApp/module/other/truefalseRadioGroupTemplate.html', | 1018 | + templateUrl: '/pages/scheduleApp/module/other/MyDictionaryRadioGroupTemplate.html', |
| 939 | scope: { | 1019 | scope: { |
| 940 | model: "=" | 1020 | model: "=" |
| 941 | }, | 1021 | }, |
| 1022 | + controllerAs: "ctrl", | ||
| 1023 | + bindToController: true, | ||
| 1024 | + controller: function($scope) { | ||
| 1025 | + //$scope["model"] = {selectedOption: null}; | ||
| 1026 | + //console.log("controller"); | ||
| 1027 | + //console.log("controller:" + $scope["model"]); | ||
| 1028 | + }, | ||
| 942 | /** | 1029 | /** |
| 1030 | + * 重要属性如下: | ||
| 943 | * model 是绑定外部值。 | 1031 | * model 是绑定外部值。 |
| 944 | * disabled 说明是否不能修改 | 1032 | * disabled 说明是否不能修改 |
| 945 | * dicgroup 字典组的类型 | 1033 | * dicgroup 字典组的类型 |
| 1034 | + * name input name属性值 | ||
| 946 | */ | 1035 | */ |
| 947 | link: function(scope, element, attr) { | 1036 | link: function(scope, element, attr) { |
| 1037 | + //console.log("link"); | ||
| 1038 | + //console.log("link:" + scope.model); | ||
| 1039 | + //scope["model"] = {selectedOption: null}; | ||
| 1040 | + | ||
| 948 | if (attr["name"]) { | 1041 | if (attr["name"]) { |
| 949 | - scope["nv"] = attr["name"]; | 1042 | + scope["ctrl"].nv = attr["name"]; |
| 950 | } | 1043 | } |
| 951 | 1044 | ||
| 952 | if (attr["disabled"]) { | 1045 | if (attr["disabled"]) { |
| 953 | - element.find("input").attr("disabled", ""); | 1046 | + scope["ctrl"].disabled = true; |
| 954 | } | 1047 | } |
| 955 | if (attr["dicgroup"]) { | 1048 | if (attr["dicgroup"]) { |
| 956 | var obj = dictionaryUtils.getByGroup(attr['dicgroup']); | 1049 | var obj = dictionaryUtils.getByGroup(attr['dicgroup']); |
| 957 | - if (obj["true"]) | ||
| 958 | - scope["trueDesc"] = obj["true"]; | ||
| 959 | - else | ||
| 960 | - scope["trueDesc"] = "未知true"; | ||
| 961 | - | ||
| 962 | - if (obj["false"]) | ||
| 963 | - scope["falseDesc"] = obj["false"]; | ||
| 964 | - else | ||
| 965 | - scope["falseDesc"] = "未知false"; | ||
| 966 | - } else { | ||
| 967 | - scope["trueDesc"] = "未知true"; | ||
| 968 | - scope["falseDesc"] = "未知false"; | 1050 | + scope["ctrl"].dic = obj; |
| 1051 | + // 处理 scope["dic"] key值 | ||
| 1052 | + scope["ctrl"].dicvalueCalcu = function(value) { | ||
| 1053 | + if (value == "true") { | ||
| 1054 | + //console.log(value); | ||
| 1055 | + return true; | ||
| 1056 | + } else if (value == "false") { | ||
| 1057 | + //console.log(value); | ||
| 1058 | + return false; | ||
| 1059 | + } else { | ||
| 1060 | + return value; | ||
| 1061 | + } | ||
| 1062 | + }; | ||
| 969 | } | 1063 | } |
| 970 | } | 1064 | } |
| 971 | }; | 1065 | }; |
src/main/resources/static/pages/scheduleApp/module/other/MyDictionaryRadioGroupTemplate.html
0 → 100644
| 1 | +<div> | ||
| 2 | + <!--<label class="radio-inline">--> | ||
| 3 | + <!--<input type="radio" name="{{nv}}"--> | ||
| 4 | + <!--ng-value="true" ng-model="model" {{disabled}}/>{{trueDesc}}--> | ||
| 5 | + <!--</label>--> | ||
| 6 | + <!--<label class="radio-inline">--> | ||
| 7 | + <!--<input type="radio" name="{{nv}}"--> | ||
| 8 | + <!--ng-value="false" ng-model="model" {{disabled}}/>{{falseDesc}}--> | ||
| 9 | + <!--</label>--> | ||
| 10 | + | ||
| 11 | + <!-- 单选按钮组模版 --> | ||
| 12 | + <!-- | ||
| 13 | + 使用 ng-repeat 循环生成input radio时候,双向绑定会有问题,因为ng-repeat有自己的controller, | ||
| 14 | + 会影响外部的controller绑定,网上有很多解决方法,这里使用controllerAs方式,让指令定义自己的控制器别名, | ||
| 15 | + 模版里指定别名就不会和ng-repeat控制器混了。 | ||
| 16 | + --> | ||
| 17 | + | ||
| 18 | + <label class="radio-inline" ng-repeat="(dicvalue, dicdesc) in ctrl.dic"> | ||
| 19 | + <input type="radio" name="{{ctrl.nv}}" | ||
| 20 | + ng-value="ctrl.dicvalueCalcu(dicvalue)" ng-model="ctrl.model" ng-disabled="ctrl.disabled" />{{dicdesc}} | ||
| 21 | + </label> | ||
| 22 | +</div> | ||
| 0 | \ No newline at end of file | 23 | \ No newline at end of file |
src/main/resources/static/pages/scheduleApp/module/other/MyDictionarySelectTemplate.html
0 → 100644
| 1 | + | ||
| 2 | +<div class="input-group"> | ||
| 3 | + <ui-select ng-model="$saSelectCtrl.cmodel" on-select="$saSelectCtrl.select($item)" | ||
| 4 | + theme="bootstrap" name="{{$saSelectCtrl.nv}}" > | ||
| 5 | + <ui-select-match placeholder="{{$saSelectCtrl.ph}}">{{$select.selected.name}}</ui-select-match> | ||
| 6 | + <ui-select-choices repeat="item.code as item in $saSelectCtrl.datas"> | ||
| 7 | + <span ng-bind="item.name"></span> | ||
| 8 | + </ui-select-choices> | ||
| 9 | + </ui-select> | ||
| 10 | + <span class="input-group-btn"> | ||
| 11 | + <button type="button" ng-click="$saSelectCtrl.remove()" class="btn btn-default"> | ||
| 12 | + <span class="glyphicon glyphicon-trash"></span> | ||
| 13 | + </button> | ||
| 14 | + </span> | ||
| 15 | +</div> |
src/main/resources/static/pages/scheduleApp/module/other/truefalseRadioGroupTemplate.html deleted
100644 → 0
| 1 | -<div> | ||
| 2 | - <label class="radio-inline"> | ||
| 3 | - <input type="radio" name="{{nv}}" | ||
| 4 | - ng-value="true" ng-model="model" {{disabled}}/>{{trueDesc}} | ||
| 5 | - </label> | ||
| 6 | - <label class="radio-inline"> | ||
| 7 | - <input type="radio" name="{{nv}}" | ||
| 8 | - ng-value="false" ng-model="model" {{disabled}}/>{{falseDesc}} | ||
| 9 | - </label> | ||
| 10 | -</div> | ||
| 11 | \ No newline at end of file | 0 | \ No newline at end of file |