Commit 24e1e45a807a42f0eb3d210710b328efc2121a06

Authored by fangcheng
1 parent 7ee7a147b1
Exists in master

基础管理模块全部可视化操作完成

Showing 3 changed files with 51 additions and 7 deletions

parent/center.manager/src/main/java/com/lyms/cm/controller/sys/SysDepartmentsController.java View file @ 24e1e45
1 1 package com.lyms.cm.controller.sys;
2 2  
  3 +import java.util.List;
3 4 import java.util.Map;
4 5  
5 6 import org.apache.commons.lang3.StringUtils;
6 7  
... ... @@ -14,8 +15,10 @@
14 15 import com.baomidou.mybatisplus.mapper.EntityWrapper;
15 16 import com.baomidou.mybatisplus.plugins.Page;
16 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.enums.ValidityEnum;
18 20 import com.lyms.base.common.service.organ.DepartmentsService;
  21 +import com.lyms.base.common.service.organ.OrganizationsService;
19 22 import com.lyms.constants.OperationName;
20 23 import com.lyms.util.StrUtils;
21 24 import com.lyms.web.bean.AjaxResult;
... ... @@ -35,6 +38,10 @@
35 38  
36 39 @Autowired
37 40 private DepartmentsService departmentService;
  41 + @Autowired
  42 + private OrganizationsService sysOrganizationsService;
  43 + @Autowired
  44 + private DepartmentsService sysDepartmentsService;
38 45  
39 46 /**
40 47 * <li>@Description:到部门科室列表
... ... @@ -45,7 +52,9 @@
45 52 * <li>修改时间:
46 53 */
47 54 @RequestMapping(value = "/toList", method = RequestMethod.GET)
48   - public String toList() {
  55 + public String toList(Model model) {
  56 + List<Organizations> orgs = sysOrganizationsService.getAllEnableOrg();
  57 + model.addAttribute("orgs", orgs);
49 58 return "/depart/depart_list";
50 59 }
51 60  
52 61  
... ... @@ -90,7 +99,11 @@
90 99 if (StringUtils.isNotBlank(id)) {
91 100 Departments departments = departmentService.selectById(id);
92 101 model.addAttribute("depart", departments);
  102 + List<Departments> depts = sysDepartmentsService.selectList(new EntityWrapper<Departments>().where("ifdel=0").and("ORG_ID={0}",departments.getOrgId()));
  103 + model.addAttribute("depts", depts);
93 104 }
  105 + List<Organizations> orgs = sysOrganizationsService.getAllEnableOrg();
  106 + model.addAttribute("orgs", orgs);
94 107 return "/depart/depart_edit";
95 108 }
96 109  
parent/center.manager/src/main/webapp/WEB-INF/views/depart/depart_edit.html View file @ 24e1e45
... ... @@ -11,9 +11,9 @@
11 11 </div>
12 12  
13 13 <div class="form-group">
14   - <label class="col-sm-3 control-label">医院id:</label>
  14 + <label class="col-sm-3 control-label">医院:</label>
15 15 <div class="col-sm-8">
16   - <input type="text" placeholder="医院id" value="$!depart.orgId" aria-required="true" required="true" class="form-control" minlength="2" name="orgId" id="orgId">
  16 + #selector("orgId" "orgId" $orgs $!depart.orgId)
17 17 <!--
18 18 <select class="form-control" name="orgId" id="orgs">
19 19 <option value="0">--选择--</option>
... ... @@ -25,7 +25,7 @@
25 25 <div class="form-group">
26 26 <label class="col-sm-3 control-label">上级科室id:</label>
27 27 <div class="col-sm-8">
28   - <input type="text" placeholder="上级科室id" value="$!depart.parentId" class="form-control" name="parentId" id="parentId">
  28 + #selector("parentId" "parentId" $depts $!depart.parentId)
29 29 <!--
30 30 <select class="form-control" name="parentId" id="parent">
31 31 <option value="0">--选择--</option>
... ... @@ -72,6 +72,37 @@
72 72 </div>
73 73 </div>
74 74 <script type="text/javascript">
  75 +$(function () {
  76 + var orgId_select = $('#orgId');
  77 + orgId_select.on("change",function(){
  78 + if(orgId_select.val() != ""){
  79 + var url = APP.PATH +"/sysDepartments/list";
  80 + $.ajax({
  81 + url: url,
  82 + cache: false,
  83 + data: { orgId : orgId_select.val() },
  84 + dataType: "json",
  85 + success: function(data){
  86 + if(data && data.rows){
  87 + var deptOpt = $("#parentId option");
  88 + deptOpt.remove();
  89 + $('#parentId').append('<option value="">&nbsp;</option>');
  90 + for(idx in data.rows){
  91 + $('#parentId').append('<option value="' + data.rows[idx].id + '">' + data.rows[idx].name + '</option>');
  92 + }
  93 + $('#parentId').selectator('destroy');
  94 + $('#parentId').selectator({
  95 + labels: {
  96 + search: 'Search here...'
  97 + }
  98 + });
  99 +
  100 + }
  101 + }
  102 + });
  103 + }
  104 + });
  105 +})
75 106 function save(){
76 107 if($('#validForm').valid()){
77 108 var data = $('#validForm').serialize();
parent/center.manager/src/main/webapp/WEB-INF/views/depart/depart_list.html View file @ 24e1e45
... ... @@ -4,11 +4,11 @@
4 4 <div style="padding-top:30px;">
5 5 <form role="form" class="form-inline">
6 6 <div class="form-group" id="leve">
7   - <span class="form-control">医院id</span>
8   - <input type="text" placeholder="医院id" id="searchOrgId" class="form-control">
  7 + 医院:
  8 + #selector("searchOrgId" "orgId" $orgs)
9 9 </div>
10 10 <div class="form-group" id="leve">
11   - <span class="form-control">科室名称</span>
  11 + 科室名称
12 12 <input type="text" placeholder="科室名称" id="searchName" class="form-control">
13 13 </div>
14 14 </form>