Commit 000eb60503b6116bbbe17e16fc41596396791018
1 parent
a9dd7c9a82
Exists in
master
添加字典管理模块
Showing 7 changed files with 471 additions and 10 deletions
- parent/base.common/src/main/java/com/lyms/base/common/entity/sys/SysDict.java
- parent/base.common/src/main/java/com/lyms/base/common/service/sys/SysDictService.java
- parent/base.common/src/main/java/com/lyms/base/common/service/sys/impl/SysDictServiceImpl.java
- parent/center.manager/src/main/java/com/lyms/cm/controller/sys/SysDictController.java
- parent/center.manager/src/main/webapp/WEB-INF/views/dict/dict_edit.html
- parent/center.manager/src/main/webapp/WEB-INF/views/dict/dict_list.html
- parent/core.sdk/src/main/java/com/lyms/constants/OperationName.java
parent/base.common/src/main/java/com/lyms/base/common/entity/sys/SysDict.java
View file @
000eb60
| ... | ... | @@ -43,6 +43,8 @@ |
| 43 | 43 | */ |
| 44 | 44 | @TableField(value="ENABLE") |
| 45 | 45 | private Integer enable; |
| 46 | + @TableField(exist=false) | |
| 47 | + private String txtAndEnable; | |
| 46 | 48 | |
| 47 | 49 | |
| 48 | 50 | public String getId() { |
| ... | ... | @@ -85,5 +87,18 @@ |
| 85 | 87 | this.enable = enable; |
| 86 | 88 | } |
| 87 | 89 | |
| 90 | + public String getTxtAndEnable() { | |
| 91 | + StringBuilder sb = new StringBuilder(); | |
| 92 | + sb.append(getTxt()); | |
| 93 | + if(this.getEnable() == 0){ | |
| 94 | + sb.append("(已禁用)"); | |
| 95 | + } | |
| 96 | + return sb.toString(); | |
| 97 | + } | |
| 98 | + | |
| 99 | + public void setTxtAndEnable(String txtAndEnable) { | |
| 100 | + this.txtAndEnable = txtAndEnable; | |
| 101 | + } | |
| 102 | + | |
| 88 | 103 | } |
parent/base.common/src/main/java/com/lyms/base/common/service/sys/SysDictService.java
View file @
000eb60
| ... | ... | @@ -43,6 +43,33 @@ |
| 43 | 43 | * <li>修改时间: |
| 44 | 44 | */ |
| 45 | 45 | public String getDictNameById(String id); |
| 46 | + | |
| 47 | + /** | |
| 48 | + * <li>@Description:添加一个字典 | |
| 49 | + * <li>@param dict | |
| 50 | + * <li>@return | |
| 51 | + * <li>创建人:方承 | |
| 52 | + * <li>创建时间:2017年5月26日 | |
| 53 | + * <li>修改人: | |
| 54 | + * <li>修改时间: | |
| 55 | + */ | |
| 56 | + public boolean createDict(SysDict dict); | |
| 57 | + | |
| 58 | + public boolean updateDict(SysDict dict); | |
| 59 | + | |
| 60 | + | |
| 61 | + /** | |
| 62 | + * <li>@Description:禁用 | |
| 63 | + * <li>@param id | |
| 64 | + * <li>@return | |
| 65 | + * <li>创建人:方承 | |
| 66 | + * <li>创建时间:2017年5月26日 | |
| 67 | + * <li>修改人: | |
| 68 | + * <li>修改时间: | |
| 69 | + */ | |
| 70 | + public boolean disable(String id); | |
| 71 | + | |
| 72 | + public boolean enable(String id); | |
| 46 | 73 | |
| 47 | 74 | } |
parent/base.common/src/main/java/com/lyms/base/common/service/sys/impl/SysDictServiceImpl.java
View file @
000eb60
| ... | ... | @@ -3,6 +3,7 @@ |
| 3 | 3 | import com.lyms.base.common.entity.sys.SysDict; |
| 4 | 4 | import com.lyms.base.common.dao.sys.SysDictMapper; |
| 5 | 5 | import com.lyms.base.common.service.sys.SysDictService; |
| 6 | +import com.lyms.util.StrUtils; | |
| 6 | 7 | import com.baomidou.mybatisplus.service.impl.ServiceImpl; |
| 7 | 8 | import org.springframework.stereotype.Service; |
| 8 | 9 | import java.io.Serializable; |
| 9 | 10 | |
| 10 | 11 | |
| 11 | 12 | |
| ... | ... | @@ -18,20 +19,51 @@ |
| 18 | 19 | */ |
| 19 | 20 | @Service |
| 20 | 21 | public class SysDictServiceImpl extends ServiceImpl<SysDictMapper, SysDict> implements SysDictService { |
| 21 | - | |
| 22 | - public Integer deleteLogicById(Serializable id){ | |
| 23 | - return baseMapper.deleteLogicById(id); | |
| 24 | - } | |
| 25 | 22 | |
| 23 | + public Integer deleteLogicById(Serializable id) { | |
| 24 | + return baseMapper.deleteLogicById(id); | |
| 25 | + } | |
| 26 | + | |
| 26 | 27 | @Override |
| 27 | 28 | public List<SysDict> getDictListByTypeCode(Serializable typeCode) { |
| 28 | - return baseMapper.getDictListByTypeCode(typeCode); | |
| 29 | + return baseMapper.getDictListByTypeCode(typeCode); | |
| 29 | 30 | } |
| 30 | 31 | |
| 31 | - @Override | |
| 32 | - public String getDictNameById(String id) { | |
| 33 | - SysDict dic = baseMapper.selectById(id); | |
| 34 | - return dic==null?null:dic.getTxt(); | |
| 35 | - } | |
| 32 | + @Override | |
| 33 | + public String getDictNameById(String id) { | |
| 34 | + SysDict dic = baseMapper.selectById(id); | |
| 35 | + return dic == null ? null : dic.getTxt(); | |
| 36 | + } | |
| 37 | + | |
| 38 | + @Override | |
| 39 | + public boolean createDict(SysDict dict) { | |
| 40 | + if (StrUtils.isEmpty(dict.getId())) { | |
| 41 | + dict.setId(StrUtils.uuid()); | |
| 42 | + } | |
| 43 | + Integer tag = baseMapper.insert(dict); | |
| 44 | + return tag > 0; | |
| 45 | + } | |
| 46 | + | |
| 47 | + @Override | |
| 48 | + public boolean updateDict(SysDict dict) { | |
| 49 | + Integer tag = baseMapper.updateById(dict); | |
| 50 | + return tag > 0; | |
| 51 | + } | |
| 52 | + | |
| 53 | + @Override | |
| 54 | + public boolean disable(String id) { | |
| 55 | + SysDict dict = new SysDict(); | |
| 56 | + dict.setId(id); | |
| 57 | + dict.setEnable(0); | |
| 58 | + return baseMapper.updateById(dict) > 0; | |
| 59 | + } | |
| 60 | + | |
| 61 | + @Override | |
| 62 | + public boolean enable(String id) { | |
| 63 | + SysDict dict = new SysDict(); | |
| 64 | + dict.setId(id); | |
| 65 | + dict.setEnable(1); | |
| 66 | + return baseMapper.updateById(dict) > 0; | |
| 67 | + } | |
| 36 | 68 | } |
parent/center.manager/src/main/java/com/lyms/cm/controller/sys/SysDictController.java
View file @
000eb60
| 1 | +package com.lyms.cm.controller.sys; | |
| 2 | + | |
| 3 | +import java.util.List; | |
| 4 | +import java.util.Map; | |
| 5 | + | |
| 6 | +import com.lyms.base.common.entity.sys.SysDict; | |
| 7 | +import com.lyms.base.common.service.sys.SysDictService; | |
| 8 | +import org.apache.commons.lang3.StringUtils; | |
| 9 | +import org.springframework.beans.factory.annotation.Autowired; | |
| 10 | +import org.springframework.stereotype.Controller; | |
| 11 | +import org.springframework.ui.Model; | |
| 12 | +import org.springframework.web.bind.annotation.PathVariable; | |
| 13 | +import org.springframework.web.bind.annotation.RequestMapping; | |
| 14 | +import org.springframework.web.bind.annotation.RequestMethod; | |
| 15 | +import org.springframework.web.bind.annotation.ResponseBody; | |
| 16 | + | |
| 17 | +import com.alibaba.fastjson.JSON; | |
| 18 | +import com.baomidou.mybatisplus.mapper.EntityWrapper; | |
| 19 | +import com.baomidou.mybatisplus.plugins.Page; | |
| 20 | +import com.lyms.base.common.entity.organ.Departments; | |
| 21 | +import com.lyms.base.common.entity.organ.Organizations; | |
| 22 | +import com.lyms.base.common.entity.role.Roles; | |
| 23 | +import com.lyms.base.common.entity.role.UserRoleMaps; | |
| 24 | +import com.lyms.base.common.entity.user.SysUserDataPermissions; | |
| 25 | +import com.lyms.base.common.entity.user.Users; | |
| 26 | +import com.lyms.base.common.service.organ.DepartmentsService; | |
| 27 | +import com.lyms.base.common.service.organ.OrganizationsService; | |
| 28 | +import com.lyms.base.common.service.role.RolesService; | |
| 29 | +import com.lyms.base.common.service.role.UserRoleMapsService; | |
| 30 | +import com.lyms.base.common.service.user.SysUserDataPermissionsService; | |
| 31 | +import com.lyms.base.common.service.user.UsersService; | |
| 32 | +import com.lyms.constants.OperationName; | |
| 33 | +import com.lyms.util.InstanceUtils; | |
| 34 | +import com.lyms.util.StrUtils; | |
| 35 | +import com.lyms.web.bean.AjaxResult; | |
| 36 | +import com.lyms.web.controller.BaseController; | |
| 37 | + | |
| 38 | +/** | |
| 39 | + * <p> | |
| 40 | + * 字典 前端控制器 | |
| 41 | + * </p> | |
| 42 | + * | |
| 43 | + * @author maliang | |
| 44 | + * @since 2017-03-02 | |
| 45 | + */ | |
| 46 | +@Controller | |
| 47 | +@RequestMapping("/sysDict") | |
| 48 | +public class SysDictController extends BaseController { | |
| 49 | + | |
| 50 | + @Autowired | |
| 51 | + private SysDictService sysDictService; | |
| 52 | + | |
| 53 | + /** | |
| 54 | + * 跳转到字典列表页面 | |
| 55 | + * | |
| 56 | + * @return | |
| 57 | + */ | |
| 58 | + @RequestMapping(value = "/toList", method = {RequestMethod.GET}) | |
| 59 | + public String toList(Model model) { | |
| 60 | + EntityWrapper<SysDict> ew = new EntityWrapper<SysDict>(); | |
| 61 | + ew.orderBy("enable", false); | |
| 62 | + List<SysDict> list = sysDictService.selectList(ew); | |
| 63 | + model.addAttribute("dictString", JSON.toJSONString(list)); | |
| 64 | + return "/dict/dict_list"; | |
| 65 | + } | |
| 66 | + | |
| 67 | + /** | |
| 68 | + * 字典列表 | |
| 69 | + * | |
| 70 | + * @param model | |
| 71 | + * @return | |
| 72 | + */ | |
| 73 | + @RequestMapping(value = "/list", method = {RequestMethod.POST, RequestMethod.GET}) | |
| 74 | + @ResponseBody | |
| 75 | + public Map<String, Object> list(Model model) { | |
| 76 | + Page<SysDict> page = getPage(); | |
| 77 | + EntityWrapper<SysDict> ew = new EntityWrapper<SysDict>(); | |
| 78 | + ew.where("pid=0").and("enable=1"); | |
| 79 | + page = sysDictService.selectPage(page, ew); | |
| 80 | + return toGridData(page); | |
| 81 | + } | |
| 82 | + | |
| 83 | + @RequestMapping(value = "/create", method = RequestMethod.POST) | |
| 84 | + @ResponseBody | |
| 85 | + public AjaxResult create(SysDict sysDict, AjaxResult ajaxResult) { | |
| 86 | + boolean tag = sysDictService.createDict(sysDict); | |
| 87 | + return handleAjaxResult(ajaxResult, tag, OperationName.CREATE); | |
| 88 | + } | |
| 89 | + | |
| 90 | + @RequestMapping(value = "/update", method = { RequestMethod.POST }) | |
| 91 | + @ResponseBody | |
| 92 | + public AjaxResult update(SysDict sysDict, AjaxResult ajaxResult) { | |
| 93 | + boolean tag = sysDictService.updateDict(sysDict); | |
| 94 | + return handleAjaxResult(ajaxResult, tag, OperationName.UPDATE); | |
| 95 | + | |
| 96 | + } | |
| 97 | + | |
| 98 | + /** | |
| 99 | + * 跳转到编辑页面 | |
| 100 | + * | |
| 101 | + * @return | |
| 102 | + */ | |
| 103 | + @RequestMapping(value = { "/{id}/toEdit" }, method = RequestMethod.GET) | |
| 104 | + public String toEdit(@PathVariable String id, Model model) { | |
| 105 | + if (!StringUtils.isBlank(id) & !"0".equals(id)) { | |
| 106 | + SysDict dict = sysDictService.selectById(id); | |
| 107 | + model.addAttribute("dict", dict); | |
| 108 | + } | |
| 109 | + EntityWrapper<SysDict> ew = new EntityWrapper<SysDict>(); | |
| 110 | + ew.orderBy("enable", false); | |
| 111 | + List<SysDict> list = sysDictService.selectList(ew); | |
| 112 | + model.addAttribute("dictList", list); | |
| 113 | + return "/dict/dict_edit"; | |
| 114 | + } | |
| 115 | + | |
| 116 | + /** | |
| 117 | + * 跳转到添加子字典 | |
| 118 | + * | |
| 119 | + * @return | |
| 120 | + */ | |
| 121 | + @RequestMapping(value = { "/{pid}/toAddSub" }, method = RequestMethod.GET) | |
| 122 | + public String toAddSub(@PathVariable String pid, Model model) { | |
| 123 | + EntityWrapper<SysDict> ew = new EntityWrapper<SysDict>(); | |
| 124 | + ew.orderBy("enable", false); | |
| 125 | + List<SysDict> list = sysDictService.selectList(ew); | |
| 126 | + model.addAttribute("dictList", list); | |
| 127 | + SysDict dict = new SysDict(); | |
| 128 | + dict.setPid(pid); | |
| 129 | + model.addAttribute("dict", dict); | |
| 130 | + return "/dict/dict_edit"; | |
| 131 | + } | |
| 132 | + | |
| 133 | + /** | |
| 134 | + * <li>@Description:禁用字典 | |
| 135 | + * <li>@param id | |
| 136 | + * <li>@param ajaxResult | |
| 137 | + * <li>@return | |
| 138 | + * <li>创建人:方承 | |
| 139 | + * <li>创建时间:2017年5月26日 | |
| 140 | + * <li>修改人: | |
| 141 | + * <li>修改时间: | |
| 142 | + */ | |
| 143 | + @RequestMapping(value = "/{id}/disable", method = { RequestMethod.GET, RequestMethod.POST }) | |
| 144 | + @ResponseBody | |
| 145 | + public AjaxResult disable(@PathVariable String id, AjaxResult ajaxResult) { | |
| 146 | + boolean tag = sysDictService.disable(id); | |
| 147 | + return handleAjaxResult(ajaxResult, tag, OperationName.DISABLE); | |
| 148 | + } | |
| 149 | + | |
| 150 | + /** | |
| 151 | + * <li>@Description:禁用字典 | |
| 152 | + * <li>@param id | |
| 153 | + * <li>@param ajaxResult | |
| 154 | + * <li>@return | |
| 155 | + * <li>创建人:方承 | |
| 156 | + * <li>创建时间:2017年5月26日 | |
| 157 | + * <li>修改人: | |
| 158 | + * <li>修改时间: | |
| 159 | + */ | |
| 160 | + @RequestMapping(value = "/{id}/enable", method = { RequestMethod.GET, RequestMethod.POST }) | |
| 161 | + @ResponseBody | |
| 162 | + public AjaxResult enable(@PathVariable String id, AjaxResult ajaxResult) { | |
| 163 | + boolean tag = sysDictService.enable(id); | |
| 164 | + return handleAjaxResult(ajaxResult, tag, OperationName.ENABLE); | |
| 165 | + } | |
| 166 | + | |
| 167 | + | |
| 168 | +} |
parent/center.manager/src/main/webapp/WEB-INF/views/dict/dict_edit.html
View file @
000eb60
| 1 | +#override("css") | |
| 2 | +<link rel="stylesheet" href="${ctx}/static/js/zTree_v3/css/zTreeStyle/zTreeStyle.css" type="text/css" /> | |
| 3 | +#end | |
| 4 | +#override("body") | |
| 5 | +<div class="ibox float-e-margins"> | |
| 6 | + <form id="validForm" class="form-horizontal m-t" novalidate="novalidate"> | |
| 7 | + <div class="ibox-content"> | |
| 8 | + <div class="col-sm-4"> | |
| 9 | + <input type="hidden" id="dict.id" name="id" value="$!dict.id"/> | |
| 10 | + <div class="form-group"> | |
| 11 | + <label class="col-sm-3 control-label">上级字典:</label> | |
| 12 | + <div class="col-sm-8"> | |
| 13 | + <select id="pid" name="pid" style="width:250px;" class="selectator" data-selectator-keep-open="true" data-selectator-show-all-options-on-focus="true" data-selectator-search-fields="value text subtitle right"> | |
| 14 | + <option value="0" selected>顶级字典</option> | |
| 15 | + #foreach($oneSelect in $dictList) | |
| 16 | + <option value="${oneSelect.id}" | |
| 17 | + #if( $string.isNotEmpty($dict.pid)) | |
| 18 | + #if($string.equals(${dict.pid}, ${oneSelect.id}) ) | |
| 19 | + selected | |
| 20 | + #end | |
| 21 | + #end | |
| 22 | + >${oneSelect.txt}</option> | |
| 23 | + #end | |
| 24 | + </select> | |
| 25 | + <script type="text/javascript"> | |
| 26 | + $(function () { | |
| 27 | + var pid_select = $('#pid'); | |
| 28 | + pid_select.selectator({ | |
| 29 | + labels: { | |
| 30 | + showAllOptionsOnFocus: true, | |
| 31 | + keepOpen: true, | |
| 32 | + search: 'Search here...' | |
| 33 | + } | |
| 34 | + }); | |
| 35 | + }); | |
| 36 | + </script> | |
| 37 | + </div> | |
| 38 | + </div> | |
| 39 | + <div class="form-group"> | |
| 40 | + <label class="col-sm-3 control-label">TYPECODE(用于快速获取子集元素):</label> | |
| 41 | + <div class="col-sm-8"> | |
| 42 | + <input type="text" placeholder="TYPECODE" value="$!dict.typecode" class="form-control" name="typecode" id="typecode"> | |
| 43 | + </div> | |
| 44 | + </div> | |
| 45 | + <div class="form-group"> | |
| 46 | + <label class="col-sm-3 control-label">字典名称:</label> | |
| 47 | + <div class="col-sm-8"> | |
| 48 | + <input type="text" placeholder="字典名称" value="$!dict.txt" aria-required="true" required="true" minlength="2" class="form-control" name="txt" id="txt"> | |
| 49 | + </div> | |
| 50 | + </div> | |
| 51 | + <div class="hr-line-dashed"></div> | |
| 52 | + <div class="form-group"> | |
| 53 | + <div class="col-sm-4 col-sm-offset-3 pull-right"> | |
| 54 | + <button type="button" class="btn btn-primary" onclick="save();"><i class="fa fa-check"></i> 提交</button> | |
| 55 | + <button type="button" class="btn btn-white" onclick="parent.closeAll();"><i class="fa fa-close"></i> 取消</button> | |
| 56 | + </div> | |
| 57 | + </div> | |
| 58 | + </div> | |
| 59 | + </div> | |
| 60 | + </form> | |
| 61 | +</div> | |
| 62 | +<script type="text/javascript"> | |
| 63 | + function search(){ | |
| 64 | + var queryParams = { | |
| 65 | + query:{ | |
| 66 | + name: $("#groupName").val() | |
| 67 | + } | |
| 68 | + } | |
| 69 | + $('#dataTable').bootstrapTable('refresh', queryParams ); | |
| 70 | + } | |
| 71 | + | |
| 72 | + | |
| 73 | + function save(){ | |
| 74 | + if($('#validForm').valid()){ | |
| 75 | + var data = $('#validForm').serialize(); | |
| 76 | + data = data + "&" + $('#roleForm').serialize(); | |
| 77 | + if("$!dict.id" == ""){ | |
| 78 | + ajaxPost(APP.PATH + "/sysDict/create",data); | |
| 79 | + }else{ | |
| 80 | + ajaxPost(APP.PATH + "/sysDict/update",data); | |
| 81 | + } | |
| 82 | + /* timeoutThread(reloadTree_inner,500); | |
| 83 | + function reloadTree_inner(){ | |
| 84 | + parent.location.reload(); | |
| 85 | + } */ | |
| 86 | + } | |
| 87 | + } | |
| 88 | + | |
| 89 | + | |
| 90 | +</script> | |
| 91 | +#end | |
| 92 | +#extends("/common/base_list.html") |
parent/center.manager/src/main/webapp/WEB-INF/views/dict/dict_list.html
View file @
000eb60
| 1 | +#override("css") | |
| 2 | +<link rel="stylesheet" href="${ctx}/static/js/zTree_v3/css/zTreeStyle/zTreeStyle.css" type="text/css" /> | |
| 3 | +#end | |
| 4 | +#override("body") | |
| 5 | +<div class="wrapper wrapper-content"> | |
| 6 | + <div class="row"> | |
| 7 | + <div class="col-sm-12"> | |
| 8 | + <div id="toolbar"> | |
| 9 | + <button class="btn btn-info " type="button" onclick="add();"><i class="fa fa-plus"></i> 新增顶级字典</button> | |
| 10 | + <button class="btn btn-info " type="button" onclick="addSub();"><i class="fa fa-plus"></i> 添加子字典</button> | |
| 11 | + <button class="btn btn-info " type="button" onclick="edit();"><i class="fa fa-paste"></i> 修改</button> | |
| 12 | + <button class="btn btn-info " type="button" onclick="enable();"><i class=""></i> 启用</button> | |
| 13 | + <button class="btn btn-danger" type="button" onclick="disable();"><i class=""></i> 禁用</button> | |
| 14 | + <button class="btn btn-success m-r-xs" type="button" onclick="reload();"><i class=""></i> 刷新</button> | |
| 15 | + </div> | |
| 16 | + <div> | |
| 17 | + <div id="treeContent_resource" class="menuContent"> | |
| 18 | + <ul id="dictTree" class="ztree" style="margin-top:0; width:180px; height: 250px;"></ul> | |
| 19 | + </div> | |
| 20 | + </div> | |
| 21 | + </div> | |
| 22 | + </div> | |
| 23 | +</div> | |
| 24 | +#end | |
| 25 | +#override("js") | |
| 26 | +<script src="${ctx}/static/js/zTree_v3/js/jquery.ztree.all-3.5.min.js" type="text/javascript"></script> | |
| 27 | +<script type="text/javascript"> | |
| 28 | +var controllerRequestMappint = "/sysDict/"; | |
| 29 | +function search(){ | |
| 30 | + var queryParams = { | |
| 31 | + query:{ | |
| 32 | + name: $("#searchName").val(), | |
| 33 | + account: $("#searchAccount").val(), | |
| 34 | + phone: $("#searchPhone").val(), | |
| 35 | + orgId: $("#searchOrgId").val(), | |
| 36 | + deptId: $("#searchdeptId").val() | |
| 37 | + } | |
| 38 | + } | |
| 39 | + $('#dataTable').bootstrapTable('refresh', queryParams ); | |
| 40 | +} | |
| 41 | + | |
| 42 | +function add() { | |
| 43 | + fullWindow("新增顶级字典", APP.PATH + controllerRequestMappint + "0/toEdit"); | |
| 44 | +} | |
| 45 | +function addSub() { | |
| 46 | + var zTree = $.fn.zTree.getZTreeObj('dictTree'); | |
| 47 | + var nodes = zTree.getSelectedNodes(); | |
| 48 | + if(nodes.length > 0){ | |
| 49 | + fullWindow("添加子字典", APP.PATH + controllerRequestMappint + nodes[0]['id'] + "/toAddSub"); | |
| 50 | + }else{ | |
| 51 | + msg("请选中需要添加子字典的父字典项"); | |
| 52 | + } | |
| 53 | +} | |
| 54 | +function edit(){ | |
| 55 | + var zTree = $.fn.zTree.getZTreeObj('dictTree'); | |
| 56 | + var nodes = zTree.getSelectedNodes(); | |
| 57 | + if(nodes.length > 0){ | |
| 58 | + fullWindow("修改字典", APP.PATH + controllerRequestMappint + nodes[0]['id'] + "/toEdit"); | |
| 59 | + }else{ | |
| 60 | + msg("请选中需要编辑的字典数据"); | |
| 61 | + } | |
| 62 | +} | |
| 63 | +function reload(){ | |
| 64 | + location.reload(); | |
| 65 | +} | |
| 66 | +function disable(){ | |
| 67 | + var zTree = $.fn.zTree.getZTreeObj('dictTree'); | |
| 68 | + var nodes = zTree.getSelectedNodes(); | |
| 69 | + if(nodes.length > 0){ | |
| 70 | + layer.confirm('确定删除选中的数据', { | |
| 71 | + btn: ['确定','取消'] //按钮 | |
| 72 | + }, function(){ | |
| 73 | + var url = APP.PATH + controllerRequestMappint + nodes[0]['id'] + "/disable"; | |
| 74 | + ajaxPost(url,null,function(r){ | |
| 75 | + msg(r.message); | |
| 76 | + }); | |
| 77 | + }, function(){ | |
| 78 | + | |
| 79 | + }); | |
| 80 | + }else{ | |
| 81 | + msg("请选中需要禁用的字典数据"); | |
| 82 | + } | |
| 83 | +} | |
| 84 | +function enable(){ | |
| 85 | + var zTree = $.fn.zTree.getZTreeObj('dictTree'); | |
| 86 | + var nodes = zTree.getSelectedNodes(); | |
| 87 | + if(nodes.length > 0){ | |
| 88 | + layer.confirm('确定启用选中的数据', { | |
| 89 | + btn: ['确定','取消'] //按钮 | |
| 90 | + }, function(){ | |
| 91 | + var url = APP.PATH + controllerRequestMappint + nodes[0]['id'] + "/enable"; | |
| 92 | + ajaxPost(url,null,function(r){ | |
| 93 | + msg(r.message); | |
| 94 | + }); | |
| 95 | + }, function(){ | |
| 96 | + | |
| 97 | + }); | |
| 98 | + }else{ | |
| 99 | + msg("请选中需要启用的字典数据"); | |
| 100 | + } | |
| 101 | +} | |
| 102 | +var setting = { | |
| 103 | + data: { | |
| 104 | + simpleData: { | |
| 105 | + enable: true, | |
| 106 | + idKey: "id", | |
| 107 | + pIdKey: "pid", | |
| 108 | + rootPId: 0 | |
| 109 | + }, | |
| 110 | + key:{ | |
| 111 | + name:'txtAndEnable' | |
| 112 | + } | |
| 113 | + } | |
| 114 | + }; | |
| 115 | + | |
| 116 | + var zNodes =${dictString}; | |
| 117 | + | |
| 118 | + $(document).ready(function(){ | |
| 119 | + $.fn.zTree.init($("#dictTree"), setting, zNodes); | |
| 120 | + }); | |
| 121 | +</script> | |
| 122 | +#end | |
| 123 | +#extends("/common/base_list.html") |