Commit dffb4c74a96ed9a3f0b415684dd8cdb951f1dd2e
1 parent
6c36924006
Exists in
master
添加宏
机构和科室修改为selector动态选择
Showing 5 changed files with 77 additions and 13 deletions
- parent/center.manager/src/main/java/com/lyms/cm/controller/sys/SysUsersController.java
- parent/center.manager/src/main/webapp/WEB-INF/views/common/base_list.html
- parent/center.manager/src/main/webapp/WEB-INF/views/macro/macro.vm
- parent/center.manager/src/main/webapp/WEB-INF/views/user/user_edit.html
- parent/center.manager/src/main/webapp/WEB-INF/views/user/user_list.html
parent/center.manager/src/main/java/com/lyms/cm/controller/sys/SysUsersController.java
View file @
dffb4c7
| ... | ... | @@ -14,10 +14,14 @@ |
| 14 | 14 | |
| 15 | 15 | import com.baomidou.mybatisplus.mapper.EntityWrapper; |
| 16 | 16 | import com.baomidou.mybatisplus.plugins.Page; |
| 17 | +import com.lyms.base.common.entity.organ.Departments; | |
| 18 | +import com.lyms.base.common.entity.organ.Organizations; | |
| 17 | 19 | import com.lyms.base.common.entity.role.Roles; |
| 18 | 20 | import com.lyms.base.common.entity.role.UserRoleMaps; |
| 19 | 21 | import com.lyms.base.common.entity.user.SysUserDataPermissions; |
| 20 | 22 | import com.lyms.base.common.entity.user.Users; |
| 23 | +import com.lyms.base.common.service.organ.DepartmentsService; | |
| 24 | +import com.lyms.base.common.service.organ.OrganizationsService; | |
| 21 | 25 | import com.lyms.base.common.service.role.RolesService; |
| 22 | 26 | import com.lyms.base.common.service.role.UserRoleMapsService; |
| 23 | 27 | import com.lyms.base.common.service.user.SysUserDataPermissionsService; |
| ... | ... | @@ -49,6 +53,10 @@ |
| 49 | 53 | private UserRoleMapsService sysUserRoleMapsService; |
| 50 | 54 | @Autowired |
| 51 | 55 | private SysUserDataPermissionsService sysUserDataPermissionsService; |
| 56 | + @Autowired | |
| 57 | + private OrganizationsService sysOrganizationsService; | |
| 58 | + @Autowired | |
| 59 | + private DepartmentsService sysDepartmentsService; | |
| 52 | 60 | |
| 53 | 61 | /** |
| 54 | 62 | * 创建用户 |
| ... | ... | @@ -78,7 +86,9 @@ |
| 78 | 86 | * @return |
| 79 | 87 | */ |
| 80 | 88 | @RequestMapping(value = "/toList", method = { RequestMethod.GET }) |
| 81 | - public String toList() { | |
| 89 | + public String toList(Model model) { | |
| 90 | + List<Organizations> orgs = sysOrganizationsService.selectList(new EntityWrapper<Organizations>().where("ifdel=0").and("status!=2")); | |
| 91 | + model.addAttribute("orgs", orgs); | |
| 82 | 92 | return "/user/user_list"; |
| 83 | 93 | } |
| 84 | 94 | |
| ... | ... | @@ -126,7 +136,7 @@ |
| 126 | 136 | */ |
| 127 | 137 | @RequestMapping(value = { "/{id}/toEdit" }, method = RequestMethod.GET) |
| 128 | 138 | public String toEdit(@PathVariable String id, Model model) { |
| 129 | - if (!StringUtils.isBlank(id)) { | |
| 139 | + if (!StringUtils.isBlank(id) & !"0".equals(id)) { | |
| 130 | 140 | Users user = userService.selectById(id); |
| 131 | 141 | model.addAttribute("user", user); |
| 132 | 142 | // 当前用户角色数据 |
| 133 | 143 | |
| 134 | 144 | |
| 135 | 145 | |
| ... | ... | @@ -136,11 +146,16 @@ |
| 136 | 146 | for (UserRoleMaps urEntity : urList) { |
| 137 | 147 | urSB.append("," + urEntity.getRoleId()); |
| 138 | 148 | } |
| 149 | + List<Departments> depts = sysDepartmentsService.selectList(new EntityWrapper<Departments>().where("ifdel=0").and("ORG_ID={0}",user.getOrgId())); | |
| 139 | 150 | model.addAttribute("userRoles", urSB.toString().replaceFirst(",", "")); |
| 151 | + model.addAttribute("depts", depts); | |
| 140 | 152 | } |
| 141 | 153 | // 所有角色数据 |
| 142 | 154 | List<Roles> roleList = sysRolesService.selectList(new EntityWrapper<Roles>().where("ifDel=0")); |
| 155 | + List<Organizations> orgs = sysOrganizationsService.selectList(new EntityWrapper<Organizations>().where("ifdel=0").and("status!=2")); | |
| 156 | + | |
| 143 | 157 | model.addAttribute("roleString", toJson(roleList)); |
| 158 | + model.addAttribute("orgs", orgs); | |
| 144 | 159 | |
| 145 | 160 | |
| 146 | 161 | //数据权限 |
parent/center.manager/src/main/webapp/WEB-INF/views/common/base_list.html
View file @
dffb4c7
| ... | ... | @@ -20,10 +20,11 @@ |
| 20 | 20 | var APP = window['APP'] || {}; |
| 21 | 21 | APP.PATH = "${ctx}"; |
| 22 | 22 | </script> |
| 23 | + <script src="${ctx}/static/js/jquery.min.js"></script> | |
| 24 | + <script src="${ctx}/static/js/selectator/fm.selectator.jquery.js"></script> | |
| 23 | 25 | </head> |
| 24 | 26 | <body class="white-bg"> |
| 25 | 27 | #block("body")#end |
| 26 | -<script src="${ctx}/static/js/jquery.min.js"></script> | |
| 27 | 28 | <script src="${ctx}/static/js/bootstrap.min.js"></script> |
| 28 | 29 | <script src="${ctx}/static/js/content.min.js"></script> |
| 29 | 30 | <script src="${ctx}/static/js//plugins/layer/layer.js"></script> |
| ... | ... | @@ -34,7 +35,6 @@ |
| 34 | 35 | <script src="${ctx}/static/js/plugins/jquery-validation/dist/localization/messages_zh.min.js"></script> |
| 35 | 36 | <script src="${ctx}/static/js/plugins/iCheck/icheck.min.js"></script> |
| 36 | 37 | <script src="${ctx}/static/js/base/common.js"></script> |
| 37 | -<script src="${ctx}/static/js/selectator/fm.selectator.jquery.js"></script> | |
| 38 | 38 | #block("js")#end |
| 39 | 39 | <script src="${ctx}/static/js/base/base_table_init.js"></script> |
| 40 | 40 | <script type="text/javascript"> |
parent/center.manager/src/main/webapp/WEB-INF/views/macro/macro.vm
View file @
dffb4c7
| 1 | +##选择控件宏 | |
| 2 | +#macro(selector $domId $domName $selectArray $defaultValue) | |
| 3 | +<select id="${domId}" name="${domName}" style="width:250px;"> | |
| 4 | + <option value=""> </option> | |
| 5 | + #foreach($oneSelect in $selectArray) | |
| 6 | + <option value="${oneSelect.id}"#if($string.equals(${defaultValue}, ${oneSelect.id}) ) selected #end>${oneSelect.name}</option> | |
| 7 | + #end | |
| 8 | +</select> | |
| 9 | +<script type="text/javascript"> | |
| 10 | +$(function () { | |
| 11 | + var ${domId}_select = $('#${domId}'); | |
| 12 | + ${domId}_select.selectator({ | |
| 13 | + labels: { | |
| 14 | + search: 'Search here...' | |
| 15 | + } | |
| 16 | + }); | |
| 17 | +}); | |
| 18 | +</script> | |
| 19 | +#end | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 1 | 23 | |
| 2 | 24 | |
| 3 | 25 | ## 分页宏 |
parent/center.manager/src/main/webapp/WEB-INF/views/user/user_edit.html
View file @
dffb4c7
| ... | ... | @@ -138,19 +138,19 @@ |
| 138 | 138 | <div class="form-group"> |
| 139 | 139 | <label class="col-sm-3 control-label">备注:</label> |
| 140 | 140 | <div class="col-sm-8"> |
| 141 | - <input type="text" placeholder="备注信息" value="$!user.orgId" aria-required="true" required="true" class="form-control" minlength="2" name="remarks" id="remarks"> | |
| 141 | + <input type="text" placeholder="备注信息" value="$!user.remarks" aria-required="true" required="true" class="form-control" minlength="2" name="remarks" id="remarks"> | |
| 142 | 142 | </div> |
| 143 | 143 | </div> |
| 144 | 144 | <div class="form-group"> |
| 145 | - <label class="col-sm-3 control-label">医院id:</label> | |
| 145 | + <label class="col-sm-3 control-label">医院:</label> | |
| 146 | 146 | <div class="col-sm-8"> |
| 147 | - <input type="text" placeholder="医院id" value="$!user.orgId" aria-required="true" required="true" class="form-control" minlength="2" name="orgId" id="orgId"> | |
| 147 | + #selector("orgId" "orgId" $orgs $!user.orgId) | |
| 148 | 148 | </div> |
| 149 | 149 | </div> |
| 150 | 150 | <div class="form-group"> |
| 151 | - <label class="col-sm-3 control-label">科室id:</label> | |
| 151 | + <label class="col-sm-3 control-label">科室:</label> | |
| 152 | 152 | <div class="col-sm-8"> |
| 153 | - <input type="text" placeholder="科室id" value="$!user.deptId" aria-required="true" required="true" class="form-control" minlength="2" name="deptId" id="deptId"> | |
| 153 | + #selector("deptId" "deptId" $depts $!user.deptId) | |
| 154 | 154 | </div> |
| 155 | 155 | </div> |
| 156 | 156 | <div class="form-group"> |
| ... | ... | @@ -360,6 +360,35 @@ |
| 360 | 360 | $(function () { |
| 361 | 361 | var orgListTable = new orgLostTableInit(); |
| 362 | 362 | orgListTable.Init(); |
| 363 | + var orgId_select = $('#orgId'); | |
| 364 | + orgId_select.on("change",function(){ | |
| 365 | + if(orgId_select.val() != ""){ | |
| 366 | + var url = APP.PATH +"/sysDepartments/list"; | |
| 367 | + $.ajax({ | |
| 368 | + url: url, | |
| 369 | + cache: false, | |
| 370 | + data: { orgId : orgId_select.val() }, | |
| 371 | + dataType: "json", | |
| 372 | + success: function(data){ | |
| 373 | + if(data && data.rows){ | |
| 374 | + var deptOpt = $("#deptId option"); | |
| 375 | + deptOpt.remove(); | |
| 376 | + $('#deptId').append('<option value=""> </option>'); | |
| 377 | + for(idx in data.rows){ | |
| 378 | + $('#deptId').append('<option value="' + data.rows[idx].id + '">' + data.rows[idx].name + '</option>'); | |
| 379 | + } | |
| 380 | + $('#deptId').selectator('destroy'); | |
| 381 | + $('#deptId').selectator({ | |
| 382 | + labels: { | |
| 383 | + search: 'Search here...' | |
| 384 | + } | |
| 385 | + }); | |
| 386 | + | |
| 387 | + } | |
| 388 | + } | |
| 389 | + }); | |
| 390 | + } | |
| 391 | + }); | |
| 363 | 392 | }) |
| 364 | 393 | |
| 365 | 394 |
parent/center.manager/src/main/webapp/WEB-INF/views/user/user_list.html
View file @
dffb4c7
| ... | ... | @@ -13,10 +13,8 @@ |
| 13 | 13 | <input type="text" placeholder="手机号" id="searchPhone" class="form-control"> |
| 14 | 14 | </div> |
| 15 | 15 | <div class="form-group"> |
| 16 | - <input type="text" placeholder="医院id" id="searchOrgId" class="form-control"> | |
| 17 | - </div> | |
| 18 | - <div class="form-group"> | |
| 19 | - <input type="text" placeholder="科室id" id="searchDeptId" class="form-control"> | |
| 16 | + 医院: | |
| 17 | + #selector("searchOrgId" "searchOrgId" $orgs ) | |
| 20 | 18 | </div> |
| 21 | 19 | </form> |
| 22 | 20 | </div> |